mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
globalsettings: update apply call to actions changes
This commit is contained in:
parent
2708b98d20
commit
8a91045f0d
2 changed files with 10 additions and 12 deletions
|
@ -455,7 +455,7 @@
|
||||||
"update": "Update user '{name}'"
|
"update": "Update user '{name}'"
|
||||||
},
|
},
|
||||||
"settings": {
|
"settings": {
|
||||||
"update": "Update global settings"
|
"update": "Update '{panel}' global settings panel"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"run": "Run",
|
"run": "Run",
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
:queries="queries" @queries-response="onQueriesResponse"
|
:queries="queries" @queries-response="onQueriesResponse"
|
||||||
ref="view" skeleton="card-form-skeleton"
|
ref="view" skeleton="card-form-skeleton"
|
||||||
>
|
>
|
||||||
<config-panels v-if="config.panels" v-bind="config" @submit="applyConfig" />
|
<config-panels v-if="config.panels" v-bind="config" @submit="onConfigSubmit" />
|
||||||
</view-base>
|
</view-base>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -39,23 +39,21 @@ export default {
|
||||||
this.config = formatYunoHostConfigPanels(config)
|
this.config = formatYunoHostConfigPanels(config)
|
||||||
},
|
},
|
||||||
|
|
||||||
async applyConfig (id_) {
|
async onConfigSubmit ({ id, form }) {
|
||||||
const formatedData = await formatFormData(
|
const args = await formatFormData(form, { removeEmpty: false, removeNull: true })
|
||||||
this.config.forms[id_],
|
|
||||||
{ removeEmpty: false, removeNull: true, multipart: false }
|
|
||||||
)
|
|
||||||
|
|
||||||
|
// FIXME no route for potential action
|
||||||
api.put(
|
api.put(
|
||||||
'settings',
|
`settings/${id}`,
|
||||||
{ key: id_, args: objectToParams(formatedData) },
|
{ args: objectToParams(args) },
|
||||||
{ key: 'settings.update', name: this.name }
|
{ key: 'settings.update', panel: id }
|
||||||
).then(() => {
|
).then(() => {
|
||||||
this.$refs.view.fetchQueries({ triggerLoading: true })
|
this.$refs.view.fetchQueries({ triggerLoading: true })
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
if (err.name !== 'APIBadRequestError') throw err
|
if (err.name !== 'APIBadRequestError') throw err
|
||||||
const panel = this.config.panels.find(({ id }) => id_ === id)
|
const panel = this.config.panels.find(panel => panel.id === id)
|
||||||
if (err.data.name) {
|
if (err.data.name) {
|
||||||
this.config.errors[id_][err.data.name].message = err.message
|
this.config.errors[id][err.data.name].message = err.message
|
||||||
} else this.$set(panel, 'serverError', err.message)
|
} else this.$set(panel, 'serverError', err.message)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue