From b8112bbe6f2cb7ad290768058e484da6346d524c Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 14 Jul 2022 15:16:51 +0200 Subject: [PATCH] Bug 32030: Add warning to Dialog Signed-off-by: Jonathan Field Signed-off-by: Martin Renvoize Signed-off-by: Kyle M Hall Signed-off-by: Tomas Cohen Arazi --- .../intranet-tmpl/prog/js/vue/components/ERM/Dialog.vue | 5 +++-- koha-tmpl/intranet-tmpl/prog/js/vue/messages.js | 7 ++++++- koha-tmpl/intranet-tmpl/prog/js/vue/stores/main.js | 8 ++++++++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/Dialog.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/Dialog.vue index be910a4e12..4a7ba92a4a 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/Dialog.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/Dialog.vue @@ -1,6 +1,7 @@ \ No newline at end of file diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/messages.js b/koha-tmpl/intranet-tmpl/prog/js/vue/messages.js index 7d229089af..14f8ac2ffa 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/messages.js +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/messages.js @@ -1,5 +1,4 @@ import { useMainStore } from "./stores/main"; -import { storeToRefs } from "pinia"; export const setError = function (new_error) { const mainStore = useMainStore(); @@ -7,6 +6,12 @@ export const setError = function (new_error) { setError("Something went wrong: " + new_error); }; +export const setWarning = function (new_warning) { + const mainStore = useMainStore(); + const { setWarning } = mainStore; + setWarning(new_warning); +}; + export const setMessage = function (message) { const mainStore = useMainStore(); const { setMessage } = mainStore; diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/stores/main.js b/koha-tmpl/intranet-tmpl/prog/js/vue/stores/main.js index 9e66ce87e3..94311f727f 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/stores/main.js +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/stores/main.js @@ -4,6 +4,7 @@ export const useMainStore = defineStore("main", { state: () => ({ message: null, error: null, + warning: null, previousMessage: null, previousError: null, displayed_already: false, @@ -11,6 +12,7 @@ export const useMainStore = defineStore("main", { actions: { setMessage(message) { this.error = null; + this.warning = null; this.message = message; this.displayed_already = false; /* Will be displayed on the next view */ }, @@ -19,9 +21,15 @@ export const useMainStore = defineStore("main", { this.message = null; this.displayed_already = true; /* Is displayed on the current view */ }, + setWarning(warning) { + this.warning = warning; + this.message = null; + this.displayed_already = true; /* Is displayed on the current view */ + }, removeMessages() { if (this.displayed_already) { this.error = null; + this.warning = null; this.message = null; } this.displayed_already = true; -- 2.39.2