From: @huang_wei_feng4 Reviewed-by: @ouwenchang,@yelihua Signed-off-by: @yelihuapull/1305/MERGE
| @@ -85,7 +85,7 @@ | |||||
| "graphUrl": "https://www.mindspore.cn/tutorial/training/zh-CN/master/advanced_use/dashboard.html#id5", | "graphUrl": "https://www.mindspore.cn/tutorial/training/zh-CN/master/advanced_use/dashboard.html#id5", | ||||
| "dataProcessUrl": "https://www.mindspore.cn/tutorial/training/zh-CN/master/advanced_use/dashboard.html#id6", | "dataProcessUrl": "https://www.mindspore.cn/tutorial/training/zh-CN/master/advanced_use/dashboard.html#id6", | ||||
| "imageUrl": "https://www.mindspore.cn/tutorial/training/zh-CN/master/advanced_use/dashboard.html#id7", | "imageUrl": "https://www.mindspore.cn/tutorial/training/zh-CN/master/advanced_use/dashboard.html#id7", | ||||
| "sessionLimit": "离线调试器的session个数超过上线", | |||||
| "sessionLimit": "离线调试器的session个数超过上限", | |||||
| "sessionLimitNum": "最多同时存在2个", | "sessionLimitNum": "最多同时存在2个", | ||||
| "sessionLists": "目前存在的session列表", | "sessionLists": "目前存在的session列表", | ||||
| "deleteSessionConfirm": "此操作将删除当前session, 是否继续?", | "deleteSessionConfirm": "此操作将删除当前session, 是否继续?", | ||||
| @@ -44,7 +44,9 @@ export default { | |||||
| nodesCountLimit: 4500, // Maximum number of sub-nodes in a namespace. | nodesCountLimit: 4500, // Maximum number of sub-nodes in a namespace. | ||||
| maxChainNum: 70, | maxChainNum: 70, | ||||
| graphContainer: null, | graphContainer: null, | ||||
| resizeTimer: null, | |||||
| resizeDelay: 500, // The delay of resize's event | resizeDelay: 500, // The delay of resize's event | ||||
| pageKey: '', | |||||
| }; | }; | ||||
| }, | }, | ||||
| mounted() { | mounted() { | ||||
| @@ -85,18 +87,17 @@ export default { | |||||
| if (target) { | if (target) { | ||||
| if (type === 'click') { | if (type === 'click') { | ||||
| this.clickEvent(target, 'graph'); | |||||
| this.clickEvent(target); | |||||
| } else { | } else { | ||||
| this.dblclickEvent(target, 'graph'); | |||||
| this.dblclickEvent(target); | |||||
| } | } | ||||
| } | } | ||||
| }, | }, | ||||
| /** | /** | ||||
| * Initializing the click event | * Initializing the click event | ||||
| * @param {Object} target The target of the click event | * @param {Object} target The target of the click event | ||||
| * @param {String} pageKey Page identification mark | |||||
| */ | */ | ||||
| clickEvent(target, pageKey) { | |||||
| clickEvent(target) { | |||||
| const nodeId = target.id; | const nodeId = target.id; | ||||
| const nodeClass = target.classList.value; | const nodeClass = target.classList.value; | ||||
| setTimeout(() => { | setTimeout(() => { | ||||
| @@ -109,9 +110,9 @@ export default { | |||||
| this.clickScope = {}; | this.clickScope = {}; | ||||
| }, 1000); | }, 1000); | ||||
| this.selectedNode.name = nodeId; | this.selectedNode.name = nodeId; | ||||
| if (pageKey === 'graph') { | |||||
| if (this.pageKey === 'graph') { | |||||
| this.selectNode(false); | this.selectNode(false); | ||||
| } else if (pageKey === 'debugger') { | |||||
| } else if (this.pageKey === 'debugger') { | |||||
| this.selectNode(false, true); | this.selectNode(false, true); | ||||
| this.contextmenu.dom.style.display = 'none'; | this.contextmenu.dom.style.display = 'none'; | ||||
| } | } | ||||
| @@ -119,9 +120,8 @@ export default { | |||||
| /** | /** | ||||
| * Initializing the click event | * Initializing the click event | ||||
| * @param {Object} target The target of the click event | * @param {Object} target The target of the click event | ||||
| * @param {String} pageKey Page identification mark | |||||
| */ | */ | ||||
| dblclickEvent(target, pageKey) { | |||||
| dblclickEvent(target) { | |||||
| const nodeId = target.id; | const nodeId = target.id; | ||||
| const nodeClass = target.classList.value; | const nodeClass = target.classList.value; | ||||
| let name = nodeId; | let name = nodeId; | ||||
| @@ -157,7 +157,7 @@ export default { | |||||
| this.dealDoubleClick(name); | this.dealDoubleClick(name); | ||||
| } else if (this.clickScope.id) { | } else if (this.clickScope.id) { | ||||
| this.selectedNode.name = this.clickScope.id; | this.selectedNode.name = this.clickScope.id; | ||||
| if (pageKey === 'graph') { | |||||
| if (this.pageKey === 'graph') { | |||||
| this.selectNode(false); | this.selectNode(false); | ||||
| } | } | ||||
| } | } | ||||
| @@ -242,9 +242,8 @@ export default { | |||||
| }, | }, | ||||
| /** | /** | ||||
| * Initializing the graph zoom | * Initializing the graph zoom | ||||
| * @param {String} pageKey | |||||
| */ | */ | ||||
| initZooming(pageKey) { | |||||
| initZooming() { | |||||
| const minDistance = 100; | const minDistance = 100; | ||||
| const pointer = {start: {x: 0, y: 0}, end: {x: 0, y: 0}}; | const pointer = {start: {x: 0, y: 0}, end: {x: 0, y: 0}}; | ||||
| const zoom = d3 | const zoom = d3 | ||||
| @@ -253,7 +252,7 @@ export default { | |||||
| const event = currentEvent.sourceEvent; | const event = currentEvent.sourceEvent; | ||||
| pointer.start.x = event.x; | pointer.start.x = event.x; | ||||
| pointer.start.y = event.y; | pointer.start.y = event.y; | ||||
| if (pageKey === 'debugger') { | |||||
| if (this.pageKey === 'debugger') { | |||||
| this.contextmenu.dom.style.display = 'none'; | this.contextmenu.dom.style.display = 'none'; | ||||
| } | } | ||||
| }) | }) | ||||
| @@ -316,7 +315,7 @@ export default { | |||||
| `translate(${this.graph.transform.x},${this.graph.transform.y}) ` + | `translate(${this.graph.transform.x},${this.graph.transform.y}) ` + | ||||
| `scale(${this.graph.transform.k})`; | `scale(${this.graph.transform.k})`; | ||||
| this.graph.dom.setAttribute('transform', tempStr); | this.graph.dom.setAttribute('transform', tempStr); | ||||
| if (pageKey === 'graph') { | |||||
| if (this.pageKey === 'graph') { | |||||
| this.setInsideBoxData(); | this.setInsideBoxData(); | ||||
| } | } | ||||
| }); | }); | ||||
| @@ -136,7 +136,7 @@ export default { | |||||
| */ | */ | ||||
| collapseBtnClick() { | collapseBtnClick() { | ||||
| this.leftShow = !this.leftShow; | this.leftShow = !this.leftShow; | ||||
| setTimeout(this.initSvgSize, this.resizeDelay); | |||||
| this.initSvgSize(); | |||||
| }, | }, | ||||
| /** | /** | ||||
| * Step input validation | * Step input validation | ||||
| @@ -902,16 +902,17 @@ export default { | |||||
| }; | }; | ||||
| }, | }, | ||||
| components: {debuggerTensor, tree}, | components: {debuggerTensor, tree}, | ||||
| computed: {}, | |||||
| mounted() { | mounted() { | ||||
| document.title = `${this.$t('debugger.debugger')}-MindInsight`; | document.title = `${this.$t('debugger.debugger')}-MindInsight`; | ||||
| this.nodeTypes.label = this.$t('debugger.nodeType'); | this.nodeTypes.label = this.$t('debugger.nodeType'); | ||||
| this.pageKey = 'debugger'; | |||||
| if (this.trainId) { | if (this.trainId) { | ||||
| document.title = `${this.trainId}-${this.$t('debugger.debugger')}-MindInsight`; | document.title = `${this.trainId}-${this.$t('debugger.debugger')}-MindInsight`; | ||||
| this.retrieveAll(); | this.retrieveAll(); | ||||
| } else { | } else { | ||||
| this.getSession(); | this.getSession(); | ||||
| } | } | ||||
| window.addEventListener('resize', this.initSvgSize, false); | |||||
| }, | }, | ||||
| watch: { | watch: { | ||||
| 'metadata.state': { | 'metadata.state': { | ||||
| @@ -1232,7 +1233,7 @@ export default { | |||||
| this.svg.size.width / 2 / this.graph.size.width, | this.svg.size.width / 2 / this.graph.size.width, | ||||
| this.svg.size.height / 2 / this.graph.size.height | this.svg.size.height / 2 / this.graph.size.height | ||||
| ); | ); | ||||
| this.initZooming('debugger'); | |||||
| this.initZooming(); | |||||
| this.initContextMenu(); | this.initContextMenu(); | ||||
| if (this.selectedNode.name) { | if (this.selectedNode.name) { | ||||
| @@ -1786,14 +1787,20 @@ export default { | |||||
| }, | }, | ||||
| rightCollapse() { | rightCollapse() { | ||||
| this.collapseTable = !this.collapseTable; | this.collapseTable = !this.collapseTable; | ||||
| setTimeout(this.initSvgSize, this.resizeDelay); | |||||
| this.initSvgSize(); | |||||
| }, | }, | ||||
| initSvgSize() { | initSvgSize() { | ||||
| const svgRect = document.querySelector('#graph svg').getBoundingClientRect(); | |||||
| this.svg.size = {width: svgRect.width, height: svgRect.height, left: svgRect.left, top: svgRect.top}; | |||||
| if (this.resizeTimer) clearTimeout(this.resizeTimer); | |||||
| this.resizeTimer = setTimeout(() => { | |||||
| const svgRect = document.querySelector('#graph svg').getBoundingClientRect(); | |||||
| this.svg.size = {width: svgRect.width, height: svgRect.height, left: svgRect.left, top: svgRect.top}; | |||||
| this.resizeTimer = null; | |||||
| }, this.resizeDelay); | |||||
| }, | }, | ||||
| }, | }, | ||||
| destroyed() {}, | |||||
| destroyed() { | |||||
| window.removeEventListener('resize', this.initSvgSize); | |||||
| }, | |||||
| }; | }; | ||||
| </script> | </script> | ||||
| <style> | <style> | ||||
| @@ -575,7 +575,6 @@ export default { | |||||
| isIntoView: true, | isIntoView: true, | ||||
| }; | }; | ||||
| }, | }, | ||||
| computed: {}, | |||||
| watch: { | watch: { | ||||
| guide: { | guide: { | ||||
| handler(newVal) { | handler(newVal) { | ||||
| @@ -608,6 +607,7 @@ export default { | |||||
| window.localStorage.setItem('graphShowGuide', true); | window.localStorage.setItem('graphShowGuide', true); | ||||
| } | } | ||||
| this.pageKey = 'graph'; | |||||
| this.trainJobID = this.$route.query.train_id; | this.trainJobID = this.$route.query.train_id; | ||||
| this.language = window.localStorage.getItem('milang'); | this.language = window.localStorage.getItem('milang'); | ||||
| @@ -786,7 +786,7 @@ export default { | |||||
| this.loading.show = false; | this.loading.show = false; | ||||
| }); | }); | ||||
| this.initSmallMap(); | this.initSmallMap(); | ||||
| this.initZooming('graph'); | |||||
| this.initZooming(); | |||||
| if (this.selectedNode.name) { | if (this.selectedNode.name) { | ||||
| this.selectNode(true); | this.selectNode(true); | ||||
| } | } | ||||