This is an automated email from the ASF dual-hosted git repository. nbonte pushed a commit to branch branch-2.0 in repository https://gitbox.apache.org/repos/asf/atlas.git
commit 93cca70026a304653959ea41f492d56b3f7f172a Author: prasad pawar <[email protected]> AuthorDate: Tue Mar 9 10:26:39 2021 +0530 ATLAS-3349:UI: Unable to edit AtlasServer entity with custom Required fields.fixed Signed-off-by: Nikhil Bonte <[email protected]> (cherry picked from commit e71eee708538b054e4e42764992f5aef87eeb0d2) --- .../js/views/entity/CreateEntityLayoutView.js | 32 ++++++++++++++-------- .../js/views/entity/CreateEntityLayoutView.js | 29 +++++++++++++------- 2 files changed, 39 insertions(+), 22 deletions(-) diff --git a/dashboardv2/public/js/views/entity/CreateEntityLayoutView.js b/dashboardv2/public/js/views/entity/CreateEntityLayoutView.js index ec06a75..5e53475 100644 --- a/dashboardv2/public/js/views/entity/CreateEntityLayoutView.js +++ b/dashboardv2/public/js/views/entity/CreateEntityLayoutView.js @@ -57,8 +57,7 @@ define(['require', toggleRequired: 'input[name="toggleRequired"]', assetName: "[data-id='assetName']", entityInput: "[data-id='entityInput']", - entitySelectionBox: "[data-id='entitySelectionBox']", - + entitySelectionBox: "[data-id='entitySelectionBox']" }, /** ui events hash */ events: function() { @@ -434,23 +433,31 @@ define(['require', that.initilizeElements(); }, initilizeElements: function() { - var that = this; + var that = this, + $createTime = this.modal.$el.find('input[name="createTime"]'), + dateObj = { + "singleDatePicker": true, + "showDropdowns": true, + "startDate": new Date(), + locale: { + format: Globals.dateFormat + } + }; this.$('input[data-type="date"]').each(function() { if (!$(this).data('daterangepicker')) { - var dateObj = { - "singleDatePicker": true, - "showDropdowns": true, - "startDate": new Date(), - locale: { - format: Globals.dateFormat - } - }; if (that.guid && this.value.length) { dateObj["startDate"] = new Date(Number(this.value)); } + if ($(this).attr('name') === "modifiedTime") { + dateObj["minDate"] = $createTime.val(); + } $(this).daterangepicker(dateObj); } }); + modifiedDateObj = _.extend({}, dateObj); + $createTime.on('apply.daterangepicker', function(ev, picker) { + that.modal.$el.find('input[name="modifiedTime"]').daterangepicker(_.extend(modifiedDateObj, { "minDate": $createTime.val() })); + }); this.initializeValidation(); if (this.ui.entityInputData.find('fieldset').length > 0 && this.ui.entityInputData.find('select.true,input.true').length === 0) { this.requiredAllToggle(this.ui.entityInputData.find('select.true,input.true').length === 0); @@ -588,6 +595,7 @@ define(['require', ' data-attribute="' + isAttribute + '"' + ' data-relation="' + isRelation + '"' + ' placeholder="' + name + '"' + + ' name="' + name + '"' + ' data-id="entityInput">'; }, getElement: function(object) { @@ -849,7 +857,7 @@ define(['require', if (that.guid) { var dataValue = that.entityData.get("entity").attributes[keyData], entities = that.entityData.get("entity").attributes, - relationshipType = that.entityData.get("entity").relationshipAttributes[keyData], + relationshipType = that.entityData.get("entity").relationshipAttributes ? that.entityData.get("entity").relationshipAttributes[keyData] : null, referredEntities = that.entityData.get("referredEntities"), selectedValue = [], select2Options = []; diff --git a/dashboardv3/public/js/views/entity/CreateEntityLayoutView.js b/dashboardv3/public/js/views/entity/CreateEntityLayoutView.js index d05fe69..0532164 100644 --- a/dashboardv3/public/js/views/entity/CreateEntityLayoutView.js +++ b/dashboardv3/public/js/views/entity/CreateEntityLayoutView.js @@ -437,23 +437,31 @@ define(['require', that.initilizeElements(); }, initilizeElements: function() { - var that = this; + var that = this, + $createTime = this.modal.$el.find('input[name="createTime"]'), + dateObj = { + "singleDatePicker": true, + "showDropdowns": true, + "startDate": new Date(), + locale: { + format: Globals.dateFormat + } + }; this.$('input[data-type="date"]').each(function() { if (!$(this).data('daterangepicker')) { - var dateObj = { - "singleDatePicker": true, - "showDropdowns": true, - "startDate": new Date(), - locale: { - format: Globals.dateFormat - } - }; if (that.guid && this.value.length) { dateObj["startDate"] = new Date(Number(this.value)); } + if ($(this).attr('name') === "modifiedTime") { + dateObj["minDate"] = $createTime.val(); + } $(this).daterangepicker(dateObj); } }); + modifiedDateObj = _.extend({}, dateObj); + $createTime.on('apply.daterangepicker', function(ev, picker) { + that.modal.$el.find('input[name="modifiedTime"]').daterangepicker(_.extend(modifiedDateObj, { "minDate": $createTime.val() })); + }); this.initializeValidation(); if (this.ui.entityInputData.find('fieldset').length > 0 && this.ui.entityInputData.find('select.true,input.true').length === 0) { this.requiredAllToggle(this.ui.entityInputData.find('select.true,input.true').length === 0); @@ -591,6 +599,7 @@ define(['require', ' data-attribute="' + isAttribute + '"' + ' data-relation="' + isRelation + '"' + ' placeholder="' + name + '"' + + ' name="' + name + '"' + ' data-id="entityInput">'; }, getElement: function(object) { @@ -854,7 +863,7 @@ define(['require', if (that.guid) { var dataValue = that.entityData.get("entity").attributes[keyData], entities = that.entityData.get("entity").attributes, - relationshipType = that.entityData.get("entity").relationshipAttributes[keyData], + relationshipType = that.entityData.get("entity").relationshipAttributes ? that.entityData.get("entity").relationshipAttributes[keyData] : null, referredEntities = that.entityData.get("referredEntities"), selectedValue = [], select2Options = [];
