From fe8e59f5003bdb7c3bee1462fafb3e2187dd280b Mon Sep 17 00:00:00 2001 From: Liu Xin Date: Tue, 31 Oct 2023 11:19:32 +0800 Subject: [PATCH] fix: fix the window have scroller when it have hpa card (#4238) * fix: fix the window have scroller when it have hpa card Signed-off-by: harrisonliu5 * fix: fix horizontalpodautoscalers api version Signed-off-by: harrisonliu5 --------- Signed-off-by: harrisonliu5 --- .../projects/components/Cards/HPA/index.jsx | 39 ++++++++++++------- .../projects/components/Cards/HPA/index.scss | 6 +++ src/utils/index.js | 10 +++++ 3 files changed, 40 insertions(+), 15 deletions(-) diff --git a/src/pages/projects/components/Cards/HPA/index.jsx b/src/pages/projects/components/Cards/HPA/index.jsx index 05d3d4993d4..c55461c0fc1 100644 --- a/src/pages/projects/components/Cards/HPA/index.jsx +++ b/src/pages/projects/components/Cards/HPA/index.jsx @@ -28,6 +28,7 @@ import { Button, Icon, Dropdown, Menu, Notify } from '@kube-design/components' import { Card } from 'components/Base' import { getSuitableUnit, getValueByUnit } from 'utils/monitoring' +import { coreUnitTS } from 'utils' import styles from './index.scss' @@ -57,7 +58,8 @@ export default class HPACard extends React.Component { getValue = (data, unitType) => { const unit = getSuitableUnit(data, unitType) const result = getValueByUnit(data, unit) - return unit ? `${result} ${unit}` : result + const unitText = coreUnitTS(result, unit) + return `${result} ${unitText}` } getHPAData = () => { @@ -125,7 +127,7 @@ export default class HPACard extends React.Component { handleCancel = () => { const { detail, onDeleted } = this.props this.store.delete(detail).then(() => { - Notify.success({ content: `${t('CANCELED_SUCCESSFULLY')}` }) + Notify.success({ content: `${t('CANCEL_SUCCESSFUL')}` }) onDeleted() }) } @@ -133,20 +135,27 @@ export default class HPACard extends React.Component { renderOperations() { const menus = this.getOperations() const contenet = ( - - {menus.map(({ icon, text, show = true, ...rest }) => { - if (!show) return null - return ( - - {icon && } {text} - - ) - })} - +
+ + {menus.map(({ icon, text, show = true, ...rest }) => { + if (!show) return null + return ( + + {icon && } {text} + + ) + })} + +
) return ( - +