From e9bd9444b35f92a02438618c0a689ed77c34c42a Mon Sep 17 00:00:00 2001 From: Angelina Filippova Date: Sun, 14 Mar 2021 14:08:59 +0300 Subject: [PATCH] Create component for frontends table, add button loading while frontend is installing --- src/lang/en.js | 3 +- src/store/modules/settings.js | 15 +- src/views/settings/components/Frontend.vue | 130 +-------------- .../inputComponents/FrontendStatusButton.vue | 64 ++++++++ .../inputComponents/FrontendsTable.vue | 148 ++++++++++++++++++ 5 files changed, 219 insertions(+), 141 deletions(-) create mode 100644 src/views/settings/components/inputComponents/FrontendStatusButton.vue create mode 100644 src/views/settings/components/inputComponents/FrontendsTable.vue diff --git a/src/lang/en.js b/src/lang/en.js index 61a66eda..641c972c 100644 --- a/src/lang/en.js +++ b/src/lang/en.js @@ -475,7 +475,8 @@ export default { buildUrl: 'Build URL', buildDir: 'Build Directory', frontendSuccess: 'Frontend installed successfully!', - frontendStartedInstallation: 'Installation started' + frontendStartedInstallation: 'Installation started', + inProcess: 'In process' }, invites: { inviteTokens: 'Invite tokens', diff --git a/src/store/modules/settings.js b/src/store/modules/settings.js index a36f6eda..61738507 100644 --- a/src/store/modules/settings.js +++ b/src/store/modules/settings.js @@ -10,8 +10,6 @@ import { updateSettings } from '@/api/settings' import { formSearchObject, parseNonTuples, parseTuples, valueHasTuples, wrapUpdatedSettings } from './normalizers' import _ from 'lodash' -import { Message } from 'element-ui' -import i18n from '@/lang' const settings = { state: { @@ -125,17 +123,8 @@ const settings = { commit('SET_LOADING', false) }, async InstallFrontend({ commit, getters }, { name, ref, file, buildUrl, buildDir }) { - try { - const { data } = await installFrontend({ name, ref, file, build_url: buildUrl, build_dir: buildDir }, getters.authHost, getters.token) - commit('SET_FRONTENDS', data) - } catch (_e) { - return - } - Message({ - message: i18n.t('settings.frontendSuccess'), - type: 'success', - duration: 5 * 1000 - }) + const { data } = await installFrontend({ name, ref, file, build_url: buildUrl, build_dir: buildDir }, getters.authHost, getters.token) + commit('SET_FRONTENDS', data) }, async RemoveInstanceDocument({ dispatch, getters }, name) { await deleteInstanceDocument(name, getters.authHost, getters.token) diff --git a/src/views/settings/components/Frontend.vue b/src/views/settings/components/Frontend.vue index f74b1e5b..574051be 100644 --- a/src/views/settings/components/Frontend.vue +++ b/src/views/settings/components/Frontend.vue @@ -1,72 +1,6 @@