diff --git a/ironic_ui/static/dashboard/admin/ironic/node-actions.service.js b/ironic_ui/static/dashboard/admin/ironic/node-actions.service.js index 34ad4a3c..605fa945 100755 --- a/ironic_ui/static/dashboard/admin/ironic/node-actions.service.js +++ b/ironic_ui/static/dashboard/admin/ironic/node-actions.service.js @@ -20,34 +20,6 @@ var POWER_STATE_ON = 'power on'; var POWER_STATE_OFF = 'power off'; - var DELETE_NODE_TITLE = gettext("Delete Node"); - var DELETE_NODE_MSG = - gettext('Are you sure you want to delete node "%s"? ' + - 'This action cannot be undone.'); - var DELETE_NODE_SUCCESS = gettext('Successfully deleted node "%s"'); - var DELETE_NODE_ERROR = gettext('Unable to delete node "%s"'); - - var DELETE_NODES_TITLE = gettext("Delete Nodes"); - var DELETE_NODES_MSG = - gettext('Are you sure you want to delete nodes "%s"? ' + - 'This action cannot be undone.'); - var DELETE_NODES_SUCCESS = gettext('Successfully deleted nodes "%s"'); - var DELETE_NODES_ERROR = gettext('Error deleting nodes "%s"'); - - var DELETE_PORT_TITLE = gettext("Delete Port"); - var DELETE_PORT_MSG = - gettext('Are you sure you want to delete port "%s"? ' + - 'This action cannot be undone.'); - var DELETE_PORT_SUCCESS = gettext('Successfully deleted port "%s"'); - var DELETE_PORT_ERROR = gettext('Unable to delete port "%s"'); - - var DELETE_PORTS_TITLE = gettext("Delete Ports"); - var DELETE_PORTS_MSG = - gettext('Are you sure you want to delete ports "%s"? ' + - 'This action cannot be undone.'); - var DELETE_PORTS_SUCCESS = gettext('Successfully deleted ports "%s"'); - var DELETE_PORTS_ERROR = gettext('Error deleting ports "%s"'); - angular .module('horizon.dashboard.admin.ironic') .factory('horizon.dashboard.admin.ironic.actions', actions); @@ -72,9 +44,7 @@ var service = { createPort: createPort, deleteNode: deleteNode, - deleteNodes: deleteNodes, deletePort: deletePort, - deletePorts: deletePorts, powerOn: powerOn, powerOff: powerOff, powerOnAll: powerOnNodes, @@ -88,32 +58,27 @@ return service; - function deleteNode(node) { - var labels = { - title: DELETE_NODE_TITLE, - message: DELETE_NODE_MSG, - submit: DELETE_NODE_TITLE, - success: DELETE_NODE_SUCCESS, - error: DELETE_NODE_ERROR - }; + function deleteNode(nodes) { var context = { - labels: labels, - deleteEntity: ironic.deleteNode, - successEvent: ironicEvents.DELETE_NODE_SUCCESS - }; - return deleteModalService.open($rootScope, [node], context); - } - - function deleteNodes(nodes) { - var labels = { - title: DELETE_NODES_TITLE, - message: DELETE_NODES_MSG, - submit: DELETE_NODES_TITLE, - success: DELETE_NODES_SUCCESS, - error: DELETE_NODES_ERROR - }; - var context = { - labels: labels, + labels: { + title: ngettext("Delete Node", + "Delete Nodes", + nodes.length), + message: ngettext('Are you sure you want to delete node "%s"? ' + + 'This action cannot be undone.', + 'Are you sure you want to delete nodes "%s"? ' + + 'This action cannot be undone.', + nodes.length), + submit: ngettext("Delete Node", + "Delete Nodes", + nodes.length), + success: ngettext('Successfully deleted node "%s"', + 'Successfully deleted nodes "%s"', + nodes.length), + error: ngettext('Unable to delete node "%s"', + 'Unable to delete nodes "%s"', + nodes.length) + }, deleteEntity: ironic.deleteNode, successEvent: ironicEvents.DELETE_NODE_SUCCESS }; @@ -210,32 +175,27 @@ return createPortService.modal(node); } - function deletePort(port) { - var labels = { - title: DELETE_PORT_TITLE, - message: DELETE_PORT_MSG, - submit: DELETE_PORT_TITLE, - success: DELETE_PORT_SUCCESS, - error: DELETE_PORT_ERROR - }; + function deletePort(ports) { var context = { - labels: labels, - deleteEntity: ironic.deletePort, - successEvent: ironicEvents.DELETE_PORT_SUCCESS - }; - return deleteModalService.open($rootScope, [port], context); - } - - function deletePorts(ports) { - var labels = { - title: DELETE_PORTS_TITLE, - message: DELETE_PORTS_MSG, - submit: DELETE_PORTS_TITLE, - success: DELETE_PORTS_SUCCESS, - error: DELETE_PORTS_ERROR - }; - var context = { - labels: labels, + labels: { + title: ngettext("Delete Port", + "Delete Ports", + ports.length), + message: ngettext('Are you sure you want to delete port "%s"? ' + + 'This action cannot be undone.', + 'Are you sure you want to delete ports "%s"? ' + + 'This action cannot be undone.', + ports.length), + submit: ngettext("Delete Port", + "Delete Ports", + ports.length), + success: ngettext('Successfully deleted port "%s"', + 'Successfully deleted ports "%s"', + ports.length), + error: ngettext('Unable to delete port "%s"', + 'Unable to delete portss "%s"', + ports.length) + }, deleteEntity: ironic.deletePort, successEvent: ironicEvents.DELETE_PORT_SUCCESS }; diff --git a/ironic_ui/static/dashboard/admin/ironic/node-details/node-details.controller.js b/ironic_ui/static/dashboard/admin/ironic/node-details/node-details.controller.js index d1d3e5ab..e41bf493 100755 --- a/ironic_ui/static/dashboard/admin/ironic/node-details/node-details.controller.js +++ b/ironic_ui/static/dashboard/admin/ironic/node-details/node-details.controller.js @@ -81,7 +81,6 @@ ctrl.editNode = editNode; ctrl.createPort = createPort; ctrl.deletePort = deletePort; - ctrl.deletePorts = deletePorts; ctrl.refresh = refresh; var editNodeHandler = @@ -161,6 +160,7 @@ ctrl.portsSrc = response.data.items; ctrl.portsSrc.forEach(function(port) { port.id = port.uuid; + port.name = port.address; }); }); } @@ -216,28 +216,13 @@ /** * @name horizon.dashboard.admin.ironic.NodeDetailsController.deletePort - * @description Delete a specified port + * @description Delete a list of ports * - * @param {port []} port – port to be deleted + * @param {port []} ports – ports to be deleted * @return {void} */ - function deletePort(port) { - ctrl.actions.deletePort({id: port.uuid, name: port.address}); - } - - /** - * @name horizon.dashboard.admin.ironic.NodeDetailsController.deletePorts - * @description Delete a specified list of ports - * - * @param {port []} ports – list of ports to be deleted - * @return {void} - */ - function deletePorts(ports) { - var selectedPorts = []; - angular.forEach(ports, function(port) { - selectedPorts.push({id: port.uuid, name: port.address}); - }); - ctrl.actions.deletePorts(selectedPorts); + function deletePort(ports) { + actions.deletePort(ports); } /** diff --git a/ironic_ui/static/dashboard/admin/ironic/node-details/sections/configuration.html b/ironic_ui/static/dashboard/admin/ironic/node-details/sections/configuration.html index 66164522..d73c892e 100644 --- a/ironic_ui/static/dashboard/admin/ironic/node-details/sections/configuration.html +++ b/ironic_ui/static/dashboard/admin/ironic/node-details/sections/configuration.html @@ -33,7 +33,7 @@ @@ -88,7 +88,7 @@ + item="[port]"> diff --git a/ironic_ui/static/dashboard/admin/ironic/node-list/node-list.html b/ironic_ui/static/dashboard/admin/ironic/node-list/node-list.html index 11461df0..96b57537 100644 --- a/ironic_ui/static/dashboard/admin/ironic/node-list/node-list.html +++ b/ironic_ui/static/dashboard/admin/ironic/node-list/node-list.html @@ -57,7 +57,7 @@ {$ 'Maintenance off' | translate $} @@ -163,7 +163,7 @@ + item="[node]"> {$ 'Delete node' | translate $}