From 1c087fae322a1b07bb7bd554ee10ff473c47c727 Mon Sep 17 00:00:00 2001
From: Fin Reinhard <fin.reinhard@icloud.com>
Date: Tue, 22 Jan 2019 20:51:03 +0000
Subject: [PATCH] Merge branch 'master' into feature/15-archive-view-url

---
 borgbutler-webapp/src/components/views/config/ConfigurationPage.jsx |   24 +++++++++++++++++++++++-
 1 files changed, 23 insertions(+), 1 deletions(-)

diff --git a/borgbutler-webapp/src/components/views/config/ConfigurationPage.jsx b/borgbutler-webapp/src/components/views/config/ConfigurationPage.jsx
index 3a26b4d..715baf8 100644
--- a/borgbutler-webapp/src/components/views/config/ConfigurationPage.jsx
+++ b/borgbutler-webapp/src/components/views/config/ConfigurationPage.jsx
@@ -8,6 +8,7 @@
 import ConfigAccountTab from "./ConfigurationAccountTab";
 import ConfigServerTab from "./ConfigurationServerTab";
 import LoadingOverlay from '../../general/loading/LoadingOverlay';
+import ConfirmModal from '../../general/modal/ConfirmModal';
 
 class ConfigurationPage
     extends React
@@ -20,11 +21,13 @@
         this.state = {
             activeTab: '1',
             loading: false,
-            reload: false
+            reload: false,
+            confirmModal: false
         };
 
         this.onSave = this.onSave.bind(this);
         this.onCancel = this.onCancel.bind(this);
+        this.toggleModal = this.toggleModal.bind(this);
     }
 
     toggleTab = tab => () => {
@@ -58,6 +61,12 @@
         this.setReload();
     }
 
+    toggleModal() {
+        this.setState({
+            confirmModal: !this.state.confirmModal
+        })
+    }
+
     render() {
         // https://codepen.io/_arpy/pen/xYoyPW
         if (this.state.reload) {
@@ -65,6 +74,17 @@
         }
         return (
             <React.Fragment>
+                <ConfirmModal
+                    onConfirm={ConfigServerTab.clearAllCaches}
+                    title={'Are you sure?'}
+                    toggle={this.toggleModal}
+                    open={this.state.confirmModal}
+                >
+                    Do you really want to clear all caches? All Archive file lists and caches for repo and archive
+                    information will be cleared.
+                    <br/>
+                    This is a safe option but it may take some time to re-fill the caches (on demand) again.
+                </ConfirmModal>
                 <PageHeader><I18n name={'configuration'}/></PageHeader>
                 <Nav tabs>
                     <NavLink
@@ -92,6 +112,8 @@
                 </TabContent>
                 <FormGroup>
                     <FormField length={12}>
+                        <FormButton id={'clearAllCaches'} onClick={this.toggleModal}> Clear all caches
+                        </FormButton>
                         <FormButton onClick={this.onCancel}
                                     hintKey="configuration.cancel.hint"><I18n name={'common.cancel'}/>
                         </FormButton>

--
Gitblit v1.10.0