Merge "Fixed node form submission issue"
This commit is contained in:
commit
0fecff4cbc
@ -57,14 +57,26 @@
|
|||||||
- adding new properties
|
- adding new properties
|
||||||
- displaying the list of properties in the set
|
- displaying the list of properties in the set
|
||||||
- changing the value of properties
|
- 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 = [
|
ctrl.propertyCollections = [
|
||||||
{id: "properties",
|
{id: "properties",
|
||||||
|
formId: "properties_form",
|
||||||
title: gettext("Properties"),
|
title: gettext("Properties"),
|
||||||
addPrompt: gettext("Add Property"),
|
addPrompt: gettext("Add Property"),
|
||||||
placeholder: gettext("Property Name")
|
placeholder: gettext("Property Name")
|
||||||
},
|
},
|
||||||
{id: "extra",
|
{id: "extra",
|
||||||
|
formId: "extra_form",
|
||||||
title: gettext("Extras"),
|
title: gettext("Extras"),
|
||||||
addPrompt: gettext("Add Extra"),
|
addPrompt: gettext("Add Extra"),
|
||||||
placeholder: gettext("Extra Property Name")
|
placeholder: gettext("Extra Property Name")
|
||||||
@ -75,11 +87,13 @@
|
|||||||
name: null,
|
name: null,
|
||||||
driver: null,
|
driver: null,
|
||||||
driver_info: {},
|
driver_info: {},
|
||||||
properties: {},
|
|
||||||
extra: {},
|
|
||||||
network_interface: null
|
network_interface: null
|
||||||
};
|
};
|
||||||
|
|
||||||
|
angular.forEach(ctrl.propertyCollections, function(collection) {
|
||||||
|
ctrl.node[collection.id] = {};
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description Get the list of currently active Ironic drivers
|
* @description Get the list of currently active Ironic drivers
|
||||||
*
|
*
|
||||||
@ -297,5 +311,28 @@
|
|||||||
ctrl.isDriverPropertyActive = function(property) {
|
ctrl.isDriverPropertyActive = function(property) {
|
||||||
return property.isActive();
|
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>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
<form id="{$ collection.id $}-form"
|
<form id="ctrl.{$ collection.formId $}"
|
||||||
name="{$ collection.id $}-form">
|
name="ctrl.{$ collection.formId $}">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="input-group input-group-sm"
|
<div class="input-group input-group-sm"
|
||||||
ng-repeat="(propertyName, propertyValue) in ctrl.node[collection.id]">
|
ng-repeat="(propertyName, propertyValue) in ctrl.node[collection.id]">
|
||||||
@ -253,10 +253,7 @@
|
|||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button type="submit"
|
<button type="submit"
|
||||||
ng-disabled="!ctrl.driverProperties ||
|
ng-disabled="!ctrl.readyToSubmit()"
|
||||||
propertiesForm.$invalid ||
|
|
||||||
extraForm.$invalid ||
|
|
||||||
instanceInfoForm.$invalid"
|
|
||||||
ng-click="ctrl.submit()"
|
ng-click="ctrl.submit()"
|
||||||
class="btn btn-primary">
|
class="btn btn-primary">
|
||||||
{$ ::ctrl.submitButtonTitle $}
|
{$ ::ctrl.submitButtonTitle $}
|
||||||
|
@ -55,16 +55,18 @@
|
|||||||
ctrl.modalTitle = gettext("Edit Node");
|
ctrl.modalTitle = gettext("Edit Node");
|
||||||
ctrl.submitButtonTitle = gettext("Update Node");
|
ctrl.submitButtonTitle = gettext("Update Node");
|
||||||
|
|
||||||
ctrl.node.instance_info = {};
|
|
||||||
|
|
||||||
ctrl.baseNode = null;
|
ctrl.baseNode = null;
|
||||||
|
|
||||||
|
var instanceInfoId = "instance_info";
|
||||||
ctrl.propertyCollections.push(
|
ctrl.propertyCollections.push(
|
||||||
{id: "instance_info",
|
{id: instanceInfoId,
|
||||||
|
formId: "instance_info_form",
|
||||||
title: gettext("Instance Info"),
|
title: gettext("Instance Info"),
|
||||||
addPrompt: gettext("Add Instance Property"),
|
addPrompt: gettext("Add Instance Property"),
|
||||||
placeholder: gettext("Instance Property Name")});
|
placeholder: gettext("Instance Property Name")});
|
||||||
|
|
||||||
|
ctrl.node[instanceInfoId] = {};
|
||||||
|
|
||||||
init(node);
|
init(node);
|
||||||
|
|
||||||
function init(node) {
|
function init(node) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user