Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
yiicenne
DolphinScheduler
提交
64a23cdc
DolphinScheduler
项目概览
yiicenne
/
DolphinScheduler
与 Fork 源项目一致
Fork自
apache / DolphinScheduler
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
DolphinScheduler
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
64a23cdc
编写于
9月 30, 2022
作者:
A
Amy0104
提交者:
GitHub
9月 30, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[Improvement][UI] Set the `required` to be reactive in the task modal. (#12225)
上级
aacabc6e
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
57 addition
and
36 deletion
+57
-36
dolphinscheduler-ui/src/components/form/fields/custom-parameters.ts
...eduler-ui/src/components/form/fields/custom-parameters.ts
+13
-6
dolphinscheduler-ui/src/components/form/fields/get-field.ts
dolphinscheduler-ui/src/components/form/fields/get-field.ts
+3
-4
dolphinscheduler-ui/src/components/form/fields/multi-condition.ts
...cheduler-ui/src/components/form/fields/multi-condition.ts
+3
-4
dolphinscheduler-ui/src/components/form/get-elements-by-json.ts
...nscheduler-ui/src/components/form/get-elements-by-json.ts
+2
-3
dolphinscheduler-ui/src/components/form/index.tsx
dolphinscheduler-ui/src/components/form/index.tsx
+2
-2
dolphinscheduler-ui/src/components/form/types.ts
dolphinscheduler-ui/src/components/form/types.ts
+17
-4
dolphinscheduler-ui/src/components/form/utils.ts
dolphinscheduler-ui/src/components/form/utils.ts
+4
-4
dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-resources.ts
...ews/projects/task/components/node/fields/use-resources.ts
+1
-1
dolphinscheduler-ui/src/views/security/alarm-instance-manage/detail.tsx
...er-ui/src/views/security/alarm-instance-manage/detail.tsx
+2
-2
dolphinscheduler-ui/src/views/security/alarm-instance-manage/types.ts
...uler-ui/src/views/security/alarm-instance-manage/types.ts
+7
-3
dolphinscheduler-ui/src/views/security/alarm-instance-manage/use-form.ts
...r-ui/src/views/security/alarm-instance-manage/use-form.ts
+3
-3
未找到文件。
dolphinscheduler-ui/src/components/form/fields/custom-parameters.ts
浏览文件 @
64a23cdc
...
...
@@ -17,12 +17,19 @@
import
{
defineComponent
,
h
,
unref
,
renderSlot
}
from
'
vue
'
import
{
useFormItem
}
from
'
naive-ui/es/_mixins
'
import
{
NFormItemGi
,
NSpace
,
NButton
,
NGrid
,
NGridItem
}
from
'
naive-ui
'
import
{
NFormItemGi
,
NSpace
,
NButton
,
NGrid
,
NGridItem
,
FormItemRule
}
from
'
naive-ui
'
import
{
isFunction
}
from
'
lodash
'
import
{
PlusOutlined
,
DeleteOutlined
}
from
'
@vicons/antd
'
import
getField
from
'
./get-field
'
import
{
formatValidate
}
from
'
../utils
'
import
type
{
IJsonItem
,
FormItemRule
}
from
'
../types
'
import
type
{
IJsonItem
,
I
FormItemRule
}
from
'
../types
'
const
CustomParameters
=
defineComponent
({
name
:
'
CustomParameters
'
,
...
...
@@ -66,11 +73,11 @@ const CustomParameters = defineComponent({
const
getDefaultValue
=
(
children
:
IJsonItem
[])
=>
{
const
defaultValue
:
{
[
field
:
string
]:
any
}
=
{}
const
ruleItem
:
{
[
key
:
string
]:
FormItemRule
[]
|
FormItemRule
}
=
{}
const
ruleItem
:
{
[
key
:
string
]:
IFormItemRule
[]
|
I
FormItemRule
}
=
{}
const
loop
=
(
children
:
IJsonItem
[],
parent
:
{
[
field
:
string
]:
any
},
ruleParent
:
{
[
key
:
string
]:
FormItemRule
[]
|
FormItemRule
}
ruleParent
:
{
[
key
:
string
]:
IFormItemRule
[]
|
I
FormItemRule
}
)
=>
{
children
.
forEach
((
child
)
=>
{
const
mergedChild
=
isFunction
(
child
)
?
child
()
:
child
...
...
@@ -102,7 +109,7 @@ const getDefaultValue = (children: IJsonItem[]) => {
export
function
renderCustomParameters
(
item
:
IJsonItem
,
fields
:
{
[
field
:
string
]:
any
},
rules
:
{
[
key
:
string
]:
FormItemRule
|
FormItemRule
[]
}[]
rules
:
{
[
key
:
string
]:
IFormItemRule
|
I
FormItemRule
[]
}[]
)
{
const
mergedItem
=
isFunction
(
item
)
?
item
()
:
item
const
{
field
,
children
=
[]
}
=
mergedItem
...
...
@@ -119,7 +126,7 @@ export function renderCustomParameters(
label
:
mergedChild
.
name
,
span
:
unref
(
mergedChild
.
span
),
class
:
mergedChild
.
class
,
rule
:
mergedChild
.
rule
rule
:
mergedChild
.
rule
as
FormItemRule
},
()
=>
getField
(
mergedChild
,
item
)
)
...
...
dolphinscheduler-ui/src/components/form/fields/get-field.ts
浏览文件 @
64a23cdc
...
...
@@ -16,8 +16,7 @@
*/
import
*
as
Field
from
'
./index
'
import
{
camelCase
,
upperFirst
,
isFunction
}
from
'
lodash
'
import
type
{
FormRules
,
FormItemRule
}
from
'
naive-ui
'
import
type
{
IJsonItem
}
from
'
../types
'
import
type
{
IJsonItem
,
IFormRules
,
IFormItemRule
}
from
'
../types
'
const
TYPES
=
[
'
input
'
,
...
...
@@ -37,7 +36,7 @@ const TYPES = [
const
getField
=
(
item
:
IJsonItem
,
fields
:
{
[
field
:
string
]:
any
},
rules
?:
FormRules
rules
?:
I
FormRules
)
=>
{
const
{
type
=
'
input
'
,
widget
,
field
}
=
isFunction
(
item
)
?
item
()
:
item
if
(
!
TYPES
.
includes
(
type
))
return
null
...
...
@@ -47,7 +46,7 @@ const getField = (
}
// TODO Support other widgets later
if
(
type
===
'
custom-parameters
'
)
{
let
fieldRules
:
{
[
key
:
string
]:
FormItemRule
}[]
=
[]
let
fieldRules
:
{
[
key
:
string
]:
I
FormItemRule
}[]
=
[]
if
(
rules
&&
!
rules
[
field
])
fieldRules
=
rules
[
field
]
=
[]
// @ts-ignore
return
Field
[
renderTypeName
](
item
,
fields
,
fieldRules
)
...
...
dolphinscheduler-ui/src/components/form/fields/multi-condition.ts
浏览文件 @
64a23cdc
...
...
@@ -20,7 +20,7 @@ import { useFormItem } from 'naive-ui/es/_mixins'
import
{
NFormItemGi
,
NSpace
,
NButton
,
NGrid
,
NGridItem
}
from
'
naive-ui
'
import
{
PlusOutlined
,
DeleteOutlined
}
from
'
@vicons/antd
'
import
{
isFunction
}
from
'
lodash
'
import
type
{
IJsonItem
,
FormItemRule
}
from
'
../types
'
import
type
{
IJsonItem
,
I
FormItemRule
}
from
'
../types
'
import
getField
from
'
@/components/form/fields/get-field
'
import
{
formatValidate
}
from
'
@/components/form/utils
'
...
...
@@ -65,10 +65,9 @@ const MultiCondition = defineComponent({
export
function
renderMultiCondition
(
item
:
IJsonItem
,
fields
:
{
[
field
:
string
]:
any
},
unused
:
{
[
key
:
string
]:
FormItemRule
}[]
fields
:
{
[
field
:
string
]:
any
}
)
{
const
ruleItem
:
{
[
key
:
string
]:
FormItemRule
}
=
{}
const
ruleItem
:
{
[
key
:
string
]:
I
FormItemRule
}
=
{}
// the fields is the data of the task definition.
// the item is the options of this component in the form.
...
...
dolphinscheduler-ui/src/components/form/get-elements-by-json.ts
浏览文件 @
64a23cdc
...
...
@@ -19,14 +19,13 @@ import { toRef, Ref } from 'vue'
import
{
formatValidate
}
from
'
./utils
'
import
getField
from
'
./fields/get-field
'
import
{
omit
,
isFunction
}
from
'
lodash
'
import
type
{
FormRules
}
from
'
naive-ui
'
import
type
{
IFormItem
,
IJsonItem
}
from
'
./types
'
import
type
{
IFormItem
,
IJsonItem
,
IFormRules
}
from
'
./types
'
export
default
function
getElementByJson
(
json
:
IJsonItem
[],
fields
:
{
[
field
:
string
]:
any
}
)
{
const
rules
:
FormRules
=
{}
const
rules
:
I
FormRules
=
{}
const
initialValues
:
{
[
field
:
string
]:
any
}
=
{}
const
elements
:
IFormItem
[]
=
[]
for
(
const
item
of
json
)
{
...
...
dolphinscheduler-ui/src/components/form/index.tsx
浏览文件 @
64a23cdc
...
...
@@ -16,7 +16,7 @@
*/
import
{
defineComponent
,
PropType
,
toRefs
,
h
,
unref
}
from
'
vue
'
import
{
NSpin
,
NGrid
,
NForm
,
NFormItemGi
}
from
'
naive-ui
'
import
{
NSpin
,
NGrid
,
NForm
,
NFormItemGi
,
FormRules
}
from
'
naive-ui
'
import
{
useForm
}
from
'
./use-form
'
import
type
{
GridProps
,
IMeta
}
from
'
./types
'
...
...
@@ -50,7 +50,7 @@ const Form = defineComponent({
const
{
elements
=
[],
...
restFormProps
}
=
meta
return
(
<
NSpin
show
=
{
loading
}
>
<
NForm
{
...
restFormProps
}
ref
=
'formRef'
>
<
NForm
{
...
restFormProps
}
r
ules
=
{
meta
.
rules
as
FormRules
}
r
ef
=
'formRef'
>
<
NGrid
{
...
layout
}
>
{
elements
.
map
((
element
)
=>
{
const
{
span
=
24
,
path
,
widget
,
...
formItemProps
}
=
element
...
...
dolphinscheduler-ui/src/components/form/types.ts
浏览文件 @
64a23cdc
...
...
@@ -45,18 +45,29 @@ interface IFormItem {
class
?:
string
}
interface
IMeta
extends
Omit
<
FormProps
,
'
model
'
>
{
interface
IMeta
extends
Omit
<
FormProps
,
'
model
'
|
'
rules
'
>
{
elements
?:
IFormItem
[]
model
:
object
rules
:
IFormRules
}
interface
IFormItemRule
extends
Omit
<
FormItemRule
,
'
required
'
>
{
required
?:
boolean
|
Ref
<
boolean
>
}
type
IFormRules
=
|
{
[
path
:
string
]:
IFormItemRule
|
IFormItemRule
[]
}
|
FormRules
interface
IJsonItemParams
{
field
:
string
name
?:
string
props
?:
any
title
?:
string
type
?:
IType
validate
?:
FormItemRule
validate
?:
I
FormItemRule
value
?:
any
options
?:
IOption
[]
|
Ref
<
IOption
[]
>
children
?:
IJsonItem
[]
...
...
@@ -65,7 +76,7 @@ interface IJsonItemParams {
widget
?:
any
class
?:
string
path
?:
string
rule
?:
FormItemRule
rule
?:
I
FormItemRule
}
type
IJsonItemFn
=
(
i
?:
number
)
=>
IJsonItemParams
...
...
@@ -81,5 +92,7 @@ export {
FormRules
,
IFormItem
,
GridProps
,
IJsonItemParams
IJsonItemParams
,
IFormItemRule
,
IFormRules
}
dolphinscheduler-ui/src/components/form/utils.ts
浏览文件 @
64a23cdc
...
...
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
type
{
FormRules
,
FormItemRule
}
from
'
./types
'
import
type
{
FormRules
,
I
FormItemRule
}
from
'
./types
'
export
function
formatLabel
(
label
?:
string
):
string
{
if
(
!
label
)
return
''
...
...
@@ -23,11 +23,11 @@ export function formatLabel(label?: string): string {
}
export
function
formatValidate
(
validate
?:
FormItemRule
|
FormRules
):
FormItemRule
{
validate
?:
I
FormItemRule
|
FormRules
):
I
FormItemRule
{
if
(
!
validate
)
return
{}
if
(
Array
.
isArray
(
validate
))
{
validate
.
forEach
((
item
:
FormItemRule
)
=>
{
validate
.
forEach
((
item
:
I
FormItemRule
)
=>
{
if
(
!
item
?.
message
)
delete
item
.
message
return
item
})
...
...
dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-resources.ts
浏览文件 @
64a23cdc
...
...
@@ -24,7 +24,7 @@ import type { IJsonItem, IResource } from '../types'
export
function
useResources
(
span
:
number
|
Ref
<
number
>
=
24
,
required
=
false
,
required
:
boolean
|
Ref
<
boolean
>
=
false
,
limit
:
number
|
Ref
<
number
>
=
-
1
):
IJsonItem
{
const
{
t
}
=
useI18n
()
...
...
dolphinscheduler-ui/src/views/security/alarm-instance-manage/detail.tsx
浏览文件 @
64a23cdc
...
...
@@ -31,7 +31,7 @@ import { useDetail } from './use-detail'
import
Modal
from
'
@/components/modal
'
import
Form
from
'
@/components/form
'
import
getElementByJson
from
'
@/components/form/get-elements-by-json
'
import
type
{
IRecord
,
FormRules
,
IFormItem
}
from
'
./types
'
import
type
{
IRecord
,
I
FormRules
,
IFormItem
}
from
'
./types
'
import
type
{
PropType
,
Ref
}
from
'
vue
'
interface
IElements
extends
Omit
<
Ref
,
'
value
'
>
{
...
...
@@ -55,7 +55,7 @@ const DetailModal = defineComponent({
setup
(
props
,
ctx
)
{
const
{
t
}
=
useI18n
()
const
rules
=
ref
<
FormRules
>
({})
const
rules
=
ref
<
I
FormRules
>
({})
const
elements
=
ref
<
IFormItem
[]
>
([])
as
IElements
const
{
...
...
dolphinscheduler-ui/src/views/security/alarm-instance-manage/types.ts
浏览文件 @
64a23cdc
...
...
@@ -17,8 +17,12 @@
import
type
{
IPluginId
}
from
'
@/service/modules/ui-plugins/types
'
import
type
{
TableColumns
}
from
'
naive-ui/es/data-table/src/interface
'
import
type
{
IMeta
,
IJsonItem
,
IFormItem
}
from
'
@/components/form/types
'
import
type
{
FormRules
}
from
'
naive-ui
'
import
type
{
IMeta
,
IJsonItem
,
IFormItem
,
IFormRules
}
from
'
@/components/form/types
'
interface
IRecord
{
alertPluginName
?:
string
...
...
@@ -47,5 +51,5 @@ export {
IMeta
,
IFormItem
,
TableColumns
,
FormRules
I
FormRules
}
dolphinscheduler-ui/src/views/security/alarm-instance-manage/use-form.ts
浏览文件 @
64a23cdc
...
...
@@ -24,7 +24,7 @@ import {
import
type
{
IPluginId
,
IPlugin
,
FormRules
,
I
FormRules
,
IMeta
,
IJsonItem
,
IRecord
...
...
@@ -60,13 +60,13 @@ export function useForm() {
pluginDefineId
:
{
trigger
:
[
'
blur
'
,
'
change
'
],
required
:
true
,
validator
(
validte
,
value
)
{
validator
(
unused
:
any
,
value
:
number
)
{
if
(
!
value
&&
value
!==
0
)
{
return
new
Error
(
t
(
'
security.alarm_instance.select_plugin_tips
'
))
}
}
}
}
as
FormRules
}
as
I
FormRules
}
as
IMeta
const
getUiPluginsByType
=
async
()
=>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录