mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
refactor: use apply
event instead of submit
on ConfigPanels
This commit is contained in:
parent
04872f6eed
commit
1430c03a4f
7 changed files with 17 additions and 10 deletions
|
@ -6,7 +6,7 @@
|
|||
validation,
|
||||
serverError: panel.serverError,
|
||||
}"
|
||||
@submit.prevent.stop="onApply"
|
||||
@apply="onApply"
|
||||
:no-footer="!panel.hasApplyButton"
|
||||
>
|
||||
<slot name="tab-top" />
|
||||
|
@ -78,7 +78,7 @@ export default {
|
|||
onApply() {
|
||||
const panelId = this.panel.id
|
||||
|
||||
this.$emit('submit', {
|
||||
this.$emit('apply', {
|
||||
id: panelId,
|
||||
form: this.forms[panelId],
|
||||
})
|
||||
|
@ -88,7 +88,7 @@ export default {
|
|||
const panelId = this.panel.id
|
||||
const actionFieldsKeys = Object.keys(actionFields)
|
||||
|
||||
this.$emit('submit', {
|
||||
this.$emit('apply', {
|
||||
id: panelId,
|
||||
form: filterObject(this.forms[panelId], ([key]) =>
|
||||
actionFieldsKeys.includes(key),
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
<template>
|
||||
<div class="config-panel">
|
||||
<!-- FIXME vue3 - weird stuff with event binding, need to propagate by hand for now -->
|
||||
<RoutableTabs
|
||||
v-if="routes_.length > 1"
|
||||
v-bind="{ panels, forms, v: v$, ...$attrs }"
|
||||
:routes="routes_"
|
||||
v-on="$listeners"
|
||||
@apply="$emit('apply', $event)"
|
||||
>
|
||||
<template #tab-top>
|
||||
<slot name="tab-top" />
|
||||
|
|
|
@ -16,7 +16,12 @@
|
|||
|
||||
<!-- Bind extra props to the child view and forward child events to parent -->
|
||||
<RouterView v-slot="{ Component }">
|
||||
<Component v-bind="$attrs" v-on="$listeners" :is="Component">
|
||||
<Component
|
||||
v-bind="$attrs"
|
||||
:is="Component"
|
||||
v-on="$listeners"
|
||||
@apply="$emit('apply', $event)"
|
||||
>
|
||||
<template #tab-top>
|
||||
<slot name="tab-top" />
|
||||
</template>
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
:id="id"
|
||||
:inline="inline"
|
||||
:class="formClasses"
|
||||
@submit.prevent="onSubmit"
|
||||
novalidate
|
||||
@submit.prevent.stop="onSubmit"
|
||||
>
|
||||
<slot name="default" />
|
||||
|
||||
|
@ -61,7 +61,8 @@ export default {
|
|||
v.$touch()
|
||||
if (v.$pending || v.$errors.length) return
|
||||
}
|
||||
this.$emit('submit', e)
|
||||
// Weird bug with `INSTANCE_LISTENERS: true` with 'submit' event (double exec before of conflict with native submit event?)
|
||||
this.$emit('apply')
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
@ -129,7 +129,7 @@
|
|||
<ConfigPanels
|
||||
v-bind="config"
|
||||
:external-results="externalResults"
|
||||
@submit="onConfigSubmit"
|
||||
@apply="onConfigSubmit"
|
||||
>
|
||||
<!-- OPERATIONS TAB -->
|
||||
<template v-if="currentTab === 'operations'" #tab-top>
|
||||
|
|
|
@ -112,7 +112,7 @@
|
|||
v-if="config.panels"
|
||||
v-bind="config"
|
||||
:external-results="externalResults"
|
||||
@submit="onConfigSubmit"
|
||||
@apply="onConfigSubmit"
|
||||
>
|
||||
<template v-if="currentTab === 'dns'" #tab-after>
|
||||
<DomainDns :name="name" />
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
v-if="config.panels"
|
||||
v-bind="config"
|
||||
:external-results="externalResults"
|
||||
@submit="onConfigSubmit"
|
||||
@apply="onConfigSubmit"
|
||||
/>
|
||||
</ViewBase>
|
||||
</template>
|
||||
|
|
Loading…
Add table
Reference in a new issue