Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dlink
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
zhaowei
dlink
Commits
67900115
Unverified
Commit
67900115
authored
Jun 23, 2022
by
aiwenmo
Committed by
GitHub
Jun 23, 2022
Browse files
Options
Browse Files
Download
Plain Diff
[Optimization-633][web] Optimization lineage refresh
[Optimization-633][web] Optimization lineage refresh
parents
6bfada00
4bdfc523
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
58 deletions
+50
-58
LineageTable.java
...c/main/java/com/dlink/explainer/lineage/LineageTable.java
+1
-1
index.tsx
dlink-web/src/components/Lineage/index.tsx
+42
-52
index.tsx
...eb/src/components/Studio/StudioConsole/StudioCA/index.tsx
+4
-3
index.tsx
dlink-web/src/pages/DevOps/JobInfo/DataMap/index.tsx
+3
-2
No files found.
dlink-core/src/main/java/com/dlink/explainer/lineage/LineageTable.java
View file @
67900115
...
@@ -22,7 +22,7 @@ public class LineageTable {
...
@@ -22,7 +22,7 @@ public class LineageTable {
public
static
LineageTable
build
(
TableCA
tableCA
)
{
public
static
LineageTable
build
(
TableCA
tableCA
)
{
LineageTable
lineageTable
=
new
LineageTable
();
LineageTable
lineageTable
=
new
LineageTable
();
lineageTable
.
setId
(
tableCA
.
getId
().
toString
());
lineageTable
.
setId
(
tableCA
.
getId
().
toString
());
lineageTable
.
setName
(
tableCA
.
getName
());
lineageTable
.
setName
(
tableCA
.
get
Table
Name
());
List
<
LineageColumn
>
columnList
=
new
ArrayList
<>();
List
<
LineageColumn
>
columnList
=
new
ArrayList
<>();
for
(
String
columnName
:
tableCA
.
getFields
())
{
for
(
String
columnName
:
tableCA
.
getFields
())
{
columnList
.
add
(
LineageColumn
.
build
(
columnName
,
columnName
));
columnList
.
add
(
LineageColumn
.
build
(
columnName
,
columnName
));
...
...
dlink-web/src/components/Lineage/index.tsx
View file @
67900115
import
{
LineageTable
}
from
'react-lineage-dag'
;
import
{
LineageTable
}
from
'react-lineage-dag'
;
import
{
use
Effect
,
use
State
,
useRef
}
from
"react"
;
import
{
useState
,
useRef
}
from
"react"
;
import
LineageOps
from
"@/components/Lineage/LineageOps"
;
import
LineageOps
from
"@/components/Lineage/LineageOps"
;
import
*
as
_
from
'lodash'
;
export
const
getInit
=
()
=>
{
export
const
getInit
=
()
=>
{
return
{
return
{
...
@@ -15,8 +15,8 @@ const Lineage = (props: any) => {
...
@@ -15,8 +15,8 @@ const Lineage = (props: any) => {
const
{
datas
}
=
props
;
const
{
datas
}
=
props
;
const
cvsRef
=
useRef
(
null
);
const
cvsRef
=
useRef
(
null
);
const
[
data
,
setData
]
=
useState
(
getInit
()
);
const
[
data
,
setData
]
=
useState
(
datas
);
const
[
allData
,
setAllData
]
=
useState
(
getInit
()
);
const
[
allData
,
setAllData
]
=
useState
(
datas
);
const
[
relayout
,
setRelayout
]
=
useState
(
false
);
const
[
relayout
,
setRelayout
]
=
useState
(
false
);
const
[
focus
,
setFocus
]
=
useState
(
false
);
const
[
focus
,
setFocus
]
=
useState
(
false
);
...
@@ -41,79 +41,67 @@ const Lineage = (props: any) => {
...
@@ -41,79 +41,67 @@ const Lineage = (props: any) => {
};
};
const
onAction
=
(
action
,
tableId
)
=>
{
const
onAction
=
(
action
,
tableId
)
=>
{
const
newData
=
_
.
cloneDeep
(
data
);
switch
(
action
)
{
switch
(
action
)
{
case
'expand'
:
{
case
'expand'
:
{
const
table
=
d
ata
.
tables
.
find
(
t
=>
t
.
id
===
tableId
);
const
table
=
newD
ata
.
tables
.
find
(
t
=>
t
.
id
===
tableId
);
table
.
isExpand
=
true
;
table
.
isExpand
=
true
;
const
children
=
getChildren
(
tableId
);
const
children
=
getChildren
(
tableId
);
children
.
tables
.
forEach
(
table
=>
{
children
.
tables
.
forEach
(
table
=>
{
if
(
d
ata
.
tables
.
some
(
t
=>
t
.
id
===
table
.
id
))
{
if
(
newD
ata
.
tables
.
some
(
t
=>
t
.
id
===
table
.
id
))
{
return
;
return
;
}
}
d
ata
.
tables
.
push
(
table
);
newD
ata
.
tables
.
push
(
table
);
});
});
children
.
relations
.
forEach
(
relation
=>
{
children
.
relations
.
forEach
(
relation
=>
{
if
(
d
ata
.
relations
.
some
(
r
=>
r
.
id
===
relation
.
id
))
{
if
(
newD
ata
.
relations
.
some
(
r
=>
r
.
id
===
relation
.
id
))
{
return
;
return
;
}
}
d
ata
.
relations
.
push
(
relation
);
newD
ata
.
relations
.
push
(
relation
);
});
});
setData
({...
d
ata
});
setData
({...
newD
ata
});
break
;
break
;
}
}
case
'shrink'
:
{
case
'shrink'
:
{
const
table
=
d
ata
.
tables
.
find
(
t
=>
t
.
id
===
tableId
);
const
table
=
newD
ata
.
tables
.
find
(
t
=>
t
.
id
===
tableId
);
table
.
isExpand
=
false
;
table
.
isExpand
=
false
;
const
children
=
getChildren
(
tableId
);
const
children
=
getChildren
(
tableId
);
children
.
tables
.
forEach
(
table
=>
{
children
.
tables
.
forEach
(
table
=>
{
const
index
=
d
ata
.
tables
.
findIndex
(
t
=>
t
.
id
===
table
.
id
);
const
index
=
newD
ata
.
tables
.
findIndex
(
t
=>
t
.
id
===
table
.
id
);
d
ata
.
tables
.
splice
(
index
,
1
);
newD
ata
.
tables
.
splice
(
index
,
1
);
});
});
children
.
relations
.
forEach
(
relation
=>
{
children
.
relations
.
forEach
(
relation
=>
{
const
index
=
d
ata
.
relations
.
findIndex
(
r
=>
r
.
id
===
relation
.
id
);
const
index
=
newD
ata
.
relations
.
findIndex
(
r
=>
r
.
id
===
relation
.
id
);
d
ata
.
relations
.
splice
(
index
,
1
);
newD
ata
.
relations
.
splice
(
index
,
1
);
});
});
setData
({...
d
ata
});
setData
({...
newD
ata
});
break
;
break
;
}
}
case
'fold'
:
{
case
'fold'
:
{
d
ata
.
tables
.
forEach
(
table
=>
{
newD
ata
.
tables
.
forEach
(
table
=>
{
if
(
table
.
id
!==
tableId
)
{
if
(
table
.
id
!==
tableId
)
{
return
;
return
;
}
}
table
.
isFold
=
false
;
table
.
isFold
=
false
;
});
});
data
.
tables
=
[...
d
ata
.
tables
];
newData
.
tables
=
[...
newD
ata
.
tables
];
setData
({...
d
ata
});
setData
({...
newD
ata
});
break
;
break
;
}
}
case
'unfold'
:
{
case
'unfold'
:
{
d
ata
.
tables
.
forEach
(
table
=>
{
newD
ata
.
tables
.
forEach
(
table
=>
{
if
(
table
.
id
!==
tableId
)
{
if
(
table
.
id
!==
tableId
)
{
return
;
return
;
}
}
table
.
isFold
=
true
;
table
.
isFold
=
true
;
});
});
data
.
tables
=
[...
d
ata
.
tables
];
newData
.
tables
=
[...
newD
ata
.
tables
];
setData
({...
d
ata
});
setData
({...
newD
ata
});
break
;
break
;
}
}
}
}
};
};
const
getData
=
()
=>
{
setData
(
datas
);
let
newDatas
=
{
tables
:
[...
datas
.
tables
],
relations
:
[...
datas
.
relations
]
};
setAllData
(
newDatas
);
};
useEffect
(()
=>
{
getData
();
},
[
datas
]);
data
.
tables
.
forEach
(
table
=>
{
data
.
tables
.
forEach
(
table
=>
{
table
.
operators
=
LineageOps
({
table
.
operators
=
LineageOps
({
isExpand
:
!!
table
.
isExpand
,
isExpand
:
!!
table
.
isExpand
,
...
@@ -123,23 +111,25 @@ const Lineage = (props: any) => {
...
@@ -123,23 +111,25 @@ const Lineage = (props: any) => {
})
})
});
});
return
(<
LineageTable
{
...
data
}
return
(
onLoaded=
{
(
canvas
)
=>
{
<
LineageTable
cvsRef
.
current
=
canvas
;
{
...
data
}
}
}
onLoaded=
{
(
canvas
)
=>
{
onEachFrame=
{
()
=>
{
cvsRef
.
current
=
canvas
;
if
(
!
cvsRef
.
current
)
{
}
}
return
;
onEachFrame=
{
()
=>
{
}
if
(
!
cvsRef
.
current
)
{
if
(
relayout
)
{
return
;
cvsRef
.
current
.
relayout
();
}
setRelayout
(
false
);
if
(
relayout
)
{
}
cvsRef
.
current
.
relayout
();
if
(
focus
)
{
setRelayout
(
false
);
cvsRef
.
current
.
focusNode
(
focus
);
}
setFocus
(
false
);
if
(
focus
)
{
}
cvsRef
.
current
.
focusNode
(
focus
);
}
}
/>)
setFocus
(
false
);
}
}
}
/>)
};
};
export
default
Lineage
;
export
default
Lineage
;
dlink-web/src/components/Studio/StudioConsole/StudioCA/index.tsx
View file @
67900115
import
{
Tabs
,
Tooltip
,
Button
,
Modal
,
message
}
from
"antd"
;
import
{
Tabs
,
Tooltip
,
Button
,
Modal
,
message
,
Empty
}
from
"antd"
;
import
{
SearchOutlined
,
SnippetsOutlined
}
from
"@ant-design/icons"
;
import
{
SearchOutlined
,
SnippetsOutlined
}
from
"@ant-design/icons"
;
import
{
StateType
}
from
"@/pages/DataStudio/model"
;
import
{
StateType
}
from
"@/pages/DataStudio/model"
;
import
{
connect
}
from
"umi"
;
import
{
connect
}
from
"umi"
;
...
@@ -13,9 +13,10 @@ const { TabPane } = Tabs;
...
@@ -13,9 +13,10 @@ const { TabPane } = Tabs;
const
StudioCA
=
(
props
:
any
)
=>
{
const
StudioCA
=
(
props
:
any
)
=>
{
const
{
current
}
=
props
;
const
{
current
}
=
props
;
const
[
data
,
setData
]
=
useState
(
getInit
()
);
const
[
data
,
setData
]
=
useState
(
undefined
);
const
handleLineage
=
()
=>
{
const
handleLineage
=
()
=>
{
setData
(
undefined
);
const
res
=
getLineage
({
const
res
=
getLineage
({
statement
:
current
.
value
,
statement
:
current
.
value
,
statementSet
:
current
.
task
.
statementSet
,
statementSet
:
current
.
task
.
statementSet
,
...
@@ -79,7 +80,7 @@ const StudioCA = (props: any) => {
...
@@ -79,7 +80,7 @@ const StudioCA = (props: any) => {
</>
}
</>
}
>
>
<
TabPane
tab=
{
<
span
>
血缘分析
</
span
>
}
key=
"Lineage"
>
<
TabPane
tab=
{
<
span
>
血缘分析
</
span
>
}
key=
"Lineage"
>
<
Lineage
datas=
{
data
}
/>
{
data
?<
Lineage
datas=
{
data
}
/>:<
Empty
image=
{
Empty
.
PRESENTED_IMAGE_SIMPLE
}
/>
}
</
TabPane
>
</
TabPane
>
</
Tabs
>
</
Tabs
>
</>)
</>)
...
...
dlink-web/src/pages/DevOps/JobInfo/DataMap/index.tsx
View file @
67900115
...
@@ -7,9 +7,10 @@ const {TabPane} = Tabs;
...
@@ -7,9 +7,10 @@ const {TabPane} = Tabs;
const
DataMap
=
(
props
:
any
)
=>
{
const
DataMap
=
(
props
:
any
)
=>
{
const
{
job
}
=
props
;
const
{
job
}
=
props
;
const
[
data
,
setData
]
=
useState
(
getInit
()
);
const
[
data
,
setData
]
=
useState
(
undefined
);
const
getData
=
()
=>
{
const
getData
=
()
=>
{
setData
(
undefined
);
const
res
=
getLineage
(
job
.
instance
?.
id
);
const
res
=
getLineage
(
job
.
instance
?.
id
);
res
.
then
((
result
)
=>
{
res
.
then
((
result
)
=>
{
result
.
datas
.
tables
.
forEach
(
table
=>
{
result
.
datas
.
tables
.
forEach
(
table
=>
{
...
@@ -29,7 +30,7 @@ const DataMap = (props: any) => {
...
@@ -29,7 +30,7 @@ const DataMap = (props: any) => {
border
:
"1px solid #f0f0f0"
border
:
"1px solid #f0f0f0"
}
}
>
}
}
>
<
TabPane
tab=
{
<
span
>
血缘分析
</
span
>
}
key=
"Lineage"
>
<
TabPane
tab=
{
<
span
>
血缘分析
</
span
>
}
key=
"Lineage"
>
<
Lineage
datas=
{
data
}
/>
{
data
?<
Lineage
datas=
{
data
}
/>:<
Empty
image=
{
Empty
.
PRESENTED_IMAGE_SIMPLE
}
/>
}
</
TabPane
>
</
TabPane
>
</
Tabs
>
</
Tabs
>
</>)
</>)
...
...
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