From 1b0fe95ae3bf583fd4543fde9ae87dce83cc4a32 Mon Sep 17 00:00:00 2001 From: mathieuRA Date: Wed, 11 Dec 2024 15:10:12 +0100 Subject: [PATCH] front --- packages/xo-web/src/common/intl/messages.js | 1 + packages/xo-web/src/common/xo/utils.js | 4 ++ .../xo-web/src/xo-app/host/tab-patches.js | 28 ++++++++---- .../xo-web/src/xo-app/pool/tab-patches.js | 45 +++++++++++++------ 4 files changed, 56 insertions(+), 22 deletions(-) diff --git a/packages/xo-web/src/common/intl/messages.js b/packages/xo-web/src/common/intl/messages.js index aa3d7d8a049..b88d29f7f43 100644 --- a/packages/xo-web/src/common/intl/messages.js +++ b/packages/xo-web/src/common/intl/messages.js @@ -54,6 +54,7 @@ const messages = { notifications: 'Notifications', noNotifications: 'No notifications so far.', notificationNew: 'NEW!', + notYetAvailableForXs8: 'Not yet available for XenServer 8', moreDetails: 'More details', messageSubject: 'Subject', messageFrom: 'From', diff --git a/packages/xo-web/src/common/xo/utils.js b/packages/xo-web/src/common/xo/utils.js index 2178e992adc..b4f9789bb92 100644 --- a/packages/xo-web/src/common/xo/utils.js +++ b/packages/xo-web/src/common/xo/utils.js @@ -1,4 +1,5 @@ import defined from '@xen-orchestra/defined' +import semver from 'semver' import { find, forEach, includes, map } from 'lodash' export const getDefaultNetworkForVif = (vif, destHost, pifs, networks) => { @@ -41,3 +42,6 @@ export const getDefaultMigrationNetwork = (intraPool, destHost, pools, pifs) => intraPool ? {} : defaultPif ).$network } + +export const isXsHostWithCdnPatches = ({ version, productBrand }) => + productBrand === 'XenServer' && semver.gte(version, '8.4.0') diff --git a/packages/xo-web/src/xo-app/host/tab-patches.js b/packages/xo-web/src/xo-app/host/tab-patches.js index 5962a25351e..4671a981944 100644 --- a/packages/xo-web/src/xo-app/host/tab-patches.js +++ b/packages/xo-web/src/xo-app/host/tab-patches.js @@ -13,6 +13,7 @@ import { installAllPatchesOnHost, restartHost } from 'xo' import isEmpty from 'lodash/isEmpty.js' import { createGetObject } from '../../common/selectors' +import { isXsHostWithCdnPatches } from '../../common/xo/utils' const MISSING_PATCH_COLUMNS = [ { @@ -163,7 +164,7 @@ class XcpPatches extends Component { /> )} @@ -210,12 +212,18 @@ class XenServerPatches extends Component { /> )} @@ -227,12 +235,14 @@ class XenServerPatches extends Component { )} - - -

{_('hostAppliedPatches')}

- - -
+ {!_isXsHostWithCdnPatches && ( + + +

{_('hostAppliedPatches')}

+ + +
+ )} ) } diff --git a/packages/xo-web/src/xo-app/pool/tab-patches.js b/packages/xo-web/src/xo-app/pool/tab-patches.js index a6144caab27..abd868403c8 100644 --- a/packages/xo-web/src/xo-app/pool/tab-patches.js +++ b/packages/xo-web/src/xo-app/pool/tab-patches.js @@ -22,6 +22,7 @@ import filter from 'lodash/filter.js' import isEmpty from 'lodash/isEmpty.js' import size from 'lodash/size.js' import some from 'lodash/some.js' +import { isXsHostWithCdnPatches } from 'xo/utils' const ROLLING_POOL_UPDATES_AVAILABLE = getXoaPlan().value >= ENTERPRISE.value @@ -59,7 +60,8 @@ const MISSING_PATCH_COLUMNS = [ const ACTIONS = [ { - disabled: (_, { pool, needsCredentials }) => pool.HA_enabled || needsCredentials, + disabled: (_, { isXsHostWithCdnPatches, pool, needsCredentials }) => + pool.HA_enabled || needsCredentials || isXsHostWithCdnPatches, handler: (patches, { pool }) => installPatches(patches, pool), icon: 'host-patch-update', label: _('install'), @@ -223,14 +225,16 @@ export default class TabPatches extends Component { render() { const { hostPatches, - master: { productBrand }, + master: { productBrand, version }, missingPatches = [], pool, poolHosts, userPreferences, } = this.props - const needsCredentials = productBrand !== 'XCP-ng' && userPreferences.xsCredentials === undefined + const _isXsHostWithCdnPatches = isXsHostWithCdnPatches({ version, productBrand }) + const needsCredentials = + productBrand !== 'XCP-ng' && !_isXsHostWithCdnPatches && userPreferences.xsCredentials === undefined const isSingleHost = size(poolHosts) < 2 @@ -246,7 +250,11 @@ export default class TabPatches extends Component { )} @@ -318,18 +330,25 @@ export default class TabPatches extends Component { actions={ACTIONS} collection={missingPatches} columns={MISSING_PATCH_COLUMNS} + data-isXsHostWithCdnPatches={_isXsHostWithCdnPatches} data-pool={pool} data-needsCredentials={needsCredentials} stateUrlParam='s_missing' /> - - -

{_('hostAppliedPatches')}

- - -
+ {!_isXsHostWithCdnPatches && ( + + +

{_('hostAppliedPatches')}

+ + +
+ )} )}