Unverified Commit 255aca5a authored by Zzm0809's avatar Zzm0809 Committed by GitHub

[Fix] Fix k8s application type can not render (#3202)

parent 9f000eda
...@@ -17,8 +17,7 @@ ...@@ -17,8 +17,7 @@
* *
*/ */
import { ClusterType } from '@/pages/RegCenter/Cluster/constants'; import { CLUSTER_INSTANCE_TYPE } from '@/pages/RegCenter/Cluster/constants';
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';
import { API_CONSTANTS } from '@/services/endpoints'; import { API_CONSTANTS } from '@/services/endpoints';
...@@ -85,7 +84,7 @@ const EditJobInstanceForm = (props: { ...@@ -85,7 +84,7 @@ const EditJobInstanceForm = (props: {
name='type' name='type'
label={l('rc.ci.type')} label={l('rc.ci.type')}
disabled disabled
options={CLUSTER_INSTANCE_TYPE([ClusterType.YARN_APPLICATION])} options={CLUSTER_INSTANCE_TYPE()}
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')}
/> />
......
...@@ -27,7 +27,7 @@ import { DataAction } from '@/components/StyledComponents'; ...@@ -27,7 +27,7 @@ import { DataAction } from '@/components/StyledComponents';
import { Authorized, HasAuthority } from '@/hooks/useAccess'; import { Authorized, HasAuthority } from '@/hooks/useAccess';
import { imgStyle } from '@/pages/Home/constants'; import { imgStyle } from '@/pages/Home/constants';
import ConfigurationModal from '@/pages/RegCenter/Cluster/Configuration/components/ConfigurationModal'; import ConfigurationModal from '@/pages/RegCenter/Cluster/Configuration/components/ConfigurationModal';
import { CLUSTER_CONFIG_TYPE } from '@/pages/RegCenter/Cluster/Configuration/components/contants'; import { CLUSTER_TYPE_OPTIONS } from '@/pages/RegCenter/Cluster/constants';
import { import {
handleAddOrUpdate, handleAddOrUpdate,
handleOption, handleOption,
...@@ -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_CONFIG_TYPE.find((record) => item.type === record.value)?.label} {CLUSTER_TYPE_OPTIONS.find((record) => item.type === record.value)?.label}
</Tag> </Tag>
<Tag <Tag
icon={item.isAvailable ? <CheckCircleOutlined /> : <ExclamationCircleOutlined />} icon={item.isAvailable ? <CheckCircleOutlined /> : <ExclamationCircleOutlined />}
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
* *
*/ */
import { CLUSTER_CONFIG_TYPE } from '@/pages/RegCenter/Cluster/Configuration/components/contants'; import { ClusterType, CLUSTER_CONFIG_TYPE } from '@/pages/RegCenter/Cluster/constants';
import { l } from '@/utils/intl'; import { l } from '@/utils/intl';
import { import {
ProFormDigit, ProFormDigit,
...@@ -38,7 +38,11 @@ const BaseConfig: React.FC = () => { ...@@ -38,7 +38,11 @@ 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_APPLICATION,
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')}
/> />
......
...@@ -158,7 +158,7 @@ const FlinkK8s = (props: { type: string; value: any; form: FormInstance<Values> ...@@ -158,7 +158,7 @@ const FlinkK8s = (props: { type: string; value: any; form: FormInstance<Values>
<Row gutter={[16, 16]}> <Row gutter={[16, 16]}>
<Col span={10}> <Col span={10}>
<ProFormGroup> <ProFormGroup>
{type && type === ClusterType.KUBERNETES_NATIVE && ( {type && type === ClusterType.KUBERNETES_APPLICATION && (
<ProFormSelect <ProFormSelect
name={[ name={[
'config', 'config',
......
...@@ -18,30 +18,7 @@ ...@@ -18,30 +18,7 @@
*/ */
import { FormConfig } from '@/pages/RegCenter/Cluster/Configuration/components/data'; import { FormConfig } from '@/pages/RegCenter/Cluster/Configuration/components/data';
import { ClusterType } from '@/pages/RegCenter/Cluster/constants';
import { l } from '@/utils/intl'; import { l } from '@/utils/intl';
import { DefaultOptionType } from 'rc-select/es/Select';
/**
* Cluster config type
*/
export const CLUSTER_CONFIG_TYPE: DefaultOptionType[] = [
{
value: ClusterType.YARN,
label: 'Flink On Yarn',
key: ClusterType.YARN
},
{
value: ClusterType.KUBERNETES_NATIVE,
label: 'Kubernetes Native',
key: ClusterType.KUBERNETES_NATIVE
},
{
value: ClusterType.KUBERNETES_OPERATOR,
label: 'Kubernetes Operator',
key: ClusterType.KUBERNETES_OPERATOR
}
];
export const FLINK_CONFIG_LIST: FormConfig[] = [ export const FLINK_CONFIG_LIST: FormConfig[] = [
{ {
...@@ -82,52 +59,6 @@ export const FLINK_CONFIG_LIST: FormConfig[] = [ ...@@ -82,52 +59,6 @@ export const FLINK_CONFIG_LIST: FormConfig[] = [
} }
]; ];
export const DOCKER_CONFIG_LIST: FormConfig[] = [
{
name: 'dinky.remote.addr',
label: l('rc.cc.docker.dinky.addr'),
placeholder: l('rc.cc.docker.dinky.addrHelp'),
tooltip: l('rc.cc.docker.dinky.addrHelp'),
defaultValue: '127.0.0.1:8888'
},
{
name: 'docker.instance',
label: l('rc.cc.docker.instance'),
placeholder: l('rc.cc.docker.instanceHelp'),
tooltip: l('rc.cc.docker.instanceHelp')
},
{
name: 'docker.registry.url',
label: l('rc.cc.docker.url'),
placeholder: l('rc.cc.docker.urlHelp'),
tooltip: l('rc.cc.docker.urlHelp')
},
{
name: 'docker.registry.username',
label: l('rc.cc.docker.username'),
placeholder: l('rc.cc.docker.usernameHelp'),
tooltip: l('rc.cc.docker.usernameHelp')
},
{
name: 'docker.registry.password',
label: l('rc.cc.docker.password'),
placeholder: l('rc.cc.docker.passwordHelp'),
tooltip: l('rc.cc.docker.passwordHelp')
},
{
name: 'docker.image.tag',
label: l('rc.cc.docker.tag'),
placeholder: l('rc.cc.docker.tagHelp'),
tooltip: l('rc.cc.docker.tagHelp')
},
{
name: 'docker.image.dockerfile',
label: l('rc.cc.docker.file'),
placeholder: l('rc.cc.docker.fileHelp'),
tooltip: l('rc.cc.docker.fileHelp')
}
];
export const KUBERNETES_CONFIG_LIST: FormConfig[] = [ export const KUBERNETES_CONFIG_LIST: FormConfig[] = [
{ {
name: 'kubernetes.namespace', name: 'kubernetes.namespace',
......
...@@ -23,7 +23,7 @@ import { EnableSwitchBtn } from '@/components/CallBackButton/EnableSwitchBtn'; ...@@ -23,7 +23,7 @@ import { EnableSwitchBtn } from '@/components/CallBackButton/EnableSwitchBtn';
import { PopconfirmDeleteBtn } from '@/components/CallBackButton/PopconfirmDeleteBtn'; import { PopconfirmDeleteBtn } from '@/components/CallBackButton/PopconfirmDeleteBtn';
import { Authorized, HasAuthority } from '@/hooks/useAccess'; import { Authorized, HasAuthority } from '@/hooks/useAccess';
import useHookRequest from '@/hooks/useHookRequest'; import useHookRequest from '@/hooks/useHookRequest';
import { CLUSTER_INSTANCE_TYPE } from '@/pages/RegCenter/Cluster/Instance/components/contants'; import { CLUSTER_TYPE_OPTIONS } from '@/pages/RegCenter/Cluster/constants';
import { renderWebUiRedirect } from '@/pages/RegCenter/Cluster/Instance/components/function'; import { renderWebUiRedirect } from '@/pages/RegCenter/Cluster/Instance/components/function';
import InstanceModal from '@/pages/RegCenter/Cluster/Instance/components/InstanceModal'; import InstanceModal from '@/pages/RegCenter/Cluster/Instance/components/InstanceModal';
import { getData } from '@/services/api'; import { getData } from '@/services/api';
...@@ -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_INSTANCE_TYPE().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 />}
......
...@@ -17,8 +17,7 @@ ...@@ -17,8 +17,7 @@
* *
*/ */
import { ClusterType } from '@/pages/RegCenter/Cluster/constants'; import { ClusterType, CLUSTER_INSTANCE_TYPE } from '@/pages/RegCenter/Cluster/constants';
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 { Cluster } from '@/types/RegCenter/data.d';
import { l } from '@/utils/intl'; import { l } from '@/utils/intl';
...@@ -65,7 +64,11 @@ const InstanceForm: React.FC<InstanceFormProps> = (props) => { ...@@ -65,7 +64,11 @@ const InstanceForm: React.FC<InstanceFormProps> = (props) => {
label={l('rc.ci.type')} label={l('rc.ci.type')}
width='sm' width='sm'
disabled={values && values.autoRegisters} disabled={values && values.autoRegisters}
options={CLUSTER_INSTANCE_TYPE([ClusterType.YARN_APPLICATION])} options={CLUSTER_INSTANCE_TYPE([
ClusterType.YARN_APPLICATION,
ClusterType.KUBERNETES_OPERATOR,
ClusterType.KUBERNETES_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')}
/> />
......
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import { ClusterType } from '@/pages/RegCenter/Cluster/constants';
import { l } from '@/utils/intl';
import { Tag } from 'antd';
import { DefaultOptionType } from 'rc-select/es/Select';
/**
* Cluster instance type
*/
export const CLUSTER_INSTANCE_TYPE = (hiddenOptions: string[] = []): DefaultOptionType[] => {
const returnResult: DefaultOptionType[] = [
{
value: ClusterType.STANDALONE,
label: 'Standalone',
key: ClusterType.STANDALONE
},
{
value: ClusterType.YARN_SESSION,
label: 'Yarn Session',
key: ClusterType.YARN_SESSION
},
{
value: ClusterType.KUBERNETES_SESSION,
label: 'Kubernetes Session',
key: ClusterType.KUBERNETES_SESSION
},
{
value: ClusterType.YARN_APPLICATION,
label: 'Yarn Application',
key: ClusterType.YARN_APPLICATION
},
{
value: ClusterType.LOCAL,
label: 'Local',
key: ClusterType.LOCAL
}
];
return returnResult.filter((item) => !hiddenOptions.includes(item.value as string));
};
/**
* Cluster instance status enum
*/
export const CLUSTER_INSTANCE_STATUS_ENUM = {
1: {
text: <Tag color={'success'}>{l('global.table.status.normal')}</Tag>,
status: 'Success'
},
0: {
text: <Tag color={'error'}>{l('global.table.status.abnormal')}</Tag>,
status: 'Error'
}
};
...@@ -17,13 +17,69 @@ ...@@ -17,13 +17,69 @@
* *
*/ */
import { DefaultOptionType } from 'rc-select/es/Select';
export enum ClusterType { export enum ClusterType {
STANDALONE = 'standalone', STANDALONE = 'standalone',
YARN = 'yarn-application', YARN = 'yarn-application',
YARN_SESSION = 'yarn-session', YARN_SESSION = 'yarn-session',
KUBERNETES_SESSION = 'kubernetes-session', KUBERNETES_SESSION = 'kubernetes-session',
KUBERNETES_NATIVE = 'kubernetes-application', KUBERNETES_APPLICATION = 'kubernetes-application',
KUBERNETES_OPERATOR = 'kubernetes-application-operator', KUBERNETES_OPERATOR = 'kubernetes-application-operator',
YARN_APPLICATION = 'yarn-application', YARN_APPLICATION = 'yarn-application',
LOCAL = 'local' LOCAL = 'local'
} }
export const CLUSTER_TYPE_OPTIONS: DefaultOptionType[] = [
{
value: ClusterType.STANDALONE,
label: 'Standalone',
key: ClusterType.STANDALONE
},
{
value: ClusterType.YARN_SESSION,
label: 'Yarn Session',
key: ClusterType.YARN_SESSION
},
{
value: ClusterType.KUBERNETES_SESSION,
label: 'Kubernetes Session',
key: ClusterType.KUBERNETES_SESSION
},
{
value: ClusterType.KUBERNETES_APPLICATION,
label: 'Kubernetes Application',
key: ClusterType.KUBERNETES_APPLICATION
},
{
value: ClusterType.KUBERNETES_OPERATOR,
label: 'Kubernetes Operator',
key: ClusterType.KUBERNETES_OPERATOR
},
{
value: ClusterType.YARN_APPLICATION,
label: 'Yarn Application',
key: ClusterType.YARN_APPLICATION
},
{
value: ClusterType.LOCAL,
label: 'Local',
key: ClusterType.LOCAL
}
];
/**
* Cluster instance type
*/
export const CLUSTER_INSTANCE_TYPE = (hiddenOptions: string[] = []): DefaultOptionType[] => {
return CLUSTER_TYPE_OPTIONS.filter((item) => !hiddenOptions.includes(item.value as string));
};
/**
* Cluster config type
* @param renderOptions
* @constructor
*/
export const CLUSTER_CONFIG_TYPE = (renderOptions: string[] = []): DefaultOptionType[] => {
return CLUSTER_TYPE_OPTIONS.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