From d176654e9687e552514dbbc2a275111467850da4 Mon Sep 17 00:00:00 2001 From: Richard Date: Sat, 29 May 2021 12:03:55 +0100 Subject: [PATCH] Allow ImJoy plugins to be disabled ImJoy is now loaded dynamically, and can be turned off with an environment variable. I've added two new scripts to develop and build without ImJoy. I suspect these won't see much use, but they will remind us how to do it when we want to release a medical version. The ImJoy "chunk" is named for ease of separation. Co-authored-by: Kaspar Emanuel --- openflexure_microscope/api/static/.env.development | 4 +++- openflexure_microscope/api/static/.env.production | 4 +++- openflexure_microscope/api/static/package.json | 2 ++ .../api/static/src/components/appContent.vue | 9 +++++++-- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/openflexure_microscope/api/static/.env.development b/openflexure_microscope/api/static/.env.development index 284c703f..0fd381c8 100644 --- a/openflexure_microscope/api/static/.env.development +++ b/openflexure_microscope/api/static/.env.development @@ -1,3 +1,5 @@ NODE_ENV=development +VUE_APP_MODE=development VUE_APP_PLATFORM=web -VUE_APP_TARGET=web \ No newline at end of file +VUE_APP_TARGET=web +VUE_APP_ENABLE_IMJOY=true \ No newline at end of file diff --git a/openflexure_microscope/api/static/.env.production b/openflexure_microscope/api/static/.env.production index e9a62687..ed3afd8e 100644 --- a/openflexure_microscope/api/static/.env.production +++ b/openflexure_microscope/api/static/.env.production @@ -1,3 +1,5 @@ NODE_ENV=production +VUE_APP_MODE=production VUE_APP_PLATFORM=web -VUE_APP_TARGET=web \ No newline at end of file +VUE_APP_TARGET=web +VUE_APP_ENABLE_IMJOY=true diff --git a/openflexure_microscope/api/static/package.json b/openflexure_microscope/api/static/package.json index d1c31011..d7bbf433 100644 --- a/openflexure_microscope/api/static/package.json +++ b/openflexure_microscope/api/static/package.json @@ -6,7 +6,9 @@ "author": "OpenFlexure (https://www.openflexure.org)", "scripts": { "serve": "vue-cli-service serve --mode development", + "serve-without-imjoy": "VUE_APP_ENABLE_IMJOY=false vue-cli-service serve --mode development", "build": "vue-cli-service build --mode production", + "build-without-imjoy": "VUE_APP_ENABLE_IMJOY=false vue-cli-service build --mode production", "lint": "vue-cli-service lint", "lint:fix": "vue-cli-service lint --fix" }, diff --git a/openflexure_microscope/api/static/src/components/appContent.vue b/openflexure_microscope/api/static/src/components/appContent.vue index bc2cb1c7..9212302a 100644 --- a/openflexure_microscope/api/static/src/components/appContent.vue +++ b/openflexure_microscope/api/static/src/components/appContent.vue @@ -49,6 +49,7 @@ import(/* webpackChunkName: "imjoy" */"./tabContentComponents/imjoyContent.vue") }, data: function() { return { @@ -297,6 +298,10 @@ export default { return this.tabOrder.indexOf(this.currentTab); }, + imjoyEnabled: function() { + return process.env.VUE_APP_ENABLE_IMJOY === "true"; + }, + ...mapState("imjoy", { imjoyTabs: "tabs" }) },