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
d2d26f6c
Unverified
Commit
d2d26f6c
authored
Oct 10, 2023
by
zhu-mingye
Committed by
GitHub
Oct 10, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor project tree layout (#2372)
parent
16835aa3
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
135 additions
and
8 deletions
+135
-8
global.ts
dinky-web/src/locales/en-US/global.ts
+1
-0
global.ts
dinky-web/src/locales/zh-CN/global.ts
+1
-0
index.tsx
.../pages/DataStudio/LeftContainer/Project/JobTree/index.tsx
+11
-4
function.tsx
...b/src/pages/DataStudio/LeftContainer/Project/function.tsx
+122
-4
No files found.
dinky-web/src/locales/en-US/global.ts
View file @
d2d26f6c
...
...
@@ -148,6 +148,7 @@ export default {
'global.table.execmode.batch'
:
'Batch Mode'
,
'global.table.execmode.streaming'
:
'Stream Mode'
,
'global.table.lifecycle.publish'
:
'Publish'
,
'global.table.lifecycle.stopped'
:
'Stopped'
,
'global.table.lifecycle.online'
:
'Online'
,
'global.table.lifecycle.unknown'
:
'Unknown'
,
'global.table.execmode'
:
'Execution mode'
,
...
...
dinky-web/src/locales/zh-CN/global.ts
View file @
d2d26f6c
...
...
@@ -144,6 +144,7 @@ export default {
'global.table.lifecycle.all'
:
'全部'
,
'global.table.lifecycle.dev'
:
'开发中'
,
'global.table.lifecycle.publish'
:
'已发布'
,
'global.table.lifecycle.stopped'
:
'已停止'
,
'global.table.lifecycle.online'
:
'已上线'
,
'global.table.lifecycle.unknown'
:
'未知'
,
'global.table.execmode'
:
'执行模式'
,
...
...
dinky-web/src/pages/DataStudio/LeftContainer/Project/JobTree/index.tsx
View file @
d2d26f6c
...
...
@@ -46,7 +46,15 @@ type TreeProps = {
};
const
JobTree
:
React
.
FC
<
TreeProps
&
connect
>
=
(
props
)
=>
{
const
{
projectData
,
onNodeClick
,
style
,
height
,
onRightClick
}
=
props
;
const
{
projectData
,
onNodeClick
,
style
,
height
,
onRightClick
,
selectedKeys
:
selectedKey
}
=
props
;
const
[
searchValue
,
setSearchValueValue
]
=
useState
(
''
);
const
[
data
,
setData
]
=
useState
<
any
[]
>
(
buildProjectTree
(
projectData
,
searchValue
));
...
...
@@ -56,8 +64,7 @@ const JobTree: React.FC<TreeProps & connect> = (props) => {
const
[
expandedKeys
,
setExpandedKeys
]
=
useState
<
Key
[]
>
();
const
[
autoExpandParent
,
setAutoExpandParent
]
=
useState
(
true
);
const
[
selectedKeys
,
setSelectedKeys
]
=
useState
(
props
.
selectedKeys
);
const
[
selectedKeys
,
setSelectedKeys
]
=
useState
(
selectedKey
);
const
onChangeSearch
=
(
e
:
any
)
=>
{
let
{
value
}
=
e
.
target
;
if
(
!
value
)
{
...
...
@@ -95,7 +102,7 @@ const JobTree: React.FC<TreeProps & connect> = (props) => {
const
expandList
:
any
[]
=
generateList
(
data
,
[]);
let
expandedKeys
:
any
=
expandList
.
map
((
item
:
any
)
=>
{
if
(
item
?.
key
==
treeKey
)
{
if
(
item
?.
key
==
=
treeKey
)
{
return
getParentKey
(
item
.
key
,
data
);
}
return
null
;
...
...
dinky-web/src/pages/DataStudio/LeftContainer/Project/function.tsx
View file @
d2d26f6c
import
{
getTabIcon
}
from
'@/pages/DataStudio/MiddleContainer/function'
;
import
{
DIALECT
}
from
'@/services/constants'
;
import
{
Catalogue
}
from
'@/types/Studio/data.d'
;
import
{
searchTreeNode
}
from
'@/utils/function'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
Badge
,
Space
}
from
'antd'
;
import
{
PresetStatusColorType
}
from
'antd/es/_util/colors'
;
export
const
generateList
=
(
data
:
any
,
list
:
any
[])
=>
{
for
(
const
element
of
data
)
{
...
...
@@ -58,17 +62,66 @@ export const buildProjectTree = (
data
?
data
.
map
((
item
:
Catalogue
)
=>
{
const
currentPath
=
path
?
[...
path
,
item
.
name
]
:
[
item
.
name
];
// 构造生命周期的值
const
stepValue
=
buildStepValue
(
item
.
task
?.
step
);
// 渲染生命周期的徽标
const
renderStepBadge
=
item
.
isLeaf
&&
showBadge
(
item
.
type
)
&&
(
<>
<
Badge
.
Ribbon
style=
{
{
top
:
-
14
,
left
:
-
57
,
width
:
'56px'
,
height
:
'18px'
,
fontSize
:
'6px'
,
lineHeight
:
'18px'
}
}
key=
{
item
.
id
}
placement=
{
'start'
}
text=
{
stepValue
.
title
}
color=
{
stepValue
.
color
}
/>
</>
);
// 渲染生命周期的 标记点
const
renderPreFixState
=
item
.
isLeaf
&&
showBadge
(
item
.
type
)
&&
(
<>
<
Badge
title=
{
stepValue
.
title
}
status=
{
(
stepValue
.
status
as
PresetStatusColorType
)
??
'default'
}
/>
</>
);
// 总渲染 title
const
renderTitle
=
(
<>
<
Space
align=
{
'baseline'
}
size=
{
2
}
>
{
renderStepBadge
}
{
searchTreeNode
(
item
.
name
,
searchValue
)
}
</
Space
>
</>
);
return
{
// isLeaf: (item.type && item.children.length === 0) ,
isLeaf
:
item
.
isLeaf
,
name
:
item
.
name
,
parentId
:
item
.
parentId
,
label
:
searchTreeNode
(
item
.
name
,
searchValue
),
icon
:
item
.
type
&&
item
.
children
.
length
===
0
&&
getTabIcon
(
item
.
type
,
20
),
icon
:
item
.
type
&&
item
.
children
.
length
===
0
&&
(
<
Space
size=
{
'small'
}
>
{
renderPreFixState
}
{
getTabIcon
(
item
.
type
,
20
)
}
</
Space
>
),
value
:
item
.
id
,
path
:
currentPath
,
type
:
item
.
type
,
title
:
<>
{
searchTreeNode
(
item
.
name
,
searchValue
)
}
</>,
title
:
(
<>
{
item
.
isLeaf
&&
showBadge
(
item
.
type
)
&&
<>
{
'
\
u00A0'
.
repeat
(
16
)
}
</>
}
{
renderTitle
}
</>
),
fullInfo
:
item
,
key
:
item
.
id
,
id
:
item
.
id
,
...
...
@@ -82,4 +135,69 @@ export const isUDF = (jobType: string) => {
return
jobType
===
'Scala'
||
jobType
===
'Python'
||
jobType
===
'Java'
;
};
export
const
buildUDFTree
=
(
data
:
[])
=>
{};
export
const
buildStepValue
=
(
step
:
number
)
=>
{
// "success", "processing", "error", "default", "warning"
// todo: 生命周期正在重构 后续在优化
switch
(
step
)
{
case
0
:
return
{
title
:
l
(
'global.table.lifecycle.unknown'
),
status
:
'default'
,
color
:
'#b0aeae'
};
case
1
:
return
{
title
:
l
(
'global.table.lifecycle.dev'
),
status
:
'processing'
,
color
:
'#1890ff'
};
case
2
:
return
{
title
:
l
(
'global.table.lifecycle.online'
),
status
:
'success'
,
color
:
'#52c41a'
};
case
3
:
return
{
title
:
l
(
'global.table.lifecycle.stopped'
),
status
:
'error'
,
color
:
'#f5222d'
};
case
4
:
return
{
title
:
l
(
'global.table.lifecycle.offline'
),
status
:
'warning'
,
color
:
'#faad14'
};
default
:
return
{
title
:
l
(
'global.table.lifecycle.dev'
),
status
:
'default'
,
color
:
'#1890ff'
};
}
};
export
const
showBadge
=
(
type
:
string
)
=>
{
if
(
!
type
)
{
return
false
;
}
switch
(
type
.
toLowerCase
())
{
case
DIALECT
.
SQL
:
case
DIALECT
.
MYSQL
:
case
DIALECT
.
ORACLE
:
case
DIALECT
.
SQLSERVER
:
case
DIALECT
.
POSTGRESQL
:
case
DIALECT
.
CLICKHOUSE
:
case
DIALECT
.
PHOENIX
:
case
DIALECT
.
DORIS
:
case
DIALECT
.
HIVE
:
case
DIALECT
.
STARROCKS
:
case
DIALECT
.
PRESTO
:
case
DIALECT
.
FLINK_SQL
:
case
DIALECT
.
FLINKJAR
:
return
true
;
default
:
return
false
;
}
};
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