Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dinky
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangpeng
dinky
Commits
845e4c75
Unverified
Commit
845e4c75
authored
Sep 25, 2023
by
gaoyan
Committed by
GitHub
Sep 25, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Feature][Web] Add Flink Job Sql Dag (#2340)
* delete unuse log * refactor tag * add job Graph Dag * change getJob to refeshJob
parent
6575066a
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
271 additions
and
352 deletions
+271
-352
DagDataNode.tsx
dinky-web/src/components/FlinkDag/component/DagDataNode.tsx
+14
-9
DagPlanNode.tsx
dinky-web/src/components/FlinkDag/component/DagPlanNode.tsx
+46
-0
functions.tsx
dinky-web/src/components/FlinkDag/functions.tsx
+43
-68
index.tsx
dinky-web/src/components/FlinkDag/index.tsx
+16
-7
JobLifeCycleTag.tsx
dinky-web/src/components/JobTags/JobLifeCycleTag.tsx
+77
-0
StatusTag.tsx
dinky-web/src/components/JobTags/StatusTag.tsx
+9
-8
data.d.ts
dinky-web/src/components/JobTags/data.d.ts
+5
-0
function.tsx
.../pages/DataStudio/HeaderContainer/FlinkGraph/function.tsx
+0
-60
index.tsx
...src/pages/DataStudio/HeaderContainer/FlinkGraph/index.tsx
+16
-74
index.tsx
dinky-web/src/pages/DataStudio/HeaderContainer/index.tsx
+1
-2
JobOverview.tsx
...eb/src/pages/DevOps/JobDetail/JobOverview/JobOverview.tsx
+1
-1
FlinkTable.tsx
...es/DevOps/JobDetail/JobOverview/components/FlinkTable.tsx
+2
-2
JobDesc.tsx
...pages/DevOps/JobDetail/JobOverview/components/JobDesc.tsx
+2
-2
index.tsx
dinky-web/src/pages/DevOps/JobDetail/index.tsx
+4
-5
JobHistoryList.tsx
...eb/src/pages/DevOps/JobList/components/JobHistoryList.tsx
+2
-2
index.tsx
dinky-web/src/pages/DevOps/JobList/index.tsx
+5
-8
function.tsx
dinky-web/src/pages/DevOps/function.tsx
+0
-102
index.tsx
dinky-web/src/pages/Metrics/Job/index.tsx
+1
-1
endpoints.tsx
dinky-web/src/services/endpoints.tsx
+1
-0
data.d.ts
dinky-web/src/types/DevOps/data.d.ts
+26
-1
No files found.
dinky-web/src/components/FlinkDag/component/DagNode.tsx
→
dinky-web/src/components/FlinkDag/component/Dag
Data
Node.tsx
View file @
845e4c75
...
...
@@ -18,25 +18,30 @@
*/
import
StatusTag
from
'@/components/JobTags/StatusTag'
;
import
{
Jobs
}
from
'@/types/DevOps/data'
;
import
{
Card
,
Col
,
Row
,
Tag
,
Typography
}
from
'antd'
;
const
{
Text
}
=
Typography
;
const
{
Text
,
Paragraph
}
=
Typography
;
const
DagNode
=
(
props
:
any
)
=>
{
const
Dag
Data
Node
=
(
props
:
any
)
=>
{
const
{
node
}
=
props
;
const
vertices
:
Jobs
.
JobVertices
=
node
?.
getData
();
const
data
:
any
=
node
?.
getData
();
return
(
<
Card
style=
{
{
width
:
'250px'
}
}
style=
{
{
width
:
'250px'
,
padding
:
0
}
}
bordered=
{
false
}
size=
{
'small'
}
type=
{
'inner'
}
hoverable=
{
true
}
title=
{
vertices
.
name
}
extra=
{
<
Text
keyboard
>
{
vertices
.
parallelism
}
</
Text
>
}
title=
{
data
.
name
}
extra=
{
<
Text
keyboard
>
{
data
.
parallelism
}
</
Text
>
}
>
<
Paragraph
ellipsis=
{
{
tooltip
:
data
.
description
}
}
>
<
blockquote
style=
{
{
margin
:
0
}
}
>
<
Text
type=
'secondary'
>
{
data
.
description
}
</
Text
>
</
blockquote
>
</
Paragraph
>
<
Row
>
<
Col
span=
{
15
}
>
<
Text
type=
'secondary'
>
BackPressure:
</
Text
>
...
...
@@ -51,7 +56,7 @@ const DagNode = (props: any) => {
<
Row
>
<
Col
span=
{
15
}
>
<
Text
type=
'secondary'
>
Status:
</
Text
>
<
StatusTag
status=
{
vertices
.
status
}
bordered=
{
false
}
animation=
{
false
}
/>
<
StatusTag
status=
{
data
.
status
}
bordered=
{
false
}
animation=
{
false
}
/>
</
Col
>
<
Col
span=
{
8
}
>
<
Text
type=
'secondary'
>
Idle:50%
</
Text
>
...
...
@@ -60,4 +65,4 @@ const DagNode = (props: any) => {
</
Card
>
);
};
export
default
DagNode
;
export
default
Dag
Data
Node
;
dinky-web/src/components/FlinkDag/component/DagPlanNode.tsx
0 → 100644
View file @
845e4c75
/*
*
* 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
{
Card
,
Typography
}
from
'antd'
;
const
{
Text
,
Paragraph
}
=
Typography
;
const
DagPlanNode
=
(
props
:
any
)
=>
{
const
{
node
}
=
props
;
const
data
:
any
=
node
?.
getData
();
return
(
<
Card
style=
{
{
width
:
'250px'
,
padding
:
0
}
}
bordered=
{
false
}
size=
{
'small'
}
type=
{
'inner'
}
hoverable=
{
true
}
title=
{
data
.
description
}
extra=
{
<
Text
keyboard
>
{
data
.
parallelism
}
</
Text
>
}
>
<
Paragraph
ellipsis=
{
{
tooltip
:
data
.
description
,
rows
:
3
}
}
>
<
blockquote
>
<
Text
>
{
data
.
description
}
</
Text
>
</
blockquote
>
</
Paragraph
>
</
Card
>
);
};
export
default
DagPlanNode
;
dinky-web/src/components/FlinkDag/functions.tsx
View file @
845e4c75
...
...
@@ -17,94 +17,69 @@
*
*/
import
{
JOB_STATUS
}
from
'@/pages/DevOps/constants'
;
import
{
Jobs
}
from
'@/types/DevOps/data'
;
import
{
Graph
,
Path
}
from
'@antv/x6'
;
export
const
build
Edge
=
(
job
:
Jobs
.
Job
)
=>
{
export
const
build
Dag
=
(
job
:
Jobs
.
JobPlan
)
=>
{
const
edges
:
any
=
[];
const
nodes
:
any
=
[];
for
(
let
node
of
job
.
plan
.
nodes
)
{
if
(
node
.
inputs
)
{
const
sources
=
node
.
inputs
;
for
(
let
i
=
0
;
i
<
sources
.
length
;
i
++
)
{
const
plan_node
=
sources
[
i
];
edges
.
push
({
attrs
:
{
line
:
{
strokeDasharray
:
'5'
,
stroke
:
'#3471F9'
,
style
:
{
animation
:
'running-line 30s infinite linear'
}
},
label
:
{
text
:
plan_node
.
ship_strategy
}
},
label
:
plan_node
.
ship_strategy
,
id
:
`
${
plan_node
.
id
}
-
${
i
}
`
,
shape
:
'data-processing-curve'
,
zIndex
:
-
1
,
source
:
{
cell
:
`
${
plan_node
.
id
}
`
,
port
:
`
${
plan_node
.
id
}
-out`
},
target
:
{
cell
:
`
${
node
.
id
}
`
,
port
:
`
${
node
.
id
}
-in`
},
data
:
node
});
}
}
}
return
edges
;
};
if
(
!
job
)
return
{
nodes
:
nodes
,
edges
:
edges
};
export
const
buildNode
=
(
job
:
Jobs
.
Job
)
=>
{
const
nodes
:
any
=
{};
for
(
let
vertice
of
job
.
vertices
)
{
nodes
[
vertice
.
id
]
=
{
id
:
vertice
.
id
,
job
.
nodes
.
forEach
((
node
)
=>
{
nodes
.
push
({
id
:
node
.
id
,
shape
:
'data-processing-dag-node'
,
ports
:
[
{
id
:
`
${
vertic
e
.
id
}
-in`
,
id
:
`
${
nod
e
.
id
}
-in`
,
group
:
'in'
},
{
id
:
`
${
vertic
e
.
id
}
-out`
,
id
:
`
${
nod
e
.
id
}
-out`
,
group
:
'out'
}
],
data
:
vertice
};
}
return
nodes
;
};
data
:
node
});
node
.
inputs
?.
forEach
((
plan_node
)
=>
{
edges
.
push
({
label
:
plan_node
.
ship_strategy
,
id
:
`
${
node
.
id
}
-
${
plan_node
.
num
}
`
,
shape
:
'data-processing-curve'
,
zIndex
:
-
1
,
source
:
{
cell
:
`
${
plan_node
.
id
}
`
,
port
:
`
${
plan_node
.
id
}
-out`
},
target
:
{
cell
:
`
${
node
.
id
}
`
,
port
:
`
${
node
.
id
}
-in`
},
data
:
node
});
});
});
export
const
buildData
=
(
job
:
Jobs
.
Job
)
=>
{
const
nodes
=
Object
.
values
(
buildNode
(
job
));
return
{
nodes
:
nodes
,
edges
:
buildEdge
(
job
)
};
return
{
nodes
:
nodes
,
edges
:
edges
};
};
export
const
updateEdge
=
(
job
:
Jobs
.
Job
,
graph
?:
Graph
)
=>
{
if
(
graph
)
{
const
nodes
=
buildNode
(
job
);
export
const
updateDag
=
(
job
:
Jobs
.
JobVertices
[],
graph
?:
Graph
)
=>
{
if
(
!
job
||
!
graph
)
return
;
graph
.
getCells
().
forEach
((
node
)
=>
{
const
data
=
node
.
getData
();
if
(
nodes
[
data
.
id
])
{
console
.
log
(
nodes
[
data
.
id
]);
node
.
setData
(
nodes
[
data
.
id
].
data
);
if
(
job
&&
graph
)
{
job
.
forEach
((
vertice
)
=>
{
const
node
=
graph
.
getCellById
(
vertice
.
id
);
if
(
node
)
{
node
.
setData
(
{
...
node
.
getData
(),
...
vertice
}
);
}
});
graph
.
getEdges
().
forEach
((
edge
)
=>
{
const
node
=
edge
.
getSourceNode
()?.
getData
();
if
(
node
.
status
==
'RUNNING'
)
{
const
nodeData
=
edge
.
getSourceNode
()?.
getData
();
if
(
nodeData
.
status
==
JOB_STATUS
.
RUNNING
)
{
edge
.
attr
({
line
:
{
stroke
:
'#3471F9'
}
});
edge
.
attr
(
'line/strokeDasharray'
,
5
);
edge
.
attr
(
'line/strokeWidth'
,
2
);
...
...
@@ -113,11 +88,11 @@ export const updateEdge = (job: Jobs.Job, graph?: Graph) => {
edge
.
attr
(
'line/strokeDasharray'
,
0
);
edge
.
attr
(
'line/style/animation'
,
''
);
edge
.
attr
(
'line/strokeWidth'
,
1
);
if
(
node
.
status
==
'FINISHED'
)
{
if
(
node
Data
.
status
==
JOB_STATUS
.
FINISHED
)
{
edge
.
attr
(
'line/stroke'
,
'#52c41a'
);
}
else
if
(
node
.
status
==
'CANCELED'
)
{
}
else
if
(
node
Data
.
status
==
JOB_STATUS
.
CANCELED
)
{
edge
.
attr
(
'line/stroke'
,
'#ffe7ba'
);
}
else
if
(
node
.
status
==
'FAILED'
)
{
}
else
if
(
node
Data
.
status
==
JOB_STATUS
.
FAILED
)
{
edge
.
attr
(
'line/stroke'
,
'#ff4d4f'
);
}
else
{
edge
.
attr
(
'line/stroke'
,
'#bfbfbf'
);
...
...
dinky-web/src/components/FlinkDag/index.tsx
View file @
845e4c75
...
...
@@ -17,9 +17,10 @@
*
*/
import
DagNode
from
'@/components/FlinkDag/component/DagNode'
;
import
DagDataNode
from
'@/components/FlinkDag/component/DagDataNode'
;
import
DagPlanNode
from
'@/components/FlinkDag/component/DagPlanNode'
;
import
{
edgeConfig
,
graphConfig
,
layoutConfig
,
portConfig
}
from
'@/components/FlinkDag/config'
;
import
{
buildDa
ta
,
regConnect
,
updateEdge
}
from
'@/components/FlinkDag/functions'
;
import
{
buildDa
g
,
regConnect
,
updateDag
}
from
'@/components/FlinkDag/functions'
;
import
{
Jobs
}
from
'@/types/DevOps/data'
;
import
{
DagreLayout
}
from
'@antv/layout'
;
import
{
Edge
,
Graph
}
from
'@antv/x6'
;
...
...
@@ -27,9 +28,16 @@ import { register } from '@antv/x6-react-shape';
import
{
useEffect
,
useRef
,
useState
}
from
'react'
;
import
'./index.css'
;
const
FlinkDag
=
(
props
:
{
jobDetail
:
Jobs
.
JobInfoDetail
})
=>
{
export
type
DagProps
=
{
job
:
Jobs
.
Job
;
onlyPlan
?:
boolean
;
};
const
FlinkDag
=
(
props
:
DagProps
)
=>
{
const
container
=
useRef
(
null
);
const
job
=
props
.
jobDetail
.
jobDataDto
.
job
;
const
{
job
,
onlyPlan
=
false
}
=
props
;
const
[
graph
,
setGraph
]
=
useState
<
Graph
>
();
const
[
curentJob
,
setCurentJob
]
=
useState
<
string
>
();
...
...
@@ -38,7 +46,7 @@ const FlinkDag = (props: { jobDetail: Jobs.JobInfoDetail }) => {
shape
:
'data-processing-dag-node'
,
width
:
212
,
height
:
48
,
component
:
Dag
Node
,
component
:
onlyPlan
?
DagPlanNode
:
DagData
Node
,
ports
:
portConfig
});
...
...
@@ -67,11 +75,12 @@ const FlinkDag = (props: { jobDetail: Jobs.JobInfoDetail }) => {
};
graph
.
zoomToFit
(
zoomOptions
);
graph
.
centerContent
();
updateDag
(
job
.
vertices
,
graph
);
return
graph
;
};
useEffect
(()
=>
{
const
flinkData
=
buildDa
ta
(
job
);
const
flinkData
=
buildDa
g
(
job
.
plan
);
// Clean up old data
if
(
graph
)
{
graph
.
clearCells
();
...
...
@@ -80,7 +89,7 @@ const FlinkDag = (props: { jobDetail: Jobs.JobInfoDetail }) => {
},
[
curentJob
]);
useEffect
(()
=>
{
update
Edge
(
job
,
graph
);
update
Dag
(
job
.
vertices
,
graph
);
if
(
curentJob
!=
job
.
jid
)
{
setCurentJob
(
job
.
jid
);
}
...
...
dinky-web/src/components/JobTags/JobLifeCycleTag.tsx
0 → 100644
View file @
845e4c75
/*
* 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
{
StatusTagProps
}
from
'@/components/JobTags/data'
;
import
{
JOB_LIFE_CYCLE
}
from
'@/pages/DevOps/constants'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
CameraOutlined
,
CarryOutOutlined
,
CloseCircleOutlined
,
EditOutlined
}
from
'@ant-design/icons'
;
import
{
Tag
}
from
'antd'
;
/**
* Renders a tag for the job life cycle based on the provided step.
*
* @returns {JSX.Element} - The tag representing the job life cycle.
* @param props
*/
const
JobLifeCycleTag
=
(
props
:
StatusTagProps
)
=>
{
const
{
status
,
animation
=
true
,
bordered
=
true
}
=
props
;
const
buildParam
=
()
=>
{
switch
(
status
)
{
case
JOB_LIFE_CYCLE
.
DEVELOP
:
return
{
icon
:
<
EditOutlined
/>,
color
:
'default'
,
text
:
l
(
'global.table.lifecycle.dev'
)
};
case
JOB_LIFE_CYCLE
.
RELEASE
:
return
{
icon
:
<
CameraOutlined
/>,
color
:
'green'
,
text
:
l
(
'global.table.lifecycle.publish'
)
};
case
JOB_LIFE_CYCLE
.
ONLINE
:
return
{
icon
:
<
CarryOutOutlined
/>,
color
:
'blue'
,
text
:
l
(
'global.table.lifecycle.online'
)
};
default
:
return
{
icon
:
<
CloseCircleOutlined
/>,
color
:
'default'
,
text
:
status
};
}
};
const
param
=
buildParam
();
return
(
<
Tag
icon=
{
animation
?
param
.
icon
:
undefined
}
color=
{
param
.
color
}
bordered=
{
bordered
}
>
{
param
.
text
}
</
Tag
>
);
};
export
default
JobLifeCycleTag
;
dinky-web/src/components/JobTags/StatusTag.tsx
View file @
845e4c75
...
...
@@ -16,6 +16,7 @@
*
*/
import
{
StatusTagProps
}
from
'@/components/JobTags/data'
;
import
{
JOB_STATUS
}
from
'@/pages/DevOps/constants'
;
import
{
CheckCircleOutlined
,
...
...
@@ -27,12 +28,12 @@ import {
}
from
'@ant-design/icons'
;
import
{
Tag
}
from
'antd'
;
export
interface
StatusTagProps
{
status
:
string
;
animation
?:
boolean
;
bordered
?:
boolean
;
}
/**
* Renders a tag for the job status based on the provided status.
*
* @returns {JSX.Element} - The tag representing the job status.
* @param props
*/
const
StatusTag
=
(
props
:
StatusTagProps
)
=>
{
const
{
status
,
animation
=
true
,
bordered
=
true
}
=
props
;
...
...
@@ -84,8 +85,8 @@ const StatusTag = (props: StatusTagProps) => {
default
:
return
{
icon
:
<
CloseCircleOutlined
/>,
color
:
'
error
'
,
text
:
'
FAILED
'
color
:
'
default
'
,
text
:
'
UNKNOWN Status
'
};
}
};
...
...
dinky-web/src/components/JobTags/data.d.ts
0 → 100644
View file @
845e4c75
export
interface
StatusTagProps
{
status
?:
any
;
animation
?:
boolean
;
bordered
?:
boolean
;
}
dinky-web/src/pages/DataStudio/HeaderContainer/FlinkGraph/function.tsx
deleted
100644 → 0
View file @
6575066a
const
escape2Html
=
(
str
:
string
)
=>
{
let
arrEntities
:
Record
<
string
,
string
>
=
{
lt
:
'<'
,
gt
:
'>'
,
nbsp
:
' '
,
amp
:
'&'
,
quot
:
'"'
};
return
str
.
replace
(
/&
(
lt|gt|nbsp|amp|quot
)
;/gi
,
function
(
all
,
t
)
{
return
arrEntities
[
t
];
});
};
const
getRangeText
=
(
str
:
string
)
=>
{
str
=
escape2Html
(
str
);
// @ts-ignore
const
canvas
=
getRangeText
.
canvas
||
(
getRangeText
.
canvas
=
document
.
createElement
(
'canvas'
));
const
context
=
canvas
.
getContext
(
'2d'
);
context
.
font
=
'10px sans-serif'
;
let
result
=
''
;
let
count
=
1
;
for
(
let
i
=
0
,
len
=
str
.
length
;
i
<
len
;
i
++
)
{
result
+=
str
[
i
];
let
width
=
context
.
measureText
(
result
).
width
;
if
(
width
>=
110
*
count
)
{
result
+=
'
\
r
\
n'
;
count
++
;
}
}
return
result
;
};
export
const
buildGraphData
=
(
data
:
any
)
=>
{
const
edges
=
[];
for
(
const
i
in
data
.
nodes
)
{
data
.
nodes
[
i
].
id
=
data
.
nodes
[
i
].
id
.
toString
();
data
.
nodes
[
i
].
value
=
{
title
:
data
.
nodes
[
i
].
pact
,
items
:
[
{
text
:
getRangeText
(
data
.
nodes
[
i
].
description
)
},
{
text
:
'
\
r
\
nParallelism: '
,
value
:
'
\
r
\
n '
+
data
.
nodes
[
i
].
parallelism
}
]
};
if
(
data
.
nodes
[
i
].
inputs
)
{
for
(
let
j
in
data
.
nodes
[
i
].
inputs
)
{
edges
.
push
({
source
:
data
.
nodes
[
i
].
inputs
[
j
].
id
.
toString
(),
target
:
data
.
nodes
[
i
].
id
.
toString
(),
value
:
data
.
nodes
[
i
].
inputs
[
j
].
ship_strategy
});
}
}
}
data
.
edges
=
edges
;
return
data
;
};
dinky-web/src/pages/DataStudio/HeaderContainer/FlinkGraph/index.tsx
View file @
845e4c75
import
{
FlowAnalysisGraph
}
from
'@ant-design/charts
'
;
import
{
FlowAnalysisGraphConfig
}
from
'@ant-design/graphs/es/components/flow-analysis-graph
'
;
import
FlinkDag
from
'@/components/FlinkDag
'
;
import
{
Jobs
}
from
'@/types/DevOps/data
'
;
import
{
Empty
}
from
'antd'
;
import
{
StateType
}
from
'rmc-input-number'
;
import
{
connect
}
from
'umi'
;
const
FlinkGraph
=
(
props
:
any
)
=>
{
const
FlinkGraph
=
(
props
:
{
data
:
Jobs
.
JobPlan
}
)
=>
{
const
{
data
}
=
props
;
const
config
:
FlowAnalysisGraphConfig
=
{
data
,
height
:
350
,
nodeCfg
:
{
size
:
[
160
,
65
],
items
:
{
autoEllipsis
:
false
,
padding
:
[
10
],
containerStyle
:
{
fill
:
'#fff'
,
width
:
'100px'
},
style
:
(
cfg
,
group
,
type
)
=>
{
const
styles
=
{
value
:
{
fill
:
'#000'
},
text
:
{
fill
:
'#222'
,
width
:
'100px'
}
};
return
styles
[
type
];
}
},
nodeStateStyles
:
{
hover
:
{
stroke
:
'#1890ff'
,
lineWidth
:
2
}
},
style
:
{
fill
:
'#40a9ff'
,
stroke
:
'#1890ff'
}
},
edgeCfg
:
{
type
:
'polyline'
,
label
:
{
style
:
{
fill
:
'#666'
,
fontSize
:
12
,
fillOpacity
:
1
}
},
endArrow
:
{
fill
:
'#333'
},
edgeStateStyles
:
{
hover
:
{
stroke
:
'#1890ff'
,
lineWidth
:
2
}
}
},
markerCfg
:
(
cfg
)
=>
{
const
{
edges
}
=
data
;
return
{
position
:
'right'
,
show
:
edges
.
find
((
item
)
=>
item
.
source
===
cfg
.
id
),
collapsed
:
!
edges
.
find
((
item
)
=>
item
.
source
===
cfg
.
id
)
};
},
behaviors
:
[
'drag-canvas'
,
'zoom-canvas'
,
'drag-node'
]
/*layout: {
rankdir: 'TB',
ranksepFunc: () => 20,
},*/
};
const
job
=
{
plan
:
data
}
as
Jobs
.
Job
;
return
(
<>
{
data
?
<
FlowAnalysisGraph
{
...
config
}
/>
:
<
Empty
image=
{
Empty
.
PRESENTED_IMAGE_SIMPLE
}
/>
}
</>
<>
{
data
?
(
<
div
style=
{
{
width
:
'50wh'
,
height
:
'50vh'
}
}
>
<
FlinkDag
job=
{
job
}
onlyPlan=
{
true
}
/>
</
div
>
)
:
(
<
Empty
image=
{
Empty
.
PRESENTED_IMAGE_SIMPLE
}
/>
)
}
</>
);
};
export
default
connect
(({
Studio
}:
{
Studio
:
StateType
})
=>
({}))(
FlinkGraph
);
export
default
connect
(({}:
{
Studio
:
StateType
})
=>
({}))(
FlinkGraph
);
dinky-web/src/pages/DataStudio/HeaderContainer/index.tsx
View file @
845e4c75
...
...
@@ -20,7 +20,6 @@ import { FlexCenterDiv } from '@/components/StyledComponents';
import
{
getCurrentData
,
getCurrentTab
,
mapDispatchToProps
}
from
'@/pages/DataStudio/function'
;
import
Explain
from
'@/pages/DataStudio/HeaderContainer/Explain'
;
import
FlinkGraph
from
'@/pages/DataStudio/HeaderContainer/FlinkGraph'
;
import
{
buildGraphData
}
from
'@/pages/DataStudio/HeaderContainer/FlinkGraph/function'
;
import
{
buildBreadcrumbItems
,
projectCommonShow
...
...
@@ -245,7 +244,7 @@ const HeaderContainer = (props: any) => {
title
:
l
(
'pages.datastudio.editor.explan.tip'
),
width
:
'100%'
,
icon
:
null
,
content
:
<
FlinkGraph
data=
{
buildGraphData
(
result
.
datas
)
}
/>,
content
:
<
FlinkGraph
data=
{
result
.
datas
}
/>,
cancelButtonProps
:
{
style
:
{
display
:
'none'
}
}
});
}
...
...
dinky-web/src/pages/DevOps/JobDetail/JobOverview/JobOverview.tsx
View file @
845e4c75
...
...
@@ -35,7 +35,7 @@ const JobConfigTab = (props: JobProps) => {
height
:
'40vh'
}
}
>
<
FlinkDag
job
Detail=
{
jobDetail
}
/>
<
FlinkDag
job
=
{
jobDetail
?.
jobDataDto
?.
job
}
/>
</
ProCard
>
<
FlinkTable
jobDetail=
{
jobDetail
}
/>
...
...
dinky-web/src/pages/DevOps/JobDetail/JobOverview/components/FlinkTable.tsx
View file @
845e4c75
import
{
TagJobStatus
}
from
'@/pages/DevOps/function
'
;
import
StatusTag
from
'@/components/JobTags/StatusTag
'
;
import
{
JobProps
}
from
'@/pages/DevOps/JobDetail/data'
;
import
{
parseByteStr
,
parseMilliSecondStr
,
parseNumStr
}
from
'@/utils/function'
;
import
{
l
}
from
'@/utils/intl'
;
...
...
@@ -42,7 +42,7 @@ const FlinkTable = (props: JobProps): JSX.Element => {
dataIndex
:
'status'
,
sorter
:
true
,
render
:
(
dom
,
entity
)
=>
{
return
<
>
{
TagJobStatus
(
entity
.
status
)
}
<
/>;
return
<
StatusTag
status=
{
entity
.
status
}
/>;
}
},
{
...
...
dinky-web/src/pages/DevOps/JobDetail/JobOverview/components/JobDesc.tsx
View file @
845e4c75
import
{
TagJobStatus
}
from
'@/pages/DevOps/function
'
;
import
StatusTag
from
'@/components/JobTags/StatusTag
'
;
import
{
JobProps
}
from
'@/pages/DevOps/JobDetail/data'
;
import
{
parseSecondStr
}
from
'@/utils/function'
;
import
{
l
}
from
'@/utils/intl'
;
...
...
@@ -58,7 +58,7 @@ const JobDesc = (props: JobProps) => {
<
ProCard
>
<
Descriptions
title=
{
l
(
'devops.jobinfo.config.JobBaseInfo'
)
}
bordered
size=
'small'
>
<
Descriptions
.
Item
label=
{
l
(
'global.table.status'
)
}
>
{
TagJobStatus
(
jobDetail
?.
instance
?.
status
)
}
<
StatusTag
status=
{
jobDetail
?.
instance
?.
status
}
/>
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
{
l
(
'devops.jobinfo.config.submitType'
)
}
>
...
...
dinky-web/src/pages/DevOps/JobDetail/index.tsx
View file @
845e4c75
...
...
@@ -17,8 +17,7 @@
*
*/
import
Lineage
from
'@/components/FlinkDag'
;
import
{
TagJobLifeCycle
}
from
'@/pages/DevOps/function'
;
import
JobLifeCycleTag
from
'@/components/JobTags/JobLifeCycleTag'
;
import
CheckPoints
from
'@/pages/DevOps/JobDetail/CheckPointsTab'
;
import
JobLogsTab
from
'@/pages/DevOps/JobDetail/JobLogs/JobLogsTab'
;
import
JobMetrics
from
'@/pages/DevOps/JobDetail/JobMetrics'
;
...
...
@@ -72,14 +71,14 @@ const JobDetail = (props: any) => {
[
OperatorEnum
.
JOB_VERSION
]:
<
JobVersionTab
jobDetail
=
{
jobInfoDetail
}
/>
,
[
OperatorEnum
.
JOB_CHECKPOINTS
]:
<
CheckPoints
jobDetail
=
{
jobInfoDetail
}
/>
,
[
OperatorEnum
.
JOB_METRICS
]:
<
JobMetrics
/>
,
[
OperatorEnum
.
JOB_LINEAGE
]:
<
Lineage
jobDetail
=
{
jobInfoDetail
}
/>
,
//
[OperatorEnum.JOB_LINEAGE]: <Lineage jobDetail={jobInfoDetail} />,
[
OperatorEnum
.
JOB_ALERT
]:
<
CheckPoints
jobDetail
=
{
jobInfoDetail
}
/>
,
[
OperatorEnum
.
JOB_GRAPH
]:
<
JobOperatorGraph
jobDetail
=
{
jobInfoDetail
}
/
>
};
useRequest
(
{
url
:
API_CONSTANTS
.
GET
_JOB_DETAIL
,
url
:
API_CONSTANTS
.
REFESH
_JOB_DETAIL
,
params
:
{
id
:
id
}
},
{
...
...
@@ -127,7 +126,7 @@ const JobDetail = (props: any) => {
return
(
<
PageContainer
title=
{
jobInfoDetail
?.
instance
?.
name
}
subTitle=
{
TagJobLifeCycle
(
jobInfoDetail
?.
instance
?.
step
)
}
subTitle=
{
<
JobLifeCycleTag
status=
{
jobInfoDetail
?.
instance
?.
step
}
/>
}
ghost=
{
false
}
extra=
{
<
JobOperator
jobDetail=
{
jobInfoDetail
}
/>
}
onBack=
{
()
=>
window
.
history
.
back
()
}
...
...
dinky-web/src/pages/DevOps/JobList/components/JobHistoryList.tsx
View file @
845e4c75
import
{
TagJobStatus
}
from
'@/pages/DevOps/function
'
;
import
StatusTag
from
'@/components/JobTags/StatusTag
'
;
import
{
queryList
}
from
'@/services/api'
;
import
{
API_CONSTANTS
}
from
'@/services/endpoints'
;
import
{
Jobs
}
from
'@/types/DevOps/data'
;
...
...
@@ -36,7 +36,7 @@ const JobHistoryList = (props: HistoryProps) => {
{
title
:
l
(
'global.table.status'
),
dataIndex
:
'status'
,
render
:
(
_
:
any
,
row
:
{
status
:
string
|
undefined
})
=>
TagJobStatus
(
row
.
status
)
render
:
(
_
:
any
,
row
:
{
status
:
string
|
undefined
})
=>
<
StatusTag
status=
{
row
.
status
}
/>
},
{
title
:
l
(
'global.table.useTime'
),
...
...
dinky-web/src/pages/DevOps/JobList/index.tsx
View file @
845e4c75
import
{
JOB_STATUS_FILTER
,
LIFECYCLE_FILTER
,
TagJobLifeCycle
,
TagJobStatus
}
from
'@/pages/DevOps/function'
;
import
JobLifeCycleTag
from
'@/components/JobTags/JobLifeCycleTag'
;
import
StatusTag
from
'@/components/JobTags/StatusTag'
;
import
{
JOB_STATUS_FILTER
,
LIFECYCLE_FILTER
}
from
'@/pages/DevOps/function'
;
import
JobHistoryList
from
'@/pages/DevOps/JobList/components/JobHistoryList'
;
import
{
queryList
}
from
'@/services/api'
;
import
{
PROTABLE_OPTIONS_PUBLIC
}
from
'@/services/constants'
;
...
...
@@ -36,7 +33,7 @@ const JobList = () => {
hideInSearch
:
true
,
filterMultiple
:
false
,
dataIndex
:
'step'
,
render
:
(
_
:
any
,
row
:
{
step
:
number
})
=>
TagJobLifeCycle
(
row
.
step
)
render
:
(
_
:
any
,
row
:
{
step
:
number
})
=>
<
JobLifeCycleTag
status=
{
row
.
step
}
/>
},
{
title
:
l
(
'global.table.runmode'
),
...
...
@@ -64,7 +61,7 @@ const JobList = () => {
filterMultiple
:
false
,
hideInSearch
:
true
,
dataIndex
:
'status'
,
render
:
(
_
:
any
,
row
:
Jobs
.
JobInstance
)
=>
TagJobStatus
(
row
.
status
)
render
:
(
_
:
any
,
row
:
Jobs
.
JobInstance
)
=>
<
StatusTag
status=
{
row
.
status
}
/>
},
Table
.
EXPAND_COLUMN
,
{
...
...
dinky-web/src/pages/DevOps/function.tsx
View file @
845e4c75
...
...
@@ -17,108 +17,6 @@
import
{
JOB_LIFE_CYCLE
,
JOB_STATUS
}
from
'@/pages/DevOps/constants'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
CameraOutlined
,
CarryOutOutlined
,
CheckCircleOutlined
,
ClockCircleOutlined
,
CloseCircleOutlined
,
EditOutlined
,
MinusCircleOutlined
,
QuestionCircleOutlined
,
SyncOutlined
}
from
'@ant-design/icons'
;
import
{
Tag
}
from
'antd'
;
/**
* Renders a tag for the job life cycle based on the provided step.
*
* @param {number} step - The step in the job life cycle.
* @returns {JSX.Element} - The tag representing the job life cycle.
*/
export
const
TagJobLifeCycle
=
(
step
?:
number
)
=>
{
switch
(
step
)
{
case
JOB_LIFE_CYCLE
.
DEVELOP
:
return
(
<
Tag
icon=
{
<
EditOutlined
/>
}
color=
'default'
>
{
l
(
'global.table.lifecycle.dev'
)
}
</
Tag
>
);
case
JOB_LIFE_CYCLE
.
RELEASE
:
return
(
<
Tag
icon=
{
<
CameraOutlined
/>
}
color=
'green'
>
{
l
(
'global.table.lifecycle.publish'
)
}
</
Tag
>
);
case
JOB_LIFE_CYCLE
.
ONLINE
:
return
(
<
Tag
icon=
{
<
CarryOutOutlined
/>
}
color=
'blue'
>
{
l
(
'global.table.lifecycle.online'
)
}
</
Tag
>
);
default
:
return
step
;
}
};
/**
* Renders a tag for the job status based on the provided status.
*
* @param {string|undefined} status - The status of the job.
* @returns {JSX.Element} - The tag representing the job status.
*/
export
const
TagJobStatus
=
(
status
:
string
|
undefined
)
=>
{
switch
(
status
)
{
case
JOB_STATUS
.
RUNNING
:
return
(
<
Tag
icon=
{
<
SyncOutlined
spin
/>
}
color=
'green'
>
RUNNING
</
Tag
>
);
case
JOB_STATUS
.
FINISHED
:
return
(
<
Tag
icon=
{
<
CheckCircleOutlined
/>
}
color=
'blue'
>
FINISHED
</
Tag
>
);
case
JOB_STATUS
.
CANCELED
:
return
(
<
Tag
icon=
{
<
MinusCircleOutlined
/>
}
color=
'orange'
>
CANCELED
</
Tag
>
);
case
JOB_STATUS
.
INITIALIZING
:
return
(
<
Tag
icon=
{
<
ClockCircleOutlined
/>
}
color=
'default'
>
INITIALIZING
</
Tag
>
);
case
JOB_STATUS
.
RESTARTING
:
return
(
<
Tag
icon=
{
<
ClockCircleOutlined
/>
}
color=
'default'
>
RESTARTING
</
Tag
>
);
case
JOB_STATUS
.
CREATED
:
return
(
<
Tag
icon=
{
<
ClockCircleOutlined
/>
}
color=
'default'
>
CREATED
</
Tag
>
);
case
JOB_STATUS
.
UNKNOWN
:
return
(
<
Tag
icon=
{
<
QuestionCircleOutlined
/>
}
color=
'default'
>
UNKNOWN
</
Tag
>
);
default
:
return
(
<
Tag
icon=
{
<
CloseCircleOutlined
/>
}
color=
'error'
>
FAILED
</
Tag
>
);
}
};
/**
* Generates an array of options for the life cycle filter.
...
...
dinky-web/src/pages/Metrics/Job/index.tsx
View file @
845e4c75
...
...
@@ -84,7 +84,7 @@ const Job = () => {
* @returns {Promise<any>}
*/
const
getFlinkTaskDetail
=
async
(
id
:
number
)
=>
{
return
await
getData
(
API_CONSTANTS
.
GET
_JOB_DETAIL
,
{
id
:
id
});
return
await
getData
(
API_CONSTANTS
.
REFESH
_JOB_DETAIL
,
{
id
:
id
});
};
/**
...
...
dinky-web/src/services/endpoints.tsx
View file @
845e4c75
...
...
@@ -216,6 +216,7 @@ export enum API_CONSTANTS {
GET_JOB_LIST
=
'/api/jobInstance'
,
GET_JOB_BY_ID
=
'/api/jobInstance/getOneById'
,
GET_JOB_DETAIL
=
'/api/jobInstance/getJobInfoDetail'
,
REFESH_JOB_DETAIL
=
'/api/jobInstance/refreshJobInfoDetail'
,
GET_JOB_VERSION
=
'/api/task/version'
,
GET_JOBMANAGER_LOG
=
'api/jobInstance/getJobManagerLog'
,
GET_JOBMANAGER_STDOUT
=
'api/jobInstance/getJobManagerStdOut'
,
...
...
dinky-web/src/types/DevOps/data.d.ts
View file @
845e4c75
...
...
@@ -93,6 +93,30 @@ declare namespace Jobs {
metrics
:
VetricsMetrics
;
};
export
type
JobNodeInput
=
{
num
:
number
;
id
:
string
;
ship_strategy
:
string
;
exchange
:
string
;
};
export
type
JobNode
=
{
id
:
string
;
parallelism
:
number
;
operator
:
string
;
operator_strategy
:
string
;
description
:
string
;
inputs
:
JobNodeInput
[];
optimizer_properties
:
any
;
};
export
type
JobPlan
=
{
jid
:
string
;
name
:
string
;
type
:
string
;
nodes
:
JobNode
[];
};
export
type
Job
=
{
jid
:
string
;
name
:
string
;
...
...
@@ -106,8 +130,9 @@ declare namespace Jobs {
timestamps
:
any
;
vertices
:
JobVertices
[];
'status-counts'
:
any
;
plan
:
any
;
plan
:
JobPlan
;
};
export
type
JobDataDtoItem
=
{
id
:
number
;
job
:
Job
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment