From 59c042ad67dbd06b964109b15f57b10eaa1b5fa0 Mon Sep 17 00:00:00 2001 From: GraceWalk Date: Tue, 13 Sep 2022 14:26:12 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20Topic=20=E5=88=97=E8=A1=A8=E8=B6=8B?= =?UTF-8?q?=E5=8A=BF=E5=9B=BE=E4=BC=98=E5=8C=96=20&=20=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E6=96=87=E6=A1=88=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/pages/TopicList/Create.tsx | 29 ++++------- .../src/pages/TopicList/index.less | 38 +++++++------- .../src/pages/TopicList/index.tsx | 49 +++++++++---------- 3 files changed, 51 insertions(+), 65 deletions(-) diff --git a/km-console/packages/layout-clusters-fe/src/pages/TopicList/Create.tsx b/km-console/packages/layout-clusters-fe/src/pages/TopicList/Create.tsx index 3c9442b0..218b0754 100644 --- a/km-console/packages/layout-clusters-fe/src/pages/TopicList/Create.tsx +++ b/km-console/packages/layout-clusters-fe/src/pages/TopicList/Create.tsx @@ -1,19 +1,6 @@ import React, { useState, useEffect } from 'react'; import { useParams } from 'react-router-dom'; -import { - Alert, - Button, - Checkbox, - Divider, - Drawer, - Form, - Input, - InputNumber, - Modal, - notification, - Select, - Utils, -} from 'knowdesign'; +import { Alert, Button, Checkbox, Divider, Drawer, Form, Input, InputNumber, Modal, notification, Select, Utils } from 'knowdesign'; import { PlusOutlined, DownOutlined, UpOutlined } from '@ant-design/icons'; import Api from '@src/api/index'; @@ -120,9 +107,9 @@ export default (props: any) => { res = item.name === 'cleanup.policy' ? item.defaultValue - .replace(/\[|\]|\s+/g, '') - .split(',') - .filter((_) => _) + .replace(/\[|\]|\s+/g, '') + .split(',') + .filter((_) => _) : item.defaultValue; } catch (e) { res = []; @@ -317,7 +304,7 @@ export default (props: any) => { } />
- + { {defaultConfigs .filter((dc) => !customDefaultFields.includes(dc.name)) .map((configItem, i) => ( - + ))} diff --git a/km-console/packages/layout-clusters-fe/src/pages/TopicList/index.less b/km-console/packages/layout-clusters-fe/src/pages/TopicList/index.less index 6dbcc748..669e85fb 100644 --- a/km-console/packages/layout-clusters-fe/src/pages/TopicList/index.less +++ b/km-console/packages/layout-clusters-fe/src/pages/TopicList/index.less @@ -19,6 +19,7 @@ align-items: center; > span { margin-left: 4px; + color: #74788d; } } } @@ -36,7 +37,7 @@ width: 120px; margin-right: 8px; } - .batch-btn{ + .batch-btn { margin-right: 8px; } .add-btn { @@ -51,44 +52,44 @@ } } .metric-data-wrap { - display: flex; - align-items: center; + // display: flex; + // align-items: center; width: 100%; .cur-val { - width: 34px; - margin-right: 11px; + display: block; + text-align: right; } - .dcloud-spin-nested-loading{ + .dcloud-spin-nested-loading { flex: 1; } } .del-topic-modal, .cluster-topic-add { .tip-info { - height: 27px; - line-height: 27px; + display: flex; color: #592d00; - padding: 0 14px; + padding: 6px 14px; font-size: 13px; background: #fffae0; border-radius: 4px; .anticon { color: #ffc300; margin-right: 4px; + margin-top: 3px; } .test-right-away { color: #556ee6; cursor: pointer; } - .dcloud-alert-content{ + .dcloud-alert-content { flex: none; } } } .cluster-topic-add { - .data-save-time-label{ - &>.dcloud-form-item-control{ - &>.dcloud-form-item-explain{ + .data-save-time-label { + & > .dcloud-form-item-control { + & > .dcloud-form-item-explain { display: none; } } @@ -124,11 +125,11 @@ display: flex; justify-content: center; align-items: center; - color: #556EE6; + color: #556ee6; .txt { width: 26px; margin-right: 4px; - color: #556EE6; + color: #556ee6; font-family: @font-family; } .anticon { @@ -226,12 +227,11 @@ } } - -.create-topic-flex-layout{ +.create-topic-flex-layout { display: flex; flex-wrap: wrap; justify-content: space-between; - .dcloud-form-item{ + .dcloud-form-item { width: 370px; } -} \ No newline at end of file +} diff --git a/km-console/packages/layout-clusters-fe/src/pages/TopicList/index.tsx b/km-console/packages/layout-clusters-fe/src/pages/TopicList/index.tsx index 02db801e..5bce3d6c 100644 --- a/km-console/packages/layout-clusters-fe/src/pages/TopicList/index.tsx +++ b/km-console/packages/layout-clusters-fe/src/pages/TopicList/index.tsx @@ -91,21 +91,9 @@ const AutoPage = (props: any) => { if (metricName === 'HealthScore') { return Math.round(orgVal); } else if (metricName === 'LogSize') { - return Number(Utils.formatAssignSize(orgVal, 'MB')).toString().length > 3 ? ( - - {Number(Utils.formatAssignSize(orgVal, 'MB')).toString().slice(0, 3) + '...'} - - ) : ( - Number(Utils.formatAssignSize(orgVal, 'MB')) - ); + return Number(Utils.formatAssignSize(orgVal, 'MB')); } else { - return Number(Utils.formatAssignSize(orgVal, 'KB')).toString().length > 3 ? ( - - {Number(Utils.formatAssignSize(orgVal, 'KB')).toString().slice(0, 3) + '...'} - - ) : ( - Number(Utils.formatAssignSize(orgVal, 'KB')) - ); + return Number(Utils.formatAssignSize(orgVal, 'KB')); // return Utils.formatAssignSize(orgVal, 'KB'); } } @@ -116,15 +104,15 @@ const AutoPage = (props: any) => { const points = record.metricLines.find((item: any) => item.metricName === metricName)?.metricPoints || []; return (
- {calcCurValue(record, metricName)} ({ time: item.timeStamp, value: item.value })), }} /> + {calcCurValue(record, metricName)}
); }; @@ -268,12 +256,16 @@ const AutoPage = (props: any) => { const menu = ( - - setChangeVisible(true)}>扩缩副本 - - - setMoveVisible(true)}>迁移副本 - + {global.hasPermission(ClustersPermissionMap.TOPIC_CHANGE_REPLICA) && ( + + setChangeVisible(true)}>扩缩副本 + + )} + {global.hasPermission(ClustersPermissionMap.TOPIC_MOVE_REPLICA) && ( + + setMoveVisible(true)}>迁移副本 + + )} ); @@ -345,11 +337,14 @@ const AutoPage = (props: any) => { setSearchKeywordsInput(e.target.value); }} /> - - - + {(global.hasPermission(ClustersPermissionMap.TOPIC_CHANGE_REPLICA) || + global.hasPermission(ClustersPermissionMap.TOPIC_MOVE_REPLICA)) && ( + + + + )} {global.hasPermission && global.hasPermission(ClustersPermissionMap.TOPIC_ADD) ? ( ) : (