diff --git a/ironic_ui/static/dashboard/admin/ironic/base-node/base-node.controller.js b/ironic_ui/static/dashboard/admin/ironic/base-node/base-node.controller.js index d07dbdcd..a02021b3 100644 --- a/ironic_ui/static/dashboard/admin/ironic/base-node/base-node.controller.js +++ b/ironic_ui/static/dashboard/admin/ironic/base-node/base-node.controller.js @@ -51,7 +51,24 @@ ctrl.modalTitle = gettext("Node"); ctrl.submitButtonTitle = gettext("Submit"); - ctrl.showInstanceInfo = false; + + /* A property-collection is a set of properties that will be displayed + in the node view as a minimal browser ui that supports: + - adding new properties + - displaying the list of properties in the set + - changing the value of properties + */ + ctrl.propertyCollections = [ + {id: "properties", + title: "Properties", + addPrompt: "Add Property", + placeholder: "Property Name" + }, + {id: "extra", + title: "Extras", + addPrompt: "Add Extra", + placeholder: "Extra Property Name" + }]; // Node object suitable for Ironic api ctrl.node = { @@ -247,46 +264,26 @@ }; /** - * @desription Delete a node property - * - * @param {string} propertyName - Name of the property - * @return {void} - */ - ctrl.deleteProperty = function(propertyName) { - delete ctrl.node.properties[propertyName]; - }; - - /** - * @description Check whether the specified node property already exists + * @description Check whether the specified property already exists * + * @param {string} collectionId - Collection ID * @param {string} propertyName - Name of the property * @return {boolean} True if the property already exists, * otherwise false */ - ctrl.checkPropertyUnique = function(propertyName) { - return !(propertyName in ctrl.node.properties); + ctrl.collectionCheckPropertyUnique = function(collectionId, propertyName) { + return !(propertyName in ctrl.node[collectionId]); }; /** * @description Delete a node metadata property * + * @param {string} collectionId - Collection ID * @param {string} propertyName - Name of the property * @return {void} */ - ctrl.deleteExtra = function(propertyName) { - delete ctrl.node.extra[propertyName]; - }; - - /** - * @description Check whether the specified node metadata property - * already exists - * - * @param {string} propertyName - Name of the metadata property - * @return {boolean} True if the property already exists, - * otherwise false - */ - ctrl.checkExtraUnique = function(propertyName) { - return !(propertyName in ctrl.node.extra); + ctrl.collectionDeleteProperty = function(collectionId, propertyName) { + delete ctrl.node[collectionId][propertyName]; }; /** diff --git a/ironic_ui/static/dashboard/admin/ironic/base-node/base-node.html b/ironic_ui/static/dashboard/admin/ironic/base-node/base-node.html index d67457d1..7d1bc55c 100644 --- a/ironic_ui/static/dashboard/admin/ironic/base-node/base-node.html +++ b/ironic_ui/static/dashboard/admin/ironic/base-node/base-node.html @@ -69,171 +69,64 @@ - -
-
- -
- - Add New Property: - - - - -
-
-
- -
-
-
- - {$ propertyName $} - - -
- - - + +
+ +
+ +
+ + {$ collection.addPrompt $}: + + + +
-
- - -
-
- -
- - Add Extra: - - - - -
-
-
- -
-
-
- - {$ propertyName $} - - -
- - - + +
+
+
+ + {$ propertyName $} + + +
+ + + +
-
- - -
-
- -
- - Add New Instance Property: - - - - -
-
-
- -
-
-
- - {$ propertyName $} - - -
- - - -
-
-
-
+ +
diff --git a/ironic_ui/static/dashboard/admin/ironic/edit-node/edit-node.controller.js b/ironic_ui/static/dashboard/admin/ironic/edit-node/edit-node.controller.js index 268ccc8d..8230b7cf 100644 --- a/ironic_ui/static/dashboard/admin/ironic/edit-node/edit-node.controller.js +++ b/ironic_ui/static/dashboard/admin/ironic/edit-node/edit-node.controller.js @@ -54,10 +54,14 @@ ctrl.submitButtonTitle = gettext("Update Node"); ctrl.node.instance_info = {}; - ctrl.showInstanceInfo = true; ctrl.baseNode = null; + ctrl.propertyCollections.push({id: "instance_info", + title: "Instance Info", + addPrompt: "Add Instance Property", + placeholder: "Instance Property Name"}); + init(node); function init(node) { @@ -96,28 +100,6 @@ }); } - /** - * @description Delete a node instance property - * - * @param {string} propertyName - Name of the property - * @return {void} - */ - ctrl.deleteInstanceProperty = function(propertyName) { - delete ctrl.node.instance_info[propertyName]; - }; - - /** - * @description Check whether the specified node instance property - * already exists - * - * @param {string} propertyName - Name of the instance property - * @return {boolean} True if the property already exists, - * otherwise false - */ - ctrl.checkInstancePropertyUnique = function(propertyName) { - return !(propertyName in ctrl.node.instance_info); - }; - /** * @description Construct a patch that converts source node into * target node