Merge "Remove node-action deleteNodes/deletePorts functions"
This commit is contained in:
commit
1e879996ff
@ -20,34 +20,6 @@
|
|||||||
var POWER_STATE_ON = 'power on';
|
var POWER_STATE_ON = 'power on';
|
||||||
var POWER_STATE_OFF = 'power off';
|
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
|
angular
|
||||||
.module('horizon.dashboard.admin.ironic')
|
.module('horizon.dashboard.admin.ironic')
|
||||||
.factory('horizon.dashboard.admin.ironic.actions', actions);
|
.factory('horizon.dashboard.admin.ironic.actions', actions);
|
||||||
@ -72,9 +44,7 @@
|
|||||||
var service = {
|
var service = {
|
||||||
createPort: createPort,
|
createPort: createPort,
|
||||||
deleteNode: deleteNode,
|
deleteNode: deleteNode,
|
||||||
deleteNodes: deleteNodes,
|
|
||||||
deletePort: deletePort,
|
deletePort: deletePort,
|
||||||
deletePorts: deletePorts,
|
|
||||||
powerOn: powerOn,
|
powerOn: powerOn,
|
||||||
powerOff: powerOff,
|
powerOff: powerOff,
|
||||||
powerOnAll: powerOnNodes,
|
powerOnAll: powerOnNodes,
|
||||||
@ -88,32 +58,27 @@
|
|||||||
|
|
||||||
return service;
|
return service;
|
||||||
|
|
||||||
function deleteNode(node) {
|
function deleteNode(nodes) {
|
||||||
var labels = {
|
|
||||||
title: DELETE_NODE_TITLE,
|
|
||||||
message: DELETE_NODE_MSG,
|
|
||||||
submit: DELETE_NODE_TITLE,
|
|
||||||
success: DELETE_NODE_SUCCESS,
|
|
||||||
error: DELETE_NODE_ERROR
|
|
||||||
};
|
|
||||||
var context = {
|
var context = {
|
||||||
labels: labels,
|
labels: {
|
||||||
deleteEntity: ironic.deleteNode,
|
title: ngettext("Delete Node",
|
||||||
successEvent: ironicEvents.DELETE_NODE_SUCCESS
|
"Delete Nodes",
|
||||||
};
|
nodes.length),
|
||||||
return deleteModalService.open($rootScope, [node], context);
|
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"? ' +
|
||||||
function deleteNodes(nodes) {
|
'This action cannot be undone.',
|
||||||
var labels = {
|
nodes.length),
|
||||||
title: DELETE_NODES_TITLE,
|
submit: ngettext("Delete Node",
|
||||||
message: DELETE_NODES_MSG,
|
"Delete Nodes",
|
||||||
submit: DELETE_NODES_TITLE,
|
nodes.length),
|
||||||
success: DELETE_NODES_SUCCESS,
|
success: ngettext('Successfully deleted node "%s"',
|
||||||
error: DELETE_NODES_ERROR
|
'Successfully deleted nodes "%s"',
|
||||||
};
|
nodes.length),
|
||||||
var context = {
|
error: ngettext('Unable to delete node "%s"',
|
||||||
labels: labels,
|
'Unable to delete nodes "%s"',
|
||||||
|
nodes.length)
|
||||||
|
},
|
||||||
deleteEntity: ironic.deleteNode,
|
deleteEntity: ironic.deleteNode,
|
||||||
successEvent: ironicEvents.DELETE_NODE_SUCCESS
|
successEvent: ironicEvents.DELETE_NODE_SUCCESS
|
||||||
};
|
};
|
||||||
@ -210,32 +175,27 @@
|
|||||||
return createPortService.modal(node);
|
return createPortService.modal(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
function deletePort(port) {
|
function deletePort(ports) {
|
||||||
var labels = {
|
|
||||||
title: DELETE_PORT_TITLE,
|
|
||||||
message: DELETE_PORT_MSG,
|
|
||||||
submit: DELETE_PORT_TITLE,
|
|
||||||
success: DELETE_PORT_SUCCESS,
|
|
||||||
error: DELETE_PORT_ERROR
|
|
||||||
};
|
|
||||||
var context = {
|
var context = {
|
||||||
labels: labels,
|
labels: {
|
||||||
deleteEntity: ironic.deletePort,
|
title: ngettext("Delete Port",
|
||||||
successEvent: ironicEvents.DELETE_PORT_SUCCESS
|
"Delete Ports",
|
||||||
};
|
ports.length),
|
||||||
return deleteModalService.open($rootScope, [port], context);
|
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"? ' +
|
||||||
function deletePorts(ports) {
|
'This action cannot be undone.',
|
||||||
var labels = {
|
ports.length),
|
||||||
title: DELETE_PORTS_TITLE,
|
submit: ngettext("Delete Port",
|
||||||
message: DELETE_PORTS_MSG,
|
"Delete Ports",
|
||||||
submit: DELETE_PORTS_TITLE,
|
ports.length),
|
||||||
success: DELETE_PORTS_SUCCESS,
|
success: ngettext('Successfully deleted port "%s"',
|
||||||
error: DELETE_PORTS_ERROR
|
'Successfully deleted ports "%s"',
|
||||||
};
|
ports.length),
|
||||||
var context = {
|
error: ngettext('Unable to delete port "%s"',
|
||||||
labels: labels,
|
'Unable to delete portss "%s"',
|
||||||
|
ports.length)
|
||||||
|
},
|
||||||
deleteEntity: ironic.deletePort,
|
deleteEntity: ironic.deletePort,
|
||||||
successEvent: ironicEvents.DELETE_PORT_SUCCESS
|
successEvent: ironicEvents.DELETE_PORT_SUCCESS
|
||||||
};
|
};
|
||||||
|
@ -81,7 +81,6 @@
|
|||||||
ctrl.editNode = editNode;
|
ctrl.editNode = editNode;
|
||||||
ctrl.createPort = createPort;
|
ctrl.createPort = createPort;
|
||||||
ctrl.deletePort = deletePort;
|
ctrl.deletePort = deletePort;
|
||||||
ctrl.deletePorts = deletePorts;
|
|
||||||
ctrl.refresh = refresh;
|
ctrl.refresh = refresh;
|
||||||
|
|
||||||
var editNodeHandler =
|
var editNodeHandler =
|
||||||
@ -161,6 +160,7 @@
|
|||||||
ctrl.portsSrc = response.data.items;
|
ctrl.portsSrc = response.data.items;
|
||||||
ctrl.portsSrc.forEach(function(port) {
|
ctrl.portsSrc.forEach(function(port) {
|
||||||
port.id = port.uuid;
|
port.id = port.uuid;
|
||||||
|
port.name = port.address;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -216,28 +216,13 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @name horizon.dashboard.admin.ironic.NodeDetailsController.deletePort
|
* @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}
|
* @return {void}
|
||||||
*/
|
*/
|
||||||
function deletePort(port) {
|
function deletePort(ports) {
|
||||||
ctrl.actions.deletePort({id: port.uuid, name: port.address});
|
actions.deletePort(ports);
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
</action>
|
</action>
|
||||||
<menu>
|
<menu>
|
||||||
<action button-type="menu-item"
|
<action button-type="menu-item"
|
||||||
callback="ctrl.deletePorts"
|
callback="ctrl.deletePort"
|
||||||
item="tCtrl.selected"
|
item="tCtrl.selected"
|
||||||
disabled="tCtrl.selected.length === 0">
|
disabled="tCtrl.selected.length === 0">
|
||||||
<span class="fa fa-trash"></span>
|
<span class="fa fa-trash"></span>
|
||||||
@ -88,7 +88,7 @@
|
|||||||
<action-list>
|
<action-list>
|
||||||
<action action-classes="'btn btn-default btn-sm'"
|
<action action-classes="'btn btn-default btn-sm'"
|
||||||
callback="ctrl.deletePort"
|
callback="ctrl.deletePort"
|
||||||
item="port">
|
item="[port]">
|
||||||
<span class="fa fa-trash"></span>
|
<span class="fa fa-trash"></span>
|
||||||
</action>
|
</action>
|
||||||
</action-list>
|
</action-list>
|
||||||
|
@ -57,7 +57,7 @@
|
|||||||
{$ 'Maintenance off' | translate $}
|
{$ 'Maintenance off' | translate $}
|
||||||
</action>
|
</action>
|
||||||
<action button-type="menu-item"
|
<action button-type="menu-item"
|
||||||
callback="table.actions.deleteNodes"
|
callback="table.actions.deleteNode"
|
||||||
item="tCtrl.selected"
|
item="tCtrl.selected"
|
||||||
disabled="tCtrl.selected.length === 0">
|
disabled="tCtrl.selected.length === 0">
|
||||||
<span class="fa fa-trash"></span>
|
<span class="fa fa-trash"></span>
|
||||||
@ -163,7 +163,7 @@
|
|||||||
<action button-type="menu-item"
|
<action button-type="menu-item"
|
||||||
callback="table.actions.deleteNode"
|
callback="table.actions.deleteNode"
|
||||||
disabled="!(node.provision_state === 'available' || node.provision_state === 'nostate' || node.provision_state === 'manageable' || node.provision_state === 'enroll')"
|
disabled="!(node.provision_state === 'available' || node.provision_state === 'nostate' || node.provision_state === 'manageable' || node.provision_state === 'enroll')"
|
||||||
item="node">
|
item="[node]">
|
||||||
<span class="fa fa-trash"></span>
|
<span class="fa fa-trash"></span>
|
||||||
{$ 'Delete node' | translate $}
|
{$ 'Delete node' | translate $}
|
||||||
</action>
|
</action>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user