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
......@@ -183,4 +183,9 @@ table.attriTable {
padding: 5px 7px;
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"] {
margin-right: 0px !important;
}
.no-border {
border: none !important;
}
.position-relative {
position: relative;
}
......
......@@ -17,49 +17,55 @@
<div>
<div class="form-group hide">
<div class="row modalHeight">
<div class="col-md-7">
<div class="form-group col-md-12">
{{#if tagModel}}
<h4>{{tagModel.typeName}}</h4> </div>{{else}}
<select class="form-control row-margin-bottom" data-id="addTagOptions" required>
</select>
</div>
{{/if}}
<div class="col-md-2">
<select class="form-control row-margin-bottom" data-id="addTagOptions" required>
</select>
</div>
{{/if}}
<div class="col-md-6">
<div class="col-md-12 addtag-propagte-box">
<div class="inline">
<label class="checkbox-inline btn">
<input type="checkbox" data-id="checkModalTagProperty" class="input" checked /> Propagate</label>
</div>
</div>
<div class="col-md-3">
<div class="inline">
<div class="inline" data-id="removePropagationOnEntityDeleteBox">
<label class="checkbox-inline btn">
<input type="checkbox" data-id="checkTimezoneProperty" class="input" /> Apply Validity Period</label>
<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="row modalHeight" style="display: none;" data-id="timeZoneDiv">
<hr>
<div class="col-sm-12">
<div class="clearfix form-group">
<button type="button" class="btn btn-action btn-sm pull-right" data-id="addTimezoneParms"><i class="fa fa-plus"></i> Add Validity Period</button>
</div>
<div class="panel panel-default" data-id="validityPeriodBody" style="display: none;">
<div class="panel-body" data-id="addTimezoneDiv">
</div>
</div>
<div class="col-md-6">
<div class="inline">
<label class="checkbox-inline btn">
<input type="checkbox" data-id="checkTimezoneProperty" class="input" /> Apply Validity Period</label>
</div>
</div>
</div>
<div class="row modalHeight">
<div class="row modalHeight" style="display: none;" data-id="timeZoneDiv">
<hr>
<div class="col-sm-12">
<div class="attrLoader" style="margin-left:45%;display:none">
<i class="fa fa-refresh fa-spin-custom"></i>
<div class="clearfix form-group">
<button type="button" class="btn btn-action btn-sm pull-right" data-id="addTimezoneParms"><i class="fa fa-plus"></i> Add Validity Period</button>
</div>
<div class="panel panel-default" data-id="validityPeriodBody" style="display: none;">
<div class="panel-body" data-id="addTimezoneDiv">
</div>
</div>
</div>
<div class="col-sm-12" style="display:none">
<p>Classification Attributes(optional)</p>
<p class="text-gray">Add attribute values for this classification</p>
<div data-id="tagAttribute"></div>
</div>
</div>
<div class="row modalHeight">
<div class="col-sm-12">
<div class="attrLoader" style="margin-left:45%;display:none">
<i class="fa fa-refresh fa-spin-custom"></i>
</div>
</div>
<div class="col-sm-12" style="display:none">
<p>Classification Attributes(optional)</p>
<p class="text-gray">Add attribute values for this classification</p>
<div data-id="tagAttribute"></div>
</div>
</div>
</div>
\ No newline at end of file
......@@ -57,14 +57,34 @@ define(['require',
timeZoneDiv: "[data-id='timeZoneDiv']",
checkTagModalPropagate: "[data-id='checkModalTagProperty']",
addTimezoneParms: "[data-id='addTimezoneParms']",
validityPeriodBody: "[data-id='validityPeriodBody']"
validityPeriodBody: "[data-id='validityPeriodBody']",
removePropagationOnEntityDelete: "[data-id='removePropagationOnEntityDelete']",
removePropagationOnEntityDeleteBox: "[data-id='removePropagationOnEntityDeleteBox']"
},
events: function() {
var events = {};
var events = {},
that = this;
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) {
if(this.tagModel){
this.buttonActive({isButtonActive: true});
if (this.tagModel) {
this.buttonActive({ isButtonActive: true });
}
if (e.target.checked) {
this.ui.timeZoneDiv.show();
......@@ -232,8 +252,10 @@ define(['require',
this.tagsCollection();
if (this.tagModel) {
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.removePropagationOnEntityDelete.prop('checked', this.tagModel.removePropagationsOnEntityDelete == true ? true : false);
if (_.isEmpty(this.tagModel.validityPeriods)) {
that.ui.timeZoneDiv.hide()
} else {
......@@ -307,11 +329,6 @@ define(['require',
that.buttonActive({ isButtonActive: true });
}
});
this.ui.checkTagModalPropagate.on('change', function(e) {
if (that.tagModel) {
that.buttonActive({ isButtonActive: true });
}
});
},
buttonActive: function(option) {
if (option) {
......@@ -342,7 +359,7 @@ define(['require',
} else {
var textElement = that.getElement(name, typeName);
if (_.isTypePrimitive(typeName)) {
that.ui.tagAttribute.append('<div class="form-group"><label>' + name + '</label>' + ' (' + typeName + ')' + textElement + '</div>');
that.ui.tagAttribute.append('<div class="form-group"><label>' + name + '</label>' + ' (' + typeName + ')' + textElement + '</div>');
}
}
});
......@@ -404,22 +421,19 @@ define(['require',
var tagName = options.tagName,
tagAttributes = options.tagAttributes,
validityPeriodVal = that.ui.checkTimeZone.is(':checked') ? that.collection.toJSON() : [],
json = {
"classification": {
"typeName": tagName,
"attributes": tagAttributes,
"propagate": that.ui.checkTagModalPropagate.is(":checked") === true ? true : false,
"validityPeriods": validityPeriodVal
},
"entityGuids": options.guid
};
if (this.tagModel) {
json = [{
classificationData = {
"typeName": tagName,
"attributes": tagAttributes,
"propagate": that.ui.checkTagModalPropagate.is(":checked") === true ? true : false,
"removePropagationsOnEntityDelete": that.ui.removePropagationOnEntityDelete.is(":checked") === true ? true : false,
"validityPeriods": validityPeriodVal
}]
},
json = {
"classification": classificationData,
"entityGuids": options.guid
};
if (this.tagModel) {
json = [classificationData]
}
if (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