From e9b114120322f79ca9029a5120b85934b74eb3a0 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 18 Nov 2020 10:02:37 +0100 Subject: [sysconfig] Show '?' for unused modules Quick and dirty client-side hack; needs refactoring anyways once we have per-location module assignment. --- modules-available/sysconfig/clientscript.js | 19 +++++++++++-------- .../sysconfig/lang/de/template-tags.json | 2 ++ .../sysconfig/lang/en/template-tags.json | 2 ++ .../sysconfig/templates/list-legend.html | 4 ++++ .../sysconfig/templates/list-modules.html | 5 ++++- 5 files changed, 23 insertions(+), 9 deletions(-) diff --git a/modules-available/sysconfig/clientscript.js b/modules-available/sysconfig/clientscript.js index a9b85251..9dbb0745 100644 --- a/modules-available/sysconfig/clientscript.js +++ b/modules-available/sysconfig/clientscript.js @@ -3,7 +3,7 @@ (function() { var boldItem = false; - var revList = false; + var modToConf = false; var $ct = $('#conftable').find('.confrow .title'); $ct.click(function () { @@ -23,9 +23,8 @@ }); var $confirm = $('#delete-item-list'); $('.btn-del-module').click(function() { - if (!revList) buildRevList(); var mid = $(this).val() + ''; - var list = revList[mid]; + var list = modToConf[mid]; if (!list || !list.length) { $confirm.append($msgs).addClass('hidden'); return; @@ -42,6 +41,11 @@ $confirm.addClass('hidden'); }); + buildRevList(); + var mods = []; + $('#modtable .modrow').each(function() { mods.push($(this).data('id')) }); + mods.forEach(function(e) { if (modToConf[e] === undefined) $('.modrow[data-id=' + e + '] .icon-unused').removeClass('hidden') }); + function showpre(e, action) { if (boldItem && action !== 'bold') return 'reset'; if (boldItem) { @@ -54,14 +58,14 @@ } function buildRevList() { - revList = {}; + modToConf = {}; $ct.each(function () { var elem = $(this).parent(); var cid = elem.data('id') + ''; var list = (elem.data('modlist') + '').split(','); for (var i = 0; i < list.length; ++i) { - if (!revList[list[i]]) revList[list[i]] = []; - revList[list[i]].push(cid); + if (!modToConf[list[i]]) modToConf[list[i]] = []; + modToConf[list[i]].push(cid); } }); } @@ -70,9 +74,8 @@ action = showpre(e, action); if (action === 'reset') return; var $e = $(e); - if (!revList) buildRevList(); var mid = $e.parent().data('id') + ''; - var list = revList[mid]; + var list = modToConf[mid]; if (list && list.length > 0) $ct.each(function () { var elem = $(this); var cid = elem.parent().data('id') + ''; diff --git a/modules-available/sysconfig/lang/de/template-tags.json b/modules-available/sysconfig/lang/de/template-tags.json index 9637314e..b8452ed0 100644 --- a/modules-available/sysconfig/lang/de/template-tags.json +++ b/modules-available/sysconfig/lang/de/template-tags.json @@ -80,6 +80,8 @@ "lang_moduleConfiguration": "Konfigurationsmodule", "lang_moduleName": "Modulname", "lang_moduleTitle": "Titel", + "lang_moduleUnused": "Ungenutzt", + "lang_moduleUnusedLong": "Dieses Modul ist mit keiner Systemkonfiguration verkn\u00fcpft.", "lang_mountOptionsNote": "Diese Einstellungen beziehen sich nur auf Linux und \u00e4hnliche Systeme (sowohl das MiniLinux als auch laufende VMs) und beeinflussen die Optionen, die beim Mounten des Verzeichnisses verwendet werden sollen. Sofern es im LDAP\/AD ein Nutzerattribut gibt, welches die passenden Optionen enth\u00e4lt, k\u00f6nnen Sie dieses hier angeben. Das Attribut wird dann vorrangig behandelt. Ist das Attribut leer oder nicht vorhanden, werden die Optionen verwendet, die Sie im Feld \"feste Mount-Optionen\" eingetragen haben. Sind beide Felder leer, werden verschiedene Optionen automatisch durchprobiert.", "lang_name": "Name", "lang_newConfiguration": "Neue Konfiguration", diff --git a/modules-available/sysconfig/lang/en/template-tags.json b/modules-available/sysconfig/lang/en/template-tags.json index 89f6886b..a9da2086 100644 --- a/modules-available/sysconfig/lang/en/template-tags.json +++ b/modules-available/sysconfig/lang/en/template-tags.json @@ -80,6 +80,8 @@ "lang_moduleConfiguration": "Module Configuration", "lang_moduleName": "Module Name", "lang_moduleTitle": "Title", + "lang_moduleUnused": "Unused", + "lang_moduleUnusedLong": "This module is not attached to any system configuration.", "lang_mountOptionsNote": "These settings are relevant for the MiniLinux and VMs containing non-Windows OSes. If you specify an LDAP user attribute, its contents will be used as mount options when mounting the user's home directory. If the attribute is not specified or its contents are empty, the mount attributes specified in the other field will be used. If you leave both fields empty, the clients will try to determine the options automatically.", "lang_name": "Name", "lang_newConfiguration": "New Configuration", diff --git a/modules-available/sysconfig/templates/list-legend.html b/modules-available/sysconfig/templates/list-legend.html index 809a0449..49974a5f 100644 --- a/modules-available/sysconfig/templates/list-legend.html +++ b/modules-available/sysconfig/templates/list-legend.html @@ -25,6 +25,10 @@ {{lang_deleteLong}}

+

+ + {{lang_moduleUnusedLong}} +

{{#showLocationBadge}}

+4 diff --git a/modules-available/sysconfig/templates/list-modules.html b/modules-available/sysconfig/templates/list-modules.html index 9284bb24..5bd19446 100644 --- a/modules-available/sysconfig/templates/list-modules.html +++ b/modules-available/sysconfig/templates/list-modules.html @@ -13,7 +13,10 @@ {{moduleType}} -
{{title}}
+
+ + {{title}} +
{{#allowDownload}} -- cgit v1.2.3-55-g7522