From d414750cd5ceced523f73bd025d41c31a2d38ed6 Mon Sep 17 00:00:00 2001 From: Angelina Filippova Date: Fri, 18 Sep 2020 01:11:50 +0300 Subject: [PATCH] Add ability to remove instance panel doc --- src/lang/en.js | 3 ++- src/store/modules/settings.js | 8 +++++--- src/views/settings/components/Instance.vue | 2 +- .../components/inputComponents/EditorInput.vue | 12 ++++++++++++ 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/lang/en.js b/src/lang/en.js index cb82b4cd..f1ef9c8a 100644 --- a/src/lang/en.js +++ b/src/lang/en.js @@ -438,7 +438,8 @@ export default { removeSettingConfirmation: 'Are you sure you want to remove this setting\'s value from the database?', changeImage: 'Change image', uploadImage: 'Upload image', - remove: 'Remove' + remove: 'Remove', + instancePanel: 'Instance Panel Document' }, invites: { inviteTokens: 'Invite tokens', diff --git a/src/store/modules/settings.js b/src/store/modules/settings.js index f6ea4873..eac8a161 100644 --- a/src/store/modules/settings.js +++ b/src/store/modules/settings.js @@ -85,7 +85,7 @@ const settings = { actions: { async FetchInstanceDocument({ commit, getters }, name) { const { data } = await getInstanceDocument(name, getters.authHost, getters.token) - commit('SET_INSTANCE_PANEL', data.url) + commit('SET_INSTANCE_PANEL', data) }, async FetchSettings({ commit, getters }) { commit('SET_LOADING', true) @@ -105,8 +105,9 @@ const settings = { commit('TOGGLE_TABS', false) commit('SET_LOADING', false) }, - async RemoveInstanceDocument({ getters }, name) { + async RemoveInstanceDocument({ dispatch, getters }, name) { await deleteInstanceDocument(name, getters.authHost, getters.token) + await dispatch('FetchInstanceDocument', 'instance-panel') }, async RemoveSetting({ commit, getters }, configs) { await removeSettings(configs, getters.authHost, getters.token) @@ -130,7 +131,8 @@ const settings = { commit('TOGGLE_REBOOT', response.data.need_reboot) commit('CLEAR_UPDATED_SETTINGS') }, - async UpdateInstanceDocs({ getters }, { name, content }) { + async UpdateInstanceDocs({ commit, getters }, { name, content }) { + commit('SET_INSTANCE_PANEL', content) const formData = new FormData() const blob = new Blob([content], { type: 'text/html' }) formData.append('file', blob) diff --git a/src/views/settings/components/Instance.vue b/src/views/settings/components/Instance.vue index c3f7fece..2e897c55 100644 --- a/src/views/settings/components/Instance.vue +++ b/src/views/settings/components/Instance.vue @@ -1,9 +1,9 @@