Commit 7e06f55f by kevalbhatt

ATLAS-3894: UI: User is able to add and remove business metadata from deleted entities

parent 8827bfb4
...@@ -23,11 +23,13 @@ ...@@ -23,11 +23,13 @@
<button type="button" title="Collapse"><i class="ec-icon fa"></i></button> <button type="button" title="Collapse"><i class="ec-icon fa"></i></button>
</div> </div>
</div> </div>
{{#ifCond readOnlyEntity "===" false}}
<div class="panel-actions"> <div class="panel-actions">
<button class="btn btn-action btn-sm" data-id="addBusinessMetadata">Add</button> <button class="btn btn-action btn-sm" data-id="addBusinessMetadata">Add</button>
<button class="btn btn-action btn-sm" style="display: none;" data-id="saveBusinessMetadata">Save</button> <button class="btn btn-action btn-sm" style="display: none;" data-id="saveBusinessMetadata">Save</button>
<button class="btn btn-action btn-sm" style="display: none;" data-id="cancel">Cancel</button> <button class="btn btn-action btn-sm" style="display: none;" data-id="cancel">Cancel</button>
</div> </div>
{{/ifCond}}
<div id="businessMetadataCollapse" class="panel-collapse collapse"> <div id="businessMetadataCollapse" class="panel-collapse collapse">
<div class="panel-body"> <div class="panel-body">
<div data-id="businessMetadataTree"></div> <div data-id="businessMetadataTree"></div>
......
...@@ -56,10 +56,12 @@ ...@@ -56,10 +56,12 @@
{{#ifCond swapItem "===" true}} {{#ifCond swapItem "===" true}}
<select class="form-control" data-id="addLabelOptions" multiple="multiple"></select> <select class="form-control" data-id="addLabelOptions" multiple="multiple"></select>
{{else}} {{else}}
{{#ifCond readOnlyEntity "===" false}}
<div class="badge-container"> <div class="badge-container">
No labels have been created yet. To add a labels, click <a href="javascript:void(0)" data-id="addLabels">here</a> No labels have been created yet. To add a labels, click <a href="javascript:void(0)" data-id="addLabels">here</a>
</div> </div>
{{/ifCond}} {{/ifCond}}
{{/ifCond}}
</div> </div>
</div> </div>
</div> </div>
......
...@@ -56,7 +56,9 @@ ...@@ -56,7 +56,9 @@
{{#ifCond swapItem "===" true}} {{#ifCond swapItem "===" true}}
<div id="r_entityUserDefinedItemView"></div> <div id="r_entityUserDefinedItemView"></div>
{{else}} {{else}}
{{#ifCond readOnlyEntity "===" false}}
No properties have been created yet. To add a property, click <a href="javascript:void(0)" data-id="addItem">here</a> No properties have been created yet. To add a property, click <a href="javascript:void(0)" data-id="addItem">here</a>
{{/ifCond}}
</div> </div>
{{/ifCond}} {{/ifCond}}
</div> </div>
......
...@@ -24,10 +24,11 @@ define([ ...@@ -24,10 +24,11 @@ define([
"models/VEntity", "models/VEntity",
"utils/Utils", "utils/Utils",
"utils/Messages", "utils/Messages",
"utils/Enums",
"utils/CommonViewFunction", "utils/CommonViewFunction",
"moment", "moment",
"utils/Globals" "utils/Globals"
], function(require, Backbone, EntityBusinessMetaDataView_tmpl, EntityBusinessMetaDataItemView, VEntity, Utils, Messages, CommonViewFunction, moment, Globals) { ], function(require, Backbone, EntityBusinessMetaDataView_tmpl, EntityBusinessMetaDataItemView, VEntity, Utils, Messages, Enums, CommonViewFunction, moment, Globals) {
"use strict"; "use strict";
return Backbone.Marionette.CompositeView.extend({ return Backbone.Marionette.CompositeView.extend({
...@@ -43,6 +44,11 @@ define([ ...@@ -43,6 +44,11 @@ define([
enumDefCollection: this.enumDefCollection enumDefCollection: this.enumDefCollection
}; };
}, },
templateHelpers: function() {
return {
readOnlyEntity: this.readOnlyEntity
}
},
/** ui selector cache */ /** ui selector cache */
ui: { ui: {
addItem: "[data-id='addItem']", addItem: "[data-id='addItem']",
...@@ -63,6 +69,7 @@ define([ ...@@ -63,6 +69,7 @@ define([
var that = this; var that = this;
_.extend(this, _.pick(options, "entity", "businessMetadataCollection", "enumDefCollection", "guid", "fetchCollection")); _.extend(this, _.pick(options, "entity", "businessMetadataCollection", "enumDefCollection", "guid", "fetchCollection"));
this.editMode = false; this.editMode = false;
this.readOnlyEntity = Enums.entityStateReadOnly[this.entity.status];
this.$("editBox").hide(); this.$("editBox").hide();
this.actualCollection = new Backbone.Collection( this.actualCollection = new Backbone.Collection(
_.map(this.entity.businessAttributes, function(val, key) { _.map(this.entity.businessAttributes, function(val, key) {
...@@ -243,7 +250,7 @@ define([ ...@@ -243,7 +250,7 @@ define([
li += that.associateAttributePanel(obj, attrLi); li += that.associateAttributePanel(obj, attrLi);
}); });
var html = li; var html = li;
if (html === "") { if (html === "" && this.readOnlyEntity === false) {
html = '<div class="col-md-12"> No business metadata have been created yet. To add a business metadata, click <a href="javascript:void(0)" data-id="addBusinessMetadata">here</a></div>'; html = '<div class="col-md-12"> No business metadata have been created yet. To add a business metadata, click <a href="javascript:void(0)" data-id="addBusinessMetadata">here</a></div>';
} }
this.ui.businessMetadataTree.html(html); this.ui.businessMetadataTree.html(html);
......
...@@ -23,11 +23,13 @@ ...@@ -23,11 +23,13 @@
<button type="button" title="Collapse"><i class="ec-icon fa"></i></button> <button type="button" title="Collapse"><i class="ec-icon fa"></i></button>
</div> </div>
</div> </div>
{{#ifCond readOnlyEntity "===" false}}
<div class="panel-actions"> <div class="panel-actions">
<button class="btn btn-action btn-sm" data-id="addBusinessMetadata">Add</button> <button class="btn btn-action btn-sm" data-id="addBusinessMetadata">Add</button>
<button class="btn btn-action btn-sm" style="display: none;" data-id="saveBusinessMetadata">Save</button> <button class="btn btn-action btn-sm" style="display: none;" data-id="saveBusinessMetadata">Save</button>
<button class="btn btn-action btn-sm" style="display: none;" data-id="cancel">Cancel</button> <button class="btn btn-action btn-sm" style="display: none;" data-id="cancel">Cancel</button>
</div> </div>
{{/ifCond}}
<div id="businessMetadataCollapse" class="panel-collapse collapse"> <div id="businessMetadataCollapse" class="panel-collapse collapse">
<div class="panel-body"> <div class="panel-body">
<div data-id="businessMetadataTree"></div> <div data-id="businessMetadataTree"></div>
......
...@@ -56,10 +56,12 @@ ...@@ -56,10 +56,12 @@
{{#ifCond swapItem "===" true}} {{#ifCond swapItem "===" true}}
<select class="form-control" data-id="addLabelOptions" multiple="multiple"></select> <select class="form-control" data-id="addLabelOptions" multiple="multiple"></select>
{{else}} {{else}}
{{#ifCond readOnlyEntity "===" false}}
<div class="badge-container"> <div class="badge-container">
No labels have been created yet. To add a labels, click <a href="javascript:void(0)" data-id="addLabels">here</a> No labels have been created yet. To add a labels, click <a href="javascript:void(0)" data-id="addLabels">here</a>
</div> </div>
{{/ifCond}} {{/ifCond}}
{{/ifCond}}
</div> </div>
</div> </div>
</div> </div>
......
...@@ -56,7 +56,9 @@ ...@@ -56,7 +56,9 @@
{{#ifCond swapItem "===" true}} {{#ifCond swapItem "===" true}}
<div id="r_entityUserDefinedItemView"></div> <div id="r_entityUserDefinedItemView"></div>
{{else}} {{else}}
{{#ifCond readOnlyEntity "===" false}}
No properties have been created yet. To add a property, click <a href="javascript:void(0)" data-id="addItem">here</a> No properties have been created yet. To add a property, click <a href="javascript:void(0)" data-id="addItem">here</a>
{{/ifCond}}
</div> </div>
{{/ifCond}} {{/ifCond}}
</div> </div>
......
...@@ -24,10 +24,11 @@ define([ ...@@ -24,10 +24,11 @@ define([
"models/VEntity", "models/VEntity",
"utils/Utils", "utils/Utils",
"utils/Messages", "utils/Messages",
"utils/Enums",
"utils/CommonViewFunction", "utils/CommonViewFunction",
"moment", "moment",
"utils/Globals" "utils/Globals"
], function(require, Backbone, EntityBusinessMetaDataView_tmpl, EntityBusinessMetaDataItemView, VEntity, Utils, Messages, CommonViewFunction, moment, Globals) { ], function(require, Backbone, EntityBusinessMetaDataView_tmpl, EntityBusinessMetaDataItemView, VEntity, Utils, Messages, Enums, CommonViewFunction, moment, Globals) {
"use strict"; "use strict";
return Backbone.Marionette.CompositeView.extend({ return Backbone.Marionette.CompositeView.extend({
...@@ -43,6 +44,11 @@ define([ ...@@ -43,6 +44,11 @@ define([
enumDefCollection: this.enumDefCollection enumDefCollection: this.enumDefCollection
}; };
}, },
templateHelpers: function() {
return {
readOnlyEntity: this.readOnlyEntity
}
},
/** ui selector cache */ /** ui selector cache */
ui: { ui: {
addItem: "[data-id='addItem']", addItem: "[data-id='addItem']",
...@@ -63,6 +69,7 @@ define([ ...@@ -63,6 +69,7 @@ define([
var that = this; var that = this;
_.extend(this, _.pick(options, "entity", "businessMetadataCollection", "enumDefCollection", "guid", "fetchCollection")); _.extend(this, _.pick(options, "entity", "businessMetadataCollection", "enumDefCollection", "guid", "fetchCollection"));
this.editMode = false; this.editMode = false;
this.readOnlyEntity = Enums.entityStateReadOnly[this.entity.status];
this.$("editBox").hide(); this.$("editBox").hide();
this.actualCollection = new Backbone.Collection( this.actualCollection = new Backbone.Collection(
_.map(this.entity.businessAttributes, function(val, key) { _.map(this.entity.businessAttributes, function(val, key) {
...@@ -243,7 +250,7 @@ define([ ...@@ -243,7 +250,7 @@ define([
li += that.associateAttributePanel(obj, attrLi); li += that.associateAttributePanel(obj, attrLi);
}); });
var html = li; var html = li;
if (html === "") { if (html === "" && this.readOnlyEntity === false) {
html = '<div class="col-md-12"> No business metadata have been created yet. To add a business metadata, click <a href="javascript:void(0)" data-id="addBusinessMetadata">here</a></div>'; html = '<div class="col-md-12"> No business metadata have been created yet. To add a business metadata, click <a href="javascript:void(0)" data-id="addBusinessMetadata">here</a></div>';
} }
this.ui.businessMetadataTree.html(html); this.ui.businessMetadataTree.html(html);
......
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