You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2015/02/06 13:48:16 UTC
[04/11] incubator-brooklyn git commit: fix JS bug where $row might
not exist when applying CSS style
fix JS bug where $row might not exist when applying CSS style
Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/afd6e847
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/afd6e847
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/afd6e847
Branch: refs/heads/master
Commit: afd6e8479d9564daf10aa251a662eff689c247d3
Parents: 851f91a
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Mon Feb 2 12:37:26 2015 +0000
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Mon Feb 2 14:44:02 2015 +0000
----------------------------------------------------------------------
usage/jsgui/src/main/webapp/assets/css/base.css | 6 +++---
.../src/main/webapp/assets/js/view/entity-config.js | 13 ++++++++-----
.../src/main/webapp/assets/js/view/entity-sensors.js | 13 ++++++++-----
3 files changed, 19 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/afd6e847/usage/jsgui/src/main/webapp/assets/css/base.css
----------------------------------------------------------------------
diff --git a/usage/jsgui/src/main/webapp/assets/css/base.css b/usage/jsgui/src/main/webapp/assets/css/base.css
index 5d4fda2..20938b5 100644
--- a/usage/jsgui/src/main/webapp/assets/css/base.css
+++ b/usage/jsgui/src/main/webapp/assets/css/base.css
@@ -1455,13 +1455,13 @@ textarea.param-value {
}
/* For secret things */
-tr.secret-info span.value {
+.secret-info span.value {
display: none;
}
-tr.secret-info.secret-revealed span.value {
+.secret-info.secret-revealed span.value {
display: inherit;
}
-tr.secret-info.secret-revealed span.secret-indicator {
+.secret-info.secret-revealed span.secret-indicator {
display: none;
}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/afd6e847/usage/jsgui/src/main/webapp/assets/js/view/entity-config.js
----------------------------------------------------------------------
diff --git a/usage/jsgui/src/main/webapp/assets/js/view/entity-config.js b/usage/jsgui/src/main/webapp/assets/js/view/entity-config.js
index b53b40a..924339d 100644
--- a/usage/jsgui/src/main/webapp/assets/js/view/entity-config.js
+++ b/usage/jsgui/src/main/webapp/assets/js/view/entity-config.js
@@ -45,7 +45,7 @@ define([
'click .refresh':'updateConfigNow',
'click .filterEmpty':'toggleFilterEmpty',
'click .toggleAutoRefresh':'toggleAutoRefresh',
- 'click #config-table tr.secret-info td.config-value':'toggleSecrecyVisibility',
+ 'click #config-table div.secret-info':'toggleSecrecyVisibility',
'mouseup .valueOpen':'valueOpen',
'mouseover #config-table tbody tr':'noteFloatMenuActive',
@@ -97,6 +97,7 @@ define([
configName = row[0],
actions = that.getConfigActions(configName);
+ // NB: the row might not yet exist
var $row = $('tr[id="'+configName+'"]');
// datatables doesn't seem to expose any way to modify the html in place for a cell,
@@ -104,8 +105,8 @@ define([
var result = "<span class='value'>"+(hasEscapedValue ? escapedValue : '')+"</span>";
- if (Util.isSecret(configName)) {
- $row.addClass("secret-info");
+ var isSecret = Util.isSecret(configName);
+ if (isSecret) {
result += "<span class='secret-indicator'>(hidden)</span>";
}
@@ -159,7 +160,9 @@ define([
"<div class='floatLeft'><span class='icon-chevron-down hasFloatDown'></span>" +
downMenu +
"</div>";
- result = "<div class='floatGroup'>" + result + "</div>";
+ result = "<div class='floatGroup"+
+ (isSecret ? " secret-info" : "")+
+ "'>" + result + "</div>";
// also see updateFloatMenus which wires up the JS for these classes
return result;
@@ -437,7 +440,7 @@ define([
},
toggleSecrecyVisibility: function(event) {
- $(event.target).closest('tr.secret-info').toggleClass('secret-revealed');
+ $(event.target).closest('.secret-info').toggleClass('secret-revealed');
},
/**
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/afd6e847/usage/jsgui/src/main/webapp/assets/js/view/entity-sensors.js
----------------------------------------------------------------------
diff --git a/usage/jsgui/src/main/webapp/assets/js/view/entity-sensors.js b/usage/jsgui/src/main/webapp/assets/js/view/entity-sensors.js
index f4369b0..cf84508 100644
--- a/usage/jsgui/src/main/webapp/assets/js/view/entity-sensors.js
+++ b/usage/jsgui/src/main/webapp/assets/js/view/entity-sensors.js
@@ -48,7 +48,7 @@ define([
'click .refresh': 'updateSensorsNow',
'click .filterEmpty':'toggleFilterEmpty',
'click .toggleAutoRefresh':'toggleAutoRefresh',
- 'click #sensors-table tr.secret-info td.sensor-value':'toggleSecrecyVisibility',
+ 'click #sensors-table div.secret-info':'toggleSecrecyVisibility',
'mouseup .valueOpen':'valueOpen',
'mouseover #sensors-table tbody tr':'noteFloatMenuActive',
@@ -105,6 +105,7 @@ define([
sensorName = row[0],
actions = that.getSensorActions(sensorName);
+ // NB: the row might not yet exist
var $row = $('tr[id="'+sensorName+'"]');
// datatables doesn't seem to expose any way to modify the html in place for a cell,
@@ -112,8 +113,8 @@ define([
var result = "<span class='value'>"+(hasEscapedValue ? escapedValue : '')+"</span>";
- if (Util.isSecret(sensorName)) {
- $row.addClass("secret-info");
+ var isSecret = Util.isSecret(sensorName);
+ if (isSecret) {
result += "<span class='secret-indicator'>(hidden)</span>";
}
@@ -167,7 +168,9 @@ define([
"<div class='floatLeft'><span class='icon-chevron-down hasFloatDown'></span>" +
downMenu +
"</div>";
- result = "<div class='floatGroup'>" + result + "</div>";
+ result = "<div class='floatGroup"+
+ (isSecret ? " secret-info" : "")+
+ "'>" + result + "</div>";
// also see updateFloatMenus which wires up the JS for these classes
return result;
@@ -456,7 +459,7 @@ define([
},
toggleSecrecyVisibility: function(event) {
- $(event.target).closest('tr.secret-info').toggleClass('secret-revealed');
+ $(event.target).closest('.secret-info').toggleClass('secret-revealed');
},
/**