From 67d7da5d9cd82c76376a6e4c8a9111100379734e Mon Sep 17 00:00:00 2001 From: Daniel Egger Date: Tue, 10 May 2022 12:18:09 +0200 Subject: [PATCH 1/5] Move "my-kv" values to seperate file --- client/config/prod-my-kv.env.js | 20 ++++++++++++++++++++ client/config/prod.env.js | 32 ++++++++++++++++++++++---------- 2 files changed, 42 insertions(+), 10 deletions(-) create mode 100644 client/config/prod-my-kv.env.js diff --git a/client/config/prod-my-kv.env.js b/client/config/prod-my-kv.env.js new file mode 100644 index 00000000..e5e9a958 --- /dev/null +++ b/client/config/prod-my-kv.env.js @@ -0,0 +1,20 @@ +'use strict' +module.exports = { + /* + * ENV variables used in JS code need to be stringyfied, as they will be replaced in the code, and JS needs quotes + * around strings + */ + VUE_APP_LOGO: '"https://skillbox-my-kv-prod.s3-eu-west-1.amazonaws.com/mykv-logo.png"', + VUE_APP_ENABLE_PORTFOLIO: "true", + VUE_APP_ENABLE_SPELLCHECK: !!process.env.TASKBASE_BASEURL, + VUE_APP_JS_TITLE: '"My KV"', + VUE_APP_ENABLE_FOOTER: "false", + /* + * Vars used in HTML templates don't need to be stringyfied, as HTML does not need them to have quotes + */ + // vvvv HTML PROPERTIES FROM HERE, NOT STRINGIFIED vvvv + VUE_APP_FAVICON_32: 'https://skillbox-my-kv-prod.s3-eu-west-1.amazonaws.com/mykv-fav.png', + VUE_APP_FAVICON_16: 'https://skillbox-my-kv-prod.s3-eu-west-1.amazonaws.com/mykv-fav.png', + VUE_APP_TITLE: 'My KV' + // ^^^^ HTML PROPERTIES TO HERE, NOT STRINGIFIED ^^^^ +} diff --git a/client/config/prod.env.js b/client/config/prod.env.js index af7e0a0b..67ac6e36 100644 --- a/client/config/prod.env.js +++ b/client/config/prod.env.js @@ -1,25 +1,37 @@ 'use strict' -module.exports = { +const { merge } = require('webpack-merge') + +const values = { NODE_ENV: '"production"', HEP_URL: JSON.stringify(process.env.HEP_URL), MATOMO_HOST: JSON.stringify(process.env.MATOMO_HOST), MATOMO_SITE_ID: JSON.stringify(process.env.MATOMO_SITE_ID), LOGOUT_REDIRECT_URL: JSON.stringify(process.env.LOGOUT_REDIRECT_URL), /* - * ENV variables used in JS code need to be stringyfied, as they will be replaced in the code, and JS needs quotes - * around strings + * ENV variables used in JS code need to be stringyfied, as they will be replaced (in place) in the code, + * and JS needs quotes around strings + * see https://cli.vuejs.org/guide/mode-and-env.html#using-env-variables-in-client-side-code */ - VUE_APP_LOGO: JSON.stringify(process.env.VUE_APP_LOGO) || '"/static/logo.png"', - VUE_APP_ENABLE_PORTFOLIO: process.env.ENABLE_PORTFOLIO || "true", + VUE_APP_LOGO: '"/static/logo.png"', + VUE_APP_ENABLE_PORTFOLIO: "true", VUE_APP_ENABLE_SPELLCHECK: !!process.env.TASKBASE_BASEURL, - VUE_APP_JS_TITLE: JSON.stringify(process.env.VUE_APP_TITLE) || '"mySkillbox"', - VUE_APP_ENABLE_FOOTER: process.env.ENABLE_FOOTER || "true", + VUE_APP_JS_TITLE: '"mySkillbox"', + VUE_APP_ENABLE_FOOTER: "true", + /* * Vars used in HTML templates don't need to be stringyfied, as HTML does not need them to have quotes */ // vvvv HTML PROPERTIES FROM HERE, NOT STRINGIFIED vvvv - VUE_APP_FAVICON_32: process.env.VUE_APP_FAVICON_32 || '/static/favicon-32x32.png', - VUE_APP_FAVICON_16: process.env.VUE_APP_FAVICON_16 || '/static/favicon-16x16.png', - VUE_APP_TITLE: process.env.VUE_APP_TITLE || 'mySkillbox' + VUE_APP_FAVICON_32: '/static/favicon-32x32.png', + VUE_APP_FAVICON_16: '/static/favicon-16x16.png', + VUE_APP_TITLE: 'mySkillbox' // ^^^^ HTML PROPERTIES TO HERE, NOT STRINGIFIED ^^^^ } + +if (process.env.APP_TYPE === 'my-kv') { + module.exports = merge(values, require('./prod-my-kv.env.js')); +} else { + // we are on the skillbox APP_TYPE + module.exports = values; +} + From 0d8c95013b9e3653eb6ad9176f25226ad21d4467 Mon Sep 17 00:00:00 2001 From: Daniel Egger Date: Tue, 10 May 2022 12:33:47 +0200 Subject: [PATCH 2/5] MS-491: Make visibility of "Lernziele"-title configurable --- client/config/prod-my-kv.env.js | 2 ++ client/config/prod.env.js | 2 ++ client/src/components/modules/Module.vue | 5 ++++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/client/config/prod-my-kv.env.js b/client/config/prod-my-kv.env.js index e5e9a958..ad0831fc 100644 --- a/client/config/prod-my-kv.env.js +++ b/client/config/prod-my-kv.env.js @@ -9,6 +9,8 @@ module.exports = { VUE_APP_ENABLE_SPELLCHECK: !!process.env.TASKBASE_BASEURL, VUE_APP_JS_TITLE: '"My KV"', VUE_APP_ENABLE_FOOTER: "false", + VUE_APP_SHOW_OBJECTIVES_TITLE: "false", + /* * Vars used in HTML templates don't need to be stringyfied, as HTML does not need them to have quotes */ diff --git a/client/config/prod.env.js b/client/config/prod.env.js index 67ac6e36..39d811c2 100644 --- a/client/config/prod.env.js +++ b/client/config/prod.env.js @@ -7,6 +7,7 @@ const values = { MATOMO_HOST: JSON.stringify(process.env.MATOMO_HOST), MATOMO_SITE_ID: JSON.stringify(process.env.MATOMO_SITE_ID), LOGOUT_REDIRECT_URL: JSON.stringify(process.env.LOGOUT_REDIRECT_URL), + VUE_APP_TYPE: JSON.stringify(process.env.APP_TYPE), /* * ENV variables used in JS code need to be stringyfied, as they will be replaced (in place) in the code, * and JS needs quotes around strings @@ -17,6 +18,7 @@ const values = { VUE_APP_ENABLE_SPELLCHECK: !!process.env.TASKBASE_BASEURL, VUE_APP_JS_TITLE: '"mySkillbox"', VUE_APP_ENABLE_FOOTER: "true", + VUE_APP_SHOW_OBJECTIVES_TITLE: "true", /* * Vars used in HTML templates don't need to be stringyfied, as HTML does not need them to have quotes diff --git a/client/src/components/modules/Module.vue b/client/src/components/modules/Module.vue index a4d576e5..b84f57ac 100644 --- a/client/src/components/modules/Module.vue +++ b/client/src/components/modules/Module.vue @@ -40,7 +40,7 @@

- Lernziele + Lernziele

@@ -99,6 +99,9 @@ } return this.module.bookmark.note; }, + showObjectivesTitle() { + return process.env.VUE_APP_SHOW_OBJECTIVES_TITLE; + } }, }; From 77c355d56982b36181f374e88342b0fa1625f9c9 Mon Sep 17 00:00:00 2001 From: Daniel Egger Date: Tue, 10 May 2022 15:03:55 +0200 Subject: [PATCH 3/5] MS-474: Add myKV-specific terms --- client/config/prod-my-kv.env.js | 1 - client/config/prod.env.js | 7 ++- .../components/AssignmentWithSubmissions.vue | 6 ++- client/src/components/BackLink.vue | 14 +++-- client/src/components/ContentBlock.vue | 14 ++--- .../book-navigation/ContentNavigation.vue | 7 +-- .../content-blocks/InstrumentWidget.vue | 7 ++- .../components/modules/SnapshotCreated.vue | 6 ++- .../src/components/modules/SnapshotHeader.vue | 7 +-- .../components/profile/DeactivatePerson.vue | 5 +- .../components/toggle-menu/ToggleEditing.vue | 10 ++-- client/src/mixins/app-flavor-terms.js | 52 +++++++++++++++++++ client/src/mixins/page-title.js | 7 --- client/src/pages/hello.vue | 6 +-- client/src/pages/index.vue | 5 +- client/src/pages/license-activation.vue | 10 ++-- client/src/pages/module/moduleSettings.vue | 5 +- client/src/pages/onboarding/start.vue | 6 +-- client/src/pages/onboarding/step1.vue | 8 +-- client/src/pages/snapshot/snapshots.vue | 5 +- client/src/pages/start.vue | 17 +++--- client/src/pages/topic-page.vue | 6 ++- 22 files changed, 142 insertions(+), 69 deletions(-) create mode 100644 client/src/mixins/app-flavor-terms.js delete mode 100644 client/src/mixins/page-title.js diff --git a/client/config/prod-my-kv.env.js b/client/config/prod-my-kv.env.js index ad0831fc..b6e3d76f 100644 --- a/client/config/prod-my-kv.env.js +++ b/client/config/prod-my-kv.env.js @@ -7,7 +7,6 @@ module.exports = { VUE_APP_LOGO: '"https://skillbox-my-kv-prod.s3-eu-west-1.amazonaws.com/mykv-logo.png"', VUE_APP_ENABLE_PORTFOLIO: "true", VUE_APP_ENABLE_SPELLCHECK: !!process.env.TASKBASE_BASEURL, - VUE_APP_JS_TITLE: '"My KV"', VUE_APP_ENABLE_FOOTER: "false", VUE_APP_SHOW_OBJECTIVES_TITLE: "false", diff --git a/client/config/prod.env.js b/client/config/prod.env.js index 39d811c2..f70b3b7a 100644 --- a/client/config/prod.env.js +++ b/client/config/prod.env.js @@ -7,7 +7,7 @@ const values = { MATOMO_HOST: JSON.stringify(process.env.MATOMO_HOST), MATOMO_SITE_ID: JSON.stringify(process.env.MATOMO_SITE_ID), LOGOUT_REDIRECT_URL: JSON.stringify(process.env.LOGOUT_REDIRECT_URL), - VUE_APP_TYPE: JSON.stringify(process.env.APP_TYPE), + VUE_APP_FLAVOR: JSON.stringify(process.env.APP_FLAVOR), /* * ENV variables used in JS code need to be stringyfied, as they will be replaced (in place) in the code, * and JS needs quotes around strings @@ -16,7 +16,6 @@ const values = { VUE_APP_LOGO: '"/static/logo.png"', VUE_APP_ENABLE_PORTFOLIO: "true", VUE_APP_ENABLE_SPELLCHECK: !!process.env.TASKBASE_BASEURL, - VUE_APP_JS_TITLE: '"mySkillbox"', VUE_APP_ENABLE_FOOTER: "true", VUE_APP_SHOW_OBJECTIVES_TITLE: "true", @@ -30,10 +29,10 @@ const values = { // ^^^^ HTML PROPERTIES TO HERE, NOT STRINGIFIED ^^^^ } -if (process.env.APP_TYPE === 'my-kv') { +if (process.env.APP_FLAVOR === 'my-kv') { module.exports = merge(values, require('./prod-my-kv.env.js')); } else { - // we are on the skillbox APP_TYPE + // we are on the skillbox APP_FLAVOR module.exports = values; } diff --git a/client/src/components/AssignmentWithSubmissions.vue b/client/src/components/AssignmentWithSubmissions.vue index f27a9181..944e0867 100644 --- a/client/src/components/AssignmentWithSubmissions.vue +++ b/client/src/components/AssignmentWithSubmissions.vue @@ -9,7 +9,7 @@ Aufgabe im Modul anzeigen + >Aufgabe im {{ flavorTextModul }} anzeigen
import StudentSubmission from '@/components/StudentSubmission'; + import appFlavorTermsMixin from '@/mixins/app-flavor-terms'; - import {meQuery} from '@/graphql/queries'; + import { meQuery } from '@/graphql/queries'; export default { props: ['assignment'], + mixins: [appFlavorTermsMixin], components: { StudentSubmission diff --git a/client/src/components/BackLink.vue b/client/src/components/BackLink.vue index 377d2c35..0f490e79 100644 --- a/client/src/components/BackLink.vue +++ b/client/src/components/BackLink.vue @@ -9,9 +9,11 @@ diff --git a/client/src/components/modules/SnapshotCreated.vue b/client/src/components/modules/SnapshotCreated.vue index 687db00f..b63eb12f 100644 --- a/client/src/components/modules/SnapshotCreated.vue +++ b/client/src/components/modules/SnapshotCreated.vue @@ -25,7 +25,7 @@ Zurück zum Modul + >Zurück zum {{ flavorTextModul }}
@@ -33,10 +33,12 @@ diff --git a/client/src/helpers/footer.js b/client/src/helpers/footer.js deleted file mode 100644 index b946d62d..00000000 --- a/client/src/helpers/footer.js +++ /dev/null @@ -1,3 +0,0 @@ -const enableFooter = () => process.env.VUE_APP_ENABLE_FOOTER; - -export default enableFooter; diff --git a/client/src/helpers/instrumentType.js b/client/src/helpers/instrumentType.js index 68f2d6d9..474b4cda 100644 --- a/client/src/helpers/instrumentType.js +++ b/client/src/helpers/instrumentType.js @@ -1,13 +1,13 @@ -import {LANGUAGE_COMMUNICATION, SOCIETY} from '@/consts/instrument.consts'; +import { LANGUAGE_COMMUNICATION, SOCIETY } from '@/consts/instrument.consts'; const instrumentType = ({type: {category}}) => { - if (category === LANGUAGE_COMMUNICATION) { - return 'Sprache & Kommunikation'; - } else if (category === SOCIETY) { - return 'Gesellschaft'; - } else { - return 'Überfachliches Instrument'; - } + if (category === LANGUAGE_COMMUNICATION) { + return 'Sprache & Kommunikation'; + } else if (category === SOCIETY) { + return 'Gesellschaft'; + } else { + return 'Überfachliches Instrument'; + } }; export default instrumentType; diff --git a/client/src/layouts/DefaultLayout.vue b/client/src/layouts/DefaultLayout.vue index 2d10ec7c..08020cf0 100644 --- a/client/src/layouts/DefaultLayout.vue +++ b/client/src/layouts/DefaultLayout.vue @@ -26,9 +26,10 @@ import ProfileSidebar from '@/components/profile/ProfileSidebar'; import DefaultFooter from '@/layouts/DefaultFooter'; import NavigationSidebar from '@/components/book-navigation/NavigationSidebar'; - import enableFooter from '@/helpers/footer'; + import appFlavorFlagsMixin from '@/mixins/app-flavor-flags'; export default { + mixins: [appFlavorFlagsMixin], components: { HeaderBar, ProfileSidebar, @@ -56,7 +57,7 @@ return classes; }, enableFooter() { - return enableFooter() && (!this.$route.meta || !this.$route.meta.hideFooter); + return this.flavorShowFooter && (!this.$route.meta || !this.$route.meta.hideFooter); } } }; diff --git a/client/src/layouts/PublicLayout.vue b/client/src/layouts/PublicLayout.vue index 88e9b444..c28b2a4c 100644 --- a/client/src/layouts/PublicLayout.vue +++ b/client/src/layouts/PublicLayout.vue @@ -11,24 +11,22 @@ diff --git a/client/src/layouts/SimpleLayout.vue b/client/src/layouts/SimpleLayout.vue index 8b897e35..28456fb5 100644 --- a/client/src/layouts/SimpleLayout.vue +++ b/client/src/layouts/SimpleLayout.vue @@ -19,10 +19,12 @@ diff --git a/client/src/components/icons/Logo.vue b/client/src/components/icons/Logo.vue index 7c0cbc50..cef4f43e 100644 --- a/client/src/components/icons/Logo.vue +++ b/client/src/components/icons/Logo.vue @@ -10,7 +10,7 @@ export default { computed: { img() { - return process.env.VUE_APP_LOGO; + return this.$flavor.appLogo; } }, }; diff --git a/client/src/components/instruments/InstrumentEntry.vue b/client/src/components/instruments/InstrumentEntry.vue index f971362c..d023142b 100644 --- a/client/src/components/instruments/InstrumentEntry.vue +++ b/client/src/components/instruments/InstrumentEntry.vue @@ -15,7 +15,6 @@