This is an automated email from the ASF dual-hosted git repository. nixon pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/atlas.git
commit e8832f0dbb203dc33475a49711463929b984a37b Author: prasad pawar <prasad.pa...@freestoneinfotech.com> AuthorDate: Tue Jun 8 17:01:34 2021 +0530 ATLAS-4326: Atlas UI: Multiple continuous space is accepted on Short description for Classifications, Gloassarys, Categorys & Terms, fixed #2. Signed-off-by: nixonrodrigues <ni...@apache.org> --- dashboardv2/public/js/utils/CommonViewFunction.js | 3 +++ dashboardv2/public/js/views/tag/TagAttributeDetailLayoutView.js | 5 +++-- dashboardv2/public/js/views/tag/TagLayoutView.js | 5 ++++- dashboardv3/public/js/utils/CommonViewFunction.js | 3 +++ .../public/js/views/search/tree/ClassificationTreeLayoutView.js | 5 ++++- dashboardv3/public/js/views/tag/TagAttributeDetailLayoutView.js | 5 +++-- 6 files changed, 20 insertions(+), 6 deletions(-) diff --git a/dashboardv2/public/js/utils/CommonViewFunction.js b/dashboardv2/public/js/utils/CommonViewFunction.js index bb3fa3f..8c2df51 100644 --- a/dashboardv2/public/js/utils/CommonViewFunction.js +++ b/dashboardv2/public/js/utils/CommonViewFunction.js @@ -710,6 +710,9 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum "okText": model ? "Update" : "Create", "allowCancel": true }).open(); + modal.$el.find('input[data-id=shortDescription]').on('input keydown', function(e) { + $(this).val($(this).val().replace(/\s+/g, ' ')); + }); modal.$el.find('button.ok').attr("disabled", "true"); modal.on('ok', function() { modal.$el.find('button.ok').showButtonLoader(); diff --git a/dashboardv2/public/js/views/tag/TagAttributeDetailLayoutView.js b/dashboardv2/public/js/views/tag/TagAttributeDetailLayoutView.js index 8e7e6c3..be33e7c 100644 --- a/dashboardv2/public/js/views/tag/TagAttributeDetailLayoutView.js +++ b/dashboardv2/public/js/views/tag/TagAttributeDetailLayoutView.js @@ -276,14 +276,14 @@ define(['require', }); }, textAreaChangeEvent: function(view) { - if (this.model.get('description') === view.ui.description.val() || view.ui.description.val().length == 0) { + if (this.model.get('description') === view.ui.description.val() || view.ui.description.val().length == 0 || view.ui.description.val().trim().length === 0) { this.modal.$el.find('button.ok').prop('disabled', true); } else { this.modal.$el.find('button.ok').prop('disabled', false); } }, onPublishClick: function(view) { - var saveObj = _.extend(this.model.toJSON(), { 'description': view.ui.description.val() }); + var saveObj = _.extend(this.model.toJSON(), { 'description': view.ui.description.val().trim() }); this.onSaveButton(saveObj, Messages.tag.updateTagDescriptionMessage); this.ui.description.show(); }, @@ -303,6 +303,7 @@ define(['require', allowCancel: true, }).open(); view.ui.description.on('keyup input', function(e) { + $(this).val($(this).val().replace(/\s+/g, ' ')); that.textAreaChangeEvent(view); e.stopPropagation(); }); diff --git a/dashboardv2/public/js/views/tag/TagLayoutView.js b/dashboardv2/public/js/views/tag/TagLayoutView.js index 9dd15b4..38df187 100644 --- a/dashboardv2/public/js/views/tag/TagLayoutView.js +++ b/dashboardv2/public/js/views/tag/TagLayoutView.js @@ -403,7 +403,10 @@ define(['require', }).open(); modal.$el.find('button.ok').attr("disabled", "true"); view.ui.tagName.on('keyup input', function(e) { - view.ui.description.val(this.value); + view.ui.description.val($(this).val().replace(/\s+/g, ' ')); + }); + view.ui.description.on('input keydown', function(e) { + $(this).val($(this).val().replace(/\s+/g, ' ')); }); modal.on('shownModal', function() { view.ui.parentTag.select2({ diff --git a/dashboardv3/public/js/utils/CommonViewFunction.js b/dashboardv3/public/js/utils/CommonViewFunction.js index 34afa2d..e739544 100644 --- a/dashboardv3/public/js/utils/CommonViewFunction.js +++ b/dashboardv3/public/js/utils/CommonViewFunction.js @@ -730,6 +730,9 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum "okText": model ? "Update" : "Create", "allowCancel": true }).open(); + modal.$el.find('input[data-id=shortDescription]').on('input keydown', function(e) { + $(this).val($(this).val().replace(/\s+/g, ' ')); + }); modal.$el.find('button.ok').attr("disabled", "true"); modal.on('ok', function() { modal.$el.find('button.ok').showButtonLoader(); diff --git a/dashboardv3/public/js/views/search/tree/ClassificationTreeLayoutView.js b/dashboardv3/public/js/views/search/tree/ClassificationTreeLayoutView.js index 18d3650..3bfc201 100644 --- a/dashboardv3/public/js/views/search/tree/ClassificationTreeLayoutView.js +++ b/dashboardv3/public/js/views/search/tree/ClassificationTreeLayoutView.js @@ -687,7 +687,10 @@ define([ }).open(); modal.$el.find("button.ok").attr("disabled", "true"); view.ui.tagName.on('keyup input', function(e) { - view.ui.description.val(this.value); + view.ui.description.val($(this).val().replace(/\s+/g, ' ')); + }); + view.ui.description.on('input keydown', function(e) { + $(this).val($(this).val().replace(/\s+/g, ' ')); }); modal.on("shownModal", function() { view.ui.parentTag.select2({ diff --git a/dashboardv3/public/js/views/tag/TagAttributeDetailLayoutView.js b/dashboardv3/public/js/views/tag/TagAttributeDetailLayoutView.js index cabf32b..52ff043 100644 --- a/dashboardv3/public/js/views/tag/TagAttributeDetailLayoutView.js +++ b/dashboardv3/public/js/views/tag/TagAttributeDetailLayoutView.js @@ -280,14 +280,14 @@ define(['require', }); }, textAreaChangeEvent: function(view) { - if (this.model.get('description') === view.ui.description.val() || view.ui.description.val().length == 0) { + if (this.model.get('description') === view.ui.description.val() || view.ui.description.val().length == 0 || view.ui.description.val().trim().length === 0) { this.modal.$el.find('button.ok').prop('disabled', true); } else { this.modal.$el.find('button.ok').prop('disabled', false); } }, onPublishClick: function(view) { - var saveObj = _.extend(this.model.toJSON(), { 'description': view.ui.description.val() }); + var saveObj = _.extend(this.model.toJSON(), { 'description': view.ui.description.val().trim() }); this.onSaveButton(saveObj, Messages.tag.updateTagDescriptionMessage); this.ui.description.show(); }, @@ -307,6 +307,7 @@ define(['require', allowCancel: true, }).open(); view.ui.description.on('keyup input', function(e) { + $(this).val($(this).val().replace(/\s+/g, ' ')); that.textAreaChangeEvent(view); e.stopPropagation(); });