Commit bd69a4f1 by Kalyani Committed by nixonrodrigues

ATLAS-1809 : UI : Update button in Edit tag attributes window should be enabled…

ATLAS-1809 : UI : Update button in Edit tag attributes window should be enabled only when any update is done Signed-off-by: 's avatarnixonrodrigues <nixon@apache.org>
parent 363b88cf
......@@ -115,6 +115,17 @@ define(['require',
this.listenTo(this.collection, 'error', function() {
this.hideLoader();
}, this);
},
onRender: function() {
this.bindEvents();
if (!this.guid) {
this.bindRequiredField();
}
this.showLoader();
this.fetchCollections();
},
bindRequiredField: function() {
var that = this;
this.ui.entityInputData.on("keyup change", "textarea", function(e) {
var value = this.value;
if (!value.length && $(this).hasClass('false')) {
......@@ -158,11 +169,6 @@ define(['require',
}
});
},
onRender: function() {
this.bindEvents();
this.showLoader();
this.fetchCollections();
},
bindNonRequiredField: function() {
var that = this;
this.ui.entityInputData.off('keyup change dp.change', 'input.false,select.false').on('keyup change dp.change', 'input.false,select.false', function(e) {
......@@ -332,9 +338,6 @@ define(['require',
});
}
});
if (this.guid) {
this.bindNonRequiredField();
}
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);
......@@ -723,7 +726,12 @@ define(['require',
if (selectedValue) {
$this.val(selectedValue).trigger("change");
}
});
if (this.guid) {
this.bindRequiredField();
this.bindNonRequiredField();
}
this.hideLoader();
}
});
......
......@@ -62,14 +62,13 @@ define(['require',
okText: 'Add',
cancelText: "Cancel",
allowCancel: true,
},
state = this.tagModel ? false : true;
};
if (this.tagModel) {
modalObj.title = 'Edit Tag';
modalObj.okText = 'Update';
}
this.modal = new Modal(modalObj).open();
this.modal.$el.find('button.ok').attr("disabled", state);
this.modal.$el.find('button.ok').attr("disabled", true);
this.on('ok', function() {
var tagName = this.tagModel ? this.tagModel.typeName : this.ui.addTagOptions.val(),
tagAttributes = {},
......@@ -242,11 +241,17 @@ define(['require',
this.subAttributeData(attributeDefs);
},
showAttributeBox: function() {
var that = this;
this.$('.attrLoader').hide();
this.$('.form-group.hide').removeClass('hide');
if (this.ui.tagAttribute.children().length !== 0) {
this.ui.tagAttribute.parent().show();
}
this.ui.tagAttribute.find('input,select').on("keyup change", function(e) {
if (e.keyCode != 32) {
that.modal.$el.find('button.ok').attr("disabled", false);
}
});
},
hideAttributeBox: function() {
this.ui.tagAttribute.children().empty();
......@@ -264,7 +269,7 @@ define(['require',
var str = "<option disabled='disabled'" + (!that.tagModel ? 'selected' : '') + ">-- Select " + typeName + " --</option>";
var enumValue = typeNameValue.get('elementDefs');
_.each(enumValue, function(key, value) {
str += '<option ' + (that.tagModel && key.value === _.values(that.tagModel.attributes)[0] ? 'selected' : '') + '>' + key.value + '</option>';
str += '<option ' + (that.tagModel && key.value === that.tagModel.attributes[name] ? 'selected' : '') + '>' + key.value + '</option>';
})
that.ui.tagAttribute.append('<div class="form-group"><label>' + name + '</label>' +
'<select class="form-control attributeInputVal attrName" data-key="' + name + '">' + str + '</select></div>');
......
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