-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
wangqi
committed
Nov 26, 2024
1 parent
86836c5
commit 1f98a0d
Showing
8 changed files
with
219 additions
and
101 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
scaleph-common/src/main/java/cn/sliew/scaleph/common/dict/DictRegister.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
package cn.sliew.scaleph.common.dict; | ||
|
||
import cn.sliew.carp.framework.common.dict.EnumDictRegistry; | ||
import org.apache.commons.lang3.EnumUtils; | ||
import org.springframework.beans.factory.InitializingBean; | ||
import org.springframework.stereotype.Component; | ||
|
||
import java.util.List; | ||
|
||
@Component | ||
public class DictRegister implements InitializingBean { | ||
|
||
@Override | ||
public void afterPropertiesSet() throws Exception { | ||
List<DictType> enumList = EnumUtils.getEnumList(DictType.class); | ||
for (DictType dictType : enumList) { | ||
List values = EnumUtils.getEnumList(dictType.getInstanceClass()); | ||
EnumDictRegistry.register(dictType, values); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
scaleph-ui-react/src/pages/Project/Workspace/DataService/Config/Steps/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 84 additions & 0 deletions
84
scaleph-ui-react/src/pages/Project/Workspace/Schedule/Job/ScheduleJobForm.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import {Form, message} from 'antd'; | ||
import {ModalForm, ProFormDigit, ProFormText, ProFormTextArea} from "@ant-design/pro-components"; | ||
import {useIntl} from '@umijs/max'; | ||
import {ModalFormProps} from '@/typings'; | ||
import {WORKSPACE_CONF} from '@/constants/constant'; | ||
import {ScheduleJob} from '@/services/project/typings'; | ||
import {WsScheduleGroupService} from "@/services/project/WsScheduleGroupService"; | ||
|
||
const ScheduleJobForm: React.FC<ModalFormProps<ScheduleJob>> = ({ | ||
data, | ||
visible, | ||
onVisibleChange | ||
}) => { | ||
const intl = useIntl(); | ||
const [form] = Form.useForm(); | ||
const projectId = localStorage.getItem(WORKSPACE_CONF.projectId); | ||
|
||
return ( | ||
<ModalForm | ||
title={ | ||
data.id | ||
? intl.formatMessage({id: 'app.common.operate.edit.label'}) + | ||
intl.formatMessage({id: 'pages.project.schedule.job'}) | ||
: intl.formatMessage({id: 'app.common.operate.new.label'}) + | ||
intl.formatMessage({id: 'pages.project.schedule.job'}) | ||
} | ||
form={form} | ||
initialValues={{ | ||
id: data?.id, | ||
name: data?.name, | ||
remark: data?.remark, | ||
}} | ||
open={visible} | ||
onOpenChange={onVisibleChange} | ||
width={580} | ||
layout={"horizontal"} | ||
labelCol={{span: 6}} | ||
wrapperCol={{span: 16}} | ||
modalProps={{ | ||
destroyOnClose: true, | ||
closeIcon: false | ||
}} | ||
onFinish={(values: Record<string, any>) => { | ||
const param = { | ||
id: values.id, | ||
namespace: projectId, | ||
name: values.name, | ||
remark: values.remark | ||
}; | ||
return values.id | ||
? WsScheduleGroupService.update(param).then((response) => { | ||
if (response.success) { | ||
message.success(intl.formatMessage({id: 'app.common.operate.edit.success'})); | ||
if (onVisibleChange) { | ||
onVisibleChange(false); | ||
} | ||
} | ||
}) | ||
: WsScheduleGroupService.add(param).then((response) => { | ||
if (response.success) { | ||
message.success(intl.formatMessage({id: 'app.common.operate.new.success'})); | ||
if (onVisibleChange) { | ||
onVisibleChange(false); | ||
} | ||
} | ||
}) | ||
}} | ||
> | ||
<ProFormDigit name="id" hidden/> | ||
<ProFormText | ||
name="name" | ||
label={intl.formatMessage({id: 'pages.project.schedule.group.name'})} | ||
rules={[{required: true}, {max: 32}]} | ||
/> | ||
<ProFormTextArea | ||
name="remark" | ||
label={intl.formatMessage({id: 'app.common.data.remark'})} | ||
rules={[{max: 200}]} | ||
/> | ||
</ModalForm> | ||
); | ||
}; | ||
|
||
export default ScheduleJobForm; |
Oops, something went wrong.