From 8d52a897bb8f248716d6913bce8d4b66a5b19956 Mon Sep 17 00:00:00 2001 From: Angelina Filippova Date: Tue, 23 Feb 2021 23:04:31 +0300 Subject: [PATCH] Add ability to install one of the available frontends --- src/api/settings.js | 4 ++-- src/store/modules/settings.js | 7 +++++++ src/views/settings/components/Frontend.vue | 5 ++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/api/settings.js b/src/api/settings.js index 8596d18a..61c9523e 100644 --- a/src/api/settings.js +++ b/src/api/settings.js @@ -77,13 +77,13 @@ export async function fetchFrontends(authHost, token) { }) } -export async function installFrontend(name, ref, file, buildUrl, buildDir, authHost, token) { +export async function installFrontend(data, authHost, token) { return await request({ baseURL: baseName(authHost), url: `/api/pleroma/admin/frontends/install`, method: 'post', headers: authHeaders(token), - data: { name, ref, file, build_url: buildUrl, build_dir: buildDir } + data }) } diff --git a/src/store/modules/settings.js b/src/store/modules/settings.js index df664689..05b3084e 100644 --- a/src/store/modules/settings.js +++ b/src/store/modules/settings.js @@ -4,6 +4,7 @@ import { fetchFrontends, fetchSettings, getInstanceDocument, + installFrontend, removeSettings, updateInstanceDocument, updateSettings } from '@/api/settings' @@ -121,6 +122,12 @@ const settings = { commit('TOGGLE_TABS', false) commit('SET_LOADING', false) }, + async InstallFrontend({ commit, getters }, { name, _ref, _file, _buildUrl, _buildDir }) { + const { data } = _ref + ? await installFrontend({ name, ref: _ref, file: _file, build_url: _buildUrl, build_dir: _buildDir }, getters.authHost, getters.token) + : await installFrontend({ name }, getters.authHost, getters.token) + commit('SET_FRONTENDS', data) + }, async RemoveInstanceDocument({ dispatch, getters }, name) { await deleteInstanceDocument(name, getters.authHost, getters.token) await dispatch('FetchInstanceDocument', name) diff --git a/src/views/settings/components/Frontend.vue b/src/views/settings/components/Frontend.vue index ee01e3cd..50cc4719 100644 --- a/src/views/settings/components/Frontend.vue +++ b/src/views/settings/components/Frontend.vue @@ -21,7 +21,7 @@ prop="installed">