feat(xo-web/host/advanced): add button to disable/enable host (#5952)

This commit is contained in:
Rajaa.BARHTAOUI 2021-10-20 16:39:54 +02:00 committed by GitHub
parent 07cc4c853d
commit 268fb22d5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 34 additions and 0 deletions

View File

@ -9,6 +9,7 @@
- [Tasks] Filter out short tasks using a default filter (PR [#5921](https://github.com/vatesfr/xen-orchestra/pull/5921)) - [Tasks] Filter out short tasks using a default filter (PR [#5921](https://github.com/vatesfr/xen-orchestra/pull/5921))
- [Jobs] Ability to copy a job ID (PR [#5951](https://github.com/vatesfr/xen-orchestra/pull/5951)) - [Jobs] Ability to copy a job ID (PR [#5951](https://github.com/vatesfr/xen-orchestra/pull/5951))
- [Host/advanced] Add button to enable/disable the host (PR [#5952](https://github.com/vatesfr/xen-orchestra/pull/5952))
### Bug fixes ### Bug fixes

View File

@ -1751,6 +1751,8 @@ const messages = {
disconnectVbdsModalTitle: 'Disconnect VBD{nVbds, plural, one {} other {s}}', disconnectVbdsModalTitle: 'Disconnect VBD{nVbds, plural, one {} other {s}}',
disconnectVbdsModalMessage: disconnectVbdsModalMessage:
'Are you sure you want to disconnect {nVbds, number} VBD{nVbds, plural, one {} other {s}}?', 'Are you sure you want to disconnect {nVbds, number} VBD{nVbds, plural, one {} other {s}}?',
disableHost: 'Disable host',
disableHostModalMessage: 'Are you sure you want to disable {host}? This will prevent new VMs from starting.',
revertVmModalMessage: revertVmModalMessage:
'Are you sure you want to revert this VM to the snapshot state? This operation is irreversible.', 'Are you sure you want to revert this VM to the snapshot state? This operation is irreversible.',
revertVmModalSnapshotBefore: 'Snapshot before', revertVmModalSnapshotBefore: 'Snapshot before',

View File

@ -674,6 +674,15 @@ export const detachHost = host =>
}), }),
}).then(() => _call('host.detach', { host: host.id })) }).then(() => _call('host.detach', { host: host.id }))
export const disableHost = host =>
confirm({
icon: 'host-disable',
title: _('disableHost'),
body: _('disableHostModalMessage', {
host: <strong>{host.name_label}</strong>,
}),
}).then(() => _call('host.disable', { host: resolveId(host) }))
export const forgetHost = host => export const forgetHost = host =>
confirm({ confirm({
icon: 'host-forget', icon: 'host-forget',
@ -683,6 +692,8 @@ export const forgetHost = host =>
}), }),
}).then(() => _call('host.forget', { host: resolveId(host) })) }).then(() => _call('host.forget', { host: resolveId(host) }))
export const enableHost = host => _call('host.enable', { host: resolveId(host) })
export const setDefaultSr = sr => _call('pool.setDefaultSr', { sr: resolveId(sr) }) export const setDefaultSr = sr => _call('pool.setDefaultSr', { sr: resolveId(sr) })
export const setPoolMaster = host => export const setPoolMaster = host =>

View File

@ -23,8 +23,10 @@ import { Text } from 'editable'
import { Toggle, Select, SizeInput } from 'form' import { Toggle, Select, SizeInput } from 'form'
import { import {
detachHost, detachHost,
disableHost,
editHost, editHost,
enableAdvancedLiveTelemetry, enableAdvancedLiveTelemetry,
enableHost,
forgetHost, forgetHost,
installSupplementalPack, installSupplementalPack,
isHyperThreadingEnabledHost, isHyperThreadingEnabledHost,
@ -278,6 +280,24 @@ export default class extends Component {
labelId='disableMaintenanceMode' labelId='disableMaintenanceMode'
/> />
)} )}
{host.enabled ? (
<TabButton
btnStyle='warning'
handler={disableHost}
handlerParam={host}
icon='host-forget'
labelId='disableHostLabel'
/>
) : (
<TabButton
btnStyle='success'
handler={enableHost}
handlerParam={host}
icon='host-enable'
labelId='enableHostLabel'
/>
)}
<TabButton <TabButton
btnStyle='danger' btnStyle='danger'
handler={detachHost} handler={detachHost}