Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MindSpore
mindinsight
提交
25e6492b
M
mindinsight
项目概览
MindSpore
/
mindinsight
通知
7
Star
3
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
mindinsight
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
25e6492b
编写于
7月 25, 2020
作者:
W
WeiFeng-mindinsight
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
UI fix bug of graph that click more to modify aggregation scope page display error
上级
46099e82
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
74 addition
and
61 deletion
+74
-61
mindinsight/ui/src/views/train-manage/graph.vue
mindinsight/ui/src/views/train-manage/graph.vue
+74
-61
未找到文件。
mindinsight/ui/src/views/train-manage/graph.vue
浏览文件 @
25e6492b
...
...
@@ -467,7 +467,7 @@ export default {
show
:
false
,
info
:
''
,
},
scaleRange
:
[
0.00
01
,
10
000
],
// graph zooms in and zooms out.
scaleRange
:
[
0.00
1
,
1
000
],
// graph zooms in and zooms out.
rightShow
:
true
,
// Check whether the right side bar is displayed.
fullScreen
:
false
,
// Display Full Screen
totalMemory
:
16777216
*
2
,
// Memory size of the graph plug-in
...
...
@@ -583,29 +583,32 @@ export default {
* @param {String} dot dot statement encapsulated in graph data
*/
initGraph
(
dot
)
{
this
.
graphviz
=
d3
.
select
(
'
#graph
'
)
.
graphviz
({
useWorker
:
false
,
totalMemory
:
this
.
totalMemory
})
.
zoomScaleExtent
(
this
.
scaleRange
)
.
dot
(
dot
)
.
attributer
(
this
.
attributer
)
.
render
(()
=>
{
this
.
initSvg
();
this
.
afterInitGraph
();
});
try
{
this
.
graphviz
=
d3
.
select
(
'
#graph
'
)
.
graphviz
({
useWorker
:
false
,
totalMemory
:
this
.
totalMemory
})
.
zoomScaleExtent
(
this
.
scaleRange
)
.
dot
(
dot
)
.
attributer
(
this
.
attributer
)
.
render
(()
=>
{
this
.
initSvg
();
this
.
afterInitGraph
();
});
}
catch
(
error
)
{
const
svg
=
document
.
querySelector
(
'
#graph svg
'
);
if
(
svg
)
{
svg
.
remove
();
}
this
.
initGraph
(
dot
);
}
// Generate the dom of the submap.
if
(
!
d3
.
select
(
'
#graphTemp
'
).
size
())
{
d3
.
select
(
'
body
'
)
.
append
(
'
div
'
)
.
attr
(
'
id
'
,
'
graphTemp
'
)
.
attr
(
'
style
'
,
'
visibility: collapse
'
);
d3
.
select
(
'
body
'
).
append
(
'
div
'
).
attr
(
'
id
'
,
'
graphTemp
'
);
}
// Stores the dom of all the sorted subgraphs.
if
(
!
d3
.
select
(
'
#subgraphTemp
'
).
size
())
{
d3
.
select
(
'
body
'
)
.
append
(
'
div
'
)
.
attr
(
'
id
'
,
'
subgraphTemp
'
)
.
attr
(
'
style
'
,
'
visibility: collapse
'
);
d3
.
select
(
'
body
'
).
append
(
'
div
'
).
attr
(
'
id
'
,
'
subgraphTemp
'
);
}
},
initSvg
()
{
...
...
@@ -654,10 +657,7 @@ export default {
this
.
$nextTick
(()
=>
{
this
.
loading
.
show
=
false
;
});
const
elements
=
d3
.
select
(
'
#graph
'
)
.
selectAll
(
'
g.node, g.edge
'
)
.
nodes
();
const
elements
=
d3
.
select
(
'
#graph
'
).
selectAll
(
'
g.node, g.edge
'
).
nodes
();
elements
.
forEach
((
ele
)
=>
{
if
(
!
ele
.
hasAttribute
(
'
transform
'
))
{
ele
.
setAttribute
(
'
transform
'
,
'
translate(0,0)
'
);
...
...
@@ -728,6 +728,7 @@ export default {
.
parentNode
.
id
;
name
=
parentId
.
replace
(
'
_unfold
'
,
''
);
this
.
allGraphData
[
name
].
index
+=
changePage
;
this
.
selectedNode
.
name
=
name
;
}
if
(
unfoldFlag
)
{
this
.
dealDoubleClick
(
name
);
...
...
@@ -928,26 +929,39 @@ export default {
* @param {Boolean} toUnfold Expand the namespace.
*/
layoutNamescope
(
name
,
toUnfold
)
{
setTimeout
(()
=>
{
this
.
$nextTick
(()
=>
{
const
dotStr
=
this
.
packageNamescope
(
name
);
this
.
graphvizTemp
=
d3
.
select
(
'
#graphTemp
'
)
.
graphviz
({
useWorker
:
false
,
totalMemory
:
this
.
totalMemory
})
.
dot
(
dotStr
)
.
zoomScaleExtent
(
this
.
scaleRange
)
.
attributer
((
datum
,
index
,
nodes
)
=>
{
if
(
datum
.
tag
===
'
polygon
'
&&
datum
.
attributes
.
stroke
!==
'
transparent
'
)
{
datum
.
attributes
.
stroke
=
'
rgb(167, 167, 167)
'
;
}
})
.
render
(()
=>
{
this
.
fitGraph
(
'
graphTemp
'
);
this
.
dealNamescopeTempGraph
(
name
);
});
},
20
);
try
{
this
.
graphvizTemp
=
d3
.
select
(
'
#graphTemp
'
)
.
graphviz
({
useWorker
:
false
,
totalMemory
:
this
.
totalMemory
})
.
dot
(
dotStr
)
.
zoomScaleExtent
(
this
.
scaleRange
)
.
attributer
((
datum
,
index
,
nodes
)
=>
{
if
(
datum
.
tag
===
'
polygon
'
&&
datum
.
attributes
.
stroke
!==
'
transparent
'
)
{
datum
.
attributes
.
stroke
=
'
rgb(167, 167, 167)
'
;
}
})
.
render
(()
=>
{
this
.
fitGraph
(
'
graphTemp
'
);
this
.
dealNamescopeTempGraph
(
name
);
});
}
catch
(
error
)
{
const
graphTempSvg
=
document
.
querySelector
(
'
#graphTemp svg
'
);
if
(
graphTempSvg
)
{
graphTempSvg
.
remove
();
}
const
subGraphTempSvg
=
document
.
querySelector
(
'
#subgraphTemp svg
'
);
if
(
subGraphTempSvg
)
{
subGraphTempSvg
.
remove
();
}
this
.
dealDoubleClick
(
this
.
selectedNode
.
name
);
}
});
},
/**
* To obtain graph data, initialize and expand the namespace or aggregate nodes.
...
...
@@ -1665,10 +1679,7 @@ export default {
.
attr
(
'
width
'
,
g
.
node
().
getBBox
().
width
+
this
.
frameSpace
*
2
)
.
attr
(
'
height
'
,
g
.
node
().
getBBox
().
height
+
this
.
frameSpace
*
2
);
boxTemp
=
d3
.
select
(
`
${
idStr
}
g[id="
${
name
}
_unfold"]`
)
.
node
()
.
getBBox
();
boxTemp
=
d3
.
select
(
`
${
idStr
}
g[id="
${
name
}
_unfold"]`
).
node
().
getBBox
();
// After the namespace dom is successfully encapsulated, set the related data of the data object.
this
.
allGraphData
[
name
].
isUnfold
=
true
;
this
.
allGraphData
[
name
].
size
=
[
boxTemp
.
width
/
72
,
boxTemp
.
height
/
72
];
...
...
@@ -1680,8 +1691,9 @@ export default {
const
node
=
document
.
querySelector
(
`#graphTemp g[id="
${
name
}
"]`
);
const
box
=
node
.
getBBox
();
const
boxTemp
=
nodeTemp
.
getBBox
();
const
translateStr
=
`translate(
${
box
.
x
-
boxTemp
.
x
}
,
${
box
.
y
-
boxTemp
.
y
}
)`
;
const
translateStr
=
`translate(
${
box
.
x
-
boxTemp
.
x
}
,
${
box
.
y
-
boxTemp
.
y
}
)`
;
nodeTemp
.
setAttribute
(
'
transform
'
,
translateStr
);
node
.
parentNode
.
appendChild
(
nodeTemp
);
document
.
querySelector
(
'
#subgraphTemp svg
'
).
remove
();
...
...
@@ -1732,8 +1744,9 @@ export default {
if
(
node
&&
nodeTemp
)
{
const
box
=
node
.
getBBox
();
const
boxTemp
=
nodeTemp
.
getBBox
();
const
translateStr
=
`translate(
${
box
.
x
-
boxTemp
.
x
}
,
${
box
.
y
-
boxTemp
.
y
}
)`
;
const
translateStr
=
`translate(
${
box
.
x
-
boxTemp
.
x
}
,
${
box
.
y
-
boxTemp
.
y
}
)`
;
nodeTemp
.
setAttribute
(
'
transform
'
,
translateStr
);
node
.
parentNode
.
appendChild
(
nodeTemp
);
node
.
remove
();
...
...
@@ -1809,10 +1822,7 @@ export default {
this
.
loading
.
show
=
true
;
}
if
(
name
.
includes
(
'
/
'
))
{
const
subPath
=
name
.
split
(
'
/
'
)
.
slice
(
0
,
-
1
)
.
join
(
'
/
'
);
const
subPath
=
name
.
split
(
'
/
'
).
slice
(
0
,
-
1
).
join
(
'
/
'
);
this
.
layoutNamescope
(
subPath
,
true
);
}
else
{
const
svg
=
document
.
querySelector
(
'
#graph svg
'
);
...
...
@@ -2292,10 +2302,7 @@ export default {
if
(
subPsth
&&
this
.
allGraphData
[
subPsth
])
{
// The virtual node and its subnodes need to return their namespaces.
if
(
this
.
allGraphData
[
subPsth
].
independent_layout
)
{
subPsth
=
subPsth
.
split
(
'
/
'
)
.
slice
(
0
,
-
1
)
.
join
(
'
/
'
);
subPsth
=
subPsth
.
split
(
'
/
'
).
slice
(
0
,
-
1
).
join
(
'
/
'
);
}
}
return
subPsth
;
...
...
@@ -2619,7 +2626,7 @@ export default {
this
.
insideBox
.
height
=
this
.
smallResize
.
height
;
this
.
insideBox
.
top
=
this
.
insideBox
.
left
=
0
;
this
.
styleSet
(
'
#inside-box
'
,
this
.
insideBox
);
insideBox
.
style
.
cursor
=
'
not-allowed
'
;
this
.
insideBox
.
style
.
cursor
=
'
not-allowed
'
;
}
else
{
let
transformString
=
''
;
const
transTemp
=
this
.
graph
.
dom
.
attributes
.
transform
||
null
;
...
...
@@ -2757,8 +2764,9 @@ export default {
`<svg xmlns="http://www.w3.org/2000/svg" `
+
`xmlns:xlink="http://www.w3.org/1999/xlink" width="100%" height="100%" `
+
`viewBox="0.00 0.00
${
this
.
svg
.
originSize
.
width
}
${
this
.
svg
.
originSize
.
height
}
"`
+
`><g id="smallGraph" class="graph" transform="translate(4,
${
this
.
svg
.
originSize
.
height
-
4
}
) scale(1)"`
+
`><g id="smallGraph" class="graph" transform="translate(4,
${
this
.
svg
.
originSize
.
height
-
4
}
) scale(1)"`
+
`>
${
this
.
graph
.
dom
.
innerHTML
}
</g></svg>`
;
smallMap
.
innerHTML
=
svgOuterHtml
;
...
...
@@ -3493,4 +3501,9 @@ export default {
padding-right
:
32px
;
}
}
#graphTemp
,
#subgraphTemp
{
position
:
absolute
;
bottom
:
0
;
}
</
style
>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录