Skip to content

Commit

Permalink
fix(xo-web/host/smart reboot): XOA Premium only (#6801)
Browse files Browse the repository at this point in the history
See #6795
  • Loading branch information
pdonias authored Apr 28, 2023
1 parent c0465eb commit ac670da
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,6 @@
<!--packages-start-->

- xo-web patch

<!--packages-end-->
9 changes: 7 additions & 2 deletions packages/xo-web/src/xo-app/host/tab-advanced.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { FormattedRelative, FormattedTime } from 'react-intl'
import { Sr } from 'render-xo-item'
import { Text } from 'editable'
import { Toggle, Select, SizeInput } from 'form'
import * as xoaPlans from 'xoa-plans'
import {
detachHost,
disableHost,
Expand All @@ -44,6 +45,7 @@ import {
import { installCertificate } from './install-certificate'

const ALLOW_INSTALL_SUPP_PACK = process.env.XOA_PLAN > 1
const ALLOW_SMART_REBOOT = xoaPlans.CURRENT.value >= xoaPlans.PREMIUM.value

const SCHED_GRAN_TYPE_OPTIONS = [
{
Expand All @@ -62,7 +64,9 @@ const SCHED_GRAN_TYPE_OPTIONS = [

const forceReboot = host => restartHost(host, true)

const smartReboot = host => restartHost(host, false, true) // don't force, suspend resident VMs
const smartReboot = ALLOW_SMART_REBOOT
? host => restartHost(host, false, true) // don't force, suspend resident VMs
: () => {}

const formatPack = ({ name, author, description, version }, key) => (
<tr key={key}>
Expand Down Expand Up @@ -259,11 +263,12 @@ export default class extends Component {
<TabButton
key='smart-reboot'
btnStyle='warning'
disabled={!ALLOW_SMART_REBOOT}
handler={smartReboot}
handlerParam={host}
icon='freeze'
labelId='smartRebootHostLabel'
tooltip={_('smartRebootHostTooltip')}
tooltip={ALLOW_SMART_REBOOT ? _('smartRebootHostTooltip') : _('availableXoaPremium')}
/>,
<TabButton
key='force-reboot'
Expand Down

0 comments on commit ac670da

Please sign in to comment.