feat(xo-web): confirm modal before host emergency shutdown (#2714)

Fixes #2230
This commit is contained in:
Rajaa.BARHTAOUI 2018-03-02 17:05:58 +00:00 committed by Pierre Donias
parent 0c3b98d451
commit efaabb02e8
2 changed files with 9 additions and 1 deletions

View File

@ -1163,6 +1163,9 @@ const messages = {
restoreFilesUnselectAll: 'Unselect all files',
// ----- Modals -----
emergencyShutdownHostModalTitle: 'Emergency shutdown Host',
emergencyShutdownHostModalMessage:
'Are you sure you want to shutdown {host}?',
emergencyShutdownHostsModalTitle:
'Emergency shutdown Host{nHosts, plural, one {} other {s}}',
emergencyShutdownHostsModalMessage:

View File

@ -656,7 +656,12 @@ export const getHostMissingPatches = host =>
)
export const emergencyShutdownHost = host =>
_call('host.emergencyShutdownHost', { host: resolveId(host) })
confirm({
title: _('emergencyShutdownHostModalTitle'),
body: _('emergencyShutdownHostModalMessage', {
host: <strong>{host.name_label}</strong>,
}),
}).then(() => _call('host.emergencyShutdownHost', { host: resolveId(host) }))
export const emergencyShutdownHosts = hosts => {
const nHosts = size(hosts)