Plugin form refresh button updates form schema itself
This commit is contained in:
parent
0d17508bd9
commit
951765f2c1
2 changed files with 12 additions and 11 deletions
|
|
@ -116,6 +116,7 @@
|
||||||
:submit-label="form.submitLabel"
|
:submit-label="form.submitLabel"
|
||||||
:self-update="form.selfUpdate"
|
:self-update="form.selfUpdate"
|
||||||
:schema="form.schema"
|
:schema="form.schema"
|
||||||
|
@reloadForms="updatePlugins()"
|
||||||
/>
|
/>
|
||||||
<hr />
|
<hr />
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -201,6 +202,7 @@ export default {
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
updatePlugins: function() {
|
updatePlugins: function() {
|
||||||
|
console.log("Updating plugin forms");
|
||||||
axios
|
axios
|
||||||
.get(this.pluginsUri)
|
.get(this.pluginsUri)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,7 @@
|
||||||
<div class="uk-text-bold uk-text-uppercase uk-width-expand">
|
<div class="uk-text-bold uk-text-uppercase uk-width-expand">
|
||||||
{{ name }}
|
{{ name }}
|
||||||
</div>
|
</div>
|
||||||
<a
|
<a href="#" class="uk-icon uk-width-auto" @click="updateForm()"
|
||||||
v-if="selfUpdate"
|
|
||||||
href="#"
|
|
||||||
class="uk-icon uk-width-auto"
|
|
||||||
@click="getFormData()"
|
|
||||||
><i class="material-icons">cached</i></a
|
><i class="material-icons">cached</i></a
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -171,9 +167,14 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
updateForm(fieldName, value) {
|
updateForm() {
|
||||||
this.$set(this.formData, fieldName, value);
|
// Trigger a plugin form update
|
||||||
this.$emit("input", this.formData);
|
this.$emit("reloadForms");
|
||||||
|
// If the form can self-update (GET request to update component values)
|
||||||
|
if (this.selfUpdate) {
|
||||||
|
// Update form data values using a GET request
|
||||||
|
this.getFormData();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
getFormData: function() {
|
getFormData: function() {
|
||||||
|
|
@ -199,9 +200,7 @@ export default {
|
||||||
// Do something with the response
|
// Do something with the response
|
||||||
console.log(response);
|
console.log(response);
|
||||||
// Update the form data if we're self-updating
|
// Update the form data if we're self-updating
|
||||||
if (this.selfUpdate) {
|
this.updateForm();
|
||||||
this.getFormData();
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
this.modalError(error); // Let mixin handle error
|
this.modalError(error); // Let mixin handle error
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue