From b3f8b46f0f168e201a5e0728ed985a900872aa9f Mon Sep 17 00:00:00 2001 From: GraceWalk Date: Tue, 13 Sep 2022 14:42:21 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=89=A9=E7=BC=A9/?= =?UTF-8?q?=E8=BF=81=E7=A7=BB=E5=89=AF=E6=9C=AC=E6=97=A0=E6=B3=95=E9=80=89?= =?UTF-8?q?=E4=B8=AD=E9=BB=98=E8=AE=A4=20Topic=20=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98=20&=20=E8=BF=81=E7=A7=BB=E5=89=AF=E6=9C=AC=20Topic=20?= =?UTF-8?q?=E8=BF=81=E7=A7=BB=E6=97=B6=E9=97=B4=E5=8D=95=E4=BD=8D=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E5=88=86=E9=92=9F=E7=B2=92=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/TopicJob/ReplicaChange.tsx | 7 ++- .../src/components/TopicJob/ReplicaMove.tsx | 45 ++++++++++++++++--- .../src/components/TopicJob/index.less | 19 +++++--- .../TestingProduce/component/EditTable.tsx | 8 ++-- 4 files changed, 60 insertions(+), 19 deletions(-) diff --git a/km-console/packages/layout-clusters-fe/src/components/TopicJob/ReplicaChange.tsx b/km-console/packages/layout-clusters-fe/src/components/TopicJob/ReplicaChange.tsx index f54b2179..16637b9c 100644 --- a/km-console/packages/layout-clusters-fe/src/components/TopicJob/ReplicaChange.tsx +++ b/km-console/packages/layout-clusters-fe/src/components/TopicJob/ReplicaChange.tsx @@ -30,8 +30,8 @@ const { TextArea } = Input; const { Option } = Select; const jobNameMap: any = { - expandAndReduce: '批量扩缩副本', - transfer: '批量迁移副本', + expandAndReduce: '扩缩副本', + transfer: '迁移副本', }; interface DefaultConfig { @@ -325,8 +325,7 @@ export default (props: DefaultConfig) => { !jobId && Utils.request(Api.getTopicMetaData(+routeParams.clusterId)) .then((res: any) => { - const filterRes = res.filter((item: any) => item.type !== 1); - const topics = (filterRes || []).map((item: any) => { + const topics = (res || []).map((item: any) => { return { label: item.topicName, value: item.topicName, diff --git a/km-console/packages/layout-clusters-fe/src/components/TopicJob/ReplicaMove.tsx b/km-console/packages/layout-clusters-fe/src/components/TopicJob/ReplicaMove.tsx index 892e2586..c8c939dd 100644 --- a/km-console/packages/layout-clusters-fe/src/components/TopicJob/ReplicaMove.tsx +++ b/km-console/packages/layout-clusters-fe/src/components/TopicJob/ReplicaMove.tsx @@ -19,6 +19,7 @@ import { Divider, Transfer, IconFont, + Tooltip, } from 'knowdesign'; import './index.less'; import Api, { MetricType } from '@src/api/index'; @@ -31,8 +32,8 @@ const { TextArea } = Input; const { Option } = Select; const jobNameMap: any = { - expandAndReduce: '批量扩缩副本', - transfer: '批量迁移副本', + expandAndReduce: '扩缩副本', + transfer: '迁移副本', }; interface DefaultConfig { @@ -56,6 +57,7 @@ export default (props: DefaultConfig) => { const [topicNewReplicas, setTopicNewReplicas] = useState([]); const [needMovePartitions, setNeedMovePartitions] = useState([]); const [moveDataTimeRanges, setMoveDataTimeRanges] = useState([]); + const [moveDataTimeRangesType, setMoveDataTimeRangesType] = useState([]); const [form] = Form.useForm(); const [global] = AppContainer.useGlobalValue(); const [loadingTopic, setLoadingTopic] = useState(true); @@ -142,8 +144,23 @@ export default (props: DefaultConfig) => { title: '迁移数据时间范围', dataIndex: 'newRetentionMs', render: (v: any, r: any, i: number) => { + const selectAfter = ( + + ); return ( { moveDataTimeRangesCopy[i] = n; setMoveDataTimeRanges(moveDataTimeRangesCopy); }} - formatter={(value) => (value ? `${value} h` : '')} - parser={(value) => value.replace('h', '')} + className={'move-dete-time-tanges'} + // formatter={(value) => (value ? `${value} h` : '')} + // parser={(value) => value.replace('h', '')} + addonAfter={selectAfter} > ); }, @@ -319,8 +338,7 @@ export default (props: DefaultConfig) => { drawerVisible && Utils.request(Api.getTopicMetaData(+routeParams.clusterId)) .then((res: any) => { - const filterRes = res.filter((item: any) => item.type !== 1); - const topics = (filterRes || []).map((item: any) => { + const topics = (res || []).map((item: any) => { return { label: item.topicName, value: item.topicName, @@ -402,7 +420,7 @@ export default (props: DefaultConfig) => { originalBrokerIdList: taskPlanData[index].currentBrokerIdList, reassignBrokerIdList: taskPlanData[index].reassignBrokerIdList, originalRetentionTimeUnitMs: topicData[index].retentionMs, - reassignRetentionTimeUnitMs: moveDataTimeRanges[index] * 60 * 60 * 1000, + reassignRetentionTimeUnitMs: (moveDataTimeRanges[index] * 60 * 60 * 1000) / (moveDataTimeRangesType[index] || 1), latestDaysAvgBytesInList: topicData[index].latestDaysAvgBytesInList, latestDaysMaxBytesInList: topicData[index].latestDaysMaxBytesInList, partitionPlanList: taskPlanData[index].partitionPlanList, @@ -476,6 +494,19 @@ export default (props: DefaultConfig) => { setTopicSelectValue(v); }} options={topicMetaData} + // 点击Tooltip会触发Select的下拉 + // maxTagPlaceholder={(v) => { + // const tooltipValue = v + // .map((item) => { + // return item.value; + // }) + // .join('、'); + // return ( + // + // {'+' + v.length + '...'} + // + // ); + // }} > diff --git a/km-console/packages/layout-clusters-fe/src/components/TopicJob/index.less b/km-console/packages/layout-clusters-fe/src/components/TopicJob/index.less index 7576f159..794a252e 100644 --- a/km-console/packages/layout-clusters-fe/src/components/TopicJob/index.less +++ b/km-console/packages/layout-clusters-fe/src/components/TopicJob/index.less @@ -64,11 +64,6 @@ .task-form { margin-top: 16px; } - - .dcloud-select-selector { - max-height: 100px; - overflow: scroll; - } } .preview-task-plan-drawer { @@ -80,4 +75,18 @@ background: #F8F9FA; } } +} + +.move-dete-time-tanges{ + .dcloud-input-number-input-wrap{ + width: 80px; + } + .dcloud-input-number-wrapper{ + .dcloud-select-selector{ + border-top-left-radius: 0 !important; + border-bottom-left-radius: 0 !important; + background-color: inherit !important; + background: #F8F9FA; + } + } } \ No newline at end of file diff --git a/km-console/packages/layout-clusters-fe/src/pages/TestingProduce/component/EditTable.tsx b/km-console/packages/layout-clusters-fe/src/pages/TestingProduce/component/EditTable.tsx index 620cb6a6..49e2568d 100644 --- a/km-console/packages/layout-clusters-fe/src/pages/TestingProduce/component/EditTable.tsx +++ b/km-console/packages/layout-clusters-fe/src/pages/TestingProduce/component/EditTable.tsx @@ -1,13 +1,15 @@ /* eslint-disable react/display-name */ import React, { useState } from 'react'; -import { Table, Input, InputNumber, Popconfirm, Form, Typography, Button, message, IconFont } from 'knowdesign'; +import { Table, Input, InputNumber, Popconfirm, Form, Typography, Button, message, IconFont, Select } from 'knowdesign'; import './style/edit-table.less'; import { CheckOutlined, CloseOutlined, PlusSquareOutlined } from '@ant-design/icons'; -const EditableCell = ({ editing, dataIndex, title, inputType, placeholder, record, index, children, ...restProps }: any) => { +const EditableCell = ({ editing, dataIndex, title, inputType, placeholder, record, index, children, options, ...restProps }: any) => { const inputNode = inputType === 'number' ? ( - + + ) : inputType === 'select' ? ( + );