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 <kaspar@monostable.co.uk>
This commit is contained in:
Richard 2021-05-29 12:03:55 +01:00
parent f9f78b867c
commit d176654e96
4 changed files with 15 additions and 4 deletions

View file

@ -1,3 +1,5 @@
NODE_ENV=development
VUE_APP_MODE=development
VUE_APP_PLATFORM=web
VUE_APP_TARGET=web
VUE_APP_TARGET=web
VUE_APP_ENABLE_IMJOY=true

View file

@ -1,3 +1,5 @@
NODE_ENV=production
VUE_APP_MODE=production
VUE_APP_PLATFORM=web
VUE_APP_TARGET=web
VUE_APP_TARGET=web
VUE_APP_ENABLE_IMJOY=true

View file

@ -6,7 +6,9 @@
"author": "OpenFlexure <contact@openflexure.org> (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"
},

View file

@ -49,6 +49,7 @@
</tabIcon>
<tabIcon
v-if="imjoyEnabled"
tab-i-d="ImJoy"
title="ImJoy"
:require-connection="false"
@ -137,6 +138,7 @@
</tabContent>
<tabContent
v-if="imjoyEnabled"
tab-i-d="ImJoy"
:require-connection="false"
:current-tab="currentTab"
@ -187,7 +189,6 @@ import galleryContent from "./tabContentComponents/galleryContent.vue";
import extensionContent from "./tabContentComponents/extensionContent.vue";
import aboutContent from "./tabContentComponents/aboutContent.vue";
import loggingContent from "./tabContentComponents/loggingContent.vue";
import ImJoyContent from "./tabContentComponents/imjoyContent.vue";
// Import modal components for device initialisation
import calibrationModal from "./modalComponents/calibrationModal.vue";
@ -211,7 +212,7 @@ export default {
aboutContent,
loggingContent,
TabIcon,
ImJoyContent
ImJoyContent: () => 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" })
},