diff --git a/ansible/roles/superhero-dashboard/templates/configmap.yml.j2 b/ansible/roles/superhero-dashboard/templates/configmap.yml.j2 index 1634186..76d5f43 100644 --- a/ansible/roles/superhero-dashboard/templates/configmap.yml.j2 +++ b/ansible/roles/superhero-dashboard/templates/configmap.yml.j2 @@ -15,3 +15,4 @@ data: FEATURE_SCHOOL_SANIS_USER_MIGRATION_ENABLED: "{{ FEATURE_SCHOOL_SANIS_USER_MIGRATION_ENABLED|default(false, true) }}" FEATURE_SHOW_OUTDATED_USERS: "{{ FEATURE_SHOW_OUTDATED_USERS|default(false, true) }}" FEATURE_ENABLE_LDAP_SYNC_DURING_MIGRATION: "{{ FEATURE_ENABLE_LDAP_SYNC_DURING_MIGRATION|default(false, true) }}" + FEATURE_MEDIA_SHELF_ENABLED: "{{ FEATURE_MEDIA_SHELF_ENABLED|default(false, true) }}" diff --git a/controllers/ctltools.js b/controllers/ctltools.js index 5fb1725..7e6db04 100644 --- a/controllers/ctltools.js +++ b/controllers/ctltools.js @@ -7,8 +7,11 @@ const router = express.Router(); const authHelper = require('../helpers/authentication'); const { api } = require('../api'); const moment = require('moment'); +const {isFeatureFlagTrue} = require("../helpers/featureFlagHelper"); moment.locale('de'); +const MEDIA_SHELF_ENABLED = isFeatureFlagTrue(process.env.FEATURE_MEDIA_SHELF_ENABLED) + const clearEmptyInputs = (object) => { Object.keys(object).forEach((key) => { const type = typeof object[key]; @@ -94,8 +97,14 @@ const getDetailHandler = (req, res, next) => { toolData.config.redirectUris = toolData.config.redirectUris.join(';'); } + const showMediaShelfCount = !MEDIA_SHELF_ENABLED && toolMetaData.contextExternalToolCountPerContext.mediaBoard === 0; + if (showMediaShelfCount) { + delete toolMetaData.contextExternalToolCountPerContext.mediaBoard; + } + convertZerosToString(toolMetaData); res.json({...toolData, ...toolMetaData}); + }).catch(err => { next(err); }); diff --git a/static/scripts/ctltools.js b/static/scripts/ctltools.js index a98ad9b..800e3da 100644 --- a/static/scripts/ctltools.js +++ b/static/scripts/ctltools.js @@ -62,6 +62,12 @@ $(document).ready(function () { e.preventDefault(); var entry = $(this).parent().attr('action'); $.getJSON(entry, function (result) { + if (!result.contextExternalToolCountPerContext.mediaBoard) { + $('#media-board-label').hide(); + } else { + $('#media-board-label').show(); + } + populateModalForm($deleteModal, { action: entry, title: 'Tool wirklich löschen?', diff --git a/views/ctltools/forms/delete-form.hbs b/views/ctltools/forms/delete-form.hbs index d58277a..761b002 100644 --- a/views/ctltools/forms/delete-form.hbs +++ b/views/ctltools/forms/delete-form.hbs @@ -25,6 +25,11 @@ Spalten-Board(s) +
+