Merge "Fixed node form submission issue"
This commit is contained in:
commit
0fecff4cbc
@ -57,14 +57,26 @@
|
||||
- adding new properties
|
||||
- displaying the list of properties in the set
|
||||
- changing the value of properties
|
||||
|
||||
Collection attributes:
|
||||
id: Name of the property inside the node object that is used
|
||||
to store the collection.
|
||||
formId: Name of the controller variable that can be used to
|
||||
access the property collection form.
|
||||
prompt: Label used to prompt the user to add properties
|
||||
to the collection.
|
||||
placeholder: Label used to guide the user in providiing property
|
||||
values.
|
||||
*/
|
||||
ctrl.propertyCollections = [
|
||||
{id: "properties",
|
||||
formId: "properties_form",
|
||||
title: gettext("Properties"),
|
||||
addPrompt: gettext("Add Property"),
|
||||
placeholder: gettext("Property Name")
|
||||
},
|
||||
{id: "extra",
|
||||
formId: "extra_form",
|
||||
title: gettext("Extras"),
|
||||
addPrompt: gettext("Add Extra"),
|
||||
placeholder: gettext("Extra Property Name")
|
||||
@ -75,11 +87,13 @@
|
||||
name: null,
|
||||
driver: null,
|
||||
driver_info: {},
|
||||
properties: {},
|
||||
extra: {},
|
||||
network_interface: null
|
||||
};
|
||||
|
||||
angular.forEach(ctrl.propertyCollections, function(collection) {
|
||||
ctrl.node[collection.id] = {};
|
||||
});
|
||||
|
||||
/**
|
||||
* @description Get the list of currently active Ironic drivers
|
||||
*
|
||||
@ -297,5 +311,28 @@
|
||||
ctrl.isDriverPropertyActive = function(property) {
|
||||
return property.isActive();
|
||||
};
|
||||
|
||||
/**
|
||||
* @description Check whether the node definition form is ready for
|
||||
* to be submitted.
|
||||
*
|
||||
* @return {boolean} True if the form is ready to be submitted,
|
||||
* otherwise false.
|
||||
*/
|
||||
ctrl.readyToSubmit = function() {
|
||||
var ready = true;
|
||||
if (ctrl.driverProperties) {
|
||||
for (var i = 0; i < ctrl.propertyCollections.length; i++) {
|
||||
var collection = ctrl.propertyCollections[i];
|
||||
if (ctrl[collection.formId].$invalid) {
|
||||
ready = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ready = false;
|
||||
}
|
||||
return ready;
|
||||
};
|
||||
}
|
||||
})();
|
||||
|
@ -125,8 +125,8 @@
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<form id="{$ collection.id $}-form"
|
||||
name="{$ collection.id $}-form">
|
||||
<form id="ctrl.{$ collection.formId $}"
|
||||
name="ctrl.{$ collection.formId $}">
|
||||
<div class="form-group">
|
||||
<div class="input-group input-group-sm"
|
||||
ng-repeat="(propertyName, propertyValue) in ctrl.node[collection.id]">
|
||||
@ -253,10 +253,7 @@
|
||||
</button>
|
||||
|
||||
<button type="submit"
|
||||
ng-disabled="!ctrl.driverProperties ||
|
||||
propertiesForm.$invalid ||
|
||||
extraForm.$invalid ||
|
||||
instanceInfoForm.$invalid"
|
||||
ng-disabled="!ctrl.readyToSubmit()"
|
||||
ng-click="ctrl.submit()"
|
||||
class="btn btn-primary">
|
||||
{$ ::ctrl.submitButtonTitle $}
|
||||
|
@ -55,16 +55,18 @@
|
||||
ctrl.modalTitle = gettext("Edit Node");
|
||||
ctrl.submitButtonTitle = gettext("Update Node");
|
||||
|
||||
ctrl.node.instance_info = {};
|
||||
|
||||
ctrl.baseNode = null;
|
||||
|
||||
var instanceInfoId = "instance_info";
|
||||
ctrl.propertyCollections.push(
|
||||
{id: "instance_info",
|
||||
{id: instanceInfoId,
|
||||
formId: "instance_info_form",
|
||||
title: gettext("Instance Info"),
|
||||
addPrompt: gettext("Add Instance Property"),
|
||||
placeholder: gettext("Instance Property Name")});
|
||||
|
||||
ctrl.node[instanceInfoId] = {};
|
||||
|
||||
init(node);
|
||||
|
||||
function init(node) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user