diff --git a/web/console/src/modules/cluster/components/clusterManage/ClusterTablePanel.tsx b/web/console/src/modules/cluster/components/clusterManage/ClusterTablePanel.tsx index e38d586dd1..45e856f77c 100644 --- a/web/console/src/modules/cluster/components/clusterManage/ClusterTablePanel.tsx +++ b/web/console/src/modules/cluster/components/clusterManage/ClusterTablePanel.tsx @@ -18,20 +18,19 @@ import * as React from 'react'; import { connect } from 'react-redux'; -import { Bubble, Button, Drawer, Icon, Text, Dropdown, List } from '@tea/component'; +import { Bubble, Button, Drawer, Dropdown, Icon, List, Text } from '@tea/component'; import { TablePanel, TablePanelColumnProps } from '@tencent/ff-component'; import { bindActionCreators } from '@tencent/ff-redux'; import { ChartPanel } from '@tencent/tchart'; -import { t, Trans } from '@tencent/tea-app/lib/i18n'; +import { Trans, t } from '@tencent/tea-app/lib/i18n'; import { dateFormatter } from '../../../../../helpers'; -import { router as addonRouter } from '../../../addon/router'; import { Clip, LinkButton, TipInfo } from '../../../common/components'; import { Cluster } from '../../../common/models'; import { allActions } from '../../actions'; import { ClusterTypeMap } from '../../constants/Config'; import { DialogNameEnum } from '../../models'; -import { getClusterTables, MonitorPanelProps } from '../../models/MonitorPanel'; +import { MonitorPanelProps, getClusterTables } from '../../models/MonitorPanel'; import { router } from '../../router'; import { RootProps } from '../ClusterApp'; import { KubectlDialog } from '../KubectlDialog'; diff --git a/web/console/src/modules/cluster/components/resource/resourceDetail/ResourceDetailPanel.tsx b/web/console/src/modules/cluster/components/resource/resourceDetail/ResourceDetailPanel.tsx index 905de449a5..515646317e 100644 --- a/web/console/src/modules/cluster/components/resource/resourceDetail/ResourceDetailPanel.tsx +++ b/web/console/src/modules/cluster/components/resource/resourceDetail/ResourceDetailPanel.tsx @@ -27,7 +27,7 @@ import { dateFormatter } from '../../../../../../helpers'; import { HeadBubble, ListItem } from '../../../../common/components'; import { DetailLayout } from '../../../../common/layouts'; import { DetailDisplayFieldProps, DetailInfoProps } from '../../../../common/models'; -import { cloneDeep, isEmpty } from '../../../../common/utils'; +import { isEmpty } from '../../../../common/utils'; import { allActions } from '../../../actions'; import { ExternalTrafficPolicy, ResourceStatus, SessionAffinity } from '../../../constants/Config'; import { BackendGroup, BackendRecord, CreateResource, LbcfResource, PortMap, Resource, RuleMap } from '../../../models'; @@ -52,23 +52,23 @@ export class ResourceDetailPanel extends React.Component { if (templatePool[item]) { //修改提示信息 - let grayUpdateContainers = templatePool[item].spec.containers.map(c => { + const grayUpdateContainers = templatePool[item].spec.containers.map(c => { return { ...c, name: `${c.name} (灰度升级${item})` @@ -97,36 +97,38 @@ export class ResourceDetailPanel extends React.Component { - let detailInfoField = basicInfo[blockKey].dataField[0].split('.'); + const detailInfoField = basicInfo[blockKey].dataField[0].split('.'); // 需要展示的详情的数据 - let detailInfo = this._getFinalData(detailInfoField, resourceIns); - let displayField = Object.keys(basicInfo[blockKey].displayField).length ? basicInfo[blockKey].displayField : {}; + const detailInfo = this._getFinalData(detailInfoField, resourceIns); + const displayField = Object.keys(basicInfo[blockKey].displayField).length + ? basicInfo[blockKey].displayField + : {}; // 需要展示的字段名 - let showField = Object.keys(displayField); + const showField = Object.keys(displayField); showField.forEach((item, showIndex) => { - let fieldInfo = displayField[item]; + const fieldInfo = displayField[item]; /** * 这里是去判断annotations里面,其为 *.*.*. 可以有很多 . * eg: storageclass.beta.kubernetes.io/is-default-class * 那么这里的 数组 ['annotations', 'storageclass.beta.kubernetes.io/is-default-class'] */ - let dataFieldIns = + const dataFieldIns = fieldInfo.dataField[0] !== '' ? fieldInfo.dataField.length > 1 ? fieldInfo.dataField @@ -138,7 +140,7 @@ export class ResourceDetailPanel extends React.Component { - let detailInfoField = basicInfo[blockKey].dataField[0].split('.'); + const detailInfoField = basicInfo[blockKey].dataField[0].split('.'); //需要展示的详情的数据 - let detailInfo = this._getFinalData(detailInfoField, resourceIns); - let displayField = Object.keys(basicInfo[blockKey].displayField).length + const detailInfo = this._getFinalData(detailInfoField, resourceIns); + const displayField = Object.keys(basicInfo[blockKey].displayField).length ? basicInfo[blockKey].displayField : {}; // 需要展示的字段名 - let showField = Object.keys(displayField); + const showField = Object.keys(displayField); showField.forEach((item, showIndex) => { - let fieldInfo = displayField[item]; - let dataFieldIns = fieldInfo.dataField[0] !== '' ? fieldInfo.dataField[0].split('.') : []; + const fieldInfo = displayField[item]; + const dataFieldIns = fieldInfo.dataField[0] !== '' ? fieldInfo.dataField[0].split('.') : []; let showData = this._getFinalData(dataFieldIns, detailInfo); // 这里是要去判断noExist的展示 @@ -251,17 +253,17 @@ export class ResourceDetailPanel extends React.Component { @@ -271,7 +273,7 @@ export class ResourceDetailPanel extends React.Component item !== 'name')[0]; // 这里是因为volumes 当中的数据卷的类型是不固定的 + const keys = Object.keys(volumn); + const label = keys.filter(item => item !== 'name')[0]; // 这里是因为volumes 当中的数据卷的类型是不固定的 return ( @@ -328,18 +330,18 @@ export class ResourceDetailPanel extends React.Component @@ -380,21 +382,23 @@ export class ResourceDetailPanel extends React.Component { - let tab = { + const tab = { id: item['name'] + index, label: item['name'] }; @@ -404,7 +408,7 @@ export class ResourceDetailPanel extends React.Component x.id === this.state.tabName); + const finder = tabs.find(x => x.id === this.state.tabName); if (finder) { selected = finder; } @@ -438,21 +442,23 @@ export class ResourceDetailPanel extends React.Component { - let tab = { + const tab = { id: item['name'] + index, label: item['name'] }; @@ -462,7 +468,7 @@ export class ResourceDetailPanel extends React.Component x.id === this.state.tabName); + const finder = tabs.find(x => x.id === this.state.tabName); if (finder) { selected = finder; } @@ -499,9 +505,9 @@ export class ResourceDetailPanel extends React.Component ( @@ -628,8 +634,12 @@ export class ResourceDetailPanel extends React.Component -

{t('名称:') + `${refData['name']}`}

-

{`Key:${refData['key']}`}

+ {Object.entries(refData ?? {}).map(([key, value]) => ( + <> +

{`${t('名称:')}${key}`}

+

{`Key:${value}`}

+ + ))} } > diff --git a/web/console/src/modules/cluster/components/resource/resourceEdition/EditResourceContainerLimitItem.tsx b/web/console/src/modules/cluster/components/resource/resourceEdition/EditResourceContainerLimitItem.tsx index a2dc9fafbc..d7359e306f 100644 --- a/web/console/src/modules/cluster/components/resource/resourceEdition/EditResourceContainerLimitItem.tsx +++ b/web/console/src/modules/cluster/components/resource/resourceEdition/EditResourceContainerLimitItem.tsx @@ -37,13 +37,13 @@ const mapDispatchToProps = dispatch => @connect(state => state, mapDispatchToProps) export class EditResourceContainerLimitItem extends React.Component { render() { - let { + const { subRoot: { workloadEdit: { oversoldRatio } } } = this.props; - let hasCpuRatio = oversoldRatio.cpu ? true : false; - let hasMemoryRatio = oversoldRatio.memory ? true : false; + const hasCpuRatio = oversoldRatio.cpu ? true : false; + const hasMemoryRatio = oversoldRatio.memory ? true : false; return (
@@ -60,6 +60,8 @@ export class EditResourceContainerLimitItem extends React.Component Limit用于设置容器使用资源的最大上限,避免异常情况下节点资源消耗过多。 +
+ 设置超售比后,此处只能设置CPU/内存Limit值,request值通过Limit和超售比计算得出。

@@ -71,15 +73,15 @@ export class EditResourceContainerLimitItem extends React.Component c.id === cKey); + const container = containers.find(c => c.id === cKey); return container.cpuLimit.map((cpu, index) => { - let partition = cpu.type === 'request' ? '-' : t('核'); - let cpuGroupClassName = cpu.type === 'request' || hasCpuRatio ? 'tc-input-group' : 'tc-input-group mr15'; + const partition = cpu.type === 'request' ? '-' : t('核'); + const cpuGroupClassName = cpu.type === 'request' || hasCpuRatio ? 'tc-input-group' : 'tc-input-group mr15'; if (hasCpuRatio && cpu.type === 'request') { return
diff --git a/web/console/src/modules/overview/components/OverviewApp.tsx b/web/console/src/modules/overview/components/OverviewApp.tsx index 1c55a18b31..3b8a8fbc63 100644 --- a/web/console/src/modules/overview/components/OverviewApp.tsx +++ b/web/console/src/modules/overview/components/OverviewApp.tsx @@ -19,18 +19,16 @@ import * as React from 'react'; import { connect, Provider } from 'react-redux'; import { bindActionCreators } from '@tencent/ff-redux'; -import { ContentView, Row, Col } from '@tencent/tea-component'; +import { Col, ContentView, Row } from '@tencent/tea-component'; import { ResetStoreAction } from '../../../../helpers'; import { overviewActions } from '../actions/overviewActions'; +import { RootState } from '../models/RootState'; import { router } from '../router'; import { configStore } from '../stores/RootStore'; -import { OverviewHeadPanel } from './OverviewHeadPanel'; -import { RootState } from '../models/RootState'; -import { ClusterOverviewPanel } from './ClusterOverview'; -import { QuickHelpPanel } from './QuickHelpPanel'; -import { TipsPanel } from './TipsPanel'; import { ClusterDetailPanel } from './ClusterDetailPanel'; +import { ClusterOverviewPanel } from './ClusterOverview'; +import { OverviewHeadPanel } from './OverviewHeadPanel'; const store = configStore(); export class OverviewAppContainer extends React.Component {