mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
Merge pull request #422 from Tagadda/enh-domain-default-app
Manage default application using DomainConfig
This commit is contained in:
commit
975acaadab
3 changed files with 22 additions and 9 deletions
|
@ -110,11 +110,11 @@ export function formatYunoHostArgument (arg) {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
types: ['select', 'user', 'domain'],
|
types: ['select', 'user', 'domain', 'app'],
|
||||||
name: 'SelectItem',
|
name: 'SelectItem',
|
||||||
props: ['id:name', 'choices'],
|
props: ['id:name', 'choices'],
|
||||||
callback: function () {
|
callback: function () {
|
||||||
if ((arg.type === 'domain') || (arg.type === 'user')) {
|
if ((arg.type !== 'select')) {
|
||||||
field.link = { name: arg.type + '-list', text: i18n.t(`manage_${arg.type}s`) }
|
field.link = { name: arg.type + '-list', text: i18n.t(`manage_${arg.type}s`) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,15 +101,23 @@
|
||||||
</b-form-group>
|
</b-form-group>
|
||||||
<hr v-if="app.is_webapp">
|
<hr v-if="app.is_webapp">
|
||||||
|
|
||||||
<!-- CHANGE DOMAIN -->
|
<!-- MAKE DEFAULT -->
|
||||||
<b-form-group
|
<b-form-group
|
||||||
:label="$t('app_info_default_desc', { domain: app.domain })" label-for="main-domain"
|
:label="$t('app_info_default_desc', { domain: app.domain })" label-for="main-domain"
|
||||||
label-class="font-weight-bold" label-cols-md="4"
|
label-class="font-weight-bold" label-cols-md="4"
|
||||||
v-if="app.is_webapp"
|
v-if="app.is_webapp"
|
||||||
>
|
>
|
||||||
<b-button @click="setAsDefaultDomain" id="main-domain" variant="success">
|
<template v-if="!app.is_default">
|
||||||
|
<b-button @click="setAsDefaultDomain($event, false)" id="main-domain" variant="success">
|
||||||
<icon iname="star" /> {{ $t('app_make_default') }}
|
<icon iname="star" /> {{ $t('app_make_default') }}
|
||||||
</b-button>
|
</b-button>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template v-else>
|
||||||
|
<b-button @click="setAsDefaultDomain($event, true)" id="main-domain" variant="warning">
|
||||||
|
<icon iname="star" /> {{ $t('app_make_not_default') }}
|
||||||
|
</b-button>
|
||||||
|
</template>
|
||||||
</b-form-group>
|
</b-form-group>
|
||||||
<hr v-if="app.is_webapp">
|
<hr v-if="app.is_webapp">
|
||||||
|
|
||||||
|
@ -250,10 +258,14 @@ export default {
|
||||||
this.app = {
|
this.app = {
|
||||||
domain: app.settings.domain,
|
domain: app.settings.domain,
|
||||||
is_webapp: app.is_webapp,
|
is_webapp: app.is_webapp,
|
||||||
|
is_default: app.is_default,
|
||||||
supports_change_url: app.supports_change_url,
|
supports_change_url: app.supports_change_url,
|
||||||
supports_config_panel: app.supports_config_panel,
|
supports_config_panel: app.supports_config_panel,
|
||||||
permissions
|
permissions
|
||||||
}
|
}
|
||||||
|
if (this.app.is_webapp) {
|
||||||
|
this.app.is_default = app.is_default
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
changeLabel (permName, data) {
|
changeLabel (permName, data) {
|
||||||
|
@ -277,12 +289,12 @@ export default {
|
||||||
).then(this.$refs.view.fetchQueries)
|
).then(this.$refs.view.fetchQueries)
|
||||||
},
|
},
|
||||||
|
|
||||||
async setAsDefaultDomain () {
|
async setAsDefaultDomain (event, undo = false) {
|
||||||
const confirmed = await this.$askConfirmation(this.$i18n.t('confirm_app_default'))
|
const confirmed = await this.$askConfirmation(this.$i18n.t('confirm_app_default'))
|
||||||
if (!confirmed) return
|
if (!confirmed) return
|
||||||
|
|
||||||
api.put(
|
api.put(
|
||||||
`apps/${this.id}/default`,
|
`apps/${this.id}/default${undo ? '?undo' : ''}`,
|
||||||
{},
|
{},
|
||||||
{ key: 'apps.set_default', name: this.infos.label, domain: this.app.domain }
|
{ key: 'apps.set_default', name: this.infos.label, domain: this.app.domain }
|
||||||
).then(this.$refs.view.fetchQueries)
|
).then(this.$refs.view.fetchQueries)
|
||||||
|
|
|
@ -58,7 +58,8 @@ export default {
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
queries: [
|
queries: [
|
||||||
['GET', `domains/${this.name}/config?full`]
|
['GET', `domains/${this.name}/config?full`],
|
||||||
|
['GET', { uri: 'apps', storeKey: 'apps' }]
|
||||||
],
|
],
|
||||||
panels: undefined,
|
panels: undefined,
|
||||||
forms: undefined,
|
forms: undefined,
|
||||||
|
|
Loading…
Add table
Reference in a new issue