From 4fda39ddba4cbb8b74498939af394dd48f093d42 Mon Sep 17 00:00:00 2001 From: Henry Jonas Date: Mon, 24 Jun 2024 16:03:50 -0400 Subject: [PATCH 1/2] FOUR-15804:Process Map - Behavior when the task has Screen, Image or Nothing --- resources/js/bootstrap.js | 2 ++ resources/js/globalStore/index.js | 33 +++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 resources/js/globalStore/index.js diff --git a/resources/js/bootstrap.js b/resources/js/bootstrap.js index 24b959fde8..9621dcf5fd 100644 --- a/resources/js/bootstrap.js +++ b/resources/js/bootstrap.js @@ -19,6 +19,7 @@ import MonacoEditor from "vue-monaco"; import Vue from "vue"; import * as vue from "vue"; import VueCookies from "vue-cookies"; +import GlobalStore from "./globalStore"; import Pagination from "./components/common/Pagination"; import ScreenSelect from "./processes/modeler/components/inspector/ScreenSelect.vue"; import translator from "./modules/lang.js"; @@ -75,6 +76,7 @@ window.bootstrap = bootstrap; window.Vue.use(BootstrapVue); window.Vue.use(BootstrapVueIcons); window.Vue.use(ScreenBuilder); +window.Vue.use(GlobalStore); window.Vue.use(VueDeepSet); window.Vue.use(VueCookies); if (!document.head.querySelector("meta[name=\"is-horizon\"]")) { diff --git a/resources/js/globalStore/index.js b/resources/js/globalStore/index.js new file mode 100644 index 0000000000..2840fac1cb --- /dev/null +++ b/resources/js/globalStore/index.js @@ -0,0 +1,33 @@ +import Vuex from "vuex"; + +export default { + install(Vue) { + const globalStore = new Vuex.Store({ + modules: { }, + }); + + Vue.globalStore = globalStore; + + Vue.mixin({ + beforeCreate() { + const options = this.$options; + + if (options.globalStore) { + this.$globalStore = typeof options.globalStore === "function" + ? options.globalStore() + : options.globalStore; + + return; + } + + if (options.parent && options.parent.$globalStore) { + this.$globalStore = options.parent.$globalStore; + + return; + } + + this.$globalStore = globalStore; + }, + }); + }, +}; From a5abb19237921da296822ab17547040f69e9d06c Mon Sep 17 00:00:00 2001 From: Henry Jonas Date: Tue, 25 Jun 2024 10:37:47 -0400 Subject: [PATCH 2/2] FOUR-15804: update observations --- resources/js/globalStore/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/js/globalStore/index.js b/resources/js/globalStore/index.js index 2840fac1cb..ec9a7c0bbf 100644 --- a/resources/js/globalStore/index.js +++ b/resources/js/globalStore/index.js @@ -20,7 +20,7 @@ export default { return; } - if (options.parent && options.parent.$globalStore) { + if (options?.parent?.$globalStore) { this.$globalStore = options.parent.$globalStore; return;