Commit 24c9556c by gutkaBinit Committed by kevalbhatt

ATLAS-3146 UI : Toggle N/A values in relationship and property tables.

Signed-off-by: 's avatarkevalbhatt <kbhatt@apache.org>
parent 5389b9bd
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
height: 100%; height: 100%;
width: 100%; width: 100%;
overflow: hidden; overflow: hidden;
z-index: 1;
.relatioship-link { .relatioship-link {
fill: none; fill: none;
......
...@@ -42,3 +42,29 @@ tr.empty { ...@@ -42,3 +42,29 @@ tr.empty {
position: absolute; position: absolute;
right: 0px; right: 0px;
} }
.entity-detail-table,
.relationship-detail-table {
position: relative;
.hide-empty-value {
.hide-row {
display: none;
}
}
.entity-relationship-table-toggle,
.entity-detail-table-toggle {
position: absolute;
right: 0;
top: 18px;
}
table {
th:nth-child(1),
td:nth-child(1) {
width: 20%;
}
}
}
\ No newline at end of file
...@@ -14,13 +14,23 @@ ...@@ -14,13 +14,23 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
--> -->
<table class="table table-quickMenu"> <div class="entity-detail-table">
<div class="entity-detail-table-toggle">
<div class="pretty p-switch p-fill">
<input type="checkbox" data-id="noValueToggle" />
<div class="state p-primary">
<label>Show Empty Values</label>
</div>
</div>
</div>
<table class="table table-quickMenu">
<thead> <thead>
<tr> <tr>
<th>Key</th> <th>Key</th>
<th>Value</th> <th>Value</th>
</tr> </tr>
</thead> </thead>
<tbody data-id="detailValue"> <tbody data-id="detailValue" class="hide-empty-value">
</tbody> </tbody>
</table> </table>
</div>
\ No newline at end of file
...@@ -46,7 +46,15 @@ ...@@ -46,7 +46,15 @@
</div> </div>
</div> </div>
</div> </div>
<div> <div class="relationship-detail-table">
<div class="entity-relationship-table-toggle">
<div class="pretty p-switch p-fill">
<input type="checkbox" data-id="noValueToggle" />
<div class="state p-primary">
<label>Show Empty Values</label>
</div>
</div>
</div>
<table class="table table-quickMenu" data-id="relationshipDetailTable"> <table class="table table-quickMenu" data-id="relationshipDetailTable">
<thead> <thead>
<tr> <tr>
......
...@@ -254,7 +254,9 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum ...@@ -254,7 +254,9 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
val = _.escape(keyValue); val = _.escape(keyValue);
} }
if (isTable) { if (isTable) {
var htmlTag = '<div class="scroll-y">' + getValue(val) + '</div>'; var value = getValue(val),
appendClass = (value == "N/A" ? "hide-row" : ""),
htmlTag = '<div class="scroll-y">' + value + '</div>';
if (_.isObject(valueObject[key]) && !_.isEmpty(valueObject[key])) { if (_.isObject(valueObject[key]) && !_.isEmpty(valueObject[key])) {
var matchedLinkString = val.match(/href|value-loader\w*/g), var matchedLinkString = val.match(/href|value-loader\w*/g),
matchedJson = val.match(/json-value|json-string\w*/g), matchedJson = val.match(/json-value|json-string\w*/g),
...@@ -266,7 +268,7 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum ...@@ -266,7 +268,7 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
htmlTag = '<pre class="shrink code-block ' + (isMatchJSONStringIsSingle ? 'fixed-height' : '') + '">' + expandCollapseButton + '<code>' + val + '</code></pre>'; htmlTag = '<pre class="shrink code-block ' + (isMatchJSONStringIsSingle ? 'fixed-height' : '') + '">' + expandCollapseButton + '<code>' + val + '</code></pre>';
} }
} }
table += '<tr><td>' + (_.escape(key) + listCount) + '</td><td>' + htmlTag + '</td></tr>'; table += '<tr class="' + appendClass + '"><td>' + (_.escape(key) + listCount) + '</td><td>' + htmlTag + '</td></tr>';
} else { } else {
table += '<div>' + val + '</div>'; table += '<div>' + val + '</div>';
} }
......
...@@ -828,5 +828,15 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums', ...@@ -828,5 +828,15 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums',
return hours + ":" + minutes + ":" + seconds + "." + milliseconds; return hours + ":" + minutes + ":" + seconds + "." + milliseconds;
} }
Utils.togglePropertyRelationshipTableEmptyValues = function(object) {
var inputSelector = object.inputType,
tableEl = object.tableEl;
if (inputSelector.prop('checked') == true) {
tableEl.removeClass('hide-empty-value');
} else {
tableEl.addClass('hide-empty-value');
}
}
return Utils; return Utils;
}); });
\ No newline at end of file
...@@ -20,8 +20,9 @@ define(['require', ...@@ -20,8 +20,9 @@ define(['require',
'backbone', 'backbone',
'hbs!tmpl/entity/EntityDetailTableLayoutView_tmpl', 'hbs!tmpl/entity/EntityDetailTableLayoutView_tmpl',
'utils/CommonViewFunction', 'utils/CommonViewFunction',
'models/VEntity' 'models/VEntity',
], function(require, Backbone, EntityDetailTableLayoutView_tmpl, CommonViewFunction, VEntity) { 'utils/Utils'
], function(require, Backbone, EntityDetailTableLayoutView_tmpl, CommonViewFunction, VEntity, Utils) {
'use strict'; 'use strict';
var EntityDetailTableLayoutView = Backbone.Marionette.LayoutView.extend( var EntityDetailTableLayoutView = Backbone.Marionette.LayoutView.extend(
...@@ -37,10 +38,17 @@ define(['require', ...@@ -37,10 +38,17 @@ define(['require',
/** ui selector cache */ /** ui selector cache */
ui: { ui: {
detailValue: "[data-id='detailValue']", detailValue: "[data-id='detailValue']",
noValueToggle: "[data-id='noValueToggle']"
}, },
/** ui events hash */ /** ui events hash */
events: function() { events: function() {
var events = {}; var events = {};
events["click " + this.ui.noValueToggle] = function() {
Utils.togglePropertyRelationshipTableEmptyValues({
"inputType": this.ui.noValueToggle,
"tableEl": this.ui.detailValue
});
};
return events; return events;
}, },
/** /**
...@@ -58,6 +66,10 @@ define(['require', ...@@ -58,6 +66,10 @@ define(['require',
entityTableGenerate: function() { entityTableGenerate: function() {
var table = CommonViewFunction.propertyTable({ scope: this, valueObject: this.entity.attributes, attributeDefs: this.attributeDefs }); var table = CommonViewFunction.propertyTable({ scope: this, valueObject: this.entity.attributes, attributeDefs: this.attributeDefs });
this.ui.detailValue.append(table); this.ui.detailValue.append(table);
Utils.togglePropertyRelationshipTableEmptyValues({
"inputType": this.ui.noValueToggle,
"tableEl": this.ui.detailValue
});
} }
}); });
return EntityDetailTableLayoutView; return EntityDetailTableLayoutView;
......
...@@ -49,7 +49,8 @@ define(['require', ...@@ -49,7 +49,8 @@ define(['require',
relationshipSVG: "[data-id='relationshipSVG']", relationshipSVG: "[data-id='relationshipSVG']",
relationshipDetailValue: "[data-id='relationshipDetailValue']", relationshipDetailValue: "[data-id='relationshipDetailValue']",
zoomControl: "[data-id='zoomControl']", zoomControl: "[data-id='zoomControl']",
boxClose: '[data-id="box-close"]' boxClose: '[data-id="box-close"]',
noValueToggle: "[data-id='noValueToggle']"
}, },
/** ui events hash */ /** ui events hash */
...@@ -63,6 +64,12 @@ define(['require', ...@@ -63,6 +64,12 @@ define(['require',
events["change " + this.ui.relationshipViewToggle] = function(e) { events["change " + this.ui.relationshipViewToggle] = function(e) {
this.relationshipViewToggle(e.currentTarget.checked) this.relationshipViewToggle(e.currentTarget.checked)
}; };
events["click " + this.ui.noValueToggle] = function(e) {
Utils.togglePropertyRelationshipTableEmptyValues({
"inputType": this.ui.noValueToggle,
"tableEl": this.ui.relationshipDetailValue
});
};
return events; return events;
}, },
...@@ -463,6 +470,10 @@ define(['require', ...@@ -463,6 +470,10 @@ define(['require',
this.entityModel = new VEntity({}); this.entityModel = new VEntity({});
var table = CommonViewFunction.propertyTable({ scope: this, valueObject: this.entity.relationshipAttributes, attributeDefs: this.attributeDefs }); var table = CommonViewFunction.propertyTable({ scope: this, valueObject: this.entity.relationshipAttributes, attributeDefs: this.attributeDefs });
this.ui.relationshipDetailValue.html(table); this.ui.relationshipDetailValue.html(table);
Utils.togglePropertyRelationshipTableEmptyValues({
"inputType": this.ui.noValueToggle,
"tableEl": this.ui.relationshipDetailValue
});
}, },
relationshipViewToggle: function(checked) { relationshipViewToggle: function(checked) {
this.ui.relationshipDetailTable.toggleClass('visible invisible'); this.ui.relationshipDetailTable.toggleClass('visible invisible');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment