UI : Provide option whether to delete propagated classification on entity 
delete during add classification

Signed-off-by: Sarath Subramanian <[email protected]>
(cherry picked from commit 064c5767c8436cd9c16446f7ae7bbb1e6ca1d082)


Project: http://git-wip-us.apache.org/repos/asf/atlas/repo
Commit: http://git-wip-us.apache.org/repos/asf/atlas/commit/6766b9ab
Tree: http://git-wip-us.apache.org/repos/asf/atlas/tree/6766b9ab
Diff: http://git-wip-us.apache.org/repos/asf/atlas/diff/6766b9ab

Branch: refs/heads/branch-1.0
Commit: 6766b9abea46a1f873c67e9db6799d4aa702d9cf
Parents: 09fe5fe
Author: kevalbhatt <[email protected]>
Authored: Thu Aug 16 13:25:12 2018 -0700
Committer: Sarath Subramanian <[email protected]>
Committed: Thu Aug 16 13:26:35 2018 -0700

----------------------------------------------------------------------
 dashboardv2/public/css/scss/tag.scss            |  5 ++
 dashboardv2/public/css/scss/theme.scss          |  4 ++
 .../js/templates/tag/AddTagModalView_tmpl.html  | 60 +++++++++++---------
 .../public/js/views/tag/AddTagModalView.js      | 60 ++++++++++++--------
 4 files changed, 79 insertions(+), 50 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/atlas/blob/6766b9ab/dashboardv2/public/css/scss/tag.scss
----------------------------------------------------------------------
diff --git a/dashboardv2/public/css/scss/tag.scss 
b/dashboardv2/public/css/scss/tag.scss
index 53b3d96..ca5f668 100644
--- a/dashboardv2/public/css/scss/tag.scss
+++ b/dashboardv2/public/css/scss/tag.scss
@@ -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

http://git-wip-us.apache.org/repos/asf/atlas/blob/6766b9ab/dashboardv2/public/css/scss/theme.scss
----------------------------------------------------------------------
diff --git a/dashboardv2/public/css/scss/theme.scss 
b/dashboardv2/public/css/scss/theme.scss
index a820dd6..afec6f6 100644
--- a/dashboardv2/public/css/scss/theme.scss
+++ b/dashboardv2/public/css/scss/theme.scss
@@ -299,6 +299,10 @@ hr[size="10"] {
     margin-right: 0px !important;
 }
 
+.no-border {
+    border: none !important;
+}
+
 .position-relative {
     position: relative;
 }

http://git-wip-us.apache.org/repos/asf/atlas/blob/6766b9ab/dashboardv2/public/js/templates/tag/AddTagModalView_tmpl.html
----------------------------------------------------------------------
diff --git a/dashboardv2/public/js/templates/tag/AddTagModalView_tmpl.html 
b/dashboardv2/public/js/templates/tag/AddTagModalView_tmpl.html
index 0c3f7a9..e7a59f2 100644
--- a/dashboardv2/public/js/templates/tag/AddTagModalView_tmpl.html
+++ b/dashboardv2/public/js/templates/tag/AddTagModalView_tmpl.html
@@ -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

http://git-wip-us.apache.org/repos/asf/atlas/blob/6766b9ab/dashboardv2/public/js/views/tag/AddTagModalView.js
----------------------------------------------------------------------
diff --git a/dashboardv2/public/js/views/tag/AddTagModalView.js 
b/dashboardv2/public/js/views/tag/AddTagModalView.js
index c256ef3..f5a5eb8 100644
--- a/dashboardv2/public/js/views/tag/AddTagModalView.js
+++ b/dashboardv2/public/js/views/tag/AddTagModalView.js
@@ -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();

Reply via email to