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 = () => {
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
},
{
......
......@@ -237,7 +237,7 @@ export default () => {
disabled={!HasAuthority(PermissionConstants.REGISTRATION_CLUSTER_CONFIG_EDIT)}
/>
<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
icon={item.isAvailable ? <CheckCircleOutlined /> : <ExclamationCircleOutlined />}
......
......@@ -38,11 +38,10 @@ const BaseConfig: React.FC = () => {
name='type'
label={l('rc.cc.type')}
width='md'
options={CLUSTER_CONFIG_TYPE([
ClusterType.KUBERNETES_OPERATOR,
ClusterType.KUBERNETES_APPLICATION,
ClusterType.YARN
])}
options={CLUSTER_CONFIG_TYPE(
[ClusterType.KUBERNETES_OPERATOR, ClusterType.KUBERNETES_APPLICATION, ClusterType.YARN],
true
)}
rules={[{ required: true, message: l('rc.cc.typePlaceholder') }]}
placeholder={l('rc.cc.typePlaceholder')}
/>
......
......@@ -68,7 +68,7 @@ export const KUBERNETES_CONFIG_LIST: FormConfig[] = [
rules: [{ required: true }]
},
{
name: 'kubernetes.service.account',
name: 'kubernetes.service-account',
label: l('rc.cc.k8s.account'),
placeholder: l('rc.cc.k8s.accountHelp'),
tooltip: l('rc.cc.k8s.accountHelp'),
......
......@@ -237,7 +237,7 @@ export default () => {
disabled={!HasAuthority(PermissionConstants.REGISTRATION_CLUSTER_INSTANCE_EDIT)}
/>
<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
icon={item.status === 1 ? <CheckCircleOutlined /> : <ExclamationCircleOutlined />}
......
......@@ -30,7 +30,13 @@ export enum ClusterType {
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,
label: 'Standalone',
......@@ -56,11 +62,21 @@ export const CLUSTER_TYPE_OPTIONS: DefaultOptionType[] = [
label: 'Kubernetes Operator',
key: ClusterType.KUBERNETES_OPERATOR
},
{
value: ClusterType.YARN_APPLICATION,
label: 'Yarn Application',
key: ClusterType.YARN_APPLICATION
},
isClusterConfig
? {
value: ClusterType.YARN,
label: (
<span>
Yarn (<del>Pre-Job</del>/Application)
</span>
),
key: ClusterType.YARN
}
: {
value: ClusterType.YARN_APPLICATION,
label: 'Yarn Application',
key: ClusterType.YARN_APPLICATION
},
{
value: ClusterType.LOCAL,
label: 'Local',
......@@ -72,14 +88,22 @@ export const CLUSTER_TYPE_OPTIONS: DefaultOptionType[] = [
* Cluster instance type
*/
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
* @param renderOptions
* @param isClusterConfig
* @constructor
*/
export const CLUSTER_CONFIG_TYPE = (renderOptions: string[] = []): DefaultOptionType[] => {
return CLUSTER_TYPE_OPTIONS.filter((item) => renderOptions.includes(item.value as string));
export const CLUSTER_CONFIG_TYPE = (
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