Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MindSpore
mindinsight
提交
39b8ef4b
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看板
提交
39b8ef4b
编写于
8月 07, 2020
作者:
M
mindspore-ci-bot
提交者:
Gitee
8月 07, 2020
浏览文件
操作
浏览文件
下载
差异文件
!504 UI add graph plug-in compatible code
Merge pull request !504 from 黄伟锋/myMaster
上级
24adb87b
9ffc8830
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
95 addition
and
74 deletion
+95
-74
mindinsight/ui/src/views/train-manage/data-map.vue
mindinsight/ui/src/views/train-manage/data-map.vue
+5
-2
mindinsight/ui/src/views/train-manage/graph.vue
mindinsight/ui/src/views/train-manage/graph.vue
+90
-72
未找到文件。
mindinsight/ui/src/views/train-manage/data-map.vue
浏览文件 @
39b8ef4b
...
...
@@ -146,6 +146,7 @@ limitations under the License.
import
RequestService
from
'
../../services/request-service
'
;
import
CommonProperty
from
'
@/common/common-property.js
'
;
import
{
select
,
selectAll
,
zoom
}
from
'
d3
'
;
import
{
event
as
currentEvent
}
from
'
d3-selection
'
;
import
'
d3-graphviz
'
;
const
d3
=
{
select
,
selectAll
,
zoom
};
export
default
{
...
...
@@ -385,10 +386,12 @@ export default {
const
zoom
=
d3
.
zoom
()
.
on
(
'
start
'
,
()
=>
{
const
event
=
currentEvent
.
sourceEvent
;
pointer
.
start
.
x
=
event
.
x
;
pointer
.
start
.
y
=
event
.
y
;
})
.
on
(
'
zoom
'
,
()
=>
{
const
event
=
currentEvent
.
sourceEvent
;
const
transformData
=
this
.
getTransformData
(
graphDom
);
if
(
!
Object
.
keys
(
graphTransform
).
length
)
{
graphTransform
=
{
...
...
@@ -444,8 +447,8 @@ export default {
pointer
.
start
.
x
=
pointer
.
end
.
x
;
pointer
.
start
.
y
=
pointer
.
end
.
y
;
}
else
if
(
event
.
type
===
'
wheel
'
)
{
const
wheelDelta
=
event
.
wheelDelta
;
const
rate
=
Math
.
abs
(
wheelDelta
/
100
)
;
const
wheelDelta
=
-
event
.
deltaY
;
const
rate
=
1.2
;
scale
=
wheelDelta
>
0
?
transformData
.
scale
[
0
]
*
rate
...
...
mindinsight/ui/src/views/train-manage/graph.vue
浏览文件 @
39b8ef4b
...
...
@@ -415,6 +415,7 @@ import Autocomplete from '@/components/autocomplete';
import
CommonProperty
from
'
@/common/common-property.js
'
;
import
RequestService
from
'
@/services/request-service
'
;
import
{
select
,
selectAll
,
zoom
}
from
'
d3
'
;
import
{
event
as
currentEvent
}
from
'
d3-selection
'
;
import
'
d3-graphviz
'
;
const
d3
=
{
select
,
selectAll
,
zoom
};
export
default
{
...
...
@@ -679,8 +680,14 @@ export default {
*/
startApp
()
{
const
nodes
=
d3
.
selectAll
(
'
g.node, g.cluster
'
);
nodes
.
on
(
'
click
'
,
(
target
,
index
,
nodesList
)
=>
{
nodes
.
on
(
'
click
'
,
(
target
,
index
,
nodesList
)
=>
{
// The target value of the element converted from the HTML attribute of the variable is null.
const
event
=
currentEvent
;
event
.
stopPropagation
();
event
.
preventDefault
();
const
clickNode
=
nodesList
[
index
];
const
nodeId
=
clickNode
.
id
;
const
nodeClass
=
clickNode
.
classList
.
value
;
...
...
@@ -695,16 +702,19 @@ export default {
},
1000
);
this
.
selectedNode
.
name
=
nodeId
;
this
.
selectNode
(
false
);
if
(
!
event
||
!
event
.
type
||
event
.
type
!==
'
click
'
)
{
return
;
}
event
.
stopPropagation
();
event
.
preventDefault
();
});
},
false
,
);
// namespaces Expansion or Reduction
nodes
.
on
(
'
dblclick
'
,
(
target
,
index
,
nodesList
)
=>
{
nodes
.
on
(
'
dblclick
'
,
(
target
,
index
,
nodesList
)
=>
{
// The target of the element converted from the HTML attribute of the variable is empty and
// needs to be manually encapsulated.
const
event
=
currentEvent
;
event
.
stopPropagation
();
event
.
preventDefault
();
const
clickNode
=
nodesList
[
index
];
const
nodeId
=
clickNode
.
id
;
const
nodeClass
=
clickNode
.
classList
.
value
;
...
...
@@ -728,6 +738,13 @@ export default {
.
parentNode
.
id
;
name
=
parentId
.
replace
(
'
_unfold
'
,
''
);
this
.
allGraphData
[
name
].
index
+=
changePage
;
this
.
allGraphData
[
name
].
index
=
Math
.
max
(
0
,
Math
.
min
(
this
.
allGraphData
[
name
].
index
,
this
.
allGraphData
[
name
].
childIdsList
.
length
-
1
,
),
);
this
.
selectedNode
.
name
=
name
;
}
if
(
unfoldFlag
)
{
...
...
@@ -736,12 +753,9 @@ export default {
this
.
selectedNode
.
name
=
this
.
clickScope
.
id
;
this
.
selectNode
(
false
);
}
if
(
!
event
||
!
event
.
type
||
event
.
type
!==
'
dblclick
'
)
{
return
;
}
event
.
stopPropagation
();
event
.
preventDefault
();
});
},
false
,
);
this
.
initZooming
();
if
(
this
.
selectedNode
.
name
)
{
this
.
selectNode
(
true
);
...
...
@@ -758,10 +772,15 @@ export default {
const
zoom
=
d3
.
zoom
()
.
on
(
'
start
'
,
()
=>
{
const
event
=
currentEvent
.
sourceEvent
;
pointer
.
start
.
x
=
event
.
x
;
pointer
.
start
.
y
=
event
.
y
;
})
.
on
(
'
zoom
'
,
()
=>
{
const
event
=
currentEvent
.
sourceEvent
;
event
.
stopPropagation
();
event
.
preventDefault
();
const
transformData
=
this
.
getTransformData
(
this
.
graph
.
dom
);
let
tempStr
=
''
;
let
change
=
{};
...
...
@@ -809,8 +828,8 @@ export default {
pointer
.
start
.
x
=
pointer
.
end
.
x
;
pointer
.
start
.
y
=
pointer
.
end
.
y
;
}
else
if
(
event
.
type
===
'
wheel
'
)
{
const
wheelDelta
=
event
.
wheelDelta
;
const
rate
=
Math
.
abs
(
wheelDelta
/
100
)
;
const
wheelDelta
=
-
event
.
deltaY
;
const
rate
=
1.2
;
scale
=
wheelDelta
>
0
?
transformData
.
scale
[
0
]
*
rate
...
...
@@ -838,11 +857,11 @@ export default {
this
.
graph
.
transRate
=
graphRect
.
width
/
graphBox
.
width
/
this
.
graph
.
transform
.
k
;
tempStr
=
`translate(
${
this
.
graph
.
transform
.
x
}
,
${
this
.
graph
.
transform
.
y
}
) scale(
${
this
.
graph
.
transform
.
k
}
)`
;
tempStr
=
`translate(
${
this
.
graph
.
transform
.
x
}
,
${
this
.
graph
.
transform
.
y
}
) `
+
`scale(
${
this
.
graph
.
transform
.
k
}
)`
;
this
.
graph
.
dom
.
setAttribute
(
'
transform
'
,
tempStr
);
this
.
setInsideBoxData
();
event
.
stopPropagation
();
event
.
preventDefault
();
});
const
svg
=
d3
.
select
(
'
#graph svg
'
);
...
...
@@ -930,8 +949,8 @@ export default {
*/
layoutNamescope
(
name
,
toUnfold
)
{
this
.
$nextTick
(()
=>
{
const
dotStr
=
this
.
packageNamescope
(
name
);
try
{
const
dotStr
=
this
.
packageNamescope
(
name
);
this
.
graphvizTemp
=
d3
.
select
(
'
#graphTemp
'
)
.
graphviz
({
useWorker
:
false
,
totalMemory
:
this
.
totalMemory
})
...
...
@@ -2678,12 +2697,11 @@ export default {
};
// Mouse wheel event
smallContainer
.
on
mouse
wheel
=
(
e
)
=>
{
smallContainer
.
onwheel
=
(
e
)
=>
{
e
=
e
||
window
.
event
;
const
wheelDelta
=
e
.
wheelDelta
?
e
.
wheelDelta
:
e
.
detail
;
const
wheelDelta
=
e
.
wheelDelta
?
e
.
wheelDelta
:
-
e
.
deltaY
;
if
(
!
isNaN
(
this
.
graph
.
transform
.
k
)
&&
this
.
graph
.
transform
.
k
!==
0
)
{
let
rate
=
wheelDelta
>
0
?
wheelDelta
/
100
:
-
1
/
(
wheelDelta
/
100
);
let
rate
=
wheelDelta
>
0
?
1.2
:
1
/
1.2
;
let
scaleTemp
=
this
.
graph
.
transform
.
k
/
rate
;
if
(
scaleTemp
<=
this
.
graph
.
minScale
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录