You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ma...@apache.org on 2022/02/17 00:43:29 UTC

[airavata-django-portal] 08/16: AIRAVATA-3557 Make store initialization compatible with entry function

This is an automated email from the ASF dual-hosted git repository.

machristie pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/airavata-django-portal.git

commit f5cc136379cfc40d94425a64b15c812aa07f3a96
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Tue Feb 15 11:08:07 2022 -0500

    AIRAVATA-3557 Make store initialization compatible with entry function
---
 .../js/entry-view-experiment.js                    | 68 +++++++++-------------
 .../django_airavata_workspace/js/store/index.js    | 20 ++++---
 2 files changed, 38 insertions(+), 50 deletions(-)

diff --git a/django_airavata/apps/workspace/static/django_airavata_workspace/js/entry-view-experiment.js b/django_airavata/apps/workspace/static/django_airavata_workspace/js/entry-view-experiment.js
index 4a0ab0d..7eb7cff 100644
--- a/django_airavata/apps/workspace/static/django_airavata_workspace/js/entry-view-experiment.js
+++ b/django_airavata/apps/workspace/static/django_airavata_workspace/js/entry-view-experiment.js
@@ -1,44 +1,30 @@
-import { components, errors } from "django-airavata-common-ui";
+import { components, entry } from "django-airavata-common-ui";
 import { mapActions } from "vuex";
 import ExperimentSummary from "./components/experiment/ExperimentSummary.vue";
-import store from "./store";
+import createStore from "./store";
 
-import Vue from "vue";
-import BootstrapVue from "bootstrap-vue";
-import AsyncComputed from "vue-async-computed";
-
-errors.GlobalErrorHandler.init();
-
-// This is imported globally on the website (see main.js) so no need to include
-// it again in this view
-// import 'bootstrap/dist/css/bootstrap.css'
-import "bootstrap-vue/dist/bootstrap-vue.css";
-
-// Common Vue configuration
-Vue.use(BootstrapVue);
-Vue.use(AsyncComputed);
-
-// TODO: fix entry so that we can still get common configuration when using Vuex
-// entry((Vue) => {
-new Vue({
-  store,
-  render(h) {
-    return h(components.MainLayout, [h(ExperimentSummary)]);
-  },
-  async beforeMount() {
-    const fullExperimentData = JSON.parse(this.$el.dataset.fullExperimentData);
-    this.setInitialFullExperimentData({ fullExperimentData });
-    if ("launching" in this.$el.dataset) {
-      const launching = JSON.parse(this.$el.dataset.launching);
-      this.setLaunching({ launching });
-    }
-  },
-  methods: {
-    ...mapActions("viewExperiment", [
-      "setInitialFullExperimentData",
-      "setLaunching",
-    ]),
-  },
-}).$mount("#view-experiment");
-
-// });
+entry((Vue) => {
+  const store = createStore(Vue);
+  new Vue({
+    store,
+    render(h) {
+      return h(components.MainLayout, [h(ExperimentSummary)]);
+    },
+    async beforeMount() {
+      const fullExperimentData = JSON.parse(
+        this.$el.dataset.fullExperimentData
+      );
+      this.setInitialFullExperimentData({ fullExperimentData });
+      if ("launching" in this.$el.dataset) {
+        const launching = JSON.parse(this.$el.dataset.launching);
+        this.setLaunching({ launching });
+      }
+    },
+    methods: {
+      ...mapActions("viewExperiment", [
+        "setInitialFullExperimentData",
+        "setLaunching",
+      ]),
+    },
+  }).$mount("#view-experiment");
+});
diff --git a/django_airavata/apps/workspace/static/django_airavata_workspace/js/store/index.js b/django_airavata/apps/workspace/static/django_airavata_workspace/js/store/index.js
index b997094..e833bd1 100644
--- a/django_airavata/apps/workspace/static/django_airavata_workspace/js/store/index.js
+++ b/django_airavata/apps/workspace/static/django_airavata_workspace/js/store/index.js
@@ -1,14 +1,16 @@
-import Vue from "vue";
 import Vuex from "vuex";
 import viewExperiment from "./modules/view-experiment";
 
-Vue.use(Vuex);
-
 const debug = process.env.NODE_ENV !== "production";
 
-export default new Vuex.Store({
-  modules: {
-    viewExperiment,
-  },
-  strict: debug,
-});
+function createStore(Vue) {
+  Vue.use(Vuex);
+  return new Vuex.Store({
+    modules: {
+      viewExperiment,
+    },
+    strict: debug,
+  });
+}
+
+export default createStore;