forked from AkkomaGang/admin-fe
Add ability to install one of the available frontends
This commit is contained in:
parent
21976f3828
commit
8d52a897bb
3 changed files with 13 additions and 3 deletions
|
@ -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({
|
return await request({
|
||||||
baseURL: baseName(authHost),
|
baseURL: baseName(authHost),
|
||||||
url: `/api/pleroma/admin/frontends/install`,
|
url: `/api/pleroma/admin/frontends/install`,
|
||||||
method: 'post',
|
method: 'post',
|
||||||
headers: authHeaders(token),
|
headers: authHeaders(token),
|
||||||
data: { name, ref, file, build_url: buildUrl, build_dir: buildDir }
|
data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ import {
|
||||||
fetchFrontends,
|
fetchFrontends,
|
||||||
fetchSettings,
|
fetchSettings,
|
||||||
getInstanceDocument,
|
getInstanceDocument,
|
||||||
|
installFrontend,
|
||||||
removeSettings,
|
removeSettings,
|
||||||
updateInstanceDocument,
|
updateInstanceDocument,
|
||||||
updateSettings } from '@/api/settings'
|
updateSettings } from '@/api/settings'
|
||||||
|
@ -121,6 +122,12 @@ const settings = {
|
||||||
commit('TOGGLE_TABS', false)
|
commit('TOGGLE_TABS', false)
|
||||||
commit('SET_LOADING', 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) {
|
async RemoveInstanceDocument({ dispatch, getters }, name) {
|
||||||
await deleteInstanceDocument(name, getters.authHost, getters.token)
|
await deleteInstanceDocument(name, getters.authHost, getters.token)
|
||||||
await dispatch('FetchInstanceDocument', name)
|
await dispatch('FetchInstanceDocument', name)
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
prop="installed">
|
prop="installed">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button
|
<el-button
|
||||||
v-if="!scope.row.installed"
|
v-if="scope.row.installed"
|
||||||
disabled
|
disabled
|
||||||
type="text"
|
type="text"
|
||||||
size="small">
|
size="small">
|
||||||
|
@ -169,6 +169,9 @@ export default {
|
||||||
await this.$store.dispatch('FetchFrontends')
|
await this.$store.dispatch('FetchFrontends')
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
installFrontend({ name }) {
|
||||||
|
this.$store.dispatch('InstallFrontend', { name })
|
||||||
|
},
|
||||||
async onSubmit() {
|
async onSubmit() {
|
||||||
try {
|
try {
|
||||||
await this.$store.dispatch('SubmitChanges')
|
await this.$store.dispatch('SubmitChanges')
|
||||||
|
|
Loading…
Reference in a new issue