Unverified Commit fda2de4f authored by Zzm0809's avatar Zzm0809 Committed by GitHub

[Optimization-2757] optimization flink-instance render type (#2852)

* optimization-flink-instance-reg * Spotless Apply * optimization-flink-instance-reg * Spotless Apply --------- Co-authored-by: 's avatarZzm0809 <Zzm0809@users.noreply.github.com>
parent 0e6a80cd
...@@ -791,6 +791,8 @@ export default { ...@@ -791,6 +791,8 @@ export default {
'rc.ci.management': 'Cluster Instance Management', 'rc.ci.management': 'Cluster Instance Management',
'rc.ci.modify': 'Modify cluster Instance', 'rc.ci.modify': 'Modify cluster Instance',
'rc.ci.name': 'Name', 'rc.ci.name': 'Name',
'rc.ci.autoRegisterCannotModify':
'Automatically registered instances can only modify the `JobManger high-availability address` attribute, and others cannot be modified!',
'rc.ci.namePlaceholder': 'Please enter a name!', 'rc.ci.namePlaceholder': 'Please enter a name!',
'rc.ci.recycle': 'Recycle Flink Cluster Instances', 'rc.ci.recycle': 'Recycle Flink Cluster Instances',
'rc.ci.recycleConfirm': 'rc.ci.recycleConfirm':
......
...@@ -760,6 +760,8 @@ export default { ...@@ -760,6 +760,8 @@ export default {
'rc.ci.management': '集群实例管理', 'rc.ci.management': '集群实例管理',
'rc.ci.modify': '修改集群', 'rc.ci.modify': '修改集群',
'rc.ci.name': '实例名称', 'rc.ci.name': '实例名称',
'rc.ci.autoRegisterCannotModify':
'自动注册的实例仅能修改 `JobManger高可用地址` 属性,其他无法修改!',
'rc.ci.namePlaceholder': '请输入名称!', 'rc.ci.namePlaceholder': '请输入名称!',
'rc.ci.recycle': '回收 Flink 实例', 'rc.ci.recycle': '回收 Flink 实例',
'rc.ci.recycleConfirm': '确定回收所有自动创建且过期的 Flink 实例吗?', 'rc.ci.recycleConfirm': '确定回收所有自动创建且过期的 Flink 实例吗?',
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
* *
*/ */
import { ClusterType } from '@/pages/RegCenter/Cluster/constants';
import { CLUSTER_INSTANCE_TYPE } from '@/pages/RegCenter/Cluster/Instance/components/contants'; import { CLUSTER_INSTANCE_TYPE } from '@/pages/RegCenter/Cluster/Instance/components/contants';
import { validatorJMHAAdderess } from '@/pages/RegCenter/Cluster/Instance/components/function'; import { validatorJMHAAdderess } from '@/pages/RegCenter/Cluster/Instance/components/function';
import { handleAddOrUpdate } from '@/services/BusinessCrud'; import { handleAddOrUpdate } from '@/services/BusinessCrud';
...@@ -84,7 +85,7 @@ const EditJobInstanceForm = (props: { ...@@ -84,7 +85,7 @@ const EditJobInstanceForm = (props: {
name='type' name='type'
label={l('rc.ci.type')} label={l('rc.ci.type')}
disabled disabled
options={CLUSTER_INSTANCE_TYPE} options={CLUSTER_INSTANCE_TYPE([ClusterType.YARN_APPLICATION])}
rules={[{ required: true, message: l('rc.ci.typePlaceholder') }]} rules={[{ required: true, message: l('rc.ci.typePlaceholder') }]}
placeholder={l('rc.ci.typePlaceholder')} placeholder={l('rc.ci.typePlaceholder')}
/> />
......
...@@ -205,7 +205,7 @@ export default () => { ...@@ -205,7 +205,7 @@ export default () => {
disabled={!HasAuthority('/registration/cluster/instance/edit')} disabled={!HasAuthority('/registration/cluster/instance/edit')}
/> />
<Tag color='cyan'> <Tag color='cyan'>
{CLUSTER_INSTANCE_TYPE.find((record) => item.type === record.value)?.label} {CLUSTER_INSTANCE_TYPE().find((record) => item.type === record.value)?.label}
</Tag> </Tag>
<Tag <Tag
icon={item.status === 1 ? <CheckCircleOutlined /> : <ExclamationCircleOutlined />} icon={item.status === 1 ? <CheckCircleOutlined /> : <ExclamationCircleOutlined />}
......
...@@ -17,8 +17,10 @@ ...@@ -17,8 +17,10 @@
* *
*/ */
import { ClusterType } from '@/pages/RegCenter/Cluster/constants';
import { CLUSTER_INSTANCE_TYPE } from '@/pages/RegCenter/Cluster/Instance/components/contants'; import { CLUSTER_INSTANCE_TYPE } from '@/pages/RegCenter/Cluster/Instance/components/contants';
import { validatorJMHAAdderess } from '@/pages/RegCenter/Cluster/Instance/components/function'; import { validatorJMHAAdderess } from '@/pages/RegCenter/Cluster/Instance/components/function';
import { Cluster } from '@/types/RegCenter/data.d';
import { l } from '@/utils/intl'; import { l } from '@/utils/intl';
import { import {
ProFormGroup, ProFormGroup,
...@@ -26,16 +28,26 @@ import { ...@@ -26,16 +28,26 @@ import {
ProFormText, ProFormText,
ProFormTextArea ProFormTextArea
} from '@ant-design/pro-components'; } from '@ant-design/pro-components';
import { Alert } from 'antd';
import React from 'react';
const InstanceForm = () => { type InstanceFormProps = {
values: Partial<Cluster.Instance>;
};
const InstanceForm: React.FC<InstanceFormProps> = (props) => {
const { values } = props;
const renderForm = () => { const renderForm = () => {
return ( return (
<> <>
{values && values.autoRegisters && (
<Alert type={'warning'} message={l('rc.ci.autoRegisterCannotModify')} showIcon />
)}
<ProFormGroup> <ProFormGroup>
<ProFormText <ProFormText
name='name' name='name'
label={l('rc.ci.name')} label={l('rc.ci.name')}
width='md' width='md'
disabled={values && values.autoRegisters}
rules={[{ required: true, message: l('rc.ci.namePlaceholder') }]} rules={[{ required: true, message: l('rc.ci.namePlaceholder') }]}
placeholder={l('rc.ci.namePlaceholder')} placeholder={l('rc.ci.namePlaceholder')}
/> />
...@@ -44,6 +56,7 @@ const InstanceForm = () => { ...@@ -44,6 +56,7 @@ const InstanceForm = () => {
name='alias' name='alias'
label={l('rc.ci.alias')} label={l('rc.ci.alias')}
width='sm' width='sm'
disabled={values && values.autoRegisters}
placeholder={l('rc.ci.aliasPlaceholder')} placeholder={l('rc.ci.aliasPlaceholder')}
/> />
...@@ -51,7 +64,8 @@ const InstanceForm = () => { ...@@ -51,7 +64,8 @@ const InstanceForm = () => {
name='type' name='type'
label={l('rc.ci.type')} label={l('rc.ci.type')}
width='sm' width='sm'
options={CLUSTER_INSTANCE_TYPE} disabled={values && values.autoRegisters}
options={CLUSTER_INSTANCE_TYPE([ClusterType.YARN_APPLICATION])}
rules={[{ required: true, message: l('rc.ci.typePlaceholder') }]} rules={[{ required: true, message: l('rc.ci.typePlaceholder') }]}
placeholder={l('rc.ci.typePlaceholder')} placeholder={l('rc.ci.typePlaceholder')}
/> />
...@@ -72,6 +86,7 @@ const InstanceForm = () => { ...@@ -72,6 +86,7 @@ const InstanceForm = () => {
/> />
<ProFormTextArea <ProFormTextArea
name='note' name='note'
disabled={values && values.autoRegisters}
label={l('global.table.note')} label={l('global.table.note')}
width='md' width='md'
placeholder={l('global.table.notePlaceholder')} placeholder={l('global.table.notePlaceholder')}
......
...@@ -109,7 +109,7 @@ const InstanceModal: React.FC<InstanceModalProps> = (props) => { ...@@ -109,7 +109,7 @@ const InstanceModal: React.FC<InstanceModalProps> = (props) => {
submitter={{ render: () => [...renderFooter()] }} submitter={{ render: () => [...renderFooter()] }}
initialValues={value} initialValues={value}
> >
<InstanceForm /> <InstanceForm values={value} />
</ModalForm> </ModalForm>
</> </>
); );
......
...@@ -25,33 +25,36 @@ import { DefaultOptionType } from 'rc-select/es/Select'; ...@@ -25,33 +25,36 @@ import { DefaultOptionType } from 'rc-select/es/Select';
/** /**
* Cluster instance type * Cluster instance type
*/ */
export const CLUSTER_INSTANCE_TYPE: DefaultOptionType[] = [ export const CLUSTER_INSTANCE_TYPE = (hiddenOptions: string[] = []): DefaultOptionType[] => {
{ const returnResult: DefaultOptionType[] = [
value: ClusterType.STANDALONE, {
label: 'Standalone', value: ClusterType.STANDALONE,
key: ClusterType.STANDALONE label: 'Standalone',
}, key: ClusterType.STANDALONE
{ },
value: ClusterType.YARN_SESSION, {
label: 'Yarn Session', value: ClusterType.YARN_SESSION,
key: ClusterType.YARN_SESSION label: 'Yarn Session',
}, key: ClusterType.YARN_SESSION
{ },
value: ClusterType.KUBERNETES_SESSION, {
label: 'Kubernetes Session', value: ClusterType.KUBERNETES_SESSION,
key: ClusterType.KUBERNETES_SESSION label: 'Kubernetes Session',
}, key: ClusterType.KUBERNETES_SESSION
{ },
value: ClusterType.YARN_APPLICATION, {
label: 'Yarn Application', value: ClusterType.YARN_APPLICATION,
key: ClusterType.YARN_APPLICATION label: 'Yarn Application',
}, key: ClusterType.YARN_APPLICATION
{ },
value: ClusterType.LOACL, {
label: 'Local', value: ClusterType.LOCAL,
key: ClusterType.LOACL label: 'Local',
} key: ClusterType.LOCAL
]; }
];
return returnResult.filter((item) => !hiddenOptions.includes(item.value as string));
};
/** /**
* Cluster instance status enum * Cluster instance status enum
......
...@@ -25,5 +25,5 @@ export enum ClusterType { ...@@ -25,5 +25,5 @@ export enum ClusterType {
KUBERNETES_NATIVE = 'kubernetes-application', KUBERNETES_NATIVE = 'kubernetes-application',
KUBERNETES_OPERATOR = 'kubernetes-application-operator', KUBERNETES_OPERATOR = 'kubernetes-application-operator',
YARN_APPLICATION = 'yarn-application', YARN_APPLICATION = 'yarn-application',
LOACL = 'local' LOCAL = 'local'
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment