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

[Optimization] optimize display cluster configuration types (#3367)

parent f15428e6
...@@ -47,7 +47,8 @@ export const buildRunModelOptions = () => { ...@@ -47,7 +47,8 @@ export const buildRunModelOptions = () => {
value: RUN_MODE.YARN_SESSION value: RUN_MODE.YARN_SESSION
}, },
{ {
label: 'Yarn Per-Job', // flink弃用了 yarn per-job 模式 在这写个标签 带横线的 | flink deprecated yarn per-job mode, write a label here with a horizontal line
label: <del>Yarn Per-Job (Deprecated)</del>,
value: RUN_MODE.YARN_PER_JOB value: RUN_MODE.YARN_PER_JOB
}, },
{ {
......
...@@ -237,7 +237,7 @@ export default () => { ...@@ -237,7 +237,7 @@ export default () => {
disabled={!HasAuthority(PermissionConstants.REGISTRATION_CLUSTER_CONFIG_EDIT)} disabled={!HasAuthority(PermissionConstants.REGISTRATION_CLUSTER_CONFIG_EDIT)}
/> />
<Tag color='cyan'> <Tag color='cyan'>
{CLUSTER_TYPE_OPTIONS.find((record) => item.type === record.value)?.label} {CLUSTER_TYPE_OPTIONS(true).find((record) => item.type === record.value)?.label}
</Tag> </Tag>
<Tag <Tag
icon={item.isAvailable ? <CheckCircleOutlined /> : <ExclamationCircleOutlined />} icon={item.isAvailable ? <CheckCircleOutlined /> : <ExclamationCircleOutlined />}
......
...@@ -38,11 +38,10 @@ const BaseConfig: React.FC = () => { ...@@ -38,11 +38,10 @@ const BaseConfig: React.FC = () => {
name='type' name='type'
label={l('rc.cc.type')} label={l('rc.cc.type')}
width='md' width='md'
options={CLUSTER_CONFIG_TYPE([ options={CLUSTER_CONFIG_TYPE(
ClusterType.KUBERNETES_OPERATOR, [ClusterType.KUBERNETES_OPERATOR, ClusterType.KUBERNETES_APPLICATION, ClusterType.YARN],
ClusterType.KUBERNETES_APPLICATION, true
ClusterType.YARN )}
])}
rules={[{ required: true, message: l('rc.cc.typePlaceholder') }]} rules={[{ required: true, message: l('rc.cc.typePlaceholder') }]}
placeholder={l('rc.cc.typePlaceholder')} placeholder={l('rc.cc.typePlaceholder')}
/> />
......
...@@ -68,7 +68,7 @@ export const KUBERNETES_CONFIG_LIST: FormConfig[] = [ ...@@ -68,7 +68,7 @@ export const KUBERNETES_CONFIG_LIST: FormConfig[] = [
rules: [{ required: true }] rules: [{ required: true }]
}, },
{ {
name: 'kubernetes.service.account', name: 'kubernetes.service-account',
label: l('rc.cc.k8s.account'), label: l('rc.cc.k8s.account'),
placeholder: l('rc.cc.k8s.accountHelp'), placeholder: l('rc.cc.k8s.accountHelp'),
tooltip: l('rc.cc.k8s.accountHelp'), tooltip: l('rc.cc.k8s.accountHelp'),
......
...@@ -237,7 +237,7 @@ export default () => { ...@@ -237,7 +237,7 @@ export default () => {
disabled={!HasAuthority(PermissionConstants.REGISTRATION_CLUSTER_INSTANCE_EDIT)} disabled={!HasAuthority(PermissionConstants.REGISTRATION_CLUSTER_INSTANCE_EDIT)}
/> />
<Tag color='cyan'> <Tag color='cyan'>
{CLUSTER_TYPE_OPTIONS.find((record) => item.type === record.value)?.label} {CLUSTER_TYPE_OPTIONS().find((record) => item.type === record.value)?.label}
</Tag> </Tag>
<Tag <Tag
icon={item.status === 1 ? <CheckCircleOutlined /> : <ExclamationCircleOutlined />} icon={item.status === 1 ? <CheckCircleOutlined /> : <ExclamationCircleOutlined />}
......
...@@ -30,7 +30,13 @@ export enum ClusterType { ...@@ -30,7 +30,13 @@ export enum ClusterType {
LOCAL = 'local' LOCAL = 'local'
} }
export const CLUSTER_TYPE_OPTIONS: DefaultOptionType[] = [ /**
* Cluster type options
* @constructor
* @param isClusterConfig
*/
export const CLUSTER_TYPE_OPTIONS = (isClusterConfig: boolean = false): DefaultOptionType[] => [
{ {
value: ClusterType.STANDALONE, value: ClusterType.STANDALONE,
label: 'Standalone', label: 'Standalone',
...@@ -56,7 +62,17 @@ export const CLUSTER_TYPE_OPTIONS: DefaultOptionType[] = [ ...@@ -56,7 +62,17 @@ export const CLUSTER_TYPE_OPTIONS: DefaultOptionType[] = [
label: 'Kubernetes Operator', label: 'Kubernetes Operator',
key: ClusterType.KUBERNETES_OPERATOR key: ClusterType.KUBERNETES_OPERATOR
}, },
{ isClusterConfig
? {
value: ClusterType.YARN,
label: (
<span>
Yarn (<del>Pre-Job</del>/Application)
</span>
),
key: ClusterType.YARN
}
: {
value: ClusterType.YARN_APPLICATION, value: ClusterType.YARN_APPLICATION,
label: 'Yarn Application', label: 'Yarn Application',
key: ClusterType.YARN_APPLICATION key: ClusterType.YARN_APPLICATION
...@@ -72,14 +88,22 @@ export const CLUSTER_TYPE_OPTIONS: DefaultOptionType[] = [ ...@@ -72,14 +88,22 @@ export const CLUSTER_TYPE_OPTIONS: DefaultOptionType[] = [
* Cluster instance type * Cluster instance type
*/ */
export const CLUSTER_INSTANCE_TYPE = (hiddenOptions: string[] = []): DefaultOptionType[] => { export const CLUSTER_INSTANCE_TYPE = (hiddenOptions: string[] = []): DefaultOptionType[] => {
return CLUSTER_TYPE_OPTIONS.filter((item) => !hiddenOptions.includes(item.value as string)); return CLUSTER_TYPE_OPTIONS(false).filter(
(item) => !hiddenOptions.includes(item.value as string)
);
}; };
/** /**
* Cluster config type * Cluster config type
* @param renderOptions * @param renderOptions
* @param isClusterConfig
* @constructor * @constructor
*/ */
export const CLUSTER_CONFIG_TYPE = (renderOptions: string[] = []): DefaultOptionType[] => { export const CLUSTER_CONFIG_TYPE = (
return CLUSTER_TYPE_OPTIONS.filter((item) => renderOptions.includes(item.value as string)); renderOptions: string[] = [],
isClusterConfig: boolean = false
): DefaultOptionType[] => {
return CLUSTER_TYPE_OPTIONS(isClusterConfig).filter((item) =>
renderOptions.includes(item.value as string)
);
}; };
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