Skip to content

Commit

Permalink
[refactor/queue][taier-ui]move queueConfig from rightbar to create co…
Browse files Browse the repository at this point in the history
…nfig
  • Loading branch information
mortalYoung committed Oct 14, 2022
1 parent ee2878e commit 48eed86
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 64 deletions.
Binary file added taier-ui/public/images/OceanBase.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 40 additions & 1 deletion taier-ui/src/components/scaffolds/create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ import {
FLINK_VERSION_TYPE,
PythonVersionKind,
} from '@/constant';
import { Button, Empty, Form, Input, Radio, Select } from 'antd';
import { Button, Empty, Form, Input, Radio, Select, Spin } from 'antd';
import { syncModeHelp, syncTaskHelp } from '../helpDoc/docs';
import FolderPicker from '../folderPicker';
import resourceManagerTree from '@/services/resourceManagerService';
import { dataSourceService, taskRenderService } from '@/services';
import { useEffect, useState } from 'react';
import { IDataSourceProps } from '@/interface';
import molecule from '@dtinsight/molecule';
import api from '@/api';

interface ICreateFormProps {
disabled?: boolean;
Expand Down Expand Up @@ -243,6 +244,43 @@ const DataSource = () => {
);
};

const QueueConfig = () => {
const [resourceList, setResourceList] = useState<string[]>([]);
const [fetching, setFetching] = useState(false);

useEffect(() => {
setFetching(true);
api.getResourceByTenant({})
.then((res) => {
if (res.code === 1) {
setResourceList(res.data.queues?.map((q: any) => q.queueName));
}
})
.finally(() => {
setFetching(false);
});
}, []);

return (
<Form.Item label="YARN 队列" name="queueName">
<Select
placeholder="请选择 YARN 队列"
getPopupContainer={(node) => node.parentNode}
options={resourceList.map((r) => ({ label: r, value: r }))}
showSearch
optionFilterProp="label"
notFoundContent={
fetching ? (
<Spin spinning={fetching} />
) : (
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
)
}
/>
</Form.Item>
);
};

/**
* key 值为服务端字段名,value 为组件名
*/
Expand All @@ -255,4 +293,5 @@ export default {
exeArgs: ExeArgs,
pythonVersion: PythonVersion,
datasource: DataSource,
queue: QueueConfig,
} as Record<string, (...args: any[]) => JSX.Element>;
1 change: 0 additions & 1 deletion taier-ui/src/components/task/create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ const Create = connect(

if (formFields) {
formFields.taskProperties.formField?.forEach((field) => {
console.log('field;', field);
// 特殊处理
if (field === 'syncModel') {
form.setFieldsValue({
Expand Down
2 changes: 2 additions & 0 deletions taier-ui/src/constant/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ export enum TASK_TYPE_ENUM {
FLINK = 11,
PYTHON = 12,
SHELL = 13,
CLICKHOUSE = 26
}

/**
Expand Down Expand Up @@ -528,6 +529,7 @@ export const DATA_SOURCE_TEXT: Partial<{ [key in DATA_SOURCE_ENUM]: string }> =
[DATA_SOURCE_ENUM.KAFKA_HUAWEI]: 'Kafka_huawei',
[DATA_SOURCE_ENUM.HBASE_HUAWEI]: 'Hbase_huawei',
[DATA_SOURCE_ENUM.KAFKA_CONFLUENT]: 'Confluent',
[DATA_SOURCE_ENUM.DorisRestful]: 'Doris(http)',
};

/**
Expand Down
5 changes: 1 addition & 4 deletions taier-ui/src/pages/dataSource/add.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import Version from './version';
import SelectSource from './selectSource';
import InfoConfig from './InfoConfig';
import type { IDataSourceProps } from '@/interface';
import type { DATA_SOURCE_ENUM} from '@/constant';
import type { DATA_SOURCE_ENUM } from '@/constant';
import './add.scss';

const { Step } = Steps;
Expand Down Expand Up @@ -230,9 +230,6 @@ export default function Add({ record, onSubmit }: IAddProps) {
message.success('连接成功');
}
})
.catch(() => {
message.error('测试连通性请求超时');
})
.finally(() => {
setLoading(false);
setSubmitBtnStatus(false);
Expand Down
55 changes: 0 additions & 55 deletions taier-ui/src/pages/rightBar/queueConfig.tsx

This file was deleted.

3 changes: 0 additions & 3 deletions taier-ui/src/services/rightBarService.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import { singleton } from 'tsyringe';
import { RightBarKind } from '@/interface';
import { taskRenderService } from '.';
import TaskConfig from '@/pages/rightBar/taskConfig';
import QueueConfig from '@/pages/rightBar/queueConfig';

interface IRightBarService {
/**
Expand Down Expand Up @@ -189,8 +188,6 @@ export default class RightBarService extends Component<IRightbarState> implement
return this.withForm(<FlinkResultPanel key="result" current={current} />);
case RightBarKind.FLINKSQL_DIMENSION:
return this.withForm(<FlinkDimensionPanel key="dimension" current={current} />);
case RightBarKind.QUEUE:
return <QueueConfig current={current} />;
default:
return null;
}
Expand Down

0 comments on commit 48eed86

Please sign in to comment.