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

improve web finish button type to submit && modify layout (#2630)

* improve-web-finish-buttontype * Spotless Apply * fix udf bug * Spotless Apply * improve-web-finish-buttontype * Spotless Apply * modify ant-notification top padding * fix datasource bug * Spotless Apply * modify alert layout * Spotless Apply * fix git sort * Spotless Apply * fix i18n * fix i18n file --------- Co-authored-by: 's avatarZzm0809 <Zzm0809@users.noreply.github.com>
parent 3a9bf5cc
...@@ -160,23 +160,23 @@ daemon.task.not.support=threaded task types are notsupported ...@@ -160,23 +160,23 @@ daemon.task.not.support=threaded task types are notsupported
sys.flink.settings.useRestAPI=Use Rest API sys.flink.settings.useRestAPI=Use Rest API
sys.flink.settings.useRestAPI.note=Whether to use RestAPI when operating and maintaining Flink tasks sys.flink.settings.useRestAPI.note=Whether to use RestAPI when operating and maintaining Flink tasks
sys.flink.settings.sqlSeparator=SQL Separator sys.flink.settings.sqlSeparator=SQL Separator
sys.flink.settings.sqlSeparator.note=SQL Separator sys.flink.settings.sqlSeparator.note=please note: The default delimiter is ';', if your SQL contains ';', please modify this configuration to other characters, for example: ';\\n', please ignore the single quotes!!!!
sys.flink.settings.jobIdWait=Job submission waiting time sys.flink.settings.jobIdWait=Job submission waiting time
sys.flink.settings.jobIdWait.note=Maximum waiting time (seconds) for obtaining Job ID when submitting Application or PerJob tasks sys.flink.settings.jobIdWait.note=Maximum waiting time (seconds) for obtaining Job ID when submitting Application or PerJob tasks
sys.maven.settings.settingsFilePath=Maven configuration file path sys.maven.settings.settingsFilePath=Maven configuration file path
sys.maven.settings.settingsFilePath.note=Maven configuration file path, eg sys.maven.settings.settingsFilePath.note=Maven configuration file path, eg: /opt/maven-3.9.2/conf/settings.xml, please note: By default, the MAVEN_HOME environment variables of the host will be obtained, so there is no need to fill in here. If there is no configuration, please fill in the absolute path.
sys.maven.settings.repository=Maven warehouse address sys.maven.settings.repository=Maven warehouse address
sys.maven.settings.repository.note=Maven warehouse address sys.maven.settings.repository.note=Maven warehouse address
sys.maven.settings.repositoryUser=Maven warehouse user name sys.maven.settings.repositoryUser=Maven warehouse user name
sys.maven.settings.repositoryUser.note=Maven private server authentication user name sys.maven.settings.repositoryUser.note=Maven private server authentication user name, if you need to configure Maven private server warehouse authentication information, please fill in this
sys.maven.settings.repositoryPassword=Maven warehouse password sys.maven.settings.repositoryPassword=Maven warehouse password
sys.maven.settings.repositoryPassword.note=Maven private server authentication password, please note sys.maven.settings.repositoryPassword.note=Maven private server authentication password, if you need to configure Maven private server warehouse authentication information, please fill in this item
sys.env.settings.pythonHome=Python Env variables sys.env.settings.pythonHome=Python Env variables
sys.env.settings.pythonHome.note=Python Env variables sys.env.settings.pythonHome.note=Python environment variables, used to submit Python tasks and build Python Udf
sys.env.settings.dinkyAddr=Dinky Address sys.env.settings.dinkyAddr=Dinky Address
sys.env.settings.dinkyAddr.note=The address must be the same as the address configured in the Dinky Application background url sys.env.settings.dinkyAddr.note=The address must be the same as the address configured in the Dinky Application background url
sys.dolphinscheduler.settings.enable=Whether to enable DolphinScheduler sys.dolphinscheduler.settings.enable=Whether to enable DolphinScheduler
sys.dolphinscheduler.settings.enable.note=Whether to enable DolphinScheduler, the relevant functions of DolphinScheduler can only be used after it is enabled, please ensure that the relevant configuration of DolphinScheduler is correct sys.dolphinscheduler.settings.enable.note=Whether to enable DolphinScheduler. Only after enabling it can you use the related functions of DolphinScheduler. Please fill in the following configuration items first, and then enable this configuration after completion. Also: Please ensure that the related configurations of DolphinScheduler are correct.
sys.dolphinscheduler.settings.url=DolphinScheduler address sys.dolphinscheduler.settings.url=DolphinScheduler address
sys.dolphinscheduler.settings.url.note=The address must be consistent with the address configured in the DolphinScheduler background, eg: http://127.0.0.1:12345/dolphinscheduler sys.dolphinscheduler.settings.url.note=The address must be consistent with the address configured in the DolphinScheduler background, eg: http://127.0.0.1:12345/dolphinscheduler
sys.dolphinscheduler.settings.token=DolphinScheduler Token sys.dolphinscheduler.settings.token=DolphinScheduler Token
......
...@@ -46,6 +46,8 @@ export const PopconfirmDeleteBtn: React.FC<PopconfirmProps> = (props) => { ...@@ -46,6 +46,8 @@ export const PopconfirmDeleteBtn: React.FC<PopconfirmProps> = (props) => {
{...options} {...options}
title={l('button.delete')} title={l('button.delete')}
key={'DeleteIcon'} key={'DeleteIcon'}
htmlType={'submit'}
autoFocus
icon={<DangerDeleteIcon />} icon={<DangerDeleteIcon />}
/> />
</Popconfirm> </Popconfirm>
......
...@@ -157,6 +157,68 @@ export const EmailSvg = (props: any) => { ...@@ -157,6 +157,68 @@ export const EmailSvg = (props: any) => {
); );
}; };
export const AliYunSmsSvg = (props: any) => {
const size = props.size || defaultSvgSize;
return (
<>
<Icon
style={style}
component={() => (
<svg
className='icon'
viewBox='0 0 1024 1024'
version='1.1'
xmlns='http://www.w3.org/2000/svg'
width={size}
height={size}
>
<path d='M512 0A512 512 0 1 1 0 512 512 512 0 0 1 512 0z' fill='#FF6A00'></path>
<path
d='M298.141538 615.581538a30.72 30.72 0 0 1-24.418461-29.735384v-163.052308A31.901538 31.901538 0 0 1 298.141538 393.846154l151.236924-32.689231 16.147692-64.984615H289.476923A111.458462 111.458462 0 0 0 177.230769 406.252308v193.378461a113.033846 113.033846 0 0 0 112.246154 112.246154h176.049231l-15.950769-64.590769zM738.658462 295.384615h-177.23077l16.147693 64.984616L728.615385 393.846154a30.72 30.72 0 0 1 24.418461 29.538461v163.249231A31.704615 31.704615 0 0 1 728.615385 615.581538l-151.63077 32.886154-16.147692 64.984616h177.230769a112.443077 112.443077 0 0 0 112.836923-112.049231v-194.56a113.033846 113.033846 0 0 0-112.246153-111.458462z'
fill='#FFFFFF'
></path>
<path d='M449.378462 495.852308h129.378461V512h-129.378461z' fill='#FFFFFF'></path>
</svg>
)}
/>
</>
);
};
export const TencentSmsSvg = (props: any) => {
const size = props.size || defaultSvgSize;
return (
<>
<Icon
style={style}
component={() => (
<svg
className='icon'
viewBox='0 0 1024 1024'
version='1.1'
xmlns='http://www.w3.org/2000/svg'
width={size}
height={size}
>
<path
d='M515.12132 140c143.23 0 264.603 91.954 305.177 218.55-15.114-1.86-30.46-1.976-45.69-0.698-18.601 1.744-36.854 5.697-54.641 11.625C686.48532 291.94 607.31332 237.65 515.00432 237.65c-110.096 0-201.475 77.306-218.914 178.792-32.32-6.626-65.453-8.137-98.238-4.185C217.84932 258.808 352.24232 140 515.12132 140z'
fill='#006DFE'
></path>
<path
d='M236.68232 410.514c59.757 0 114.398 22.087 156.135 58.59 17.671 15.461 49.642 43.477 95.913 84.281l-8.138-7.207-67.662 66.727-59.757-59.636c-37.551-37.549-72.545-52.545-116.607-52.545-81.032 0-146.718 65.565-146.718 146.591 0 81.026 65.686 146.591 146.718 146.591 11.742 0 32.204 0.814 61.617 2.558l-99.284 84.63C69.73632 859.936-17.92268 738.222 3.12032 609.185c18.718-114.39 117.537-198.439 233.562-198.671z'
fill='#00CDD8'
></path>
<path
d='M693.34432 429.346c120.443-51.034 259.604 5.115 310.758 125.434 51.153 120.319-5.116 259.354-125.559 310.388-16.857 7.09-41.97 17.553-69.29 17.786-79.172 0.697-268.09 0.93-566.99 1.046h-46.968C340.85032 744.965 486.17132 605.814 631.26132 466.43c20.113-19.298 45.225-29.876 62.082-37.084z m46.038 88.35c-10.114 4.301-25.344 10.695-37.435 22.32-33.134 31.969-120.792 115.901-262.976 251.914h58.71c162.762 0 266.58-0.233 311.572-0.581 16.509-0.117 31.622-6.394 41.853-10.812 72.661-30.806 106.609-114.622 75.684-187.162-30.808-72.656-114.747-106.485-187.408-75.679z'
fill='#00A2FF'
></path>
</svg>
)}
/>
</>
);
};
export const SmsSvg = (props: any) => { export const SmsSvg = (props: any) => {
const size = props.size || defaultSvgSize; const size = props.size || defaultSvgSize;
......
...@@ -88,7 +88,7 @@ const ErrorShowModal = (props: ShowModalProps) => { ...@@ -88,7 +88,7 @@ const ErrorShowModal = (props: ShowModalProps) => {
title={title} title={title}
closable={closable} closable={closable}
footer={ footer={
<Button type='primary' onClick={() => setShowModal(false)}> <Button type='primary' htmlType={'submit'} autoFocus onClick={() => setShowModal(false)}>
{l('global.notification.iknow')} {l('global.notification.iknow')}
</Button> </Button>
} }
......
...@@ -535,6 +535,7 @@ h5 { ...@@ -535,6 +535,7 @@ h5 {
padding: 4px 4px 4px 6px; padding: 4px 4px 4px 6px;
white-space: nowrap; white-space: nowrap;
} }
.butterfly-lineage-dag .table-node .field.hover-chain { .butterfly-lineage-dag .table-node .field.hover-chain {
color: #fff; color: #fff;
transition: all 0.5s ease-in-out; transition: all 0.5s ease-in-out;
...@@ -550,6 +551,7 @@ h5 { ...@@ -550,6 +551,7 @@ h5 {
height: 100%; height: 100%;
max-height: 4vh; max-height: 4vh;
margin: 0 20px; margin: 0 20px;
.operator-item { .operator-item {
margin-left: 15px; margin-left: 15px;
} }
...@@ -582,15 +584,18 @@ h5 { ...@@ -582,15 +584,18 @@ h5 {
right: 0; right: 0;
background: #0366d6; background: #0366d6;
} }
// ==================== lineage style end ==================== // ==================== lineage style end ====================
.card-list-item-wrapper { .card-list-item-wrapper {
display: flex; display: flex;
} }
.card-list-item { .card-list-item {
width: 100%; width: 100%;
margin: 0; margin: 0;
} }
.card-list-item { .card-list-item {
transition: 0.3s; transition: 0.3s;
} }
...@@ -678,4 +683,9 @@ span .mtkb { ...@@ -678,4 +683,9 @@ span .mtkb {
.DragLayer.vertical { .DragLayer.vertical {
cursor: col-resize; cursor: col-resize;
} }
// ============================= layout split pane style end ============================= // ============================= layout split pane style end =============================
.ant-notification-notice-wrapper {
top: 80px !important;
}
...@@ -84,6 +84,10 @@ const RoleModalForm: React.FC<RoleModalProps> = (props) => { ...@@ -84,6 +84,10 @@ const RoleModalForm: React.FC<RoleModalProps> = (props) => {
title={values.id ? l('role.update') : l('role.create')} title={values.id ? l('role.update') : l('role.create')}
open={modalVisible} open={modalVisible}
onCancel={() => handleCancel()} onCancel={() => handleCancel()}
okButtonProps={{
htmlType: 'submit',
autoFocus: true
}}
onOk={() => submitForm()} onOk={() => submitForm()}
> >
<RoleProForm form={form} values={values} /> <RoleProForm form={form} values={values} />
......
...@@ -101,6 +101,10 @@ export const PermissionsModal: React.FC<RolePermissionsFormProps> = (props) => { ...@@ -101,6 +101,10 @@ export const PermissionsModal: React.FC<RolePermissionsFormProps> = (props) => {
title={values.id ? l('rowPermissions.update') : l('rowPermissions.create')} title={values.id ? l('rowPermissions.update') : l('rowPermissions.create')}
open={modalVisible} open={modalVisible}
onOk={() => submitForm()} onOk={() => submitForm()}
okButtonProps={{
htmlType: 'submit',
autoFocus: true
}}
onCancel={() => handleCancel()} onCancel={() => handleCancel()}
> >
<PermissionsForm form={form} values={values} roles={roleList} /> <PermissionsForm form={form} values={values} roles={roleList} />
......
...@@ -81,6 +81,10 @@ const TenantModalForm: React.FC<TenantModalFormProps> = (props) => { ...@@ -81,6 +81,10 @@ const TenantModalForm: React.FC<TenantModalFormProps> = (props) => {
title={values.id ? l('tenant.update') : l('tenant.create')} title={values.id ? l('tenant.update') : l('tenant.create')}
open={modalVisible} open={modalVisible}
onOk={() => submitForm()} onOk={() => submitForm()}
okButtonProps={{
htmlType: 'submit',
autoFocus: true
}}
onCancel={() => handleCancel()} onCancel={() => handleCancel()}
> >
<TenantForm values={values} form={form} /> <TenantForm values={values} form={form} />
......
...@@ -48,6 +48,10 @@ const TenantModalTransfer: React.FC<TableTransferFromProps> = (props) => { ...@@ -48,6 +48,10 @@ const TenantModalTransfer: React.FC<TableTransferFromProps> = (props) => {
maskClosable={false} maskClosable={false}
width={'75%'} width={'75%'}
onCancel={() => onCancel()} onCancel={() => onCancel()}
okButtonProps={{
htmlType: 'submit',
autoFocus: true
}}
onOk={() => handleSubmit(targetKeys)} onOk={() => handleSubmit(targetKeys)}
> >
<TenantTransfer tenant={tenant} onChange={(value) => handleValueChange(value)} /> <TenantTransfer tenant={tenant} onChange={(value) => handleValueChange(value)} />
......
...@@ -134,7 +134,14 @@ const TokenModalForm: React.FC<TokenModalFormProps & connect> = (props) => { ...@@ -134,7 +134,14 @@ const TokenModalForm: React.FC<TokenModalFormProps & connect> = (props) => {
<Button key={'cancel'} onClick={() => handleCancel()}> <Button key={'cancel'} onClick={() => handleCancel()}>
{l('button.cancel')} {l('button.cancel')}
</Button>, </Button>,
<Button key={'finish'} loading={loading} type='primary' onClick={() => submitForm()}> <Button
key={'finish'}
loading={loading}
type='primary'
htmlType={'submit'}
autoFocus
onClick={() => submitForm()}
>
{l('button.finish')} {l('button.finish')}
</Button> </Button>
]; ];
......
...@@ -85,6 +85,10 @@ const PasswordModal: React.FC<PasswordModalFormProps> = (props) => { ...@@ -85,6 +85,10 @@ const PasswordModal: React.FC<PasswordModalFormProps> = (props) => {
title={l('button.changePassword')} title={l('button.changePassword')}
open={modalVisible} open={modalVisible}
onCancel={() => handleCancel()} onCancel={() => handleCancel()}
okButtonProps={{
htmlType: 'submit',
autoFocus: true
}}
onOk={() => submitForm()} onOk={() => submitForm()}
> >
<PasswordForm values={values as UserBaseInfo.User} form={form} /> <PasswordForm values={values as UserBaseInfo.User} form={form} />
......
...@@ -52,6 +52,10 @@ const RoleModalTransfer = (props: RoleTransferFromProps) => { ...@@ -52,6 +52,10 @@ const RoleModalTransfer = (props: RoleTransferFromProps) => {
maskClosable={false} maskClosable={false}
width={'75%'} width={'75%'}
onCancel={() => handleCancel()} onCancel={() => handleCancel()}
okButtonProps={{
htmlType: 'submit',
autoFocus: true
}}
onOk={() => handleSubmit(targetKeys)} onOk={() => handleSubmit(targetKeys)}
> >
<RoleTransfer role={user} onChange={(value) => handleValueChange(value)} /> <RoleTransfer role={user} onChange={(value) => handleValueChange(value)} />
......
...@@ -72,8 +72,8 @@ const UserModalForm: React.FC<UserModalFormProps> = (props) => { ...@@ -72,8 +72,8 @@ const UserModalForm: React.FC<UserModalFormProps> = (props) => {
*/ */
const submitForm = async () => { const submitForm = async () => {
const fieldsValue = await form.validateFields(); const fieldsValue = await form.validateFields();
await handleSubmit({ ...values, ...fieldsValue }); handleSubmit({ ...values, ...fieldsValue });
await handleCancel(); handleCancel();
}; };
return ( return (
...@@ -82,6 +82,10 @@ const UserModalForm: React.FC<UserModalFormProps> = (props) => { ...@@ -82,6 +82,10 @@ const UserModalForm: React.FC<UserModalFormProps> = (props) => {
title={values.id ? l('user.update') : l('user.create')} title={values.id ? l('user.update') : l('user.create')}
open={modalVisible} open={modalVisible}
onCancel={() => handleCancel()} onCancel={() => handleCancel()}
okButtonProps={{
htmlType: 'submit',
autoFocus: true
}}
onOk={() => submitForm()} onOk={() => submitForm()}
> >
<UserForm values={values} form={form} /> <UserForm values={values} form={form} />
......
...@@ -44,6 +44,8 @@ export const JobDetailInfoModel: React.FC<JobDetailInfoModelProps> = (props) => ...@@ -44,6 +44,8 @@ export const JobDetailInfoModel: React.FC<JobDetailInfoModelProps> = (props) =>
destroyOnClose destroyOnClose
maskClosable={false} maskClosable={false}
okButtonProps={{ okButtonProps={{
htmlType: 'submit',
autoFocus: true,
style: { style: {
display: 'none' display: 'none'
} }
......
...@@ -33,7 +33,7 @@ const JobRunningModal: React.FC<JobRunningModalProps> = (props) => { ...@@ -33,7 +33,7 @@ const JobRunningModal: React.FC<JobRunningModalProps> = (props) => {
return ( return (
<Modal <Modal
title={`Job ${value?.jobName} is running`} title={value?.taskId ? `Job ${value?.jobName} is running` : 'No job running'}
open={visible} open={visible}
onOk={onOk} onOk={onOk}
width={'50%'} width={'50%'}
...@@ -47,7 +47,15 @@ const JobRunningModal: React.FC<JobRunningModalProps> = (props) => { ...@@ -47,7 +47,15 @@ const JobRunningModal: React.FC<JobRunningModalProps> = (props) => {
<Progress <Progress
showInfo showInfo
strokeLinecap={'round'} strokeLinecap={'round'}
percent={100} percent={
value?.taskId
? value?.jobState === 'RUNNING'
? 50
: value?.jobState === 'FINISHED'
? 100
: 0
: 0
}
status='active' status='active'
strokeColor={{ from: '#108ee9', to: '#87d068' }} strokeColor={{ from: '#108ee9', to: '#87d068' }}
/> />
......
...@@ -65,7 +65,7 @@ const FolderModal: React.FC<JobModalProps> = (props) => { ...@@ -65,7 +65,7 @@ const FolderModal: React.FC<JobModalProps> = (props) => {
*/ */
const submitForm = async (formData: Catalogue) => { const submitForm = async (formData: Catalogue) => {
await form.validateFields(); await form.validateFields();
const newValue = await form.getFieldsValue(); const newValue = form.getFieldsValue();
onSubmit({ ...values, name: newValue.name } as Catalogue); onSubmit({ ...values, name: newValue.name } as Catalogue);
}; };
...@@ -82,6 +82,10 @@ const FolderModal: React.FC<JobModalProps> = (props) => { ...@@ -82,6 +82,10 @@ const FolderModal: React.FC<JobModalProps> = (props) => {
modalProps={{ modalProps={{
destroyOnClose: true, destroyOnClose: true,
maskClosable: false, maskClosable: false,
okButtonProps: {
htmlType: 'submit',
autoFocus: true
},
onCancel: handleCancel onCancel: handleCancel
}} }}
onFinish={async (values) => submitForm(values)} onFinish={async (values) => submitForm(values)}
......
...@@ -27,6 +27,7 @@ import { l } from '@/utils/intl'; ...@@ -27,6 +27,7 @@ import { l } from '@/utils/intl';
import { ModalForm, ProFormSelect, ProFormText, ProFormTextArea } from '@ant-design/pro-components'; import { ModalForm, ProFormSelect, ProFormText, ProFormTextArea } from '@ant-design/pro-components';
import { ProFormCascader } from '@ant-design/pro-form/lib'; import { ProFormCascader } from '@ant-design/pro-form/lib';
import { Form } from 'antd'; import { Form } from 'antd';
import { DefaultOptionType } from 'antd/es/select';
import React, { useEffect } from 'react'; import React, { useEffect } from 'react';
type JobModalProps = { type JobModalProps = {
...@@ -39,7 +40,7 @@ type JobModalProps = { ...@@ -39,7 +40,7 @@ type JobModalProps = {
const JobModal: React.FC<JobModalProps> = (props) => { const JobModal: React.FC<JobModalProps> = (props) => {
const { onCancel, onSubmit, modalVisible, title, values } = props; const { onCancel, onSubmit, modalVisible, title, values } = props;
const [jobType, setJobType] = React.useState<string>(values.type || 'FlinkSql'); const [jobType, setJobType] = React.useState<string>(values.type || 'FlinkSql');
const [udfTemplate, setUdfTemplate] = React.useState<any[]>([]); const [udfTemplate, setUdfTemplate] = React.useState<DefaultOptionType[]>([]);
const [form] = Form.useForm<Catalogue>(); const [form] = Form.useForm<Catalogue>();
/** /**
...@@ -60,34 +61,43 @@ const JobModal: React.FC<JobModalProps> = (props) => { ...@@ -60,34 +61,43 @@ const JobModal: React.FC<JobModalProps> = (props) => {
form.setFieldsValue(newValues); form.setFieldsValue(newValues);
}, [open, values, form]); }, [open, values, form]);
const queryUdfTemplate = async () => { const queryUdfTemplate = () => {
await queryDataByParams(API_CONSTANTS.UDF_TEMPLATE_TREE).then((res) => { queryDataByParams<DefaultOptionType[]>(API_CONSTANTS.UDF_TEMPLATE_TREE).then((res) => {
res.map((item: any) => { const newRes: DefaultOptionType[] = [];
if (item.value === jobType) res = item.children.map((item: any) => item); res?.forEach((item: any) => {
if (item.value === jobType) {
item.children.forEach((item: any) => {
newRes.push(item);
}); });
setUdfTemplate(res); }
});
setUdfTemplate(newRes);
}); });
}; };
useEffect(() => { useEffect(() => {
if (isUDF(jobType)) queryUdfTemplate(); if (isUDF(jobType)) {
queryUdfTemplate();
}
}, [jobType, form]); }, [jobType, form]);
/** /**
* handle cancel * handle cancel
*/ */
const handleCancel = () => { const handleCancel = () => {
onCancel();
formContext.resetForm(); formContext.resetForm();
onCancel();
}; };
/** /**
* form values change * form values change
* @param changedValues * @param changedValues
* @param allValues
*/ */
const onValuesChange = (changedValues: any, allValues: any) => { const onValuesChange = (changedValues: any) => {
if (allValues.type) setJobType(allValues.type); if (changedValues.type) {
setJobType(changedValues.type);
form.resetFields(['configJson']); // 如果是UDF,重置configJson, 否则 模版id 会有渲染问题
}
}; };
/** /**
...@@ -179,6 +189,10 @@ const JobModal: React.FC<JobModalProps> = (props) => { ...@@ -179,6 +189,10 @@ const JobModal: React.FC<JobModalProps> = (props) => {
modalProps={{ modalProps={{
destroyOnClose: true, destroyOnClose: true,
maskClosable: false, maskClosable: false,
okButtonProps: {
htmlType: 'submit',
autoFocus: true
},
onCancel: handleCancel onCancel: handleCancel
}} }}
onFinish={async (values) => submitForm(values)} onFinish={async (values) => submitForm(values)}
......
...@@ -162,7 +162,7 @@ export const buildAlertGroupOptions = (alertGroups: Alert.AlertGroup[]) => { ...@@ -162,7 +162,7 @@ export const buildAlertGroupOptions = (alertGroups: Alert.AlertGroup[]) => {
key: -1 key: -1
} }
]; ];
for (const item of alertGroups) { alertGroups?.forEach((item) => {
alertGroupOptions.push({ alertGroupOptions.push({
label: ( label: (
<TagAlignLeft> <TagAlignLeft>
...@@ -173,7 +173,7 @@ export const buildAlertGroupOptions = (alertGroups: Alert.AlertGroup[]) => { ...@@ -173,7 +173,7 @@ export const buildAlertGroupOptions = (alertGroups: Alert.AlertGroup[]) => {
value: item.id, value: item.id,
key: item.id key: item.id
}); });
} });
return alertGroupOptions; return alertGroupOptions;
}; };
......
...@@ -78,6 +78,12 @@ const MetricsConfigForm = (props: MetricsConfigFormProps) => { ...@@ -78,6 +78,12 @@ const MetricsConfigForm = (props: MetricsConfigFormProps) => {
layout={'horizontal'} layout={'horizontal'}
title={l('devops.jobinfo.metrics.configMetrics')} title={l('devops.jobinfo.metrics.configMetrics')}
trigger={<Button type='primary'>{l('devops.jobinfo.metrics.configMetrics')}</Button>} trigger={<Button type='primary'>{l('devops.jobinfo.metrics.configMetrics')}</Button>}
modalProps={{
okButtonProps: {
htmlType: 'submit',
autoFocus: true
}
}}
onFinish={async () => await saveJobMetrics()} onFinish={async () => await saveJobMetrics()}
> >
<Tabs items={itemTabs} /> <Tabs items={itemTabs} />
......
...@@ -128,7 +128,7 @@ const JobVersionTab = (props: JobProps) => { ...@@ -128,7 +128,7 @@ const JobVersionTab = (props: JobProps) => {
return ( return (
<> <>
<ProCard size={'small'} bodyStyle={{ height: parent.innerHeight - 180, overflow: 'auto' }}> <ProCard size={'small'} bodyStyle={{ height: 'calc(100vh - 180px)', overflow: 'auto' }}>
{renderVersionList()} {renderVersionList()}
</ProCard> </ProCard>
</> </>
......
...@@ -61,6 +61,8 @@ const ChooseModal: React.FC<ChooseModalProps> = (props) => { ...@@ -61,6 +61,8 @@ const ChooseModal: React.FC<ChooseModalProps> = (props) => {
okText={l('button.confirm')} okText={l('button.confirm')}
okButtonProps={{ okButtonProps={{
disabled: check, disabled: check,
htmlType: 'submit',
autoFocus: true,
loading: submitting loading: submitting
}} }}
> >
......
...@@ -113,7 +113,13 @@ const AlertGroupForm: React.FC<AlertGroupFormProps & connect> = (props) => { ...@@ -113,7 +113,13 @@ const AlertGroupForm: React.FC<AlertGroupFormProps & connect> = (props) => {
<Button key={'GroupCancel'} onClick={() => handleModalVisible(false)}> <Button key={'GroupCancel'} onClick={() => handleModalVisible(false)}>
{l('button.cancel')} {l('button.cancel')}
</Button>, </Button>,
<Button key={'GroupFinish'} type='primary' onClick={() => submitForm()}> <Button
key={'GroupFinish'}
type='primary'
htmlType={'submit'}
autoFocus
onClick={() => submitForm()}
>
{l('button.finish')} {l('button.finish')}
</Button> </Button>
]; ];
......
...@@ -94,16 +94,6 @@ export const renderCommonSmsForm = (smsType: string) => { ...@@ -94,16 +94,6 @@ export const renderCommonSmsForm = (smsType: string) => {
rules={[{ required: true, message: l('rc.ai.templateIdPleaseHolder') }]} rules={[{ required: true, message: l('rc.ai.templateIdPleaseHolder') }]}
placeholder={l('rc.ai.templateIdPleaseHolder')} placeholder={l('rc.ai.templateIdPleaseHolder')}
/> />
<ProFormText
name={['params', 'configId']}
label={l('rc.ai.configId')}
width={'md'}
disabled
hidden
initialValue={randomStr(32)}
rules={[{ required: true, message: l('rc.ai.configIdPleaseHolder') }]}
placeholder={l('rc.ai.configIdPleaseHolder')}
/>
<ProFormDigit <ProFormDigit
name={['params', 'weight']} name={['params', 'weight']}
label={l('rc.ai.weight')} label={l('rc.ai.weight')}
...@@ -128,6 +118,16 @@ export const renderCommonSmsForm = (smsType: string) => { ...@@ -128,6 +118,16 @@ export const renderCommonSmsForm = (smsType: string) => {
rules={[{ required: true, message: l('rc.ai.maxRetriesPleaseHolder') }]} rules={[{ required: true, message: l('rc.ai.maxRetriesPleaseHolder') }]}
placeholder={l('rc.ai.maxRetriesPleaseHolder')} placeholder={l('rc.ai.maxRetriesPleaseHolder')}
/> />
<ProFormText
name={['params', 'configId']}
label={l('rc.ai.configId')}
width={'md'}
disabled
hidden
initialValue={randomStr(32)}
rules={[{ required: true, message: l('rc.ai.configIdPleaseHolder') }]}
placeholder={l('rc.ai.configIdPleaseHolder')}
/>
</> </>
); );
}; };
...@@ -140,14 +140,14 @@ export const renderAlibabaSmsForm = (smsType: string) => { ...@@ -140,14 +140,14 @@ export const renderAlibabaSmsForm = (smsType: string) => {
<ProFormText <ProFormText
name={['params', 'requestUrl']} name={['params', 'requestUrl']}
label={l('rc.ai.requestUrl')} label={l('rc.ai.requestUrl')}
width={'lg'} width={'md'}
rules={[{ required: true, message: l('rc.ai.requestUrlPleaseHolder') }]} rules={[{ required: true, message: l('rc.ai.requestUrlPleaseHolder') }]}
placeholder={l('rc.ai.requestUrlPleaseHolder')} placeholder={l('rc.ai.requestUrlPleaseHolder')}
/> />
<ProFormSelect <ProFormSelect
name={['params', 'regionId']} name={['params', 'regionId']}
label={l('rc.ai.regionId')} label={l('rc.ai.regionId')}
width={'md'} width={'sm'}
options={AliYunArea} options={AliYunArea}
rules={[{ required: true, message: l('rc.ai.regionIdPleaseHolder') }]} rules={[{ required: true, message: l('rc.ai.regionIdPleaseHolder') }]}
placeholder={l('rc.ai.regionIdPleaseHolder')} placeholder={l('rc.ai.regionIdPleaseHolder')}
...@@ -171,7 +171,6 @@ export const renderAlibabaSmsForm = (smsType: string) => { ...@@ -171,7 +171,6 @@ export const renderAlibabaSmsForm = (smsType: string) => {
initialValue={'SendSms'} initialValue={'SendSms'}
placeholder={l('rc.ai.actionPleaseHolder')} placeholder={l('rc.ai.actionPleaseHolder')}
/> />
<ProFormText <ProFormText
name={['params', 'version']} name={['params', 'version']}
label={l('rc.ai.version')} label={l('rc.ai.version')}
......
...@@ -103,7 +103,14 @@ const AlertTypeChoose: React.FC<UpdateFormProps> = (props) => { ...@@ -103,7 +103,14 @@ const AlertTypeChoose: React.FC<UpdateFormProps> = (props) => {
<Button key={'AlertTest'} type='primary' loading={loading} onClick={testSend}> <Button key={'AlertTest'} type='primary' loading={loading} onClick={testSend}>
{l('button.test')} {l('button.test')}
</Button>, </Button>,
<Button key={'AlertFinish'} type='primary' loading={loading} onClick={submit}> <Button
key={'AlertFinish'}
type='primary'
htmlType={'submit'}
autoFocus
loading={loading}
onClick={submit}
>
{l('button.finish')} {l('button.finish')}
</Button> </Button>
]; ];
......
...@@ -17,29 +17,59 @@ ...@@ -17,29 +17,59 @@
* *
*/ */
import {
AliYunSmsSvg,
DingTalkSvg,
EmailSvg,
FeiShuSvg,
SmsSvg,
TencentSmsSvg,
WeChatSvg
} from '@/components/Icons/AlertIcon';
import { ALERT_TYPE } from '@/types/RegCenter/data.d'; import { ALERT_TYPE } from '@/types/RegCenter/data.d';
import { l } from '@/utils/intl'; import { l } from '@/utils/intl';
import { Space } from 'antd';
import { DefaultOptionType } from 'rc-select/es/Select'; import { DefaultOptionType } from 'rc-select/es/Select';
export const ALERT_TYPE_LIST_OPTIONS: DefaultOptionType[] = [ export const ALERT_TYPE_LIST_OPTIONS: DefaultOptionType[] = [
{ {
label: l('rc.ai.dingTalk'), label: (
<Space align={'baseline'} size={5}>
<DingTalkSvg size={16} /> {l('rc.ai.dingTalk')}
</Space>
),
value: ALERT_TYPE.DINGTALK value: ALERT_TYPE.DINGTALK
}, },
{ {
label: l('rc.ai.wechat'), label: (
<Space align={'baseline'} size={5}>
<WeChatSvg size={16} /> {l('rc.ai.wechat')}
</Space>
),
value: ALERT_TYPE.WECHAT value: ALERT_TYPE.WECHAT
}, },
{ {
label: l('rc.ai.feishu'), label: (
<Space align={'baseline'} size={5}>
<FeiShuSvg size={16} /> {l('rc.ai.feishu')}
</Space>
),
value: ALERT_TYPE.FEISHU value: ALERT_TYPE.FEISHU
}, },
{ {
label: l('rc.ai.email'), label: (
<Space align={'baseline'} size={5}>
<EmailSvg size={16} /> {l('rc.ai.email')}
</Space>
),
value: ALERT_TYPE.EMAIL value: ALERT_TYPE.EMAIL
}, },
{ {
label: l('rc.ai.sms'), label: (
<Space align={'baseline'} size={5}>
<SmsSvg size={16} /> {l('rc.ai.sms')}
</Space>
),
value: ALERT_TYPE.SMS value: ALERT_TYPE.SMS
} }
]; ];
...@@ -60,12 +90,22 @@ export enum SMS_TYPE { ...@@ -60,12 +90,22 @@ export enum SMS_TYPE {
export const MANU_FRACTURES = [ export const MANU_FRACTURES = [
{ {
label: l('rc.ai.mf.alibaba'), label: (
value: SMS_TYPE.ALIBABA <Space align={'baseline'} size={5}>
<AliYunSmsSvg size={16} /> {l('rc.ai.mf.alibaba')}
</Space>
),
value: SMS_TYPE.ALIBABA,
key: l('rc.ai.mf.alibaba')
}, },
{ {
label: l('rc.ai.mf.tencent'), label: (
value: SMS_TYPE.TENCENT <Space align={'baseline'} size={5}>
<TencentSmsSvg size={16} /> {l('rc.ai.mf.tencent')}
</Space>
),
value: SMS_TYPE.TENCENT,
key: l('rc.ai.mf.tencent')
} }
// todo: 以下短信暂不实现 // todo: 以下短信暂不实现
// { // {
......
...@@ -54,5 +54,5 @@ export const getAlertIcon = (type: string, size?: number) => { ...@@ -54,5 +54,5 @@ export const getAlertIcon = (type: string, size?: number) => {
}; };
export const getSmsType = (type: string) => { export const getSmsType = (type: string) => {
return MANU_FRACTURES.find((item) => item.value === type)?.label; return MANU_FRACTURES.find((item) => item.value === type)?.key || '';
}; };
...@@ -93,7 +93,7 @@ const AlertTemplateForm: React.FC<AlertTemplateFormProps> = (props) => { ...@@ -93,7 +93,7 @@ const AlertTemplateForm: React.FC<AlertTemplateFormProps> = (props) => {
<CodeEdit <CodeEdit
{...CodeEditProps} {...CodeEditProps}
code={codeValue} code={codeValue}
onChange={(value) => setCodeValue(value ?? '')} onChange={(value: string) => setCodeValue(value ?? '')}
/> />
</ProForm.Item> </ProForm.Item>
</> </>
...@@ -108,7 +108,13 @@ const AlertTemplateForm: React.FC<AlertTemplateFormProps> = (props) => { ...@@ -108,7 +108,13 @@ const AlertTemplateForm: React.FC<AlertTemplateFormProps> = (props) => {
<Button key={'AlertTemplateCancel'} onClick={() => handleModalVisible(false)}> <Button key={'AlertTemplateCancel'} onClick={() => handleModalVisible(false)}>
{l('button.cancel')} {l('button.cancel')}
</Button>, </Button>,
<Button key={'AlertTemplateFinish'} type='primary' onClick={() => submitForm()}> <Button
key={'AlertTemplateFinish'}
type='primary'
htmlType={'submit'}
autoFocus
onClick={() => submitForm()}
>
{l('button.finish')} {l('button.finish')}
</Button> </Button>
]; ];
......
...@@ -30,17 +30,15 @@ import { l } from '@/utils/intl'; ...@@ -30,17 +30,15 @@ import { l } from '@/utils/intl';
import { useRequest } from '@@/exports'; import { useRequest } from '@@/exports';
import { PlusOutlined } from '@ant-design/icons'; import { PlusOutlined } from '@ant-design/icons';
import { PageContainer } from '@ant-design/pro-layout'; import { PageContainer } from '@ant-design/pro-layout';
import { Button, Card, List, Modal, Typography } from 'antd'; import { Button, Card, List, Modal } from 'antd';
import { useState } from 'react'; import { useState } from 'react';
import Markdown from 'react-markdown'; import Markdown from 'react-markdown';
const { Paragraph } = Typography;
export default () => { export default () => {
const [alertTemplateState, setAlertTemplateState] = const [alertTemplateState, setAlertTemplateState] =
useState<AlertTemplateState>(InitAlertTemplateState); useState<AlertTemplateState>(InitAlertTemplateState);
const { data, loading, run } = useRequest({ url: API_CONSTANTS.ALERT_TEMPLATE }); const { data, loading, run } = useRequest({ url: API_CONSTANTS.ALERT_TEMPLATE });
const nullData: Partial<Alert.AlertTemplate> = {};
/** /**
* edit click callback * edit click callback
...@@ -151,11 +149,24 @@ export default () => { ...@@ -151,11 +149,24 @@ export default () => {
return ( return (
<PageContainer> <PageContainer>
<Button
style={{ width: '100%', margin: '10px 0' }}
type={'dashed'}
icon={<PlusOutlined />}
onClick={() =>
setAlertTemplateState((prevState) => ({
...prevState,
addedOpen: true
}))
}
>
{l('button.create')}
</Button>
<List<Alert.AlertTemplate> <List<Alert.AlertTemplate>
rowKey='id' rowKey='id'
loading={loading} loading={loading}
grid={{ gutter: 16, xs: 1, sm: 2, md: 3, lg: 3, xl: 4, xxl: 4 }} grid={{ gutter: 16, xs: 1, sm: 2, md: 3, lg: 3, xl: 4, xxl: 4 }}
dataSource={[nullData, ...(data ?? [])]} dataSource={data ?? []}
renderItem={(item) => renderTemplateCard(item)} renderItem={(item) => renderTemplateCard(item)}
/> />
......
...@@ -84,7 +84,14 @@ const InstanceModal: React.FC<ConfigurationModalProps> = (props) => { ...@@ -84,7 +84,14 @@ const InstanceModal: React.FC<ConfigurationModalProps> = (props) => {
<Button key={'cancel'} onClick={() => handleCancel()}> <Button key={'cancel'} onClick={() => handleCancel()}>
{l('button.cancel')} {l('button.cancel')}
</Button>, </Button>,
<Button key={'finish'} loading={submitting} type='primary' onClick={() => submitForm()}> <Button
key={'finish'}
loading={submitting}
type='primary'
htmlType={'submit'}
autoFocus
onClick={() => submitForm()}
>
{l('button.finish')} {l('button.finish')}
</Button> </Button>
]; ];
......
...@@ -85,7 +85,14 @@ const InstanceModal: React.FC<InstanceModalProps> = (props) => { ...@@ -85,7 +85,14 @@ const InstanceModal: React.FC<InstanceModalProps> = (props) => {
<Button key={'cancel'} onClick={() => handleCancel()}> <Button key={'cancel'} onClick={() => handleCancel()}>
{l('button.cancel')} {l('button.cancel')}
</Button>, </Button>,
<Button key={'finish'} loading={submitting} type='primary' onClick={() => submitForm()}> <Button
key={'finish'}
loading={submitting}
type='primary'
htmlType={'submit'}
autoFocus
onClick={() => submitForm()}
>
{l('button.finish')} {l('button.finish')}
</Button> </Button>
]; ];
......
...@@ -30,11 +30,13 @@ import { AutoComplete, Form } from 'antd'; ...@@ -30,11 +30,13 @@ import { AutoComplete, Form } from 'antd';
import { FormInstance } from 'antd/es/form/hooks/useForm'; import { FormInstance } from 'antd/es/form/hooks/useForm';
import TextArea from 'antd/es/input/TextArea'; import TextArea from 'antd/es/input/TextArea';
import { Values } from 'async-validator'; import { Values } from 'async-validator';
import React, { useState } from 'react'; import React from 'react';
type DataSourceProFormProps = { type DataSourceProFormProps = {
values: Partial<DataSources.DataSource>; values: Partial<DataSources.DataSource>;
form: FormInstance<Values>; form: FormInstance<Values>;
dbType: string;
excludeFormItem: boolean;
flinkConfigChange: (value: string) => void; flinkConfigChange: (value: string) => void;
flinkTemplateChange: (value: string) => void; flinkTemplateChange: (value: string) => void;
}; };
...@@ -47,19 +49,7 @@ const CodeEditProps = { ...@@ -47,19 +49,7 @@ const CodeEditProps = {
}; };
const DataSourceProForm: React.FC<DataSourceProFormProps> = (props) => { const DataSourceProForm: React.FC<DataSourceProFormProps> = (props) => {
const { values, form, flinkTemplateChange, flinkConfigChange } = props; const { values, form, dbType, excludeFormItem, flinkTemplateChange, flinkConfigChange } = props;
const [excludeFormItem, setExcludeFormItem] = useState<boolean>(false);
const [dbType, setDbType] = useState<string>(values.type ?? 'MySQL');
const handleTypeChange = (value: any) => {
if (value.type) setDbType(value.type);
if (value.type === 'Hive' || value.type === 'Presto') {
setExcludeFormItem(true);
} else {
setExcludeFormItem(false);
}
};
const renderDataSourceForm = () => { const renderDataSourceForm = () => {
return ( return (
......
...@@ -23,7 +23,7 @@ import { DataSources } from '@/types/RegCenter/data'; ...@@ -23,7 +23,7 @@ import { DataSources } from '@/types/RegCenter/data';
import { l } from '@/utils/intl'; import { l } from '@/utils/intl';
import { ModalForm } from '@ant-design/pro-components'; import { ModalForm } from '@ant-design/pro-components';
import { Button, Form } from 'antd'; import { Button, Form } from 'antd';
import React, { useEffect } from 'react'; import React, { useEffect, useState } from 'react';
type DataSourceModalProps = { type DataSourceModalProps = {
visible: boolean; visible: boolean;
...@@ -40,6 +40,8 @@ const DataSourceModal: React.FC<DataSourceModalProps> = (props) => { ...@@ -40,6 +40,8 @@ const DataSourceModal: React.FC<DataSourceModalProps> = (props) => {
const [flinkTemplateValue, setFlinkTemplateValue] = React.useState<string>( const [flinkTemplateValue, setFlinkTemplateValue] = React.useState<string>(
values.flinkTemplate || '' values.flinkTemplate || ''
); );
const [dbType, setDbType] = useState<string>(values.type ?? 'MySQL');
const [excludeFormItem, setExcludeFormItem] = useState<boolean>(false);
/** /**
* init form * init form
...@@ -122,12 +124,28 @@ const DataSourceModal: React.FC<DataSourceModalProps> = (props) => { ...@@ -122,12 +124,28 @@ const DataSourceModal: React.FC<DataSourceModalProps> = (props) => {
<Button key={'test'} loading={submitting} type='primary' onClick={handleTestConnect}> <Button key={'test'} loading={submitting} type='primary' onClick={handleTestConnect}>
{l('button.test')} {l('button.test')}
</Button>, </Button>,
<Button key={'finish'} loading={submitting} type='primary' onClick={() => submitForm()}> <Button
key={'finish'}
loading={submitting}
type='primary'
htmlType={'submit'}
autoFocus
onClick={() => submitForm()}
>
{l('button.finish')} {l('button.finish')}
</Button> </Button>
]; ];
}; };
const handleTypeChange = (value: any) => {
if (value.type) setDbType(value.type);
if (value.type === 'Hive' || value.type === 'Presto') {
setExcludeFormItem(true);
} else {
setExcludeFormItem(false);
}
};
/** /**
* render * render
*/ */
...@@ -139,6 +157,7 @@ const DataSourceModal: React.FC<DataSourceModalProps> = (props) => { ...@@ -139,6 +157,7 @@ const DataSourceModal: React.FC<DataSourceModalProps> = (props) => {
modalProps={{ onCancel: handleCancel }} modalProps={{ onCancel: handleCancel }}
title={values.id ? l('rc.ds.modify') : l('rc.ds.create')} title={values.id ? l('rc.ds.modify') : l('rc.ds.create')}
form={form} form={form}
onValuesChange={handleTypeChange}
submitter={{ render: () => [...renderFooter()] }} submitter={{ render: () => [...renderFooter()] }}
initialValues={{ initialValues={{
...values, ...values,
...@@ -148,6 +167,8 @@ const DataSourceModal: React.FC<DataSourceModalProps> = (props) => { ...@@ -148,6 +167,8 @@ const DataSourceModal: React.FC<DataSourceModalProps> = (props) => {
> >
<DataSourceProForm <DataSourceProForm
values={values} values={values}
excludeFormItem={excludeFormItem}
dbType={dbType}
form={form} form={form}
flinkConfigChange={handleFlinkConfigValueChange} flinkConfigChange={handleFlinkConfigValueChange}
flinkTemplateChange={handleFlinkTemplateValueChange} flinkTemplateChange={handleFlinkTemplateValueChange}
......
...@@ -72,6 +72,10 @@ const DocumentModalForm: React.FC<DocumentModalProps> = (props) => { ...@@ -72,6 +72,10 @@ const DocumentModalForm: React.FC<DocumentModalProps> = (props) => {
{...NORMAL_MODAL_OPTIONS} {...NORMAL_MODAL_OPTIONS}
title={values.id ? l('rc.doc.modify') : l('rc.doc.create')} title={values.id ? l('rc.doc.modify') : l('rc.doc.create')}
open={modalVisible} open={modalVisible}
okButtonProps={{
htmlType: 'submit',
autoFocus: true
}}
onOk={() => submitForm()} onOk={() => submitForm()}
onCancel={() => handleModalVisible()} onCancel={() => handleModalVisible()}
> >
......
...@@ -153,7 +153,7 @@ const JarList: React.FC<JarListProps> = (props) => { ...@@ -153,7 +153,7 @@ const JarList: React.FC<JarListProps> = (props) => {
expandedRowRender: (record) => renderUdf(record) expandedRowRender: (record) => renderUdf(record)
}} }}
dragSortKey={'orderLine'} dragSortKey={'orderLine'}
onDragSortEnd={handleDragSortEnd} onDragSortEnd={(beforeIndex, afterIndex, newDataSource) => handleDragSortEnd(newDataSource)}
/> />
); );
}; };
......
...@@ -214,6 +214,8 @@ export const BuildSteps: React.FC<BuildStepsProps> = (props) => { ...@@ -214,6 +214,8 @@ export const BuildSteps: React.FC<BuildStepsProps> = (props) => {
key={'finish'} key={'finish'}
type={'primary'} type={'primary'}
hidden={showLog} hidden={showLog}
htmlType={'submit'}
autoFocus
disabled={steps[currentStep - 1]?.status === 'error' && percent !== 99} disabled={steps[currentStep - 1]?.status === 'error' && percent !== 99}
loading={currentStep !== steps.length && percent !== 99} loading={currentStep !== steps.length && percent !== 99}
onClick={() => handleCancel()} onClick={() => handleCancel()}
......
...@@ -91,7 +91,14 @@ const ProjectModal: React.FC<ProjectModalProps> = (props) => { ...@@ -91,7 +91,14 @@ const ProjectModal: React.FC<ProjectModalProps> = (props) => {
<Button key={'cancel'} onClick={() => handleCancel()}> <Button key={'cancel'} onClick={() => handleCancel()}>
{l('button.cancel')} {l('button.cancel')}
</Button>, </Button>,
<Button key={'finish'} loading={submitting} type='primary' onClick={() => submitForm()}> <Button
key={'finish'}
loading={submitting}
type='primary'
htmlType={'submit'}
autoFocus
onClick={() => submitForm()}
>
{l('button.finish')} {l('button.finish')}
</Button> </Button>
]; ];
......
...@@ -304,6 +304,8 @@ const ProjectProTable: React.FC = () => { ...@@ -304,6 +304,8 @@ const ProjectProTable: React.FC = () => {
<Button <Button
title={l('button.build')} title={l('button.build')}
key={`${record.id}_buildbtn`} key={`${record.id}_buildbtn`}
htmlType={'submit'}
autoFocus
icon={<BuildTwoTone />} icon={<BuildTwoTone />}
/> />
</Popconfirm> </Popconfirm>
...@@ -391,7 +393,7 @@ const ProjectProTable: React.FC = () => { ...@@ -391,7 +393,7 @@ const ProjectProTable: React.FC = () => {
request={(params, sorter, filter: any) => request={(params, sorter, filter: any) =>
queryList(API_CONSTANTS.GIT_PROJECT, { ...params, sorter, filter }) queryList(API_CONSTANTS.GIT_PROJECT, { ...params, sorter, filter })
} }
onDragSortEnd={handleDragSortEnd} onDragSortEnd={(beforeIndex, afterIndex, newDataSource) => handleDragSortEnd(newDataSource)}
/> />
{/* added modal form */} {/* added modal form */}
<ProjectModal <ProjectModal
......
...@@ -79,6 +79,7 @@ const GlobalVarModal: React.FC<GlobalVarModalProps> = (props) => { ...@@ -79,6 +79,7 @@ const GlobalVarModal: React.FC<GlobalVarModalProps> = (props) => {
{...NORMAL_MODAL_OPTIONS} {...NORMAL_MODAL_OPTIONS}
title={values.id ? l('rc.gv.modify') : l('rc.gv.create')} title={values.id ? l('rc.gv.modify') : l('rc.gv.create')}
open={modalVisible} open={modalVisible}
okButtonProps={{ htmlType: 'submit', autoFocus: true }}
onOk={() => submitForm()} onOk={() => submitForm()}
onCancel={() => handleModalVisible()} onCancel={() => handleModalVisible()}
> >
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
*/ */
import { FormContextValue } from '@/components/Context/FormContext'; import { FormContextValue } from '@/components/Context/FormContext';
import { Resource } from '@/pages/RegCenter/Resource/components/ResourceOverView'; import { ResourceInfo } from '@/types/RegCenter/data.d';
import { ModalForm, ProFormText, ProFormTextArea } from '@ant-design/pro-components'; import { ModalForm, ProFormText, ProFormTextArea } from '@ant-design/pro-components';
import { Form } from 'antd'; import { Form } from 'antd';
import React, { useEffect } from 'react'; import React, { useEffect } from 'react';
...@@ -27,8 +27,8 @@ type ResourceModalProps = { ...@@ -27,8 +27,8 @@ type ResourceModalProps = {
title: string; title: string;
visible: boolean; visible: boolean;
onClose: () => void; onClose: () => void;
onOk: (value: Partial<Resource>) => void; onOk: (value: Partial<ResourceInfo>) => void;
formValues: Partial<Resource>; formValues: Partial<ResourceInfo>;
}; };
const ResourceModal: React.FC<ResourceModalProps> = (props) => { const ResourceModal: React.FC<ResourceModalProps> = (props) => {
...@@ -70,15 +70,19 @@ const ResourceModal: React.FC<ResourceModalProps> = (props) => { ...@@ -70,15 +70,19 @@ const ResourceModal: React.FC<ResourceModalProps> = (props) => {
*/ */
const submitForm = async () => { const submitForm = async () => {
const fieldsValue = await form.validateFields(); const fieldsValue = await form.validateFields();
await handleSubmit({ ...formValues, ...fieldsValue }); handleSubmit({ ...formValues, ...fieldsValue });
await handleCancel(); handleCancel();
}; };
return ( return (
<> <>
<ModalForm<Resource> <ModalForm<ResourceInfo>
title={title} title={title}
modalProps={{ destroyOnClose: true, onCancel: handleModalVisible }} modalProps={{
destroyOnClose: true,
onCancel: handleModalVisible,
okButtonProps: { htmlType: 'submit', autoFocus: true }
}}
onFinish={submitForm} onFinish={submitForm}
form={form} form={form}
open={visible} open={visible}
......
...@@ -59,7 +59,13 @@ const ResourcesUploadModal: React.FC<ResourcesUploadModalProps> = (props) => { ...@@ -59,7 +59,13 @@ const ResourcesUploadModal: React.FC<ResourcesUploadModalProps> = (props) => {
} }
}; };
return ( return (
<Modal title={l('rc.resource.upload')} onOk={onOk} onCancel={onClose} open={visible}> <Modal
title={l('rc.resource.upload')}
okButtonProps={{ htmlType: 'submit', autoFocus: true }}
onOk={onOk}
onCancel={onClose}
open={visible}
>
<Dragger {...uploadProps}> <Dragger {...uploadProps}>
<p className='ant-upload-drag-icon'> <p className='ant-upload-drag-icon'>
<InboxOutlined /> <InboxOutlined />
......
...@@ -46,6 +46,7 @@ const UDFRegisterModal: React.FC<UDFRegisterModalProps> = (props) => { ...@@ -46,6 +46,7 @@ const UDFRegisterModal: React.FC<UDFRegisterModalProps> = (props) => {
destroyOnClose destroyOnClose
closable closable
maskClosable={false} maskClosable={false}
okButtonProps={{ htmlType: 'submit', autoFocus: true }}
onCancel={() => openChange(false)} onCancel={() => openChange(false)}
onOk={() => onOk()} onOk={() => onOk()}
> >
......
...@@ -84,7 +84,14 @@ const TemplateModal: React.FC<TemplateModalProps> = (props) => { ...@@ -84,7 +84,14 @@ const TemplateModal: React.FC<TemplateModalProps> = (props) => {
<Button key={'cancel'} onClick={() => handleCancel()}> <Button key={'cancel'} onClick={() => handleCancel()}>
{l('button.cancel')} {l('button.cancel')}
</Button>, </Button>,
<Button key={'finish'} loading={submitting} type='primary' onClick={() => submitForm()}> <Button
key={'finish'}
loading={submitting}
type='primary'
htmlType={'submit'}
autoFocus
onClick={() => submitForm()}
>
{l('button.finish')} {l('button.finish')}
</Button> </Button>
]; ];
......
...@@ -77,7 +77,13 @@ const RuleEditForm = (props: AlertRuleFormProps) => { ...@@ -77,7 +77,13 @@ const RuleEditForm = (props: AlertRuleFormProps) => {
<Button key={'RuleCancel'} onClick={() => handleModalVisible(false)}> <Button key={'RuleCancel'} onClick={() => handleModalVisible(false)}>
{l('button.cancel')} {l('button.cancel')}
</Button>, </Button>,
<Button key={'RuleFinish'} type='primary' onClick={() => submit()}> <Button
key={'RuleFinish'}
type='primary'
htmlType={'submit'}
autoFocus
onClick={() => submit()}
>
{l('button.finish')} {l('button.finish')}
</Button> </Button>
]; ];
......
...@@ -37,7 +37,10 @@ export const TestLogin = () => { ...@@ -37,7 +37,10 @@ export const TestLogin = () => {
width={400} width={400}
onFinish={testLogin} onFinish={testLogin}
form={form} form={form}
modalProps={{ onCancel: () => form.resetFields() }} modalProps={{
onCancel: () => form.resetFields(),
okButtonProps: { htmlType: 'submit', autoFocus: true }
}}
trigger={ trigger={
<Tag icon={<LoginOutlined />} color='#108ee9'> <Tag icon={<LoginOutlined />} color='#108ee9'>
{l('sys.ldap.settings.testLogin')} {l('sys.ldap.settings.testLogin')}
......
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