Skip to content

Commit

Permalink
Clean up JSONEditorDialog
Browse files Browse the repository at this point in the history
  • Loading branch information
Sensational-Code committed Dec 12, 2024
1 parent 0d2b382 commit a6c7199
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions src/ui/ManagementPortal/components/JSONEditorDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,19 @@
<JsonEditorVue v-model="json" />

<template #footer>
<!-- Save -->
<Button
severity="primary"
label="Save"
@click="handleSave"
/>

<!-- Cancel -->
<Button
class="sidebar-dialog__button"
class="ml-2"
label="Close"
text
@click="$emit('update:visible', false)"
@click="handleClose"
/>
</template>
</Dialog>
Expand All @@ -36,7 +43,7 @@ export default {
visible: {
type: Boolean,
required: true,
required: false,
},
},
Expand All @@ -55,13 +62,16 @@ export default {
this.json = this.modelValue;
},
},
},
json: {
deep: true,
handler() {
if (JSON.stringify(this.modelValue) === JSON.stringify(this.json)) return;
this.modelValue = this.json;
},
methods: {
handleSave() {
this.$emit('update:modelValue', this.json);
this.handleClose();
},
handleClose() {
this.$emit('update:visible', false);
},
},
};
Expand Down

0 comments on commit a6c7199

Please sign in to comment.