Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
DolphinScheduler
提交
985b4e85
DolphinScheduler
项目概览
apache
/
DolphinScheduler
上一次同步 1 年多
通知
707
Star
9572
Fork
3514
代码
文件
提交
分支
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,发现更多精彩内容 >>
未验证
提交
985b4e85
编写于
3月 01, 2022
作者:
D
Devosend
提交者:
GitHub
3月 01, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[Fix-8598][UI Next][V1.0.0-Alpha] Fix menu readonly bug in workflow instance
上级
09f70353
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
112 addition
and
92 deletion
+112
-92
dolphinscheduler-ui-next/src/views/projects/workflow/components/dag/dag-context-menu.tsx
...ews/projects/workflow/components/dag/dag-context-menu.tsx
+21
-34
dolphinscheduler-ui-next/src/views/projects/workflow/components/dag/index.tsx
...next/src/views/projects/workflow/components/dag/index.tsx
+57
-27
dolphinscheduler-ui-next/src/views/projects/workflow/components/dag/types.ts
...-next/src/views/projects/workflow/components/dag/types.ts
+6
-0
dolphinscheduler-ui-next/src/views/projects/workflow/components/dag/use-node-menu.ts
...c/views/projects/workflow/components/dag/use-node-menu.ts
+26
-30
dolphinscheduler-ui-next/src/views/projects/workflow/components/dag/use-node-status.ts
...views/projects/workflow/components/dag/use-node-status.ts
+2
-1
未找到文件。
dolphinscheduler-ui-next/src/views/projects/workflow/components/dag/dag-context-menu.tsx
浏览文件 @
985b4e85
...
...
@@ -17,28 +17,30 @@
import
{
genTaskCodeList
}
from
'
@/service/modules/task-definition
'
import
type
{
Cell
}
from
'
@antv/x6
'
import
{
defineComponent
,
onMounted
,
PropType
,
inject
,
ref
,
computed
}
from
'
vue
'
import
{
defineComponent
,
onMounted
,
PropType
,
inject
,
ref
}
from
'
vue
'
import
{
useI18n
}
from
'
vue-i18n
'
import
{
useRoute
}
from
'
vue-router
'
import
styles
from
'
./menu.module.scss
'
import
{
uuid
}
from
'
@/utils/common
'
import
{
IWorkflowTaskInstance
}
from
'
./types
'
const
props
=
{
startReadonly
:
{
type
:
Boolean
as
PropType
<
boolean
>
,
default
:
false
},
menuReadonly
:
{
type
:
Boolean
as
PropType
<
boolean
>
,
default
:
false
},
taskInstance
:
{
type
:
Object
as
PropType
<
IWorkflowTaskInstance
>
,
require
:
true
},
cell
:
{
type
:
Object
as
PropType
<
Cell
>
,
require
:
true
},
taskList
:
{
type
:
Array
as
PropType
<
Array
<
any
>>
,
default
:
[]
},
visible
:
{
type
:
Boolean
as
PropType
<
boolean
>
,
default
:
true
...
...
@@ -50,10 +52,6 @@ const props = {
top
:
{
type
:
Number
as
PropType
<
number
>
,
default
:
0
},
releaseState
:
{
type
:
String
as
PropType
<
string
>
,
default
:
'
OFFLINE
'
}
}
...
...
@@ -66,12 +64,6 @@ export default defineComponent({
const
route
=
useRoute
()
const
projectCode
=
Number
(
route
.
params
.
projectCode
)
const
startAvailable
=
computed
(
()
=>
route
.
name
===
'
workflow-definition-detail
'
&&
props
.
releaseState
!==
'
NOT_RELEASE
'
)
const
hide
=
()
=>
{
ctx
.
emit
(
'
hide
'
,
false
)
}
...
...
@@ -85,12 +77,8 @@ export default defineComponent({
}
const
handleViewLog
=
()
=>
{
const
taskCode
=
Number
(
props
.
cell
?.
id
)
const
taskInstance
=
props
.
taskList
.
find
(
(
task
:
any
)
=>
task
.
taskCode
===
taskCode
)
if
(
taskInstance
)
{
ctx
.
emit
(
'
viewLog
'
,
taskInstance
.
id
,
taskInstance
.
taskType
)
if
(
props
.
taskInstance
)
{
ctx
.
emit
(
'
viewLog
'
,
props
.
taskInstance
.
id
,
props
.
taskInstance
.
taskType
)
}
}
...
...
@@ -122,7 +110,6 @@ export default defineComponent({
})
return
{
startAvailable
,
startRunning
,
handleEdit
,
handleCopy
,
...
...
@@ -141,7 +128,7 @@ export default defineComponent({
>
<
div
class
=
{
`
${
styles
[
'
menu-item
'
]}
${
!
this
.
startAvailable
?
styles
[
'
disabled
'
]
:
''
this
.
startReadonly
?
styles
[
'
disabled
'
]
:
''
}
`
}
onClick
=
{
this
.
startRunning
}
>
...
...
@@ -149,7 +136,7 @@ export default defineComponent({
</
div
>
<
div
class
=
{
`
${
styles
[
'
menu-item
'
]}
${
this
.
releaseState
===
'
ONLINE
'
?
styles
[
'
disabled
'
]
:
''
this
.
menuReadonly
?
styles
[
'
disabled
'
]
:
''
}
`
}
onClick
=
{
this
.
handleEdit
}
>
...
...
@@ -157,7 +144,7 @@ export default defineComponent({
</
div
>
<
div
class
=
{
`
${
styles
[
'
menu-item
'
]}
${
this
.
releaseState
===
'
ONLINE
'
?
styles
[
'
disabled
'
]
:
''
this
.
menuReadonly
?
styles
[
'
disabled
'
]
:
''
}
`
}
onClick
=
{
this
.
handleCopy
}
>
...
...
@@ -165,13 +152,13 @@ export default defineComponent({
</
div
>
<
div
class
=
{
`
${
styles
[
'
menu-item
'
]}
${
this
.
releaseState
===
'
ONLINE
'
?
styles
[
'
disabled
'
]
:
''
this
.
menuReadonly
?
styles
[
'
disabled
'
]
:
''
}
`
}
onClick
=
{
this
.
handleDelete
}
>
{
t
(
'
project.node.delete
'
)
}
</
div
>
{
this
.
task
List
.
length
>
0
&&
(
{
this
.
task
Instance
&&
(
<
div
class
=
{
`
${
styles
[
'
menu-item
'
]}
`
}
onClick
=
{
this
.
handleViewLog
}
>
{
t
(
'
project.node.view_log
'
)
}
</
div
>
...
...
dolphinscheduler-ui-next/src/views/projects/workflow/components/dag/index.tsx
浏览文件 @
985b4e85
...
...
@@ -15,7 +15,7 @@
* limitations under the License.
*/
import
type
{
Graph
}
from
'
@antv/x6
'
import
type
{
Cell
,
Graph
}
from
'
@antv/x6
'
import
{
defineComponent
,
ref
,
...
...
@@ -23,9 +23,11 @@ import {
PropType
,
toRef
,
watch
,
onBeforeUnmount
onBeforeUnmount
,
computed
}
from
'
vue
'
import
{
useI18n
}
from
'
vue-i18n
'
import
{
useRoute
}
from
'
vue-router
'
import
DagToolbar
from
'
./dag-toolbar
'
import
DagCanvas
from
'
./dag-canvas
'
import
DagSidebar
from
'
./dag-sidebar
'
...
...
@@ -76,6 +78,7 @@ export default defineComponent({
emits
:
[
'
refresh
'
,
'
save
'
],
setup
(
props
,
context
)
{
const
{
t
}
=
useI18n
()
const
route
=
useRoute
()
const
theme
=
useThemeStore
()
// Whether the graph can be operated
...
...
@@ -108,21 +111,47 @@ export default defineComponent({
}
=
useTaskEdit
({
graph
,
definition
:
toRef
(
props
,
'
definition
'
)
})
// Right click cell
const
{
menuCell
,
pageX
,
pageY
,
menuVisible
,
startModalShow
,
logModalShow
,
logViewTaskId
,
logViewTaskType
,
menuHide
,
menuStart
,
viewLog
,
hideLog
}
=
useNodeMenu
({
graph
const
{
nodeVariables
,
menuHide
,
menuStart
,
viewLog
,
hideLog
}
=
useNodeMenu
({
graph
})
// start button in the dag node menu
const
startReadonly
=
computed
(()
=>
{
if
(
props
.
definition
)
{
return
(
route
.
name
===
'
workflow-definition-detail
'
&&
props
.
definition
!
.
processDefinition
.
releaseState
===
'
NOT_RELEASE
'
)
}
else
{
return
false
}
})
// other button in the dag node menu
const
menuReadonly
=
computed
(()
=>
{
if
(
props
.
instance
)
{
return
(
props
.
instance
.
state
!==
'
WAITING_THREAD
'
&&
props
.
instance
.
state
!==
'
SUCCESS
'
&&
props
.
instance
.
state
!==
'
PAUSE
'
&&
props
.
instance
.
state
!==
'
FAILURE
'
&&
props
.
instance
.
state
!==
'
STOP
'
)
}
else
if
(
props
.
definition
)
{
return
props
.
definition
!
.
processDefinition
.
releaseState
===
'
ONLINE
'
}
else
{
return
false
}
})
const
taskInstance
=
computed
(()
=>
{
if
(
nodeVariables
.
menuCell
)
{
const
taskCode
=
Number
(
nodeVariables
.
menuCell
!
.
id
)
return
taskList
.
value
.
find
((
task
:
any
)
=>
task
.
taskCode
===
taskCode
)
}
else
{
return
undefined
}
})
const
statusTimerRef
=
ref
()
...
...
@@ -240,12 +269,13 @@ export default defineComponent({
onCancel
=
{
taskCancel
}
/>
<
ContextMenuItem
taskList
=
{
taskList
.
value
}
cell
=
{
menuCell
.
value
}
visible
=
{
menuVisible
.
value
}
left
=
{
pageX
.
value
}
top
=
{
pageY
.
value
}
releaseState
=
{
props
.
definition
?.
processDefinition
.
releaseState
}
startReadonly
=
{
startReadonly
.
value
}
menuReadonly
=
{
menuReadonly
.
value
}
taskInstance
=
{
taskInstance
.
value
}
cell
=
{
nodeVariables
.
menuCell
as
Cell
}
visible
=
{
nodeVariables
.
menuVisible
}
left
=
{
nodeVariables
.
pageX
}
top
=
{
nodeVariables
.
pageY
}
onHide
=
{
menuHide
}
onStart
=
{
menuStart
}
onEdit
=
{
editTask
}
...
...
@@ -256,13 +286,13 @@ export default defineComponent({
{
!!
props
.
definition
&&
(
<
StartModal
v
-
model
:
row
=
{
props
.
definition
.
processDefinition
}
v
-
model
:
show
=
{
startModalShow
.
value
}
v
-
model
:
show
=
{
nodeVariables
.
startModalShow
}
/>
)
}
{
!!
props
.
instance
&&
logModalShow
.
value
&&
(
{
!!
props
.
instance
&&
nodeVariables
.
logModalShow
&&
(
<
LogModal
taskInstanceId
=
{
logViewTaskId
.
value
}
taskInstanceType
=
{
logViewTaskType
.
valu
e
}
taskInstanceId
=
{
nodeVariables
.
logTaskId
}
taskInstanceType
=
{
nodeVariables
.
logTaskTyp
e
}
onHideLog
=
{
hideLog
}
/>
)
}
...
...
dolphinscheduler-ui-next/src/views/projects/workflow/components/dag/types.ts
浏览文件 @
985b4e85
...
...
@@ -143,3 +143,9 @@ export interface IStartupParam {
warningType
:
string
warningGroupId
:
number
}
export
interface
IWorkflowTaskInstance
{
id
:
number
taskCode
:
number
taskType
:
string
}
dolphinscheduler-ui-next/src/views/projects/workflow/components/dag/use-node-menu.ts
浏览文件 @
985b4e85
...
...
@@ -15,8 +15,8 @@
* limitations under the License.
*/
import
type
{
Ref
}
from
'
vue
'
import
{
onMounted
,
ref
}
from
'
vue
'
import
{
reactive
,
Ref
}
from
'
vue
'
import
{
onMounted
}
from
'
vue
'
import
type
{
Graph
,
Cell
}
from
'
@antv/x6
'
interface
Options
{
...
...
@@ -28,63 +28,59 @@ interface Options {
*/
export
function
useNodeMenu
(
options
:
Options
)
{
const
{
graph
}
=
options
const
startModalShow
=
ref
(
false
)
const
logModalShow
=
ref
(
false
)
const
logViewTaskId
=
ref
()
const
logViewTaskType
=
ref
()
const
menuVisible
=
ref
(
false
)
const
pageX
=
ref
()
const
pageY
=
ref
()
const
menuCell
=
ref
<
Cell
>
()
const
nodeVariables
=
reactive
({
menuVisible
:
false
,
startModalShow
:
false
,
logModalShow
:
false
,
logTaskId
:
-
1
,
logTaskType
:
''
,
pageX
:
0
,
pageY
:
0
,
menuCell
:
{}
as
Cell
})
const
menuHide
=
()
=>
{
menuVisible
.
valu
e
=
false
nodeVariables
.
menuVisibl
e
=
false
// unlock scroller
graph
.
value
?.
unlockScroller
()
}
const
menuStart
=
()
=>
{
startModalShow
.
value
=
true
nodeVariables
.
startModalShow
=
true
}
const
viewLog
=
(
taskId
:
number
,
taskType
:
string
)
=>
{
logViewTaskId
.
value
=
taskId
logViewTaskType
.
valu
e
=
taskType
logModalShow
.
value
=
true
nodeVariables
.
logTaskId
=
taskId
nodeVariables
.
logTaskTyp
e
=
taskType
nodeVariables
.
logModalShow
=
true
}
const
hideLog
=
()
=>
{
logModalShow
.
value
=
false
nodeVariables
.
logModalShow
=
false
}
onMounted
(()
=>
{
if
(
graph
.
value
)
{
// contextmenu
graph
.
value
.
on
(
'
node:contextmenu
'
,
({
cell
,
x
,
y
})
=>
{
menuCell
.
value
=
cell
const
data
=
graph
.
value
?
.
localToPage
(
x
,
y
)
pageX
.
value
=
data
?
.
x
pageY
.
value
=
data
?
.
y
nodeVariables
.
menuCell
=
cell
const
data
=
graph
.
value
!
.
localToPage
(
x
,
y
)
nodeVariables
.
pageX
=
data
.
x
nodeVariables
.
pageY
=
data
.
y
// show menu
menuVisible
.
valu
e
=
true
nodeVariables
.
menuVisibl
e
=
true
// lock scroller
graph
.
value
?
.
lockScroller
()
graph
.
value
!
.
lockScroller
()
})
}
})
return
{
pageX
,
pageY
,
startModalShow
,
logModalShow
,
logViewTaskId
,
logViewTaskType
,
menuVisible
,
menuCell
,
nodeVariables
,
menuHide
,
menuStart
,
viewLog
,
...
...
dolphinscheduler-ui-next/src/views/projects/workflow/components/dag/use-node-status.ts
浏览文件 @
985b4e85
...
...
@@ -24,6 +24,7 @@ import { tasksState } from '@/utils/common'
import
{
NODE
,
NODE_STATUS_MARKUP
}
from
'
./dag-config
'
import
{
queryTaskListByProcessId
}
from
'
@/service/modules/process-instances
'
import
NodeStatus
from
'
@/views/projects/workflow/components/dag/dag-node-status
'
import
{
IWorkflowTaskInstance
}
from
'
./types
'
interface
Options
{
graph
:
Ref
<
Graph
|
undefined
>
...
...
@@ -35,7 +36,7 @@ interface Options {
export
function
useNodeStatus
(
options
:
Options
)
{
const
{
graph
}
=
options
const
route
=
useRoute
()
const
taskList
=
ref
<
Array
<
Object
>>
([])
const
taskList
=
ref
<
Array
<
IWorkflowTaskInstance
>>
([])
const
{
t
}
=
useI18n
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录