mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
appactions: rm old app action route + view
This commit is contained in:
parent
eff9389648
commit
372942d5e3
4 changed files with 1 additions and 134 deletions
|
@ -54,8 +54,6 @@
|
||||||
"api_not_found": "Seems like the web-admin tried to query something that doesn't exist.",
|
"api_not_found": "Seems like the web-admin tried to query something that doesn't exist.",
|
||||||
"api_not_responding": "The YunoHost API is not responding. Maybe 'yunohost-api' is down or got restarted?",
|
"api_not_responding": "The YunoHost API is not responding. Maybe 'yunohost-api' is down or got restarted?",
|
||||||
"api_waiting": "Waiting for the server's response...",
|
"api_waiting": "Waiting for the server's response...",
|
||||||
"app_actions": "Actions",
|
|
||||||
"app_actions_label": "Perform actions",
|
|
||||||
"app_choose_category": "Choose a category",
|
"app_choose_category": "Choose a category",
|
||||||
"app_config_panel": "Config panel",
|
"app_config_panel": "Config panel",
|
||||||
"app_config_panel_label": "Configure this app",
|
"app_config_panel_label": "Configure this app",
|
||||||
|
@ -69,7 +67,6 @@
|
||||||
"app_install_parameters": "Install settings",
|
"app_install_parameters": "Install settings",
|
||||||
"app_manage_label_and_tiles": "Manage label and tiles",
|
"app_manage_label_and_tiles": "Manage label and tiles",
|
||||||
"app_make_default": "Make default",
|
"app_make_default": "Make default",
|
||||||
"app_no_actions": "This application doesn't have any actions",
|
|
||||||
"app_show_categories": "Show categories",
|
"app_show_categories": "Show categories",
|
||||||
"app_state_inprogress": "not yet working",
|
"app_state_inprogress": "not yet working",
|
||||||
"app_state_inprogress_explanation": "This maintainer of this app declared that this application is not ready yet for production use. BE CAREFUL!",
|
"app_state_inprogress_explanation": "This maintainer of this app declared that this application is not ready yet for production use. BE CAREFUL!",
|
||||||
|
@ -407,7 +404,6 @@
|
||||||
"change_url": "Change access URL of '{name}'",
|
"change_url": "Change access URL of '{name}'",
|
||||||
"install": "Install app '{name}'",
|
"install": "Install app '{name}'",
|
||||||
"set_default": "Redirect '{domain}' domain root to '{name}'",
|
"set_default": "Redirect '{domain}' domain root to '{name}'",
|
||||||
"perform_action": "Perform action '{action}' of app '{name}'",
|
|
||||||
"uninstall": "Uninstall app '{name}'",
|
"uninstall": "Uninstall app '{name}'",
|
||||||
"update_config": "Update panel '{id}' of app '{name}' configuration"
|
"update_config": "Update panel '{id}' of app '{name}' configuration"
|
||||||
},
|
},
|
||||||
|
|
|
@ -210,16 +210,6 @@ const routes = [
|
||||||
breadcrumb: ['app-list', 'app-info']
|
breadcrumb: ['app-list', 'app-info']
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: 'app-actions',
|
|
||||||
path: '/apps/:id/actions',
|
|
||||||
component: () => import(/* webpackChunkName: "views/apps/actions" */ '@/views/app/AppActions'),
|
|
||||||
props: true,
|
|
||||||
meta: {
|
|
||||||
args: { trad: 'app_actions' },
|
|
||||||
breadcrumb: ['app-list', 'app-info', 'app-actions']
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
// no need for name here, only children are visited
|
// no need for name here, only children are visited
|
||||||
path: '/apps/:id/config-panel',
|
path: '/apps/:id/config-panel',
|
||||||
|
|
|
@ -1,106 +0,0 @@
|
||||||
<template>
|
|
||||||
<view-base
|
|
||||||
:queries="queries" @queries-response="onQueriesResponse"
|
|
||||||
ref="view" skeleton="card-form-skeleton"
|
|
||||||
>
|
|
||||||
<template v-if="actions" #default>
|
|
||||||
<b-alert variant="warning" class="mb-4">
|
|
||||||
<icon iname="exclamation-triangle" /> {{ $t('experimental_warning') }}
|
|
||||||
</b-alert>
|
|
||||||
|
|
||||||
<!-- ACTIONS FORMS -->
|
|
||||||
<card-form
|
|
||||||
v-for="(action, i) in actions" :key="i"
|
|
||||||
:title="action.name" icon="wrench" title-tag="h4"
|
|
||||||
:validation="$v.actions[i]" :id="action.id + '-form'" :server-error="action.serverError"
|
|
||||||
@submit.prevent="performAction(action)" :submit-text="$t('perform')"
|
|
||||||
>
|
|
||||||
<form-field
|
|
||||||
v-for="(field, fname) in action.fields" :key="fname" label-cols="0"
|
|
||||||
v-bind="field" v-model="action.form[fname]" :validation="$v.actions[i][fname]"
|
|
||||||
/>
|
|
||||||
</card-form>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<!-- In case of a custom url with no manifest found -->
|
|
||||||
<b-alert v-else-if="actions === null" variant="warning">
|
|
||||||
<icon iname="exclamation-triangle" /> {{ $t('app_no_actions') }}
|
|
||||||
</b-alert>
|
|
||||||
</view-base>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import api, { objectToParams } from '@/api'
|
|
||||||
import { validationMixin } from 'vuelidate'
|
|
||||||
|
|
||||||
import { formatI18nField, formatYunoHostArguments, formatFormData } from '@/helpers/yunohostArguments'
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: 'AppActions',
|
|
||||||
|
|
||||||
mixins: [validationMixin],
|
|
||||||
|
|
||||||
props: {
|
|
||||||
id: { type: String, required: true }
|
|
||||||
},
|
|
||||||
|
|
||||||
data () {
|
|
||||||
return {
|
|
||||||
queries: [
|
|
||||||
['GET', `apps/${this.id}/actions`],
|
|
||||||
['GET', { uri: 'domains' }],
|
|
||||||
['GET', { uri: 'domains/main', storeKey: 'main_domain' }],
|
|
||||||
['GET', { uri: 'users' }]
|
|
||||||
],
|
|
||||||
actions: undefined
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
validations () {
|
|
||||||
const validations = {}
|
|
||||||
for (const [i, action] of this.actions.entries()) {
|
|
||||||
if (action.validations) {
|
|
||||||
validations[i] = { form: action.validations }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return { actions: validations }
|
|
||||||
},
|
|
||||||
|
|
||||||
methods: {
|
|
||||||
onQueriesResponse (data) {
|
|
||||||
if (!data.actions) {
|
|
||||||
this.actions = null
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
this.actions = data.actions.map(({ name, id, description, arguments: arguments_ }) => {
|
|
||||||
const action = { name, id, serverError: '' }
|
|
||||||
if (description) action.description = formatI18nField(description)
|
|
||||||
if (arguments_ && arguments_.length) {
|
|
||||||
const { form, fields, validations } = formatYunoHostArguments(arguments_)
|
|
||||||
action.form = form
|
|
||||||
action.fields = fields
|
|
||||||
if (validations) action.validations = validations
|
|
||||||
}
|
|
||||||
return action
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
performAction (action) {
|
|
||||||
// FIXME api expects at least one argument ?! (fake one given with { dontmindthis } )
|
|
||||||
const args = objectToParams(action.form ? formatFormData(action.form) : { dontmindthis: undefined })
|
|
||||||
|
|
||||||
api.put(
|
|
||||||
`apps/${this.id}/actions/${action.id}`,
|
|
||||||
{ args },
|
|
||||||
{ key: 'apps.perform_action', action: action.id, name: this.id }
|
|
||||||
).then(() => {
|
|
||||||
this.$refs.view.fetchQueries()
|
|
||||||
}).catch(err => {
|
|
||||||
if (err.name !== 'APIBadRequestError') throw err
|
|
||||||
action.serverError = err.message
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
|
@ -134,19 +134,6 @@
|
||||||
</b-form-group>
|
</b-form-group>
|
||||||
</card>
|
</card>
|
||||||
|
|
||||||
<!-- EXPERIMENTAL (displayed if experimental feature has been enabled in web-admin options)-->
|
|
||||||
<card v-if="experimental" :title="$t('experimental')" icon="flask">
|
|
||||||
<!-- APP ACTIONS -->
|
|
||||||
<b-form-group
|
|
||||||
:label="$t('app_actions_label')" label-for="actions"
|
|
||||||
label-cols-md="4" label-class="font-weight-bold"
|
|
||||||
>
|
|
||||||
<b-button id="actions" variant="warning" :to="{ name: 'app-actions', params: { id } }">
|
|
||||||
<icon iname="flask" /> {{ $t('app_actions') }}
|
|
||||||
</b-button>
|
|
||||||
</b-form-group>
|
|
||||||
</card>
|
|
||||||
|
|
||||||
<template #skeleton>
|
<template #skeleton>
|
||||||
<card-info-skeleton :item-count="8" />
|
<card-info-skeleton :item-count="8" />
|
||||||
<card-form-skeleton />
|
<card-form-skeleton />
|
||||||
|
@ -184,7 +171,7 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters(['domains', 'experimental']),
|
...mapGetters(['domains']),
|
||||||
|
|
||||||
allowedGroups () {
|
allowedGroups () {
|
||||||
if (!this.app) return
|
if (!this.app) return
|
||||||
|
|
Loading…
Add table
Reference in a new issue