From 2df02ae39ee1b8a0fe2437386a189b793e0c4aa8 Mon Sep 17 00:00:00 2001 From: Axolotle Date: Sun, 27 Sep 2020 22:36:32 +0200 Subject: [PATCH] add customizable password and domain component to be used in multiples views --- .../components/reusableForms/DomainForm.vue | 191 ++++++++++++++++++ .../components/reusableForms/PasswordForm.vue | 119 +++++++++++ app/src/components/reusableForms/index.js | 2 + app/src/store/info.js | 5 +- app/src/views/domain/DomainAdd.vue | 146 ++----------- app/src/views/tool/ToolAdminpw.vue | 89 +++----- 6 files changed, 357 insertions(+), 195 deletions(-) create mode 100644 app/src/components/reusableForms/DomainForm.vue create mode 100644 app/src/components/reusableForms/PasswordForm.vue create mode 100644 app/src/components/reusableForms/index.js diff --git a/app/src/components/reusableForms/DomainForm.vue b/app/src/components/reusableForms/DomainForm.vue new file mode 100644 index 00000000..ff67cdc5 --- /dev/null +++ b/app/src/components/reusableForms/DomainForm.vue @@ -0,0 +1,191 @@ + + + diff --git a/app/src/components/reusableForms/PasswordForm.vue b/app/src/components/reusableForms/PasswordForm.vue new file mode 100644 index 00000000..10a3493d --- /dev/null +++ b/app/src/components/reusableForms/PasswordForm.vue @@ -0,0 +1,119 @@ + + + diff --git a/app/src/components/reusableForms/index.js b/app/src/components/reusableForms/index.js new file mode 100644 index 00000000..dcd04c0c --- /dev/null +++ b/app/src/components/reusableForms/index.js @@ -0,0 +1,2 @@ +export { default as PasswordForm } from './PasswordForm' +export { default as DomainForm } from './DomainForm' diff --git a/app/src/store/info.js b/app/src/store/info.js index ad834ce8..49a3a22e 100644 --- a/app/src/store/info.js +++ b/app/src/store/info.js @@ -37,8 +37,8 @@ export default { 'DISCONNECT' ({ commit }, route) { commit('SET_CONNECTED', false) commit('SET_YUNOHOST_INFOS', null) - // Do not redirect if the current route is `login` so the view can display an error. - if (router.currentRoute.name === 'login') return + // Do not redirect if the current route needs to display an error. + if (['login', 'tool-adminpw'].includes(router.currentRoute.name)) return router.push({ name: 'login', // Add a redirect query if next route is not unknown (like `logout`) or `login` @@ -63,6 +63,7 @@ export default { 'CHECK_INSTALL' ({ dispatch }, retry = 2) { // this action will try to query the `/installed` route 3 times every 5 s with // a timeout of the same delay. + // FIXME need testing with api not responding return timeout(api.get('installed'), 5000).then(({ installed }) => { return installed }).catch(err => { diff --git a/app/src/views/domain/DomainAdd.vue b/app/src/views/domain/DomainAdd.vue index 6291129a..9ab0ada5 100644 --- a/app/src/views/domain/DomainAdd.vue +++ b/app/src/views/domain/DomainAdd.vue @@ -1,90 +1,22 @@ - - diff --git a/app/src/views/tool/ToolAdminpw.vue b/app/src/views/tool/ToolAdminpw.vue index 6aa6b031..891597ea 100644 --- a/app/src/views/tool/ToolAdminpw.vue +++ b/app/src/views/tool/ToolAdminpw.vue @@ -1,39 +1,25 @@