Commit 064c5767 by kevalbhatt Committed by Sarath Subramanian

UI : Provide option whether to delete propagated classification on entity delete…

UI : Provide option whether to delete propagated classification on entity delete during add classification Signed-off-by: 's avatarSarath Subramanian <ssubramanian@hortonworks.com>
parent 5b9348f9
...@@ -184,3 +184,8 @@ table.attriTable { ...@@ -184,3 +184,8 @@ table.attriTable {
width: 50%; width: 50%;
} }
} }
.addtag-propagte-box {
border: 1px solid #ddd;
border-radius: 7px;
}
\ No newline at end of file
...@@ -299,6 +299,10 @@ hr[size="10"] { ...@@ -299,6 +299,10 @@ hr[size="10"] {
margin-right: 0px !important; margin-right: 0px !important;
} }
.no-border {
border: none !important;
}
.position-relative { .position-relative {
position: relative; position: relative;
} }
......
...@@ -17,20 +17,26 @@ ...@@ -17,20 +17,26 @@
<div> <div>
<div class="form-group hide"> <div class="form-group hide">
<div class="row modalHeight"> <div class="row modalHeight">
<div class="col-md-7"> <div class="form-group col-md-12">
{{#if tagModel}} {{#if tagModel}}
<h4>{{tagModel.typeName}}</h4> </div>{{else}} <h4>{{tagModel.typeName}}</h4> </div>{{else}}
<select class="form-control row-margin-bottom" data-id="addTagOptions" required> <select class="form-control row-margin-bottom" data-id="addTagOptions" required>
</select> </select>
</div> </div>
{{/if}} {{/if}}
<div class="col-md-2"> <div class="col-md-6">
<div class="col-md-12 addtag-propagte-box">
<div class="inline"> <div class="inline">
<label class="checkbox-inline btn"> <label class="checkbox-inline btn">
<input type="checkbox" data-id="checkModalTagProperty" class="input" checked /> Propagate</label> <input type="checkbox" data-id="checkModalTagProperty" class="input" checked /> Propagate</label>
</div> </div>
<div class="inline" data-id="removePropagationOnEntityDeleteBox">
<label class="checkbox-inline btn">
<input type="checkbox" data-id="removePropagationOnEntityDelete" class="input" title="Propagated classification are removed during entity delete"/> Remove propagation on entity delete</label>
</div>
</div> </div>
<div class="col-md-3"> </div>
<div class="col-md-6">
<div class="inline"> <div class="inline">
<label class="checkbox-inline btn"> <label class="checkbox-inline btn">
<input type="checkbox" data-id="checkTimezoneProperty" class="input" /> Apply Validity Period</label> <input type="checkbox" data-id="checkTimezoneProperty" class="input" /> Apply Validity Period</label>
...@@ -49,8 +55,8 @@ ...@@ -49,8 +55,8 @@
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="row modalHeight"> <div class="row modalHeight">
<div class="col-sm-12"> <div class="col-sm-12">
<div class="attrLoader" style="margin-left:45%;display:none"> <div class="attrLoader" style="margin-left:45%;display:none">
<i class="fa fa-refresh fa-spin-custom"></i> <i class="fa fa-refresh fa-spin-custom"></i>
...@@ -61,5 +67,5 @@ ...@@ -61,5 +67,5 @@
<p class="text-gray">Add attribute values for this classification</p> <p class="text-gray">Add attribute values for this classification</p>
<div data-id="tagAttribute"></div> <div data-id="tagAttribute"></div>
</div> </div>
</div> </div>
</div> </div>
\ No newline at end of file
...@@ -57,14 +57,34 @@ define(['require', ...@@ -57,14 +57,34 @@ define(['require',
timeZoneDiv: "[data-id='timeZoneDiv']", timeZoneDiv: "[data-id='timeZoneDiv']",
checkTagModalPropagate: "[data-id='checkModalTagProperty']", checkTagModalPropagate: "[data-id='checkModalTagProperty']",
addTimezoneParms: "[data-id='addTimezoneParms']", addTimezoneParms: "[data-id='addTimezoneParms']",
validityPeriodBody: "[data-id='validityPeriodBody']" validityPeriodBody: "[data-id='validityPeriodBody']",
removePropagationOnEntityDelete: "[data-id='removePropagationOnEntityDelete']",
removePropagationOnEntityDeleteBox: "[data-id='removePropagationOnEntityDeleteBox']"
}, },
events: function() { events: function() {
var events = {}; var events = {},
that = this;
events["change " + this.ui.addTagOptions] = 'onChangeTagDefination'; events["change " + this.ui.addTagOptions] = 'onChangeTagDefination';
events["change " + this.ui.checkTagModalPropagate] = function(e) {
if (e.target.checked) {
that.ui.removePropagationOnEntityDeleteBox.show();
that.$('.addtag-propagte-box').removeClass('no-border');
} else {
that.$('.addtag-propagte-box').addClass('no-border');
that.ui.removePropagationOnEntityDeleteBox.hide();
}
if (that.tagModel) {
that.buttonActive({ isButtonActive: true });
}
};
events["change " + this.ui.removePropagationOnEntityDelete] = function() {
if (that.tagModel) {
that.buttonActive({ isButtonActive: true });
}
};
events["change " + this.ui.checkTimeZone] = function(e) { events["change " + this.ui.checkTimeZone] = function(e) {
if(this.tagModel){ if (this.tagModel) {
this.buttonActive({isButtonActive: true}); this.buttonActive({ isButtonActive: true });
} }
if (e.target.checked) { if (e.target.checked) {
this.ui.timeZoneDiv.show(); this.ui.timeZoneDiv.show();
...@@ -232,8 +252,10 @@ define(['require', ...@@ -232,8 +252,10 @@ define(['require',
this.tagsCollection(); this.tagsCollection();
if (this.tagModel) { if (this.tagModel) {
this.fetchTagSubData(that.tagModel.typeName); this.fetchTagSubData(that.tagModel.typeName);
that.ui.checkTagModalPropagate.prop('checked', this.tagModel.propagate === true ? true : false); // Added === true because if value is null then use false.
that.ui.checkTagModalPropagate.prop('checked', this.tagModel.propagate === true ? true : false).trigger('change');
that.ui.checkTimeZone.prop('checked', _.isEmpty(this.tagModel.validityPeriods) ? false : true); that.ui.checkTimeZone.prop('checked', _.isEmpty(this.tagModel.validityPeriods) ? false : true);
that.ui.removePropagationOnEntityDelete.prop('checked', this.tagModel.removePropagationsOnEntityDelete == true ? true : false);
if (_.isEmpty(this.tagModel.validityPeriods)) { if (_.isEmpty(this.tagModel.validityPeriods)) {
that.ui.timeZoneDiv.hide() that.ui.timeZoneDiv.hide()
} else { } else {
...@@ -307,11 +329,6 @@ define(['require', ...@@ -307,11 +329,6 @@ define(['require',
that.buttonActive({ isButtonActive: true }); that.buttonActive({ isButtonActive: true });
} }
}); });
this.ui.checkTagModalPropagate.on('change', function(e) {
if (that.tagModel) {
that.buttonActive({ isButtonActive: true });
}
});
}, },
buttonActive: function(option) { buttonActive: function(option) {
if (option) { if (option) {
...@@ -404,22 +421,19 @@ define(['require', ...@@ -404,22 +421,19 @@ define(['require',
var tagName = options.tagName, var tagName = options.tagName,
tagAttributes = options.tagAttributes, tagAttributes = options.tagAttributes,
validityPeriodVal = that.ui.checkTimeZone.is(':checked') ? that.collection.toJSON() : [], validityPeriodVal = that.ui.checkTimeZone.is(':checked') ? that.collection.toJSON() : [],
json = { classificationData = {
"classification": {
"typeName": tagName, "typeName": tagName,
"attributes": tagAttributes, "attributes": tagAttributes,
"propagate": that.ui.checkTagModalPropagate.is(":checked") === true ? true : false, "propagate": that.ui.checkTagModalPropagate.is(":checked") === true ? true : false,
"removePropagationsOnEntityDelete": that.ui.removePropagationOnEntityDelete.is(":checked") === true ? true : false,
"validityPeriods": validityPeriodVal "validityPeriods": validityPeriodVal
}, },
json = {
"classification": classificationData,
"entityGuids": options.guid "entityGuids": options.guid
}; };
if (this.tagModel) { if (this.tagModel) {
json = [{ json = [classificationData]
"typeName": tagName,
"attributes": tagAttributes,
"propagate": that.ui.checkTagModalPropagate.is(":checked") === true ? true : false,
"validityPeriods": validityPeriodVal
}]
} }
if (this.showLoader) { if (this.showLoader) {
this.showLoader(); this.showLoader();
......
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