The user log activity lists all the actions done on Wok and its plugins.
To better represent the action for a given plugin, the plugin color is
display in addition to the plugin name.
As plugin color is now specified on tab-ext.xml, store the value per
plugin to be used on user log UI.
This patch also removes CSS configuration used to set the plugin color.
Signed-off-by: Aline Manera <alinefm(a)linux.vnet.ibm.com>
---
ui/css/settings.css | 32 --------------------------------
ui/css/src/settings.scss | 16 ----------------
ui/js/src/wok.main.js | 12 +++++++-----
ui/js/wok.bootgrid.js | 2 +-
4 files changed, 8 insertions(+), 54 deletions(-)
diff --git a/ui/css/settings.css b/ui/css/settings.css
index 8c0b8cb..641b805 100644
--- a/ui/css/settings.css
+++ b/ui/css/settings.css
@@ -117,38 +117,6 @@ div#user-log-actions {
vertical-align: middle;
}
-.label-primary.label-wok {
- background-color: #d9182d;
-}
-
-.label-primary.label-wok[href]:hover, .label-primary.label-wok[href]:focus {
- background-color: #ab1323;
-}
-
-.label-primary.label-kimchi {
- background-color: #8cc63f;
-}
-
-.label-primary.label-kimchi[href]:hover, .label-primary.label-kimchi[href]:focus {
- background-color: #71a230;
-}
-
-.label-primary.label-ginger {
- background-color: #00578c;
-}
-
-.label-primary.label-ginger[href]:hover, .label-primary.label-ginger[href]:focus {
- background-color: #003759;
-}
-
-.label-primary.label-gingerbase {
- background-color: #008abf;
-}
-
-.label-primary.label-gingerbase[href]:hover, .label-primary.label-gingerbase[href]:focus
{
- background-color: #00658c;
-}
-
.bootgrid-table th > .column-header-anchor > .icon.fa {
right: 6px;
top: 4px;
diff --git a/ui/css/src/settings.scss b/ui/css/src/settings.scss
index 7a40a76..19abf9d 100644
--- a/ui/css/src/settings.scss
+++ b/ui/css/src/settings.scss
@@ -71,22 +71,6 @@ div#user-log-actions {
vertical-align: middle;
}
-.label-primary.label-wok {
- @include label-variant(map-get($colors, wok));
-}
-
-.label-primary.label-kimchi {
- @include label-variant(map-get($colors, virtualizationSelected));
-}
-
-.label-primary.label-ginger {
- @include label-variant(map-get($colors, hostTab));
-}
-
-.label-primary.label-gingerbase {
- @include label-variant(map-get($colors, hostSelected));
-}
-
.bootgrid-table th>.column-header-anchor>.icon.fa {
right: 6px;
top: 4px;
diff --git a/ui/js/src/wok.main.js b/ui/js/src/wok.main.js
index 90f3b1b..4b36400 100644
--- a/ui/js/src/wok.main.js
+++ b/ui/js/src/wok.main.js
@@ -20,6 +20,7 @@
wok.NOTIFICATION_INTERVAL = 2000
wok.tabMode = {};
+wok.pluginsColor = {};
wok.config = undefined;
wok.getConfig(function(result) {
@@ -81,7 +82,7 @@ wok.main = function() {
return functionalTabHtml.join('');
};
- var parseTabs = function(xmlData) {
+ var parseTabs = function(plugin, xmlData) {
var tabs = [];
var funcNode = $(xmlData).find('functionality');
var functionality = funcNode.text();
@@ -117,13 +118,14 @@ wok.main = function() {
return tabs;
};
- var retrieveTabs = function(url) {
+ var retrieveTabs = function(plugin, url) {
var tabs = [];
$.ajax({
url : url,
async : false,
+ context: plugin,
success : function(xmlData) {
- tabs = parseTabs(xmlData);
+ tabs = parseTabs(this, xmlData);
},
statusCode : {
404: function() {
@@ -139,7 +141,7 @@ wok.main = function() {
var pluginI18nUrl = 'plugins/{plugin}/i18n.json';
var DEFAULT_HASH;
var buildTabs = function(callback) {
- var tabs = retrieveTabs(wokConfigUrl);
+ var tabs = retrieveTabs('wok', wokConfigUrl);
wok.listPlugins(function(plugins) {
$(plugins).each(function(i, p) {
var url = wok.substitute(pluginConfigUrl, {
@@ -151,7 +153,7 @@ wok.main = function() {
wok.getI18n(function(i18nObj){ $.extend(i18n, i18nObj)},
function(i18nObj){ //i18n is not define by plugin
}, i18nUrl, true);
- var pluginTabs = retrieveTabs(url);
+ var pluginTabs = retrieveTabs(p, url);
if(pluginTabs.length > 0){
tabs.push.apply(tabs, pluginTabs);
}
diff --git a/ui/js/wok.bootgrid.js b/ui/js/wok.bootgrid.js
index 7d634bb..ec3afd6 100644
--- a/ui/js/wok.bootgrid.js
+++ b/ui/js/wok.bootgrid.js
@@ -69,7 +69,7 @@ wok.createBootgrid = function(opts) {
rowSelect: false,
formatters: {
"settings-user-log-app": function(column, row) {
- return '<span class="label label-primary
label-'+row.app+'">' +row.app+ '</span> ';
+ return '<span class="label label-primary"
style="background-color:' + wok.pluginsColor[row.app] + '">' +
row.app + '</span> ';
},
"settings-user-log-message": function(column, row) {
return '<span class="trim" data-toggle="tooltip"
data-placement="auto bottom" title="'+row.message+'">'
+row.message+ '</span> ';
--
2.7.4