ATLAS-4138:UI:While adding Classification to an entity, if user select and deselect the 'Apply Validity Period' checkbox immediately, it keeps on showing pop-up with text 'Please fill the details' Fixed
Signed-off-by: Nikhil Bonte <nbonte@apache.org>
diff --git a/dashboardv2/public/js/utils/Helper.js b/dashboardv2/public/js/utils/Helper.js
index 050dfd5..b78077f 100644
--- a/dashboardv2/public/js/utils/Helper.js
+++ b/dashboardv2/public/js/utils/Helper.js
@@ -128,17 +128,21 @@
$(this).blur();
});
$('body').on('keyup input', '.modal-body', function(e) {
- var $this = $(this),
- $footerButton = $this.parents(".modal").find('.modal-footer button.ok'),
- requiredInputField = _.filter($this.find('input'), function($e) {
- if ($e.getAttribute('placeholder') && $e.getAttribute('placeholder').indexOf('require') >= 0) {
- return ($e.value.trim() == "");
- }
- });
- if (requiredInputField.length > 0) {
- $footerButton.attr("disabled", "true");
- } else {
- $footerButton.removeAttr("disabled");
+ var target = e.target,
+ isGlossary = (e.target.dataset.id === "searchTerm" || e.target.dataset.id === "searchCategory") ? true : false; // assign term/category modal
+ if ((target.type === "text" || target.type === "textarea") && !isGlossary) {
+ var $this = $(this),
+ $footerButton = $this.parents(".modal").find('.modal-footer button.ok'),
+ requiredInputField = _.filter($this.find('input'), function($e) {
+ if ($e.getAttribute('placeholder') && $e.getAttribute('placeholder').indexOf('require') >= 0) {
+ return ($e.value.trim() == "");
+ }
+ });
+ if (requiredInputField.length > 0) {
+ $footerButton.attr("disabled", "true");
+ } else {
+ $footerButton.removeAttr("disabled");
+ }
}
});
if ($.fn.select2) {
diff --git a/dashboardv2/public/js/views/tag/AddTagModalView.js b/dashboardv2/public/js/views/tag/AddTagModalView.js
index b623936..5c5581b 100644
--- a/dashboardv2/public/js/views/tag/AddTagModalView.js
+++ b/dashboardv2/public/js/views/tag/AddTagModalView.js
@@ -136,12 +136,14 @@
this.modal.open();
this.modal.$el.find('button.ok').attr("disabled", true);
this.on('ok', function() {
- if (this.validateValues()) {
- if (this.hideLoader) {
- this.hideLoader();
+ if (this.ui.checkTimeZone.is(':checked')) {
+ if (this.validateValues()) {
+ if (this.hideLoader) {
+ this.hideLoader();
+ };
+ return;
};
- return;
- };
+ }
that.modal.$el.find('button.ok').showButtonLoader();
var tagName = this.tagModel ? this.tagModel.typeName : this.ui.addTagOptions.val(),
tagAttributes = {},
diff --git a/dashboardv2/public/js/views/tag/TagAttributeDetailLayoutView.js b/dashboardv2/public/js/views/tag/TagAttributeDetailLayoutView.js
index 00861f5..4c40389 100644
--- a/dashboardv2/public/js/views/tag/TagAttributeDetailLayoutView.js
+++ b/dashboardv2/public/js/views/tag/TagAttributeDetailLayoutView.js
@@ -147,7 +147,7 @@
var validate = true;
this.modal.$el.find(".attributeInput").each(function() {
- if ($(this).val() === "") {
+ if ($(this).val().trim() === "") {
$(this).css('borderColor', "red")
validate = false;
}
diff --git a/dashboardv3/public/js/utils/Helper.js b/dashboardv3/public/js/utils/Helper.js
index acb549c..ed2fcc0 100644
--- a/dashboardv3/public/js/utils/Helper.js
+++ b/dashboardv3/public/js/utils/Helper.js
@@ -134,17 +134,21 @@
$(this).blur();
});
$('body').on('keyup input', '.modal-body', function(e) {
- var $this = $(this),
- $footerButton = $this.parents(".modal").find('.modal-footer button.ok'),
- requiredInputField = _.filter($this.find('input'), function($e) {
- if ($e.getAttribute('placeholder') && $e.getAttribute('placeholder').indexOf('require') >= 0) {
- return ($e.value.trim() == "");
- }
- });
- if (requiredInputField.length > 0) {
- $footerButton.attr("disabled", "true");
- } else {
- $footerButton.removeAttr("disabled");
+ var target = e.target,
+ isGlossary = (e.target.dataset.id === "searchTerm" || e.target.dataset.id === "searchCategory") ? true : false; // assign term/category modal
+ if ((target.type === "text" || target.type === "textarea") && !isGlossary) {
+ var $this = $(this),
+ $footerButton = $this.parents(".modal").find('.modal-footer button.ok'),
+ requiredInputField = _.filter($this.find('input'), function($e) {
+ if ($e.getAttribute('placeholder') && $e.getAttribute('placeholder').indexOf('require') >= 0) {
+ return ($e.value.trim() == "");
+ }
+ });
+ if (requiredInputField.length > 0) {
+ $footerButton.attr("disabled", "true");
+ } else {
+ $footerButton.removeAttr("disabled");
+ }
}
});
$.fn.select2.amd.define("TagHideDeleteButtonAdapter", [
diff --git a/dashboardv3/public/js/views/tag/AddTagModalView.js b/dashboardv3/public/js/views/tag/AddTagModalView.js
index b623936..5c5581b 100644
--- a/dashboardv3/public/js/views/tag/AddTagModalView.js
+++ b/dashboardv3/public/js/views/tag/AddTagModalView.js
@@ -136,12 +136,14 @@
this.modal.open();
this.modal.$el.find('button.ok').attr("disabled", true);
this.on('ok', function() {
- if (this.validateValues()) {
- if (this.hideLoader) {
- this.hideLoader();
+ if (this.ui.checkTimeZone.is(':checked')) {
+ if (this.validateValues()) {
+ if (this.hideLoader) {
+ this.hideLoader();
+ };
+ return;
};
- return;
- };
+ }
that.modal.$el.find('button.ok').showButtonLoader();
var tagName = this.tagModel ? this.tagModel.typeName : this.ui.addTagOptions.val(),
tagAttributes = {},
diff --git a/dashboardv3/public/js/views/tag/TagAttributeDetailLayoutView.js b/dashboardv3/public/js/views/tag/TagAttributeDetailLayoutView.js
index 4800241..20220f2 100644
--- a/dashboardv3/public/js/views/tag/TagAttributeDetailLayoutView.js
+++ b/dashboardv3/public/js/views/tag/TagAttributeDetailLayoutView.js
@@ -151,7 +151,7 @@
var validate = true;
this.modal.$el.find(".attributeInput").each(function() {
- if ($(this).val() === "") {
+ if ($(this).val().trim() === "") {
$(this).css('borderColor', "red")
validate = false;
}