diff --git a/frontend/src/App.vue b/frontend/src/App.vue index 8f11505f..a456d9a8 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -3,11 +3,13 @@ + diff --git a/frontend/src/components/Activities.vue b/frontend/src/components/Activities.vue index 433a3e36..6f3bba61 100644 --- a/frontend/src/components/Activities.vue +++ b/frontend/src/components/Activities.vue @@ -114,7 +114,7 @@ -
+
+ +
{ @@ -57,3 +60,7 @@ socket.on('refetch_resource', (data) => { } } }) + +if (import.meta.env.DEV) { + window.$dialog = createDialog +} diff --git a/frontend/src/utils/dialogs.js b/frontend/src/utils/dialogs.js new file mode 100644 index 00000000..9efdde3b --- /dev/null +++ b/frontend/src/utils/dialogs.js @@ -0,0 +1,31 @@ +import { Dialog, ErrorMessage } from 'frappe-ui' +import { h, reactive, ref } from 'vue' + +let dialogs = ref([]) + +export let Dialogs = { + name: 'Dialogs', + render() { + return dialogs.value.map((dialog) => { + return h( + Dialog, + { + options: dialog, + modelValue: dialog.show, + 'onUpdate:modelValue': (val) => (dialog.show = val), + }, + () => [ + h('p', { class: 'text-p-base text-gray-700' }, dialog.message), + h(ErrorMessage, { class: 'mt-2', message: dialog.error }), + ] + ) + }) + }, +} + +export function createDialog(options) { + let dialog = reactive(options) + dialog.key = `dialog-${Math.random().toString(36).slice(2, 9)}` + dialogs.value.push(dialog) + dialog.show = true +} diff --git a/frontend/src/utils.js b/frontend/src/utils/index.js similarity index 100% rename from frontend/src/utils.js rename to frontend/src/utils/index.js