mirror of
https://github.com/didi/KnowStreaming.git
synced 2025-12-24 11:52:08 +08:00
[Optimize]新增Topic时清理策略区分单选多选(#770)
This commit is contained in:
@@ -22,6 +22,8 @@ export enum ControlStatusMap {
|
|||||||
TESTING_PRODUCER_HEADER = 'FETestingProducerHeader',
|
TESTING_PRODUCER_HEADER = 'FETestingProducerHeader',
|
||||||
TESTING_PRODUCER_COMPRESSION_TYPE_ZSTD = 'FETestingProducerCompressionTypeZSTD',
|
TESTING_PRODUCER_COMPRESSION_TYPE_ZSTD = 'FETestingProducerCompressionTypeZSTD',
|
||||||
TESTING_CONSUMER_HEADER = 'FETestingConsumerHeader',
|
TESTING_CONSUMER_HEADER = 'FETestingConsumerHeader',
|
||||||
|
// Topic
|
||||||
|
CREATE_TOPIC_CLEANUP_POLICY = 'FECreateTopicCleanupPolicy',
|
||||||
}
|
}
|
||||||
|
|
||||||
const CommonRoute: React.FC = (props: any) => {
|
const CommonRoute: React.FC = (props: any) => {
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
import React, { useState, useEffect } from 'react';
|
import React, { useState, useEffect } from 'react';
|
||||||
import { useParams } from 'react-router-dom';
|
import { useParams } from 'react-router-dom';
|
||||||
import { Alert, Button, Checkbox, Divider, Drawer, Form, Input, InputNumber, Modal, Select, Utils } from 'knowdesign';
|
import { Alert, Button, Checkbox, Divider, Drawer, Form, Input, InputNumber, Modal, Select, Utils, Radio, AppContainer } from 'knowdesign';
|
||||||
import notification from '@src/components/Notification';
|
import notification from '@src/components/Notification';
|
||||||
import { PlusOutlined, DownOutlined, UpOutlined } from '@ant-design/icons';
|
import { PlusOutlined, DownOutlined, UpOutlined } from '@ant-design/icons';
|
||||||
import Api from '@src/api/index';
|
import Api from '@src/api/index';
|
||||||
|
import { ControlStatusMap } from '../CommonRoute';
|
||||||
|
|
||||||
const CheckboxGroup = Checkbox.Group;
|
const CheckboxGroup = Checkbox.Group;
|
||||||
|
const RadioGroup = Radio.Group;
|
||||||
|
|
||||||
interface DefaultConfig {
|
interface DefaultConfig {
|
||||||
name: string;
|
name: string;
|
||||||
@@ -67,6 +69,8 @@ export default (props: any) => {
|
|||||||
const routeParams = useParams<{
|
const routeParams = useParams<{
|
||||||
clusterId: string;
|
clusterId: string;
|
||||||
}>();
|
}>();
|
||||||
|
const [global] = AppContainer.useGlobalValue();
|
||||||
|
const multiCleanupPolicy = global.isShowControl && global.isShowControl(ControlStatusMap.CREATE_TOPIC_CLEANUP_POLICY);
|
||||||
const confirm = () => {
|
const confirm = () => {
|
||||||
form.validateFields().then((e) => {
|
form.validateFields().then((e) => {
|
||||||
const formVal = JSON.parse(JSON.stringify(form.getFieldsValue()));
|
const formVal = JSON.parse(JSON.stringify(form.getFieldsValue()));
|
||||||
@@ -106,7 +110,7 @@ export default (props: any) => {
|
|||||||
let res: any;
|
let res: any;
|
||||||
try {
|
try {
|
||||||
res =
|
res =
|
||||||
item.name === 'cleanup.policy'
|
item.name === 'cleanup.policy' && multiCleanupPolicy
|
||||||
? item.defaultValue
|
? item.defaultValue
|
||||||
.replace(/\[|\]|\s+/g, '')
|
.replace(/\[|\]|\s+/g, '')
|
||||||
.split(',')
|
.split(',')
|
||||||
@@ -267,12 +271,21 @@ export default (props: any) => {
|
|||||||
</div>
|
</div>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item name={['properties', 'cleanup.policy']} label="清理策略" rules={[{ required: true, message: '请输入清理策略' }]}>
|
<Form.Item name={['properties', 'cleanup.policy']} label="清理策略" rules={[{ required: true, message: '请输入清理策略' }]}>
|
||||||
<CheckboxGroup>
|
{multiCleanupPolicy ? (
|
||||||
<Checkbox style={{ marginRight: '65px' }} value="delete">
|
<CheckboxGroup>
|
||||||
delete
|
<Checkbox style={{ marginRight: '65px' }} value="delete">
|
||||||
</Checkbox>
|
delete
|
||||||
<Checkbox value="compact">compact</Checkbox>
|
</Checkbox>
|
||||||
</CheckboxGroup>
|
<Checkbox value="compact">compact</Checkbox>
|
||||||
|
</CheckboxGroup>
|
||||||
|
) : (
|
||||||
|
<RadioGroup>
|
||||||
|
<Radio style={{ marginRight: '65px' }} value="delete">
|
||||||
|
delete
|
||||||
|
</Radio>
|
||||||
|
<Radio value="compact">compact</Radio>
|
||||||
|
</RadioGroup>
|
||||||
|
)}
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<div className="more-config">
|
<div className="more-config">
|
||||||
<div className="txt">更多配置</div>
|
<div className="txt">更多配置</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user