Skip to content

Commit

Permalink
Merge pull request #653 from WeBankPartners/560_idc_resource_planning…
Browse files Browse the repository at this point in the history
…_graph_enhancement

#560 idc resource planning graph enhancement
  • Loading branch information
irvinezhao authored Jan 17, 2020
2 parents f65bd28 + 750d64f commit 8a859b9
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion cmdb-ui/src/pages/designing/resource-planning.vue
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,34 @@ export default {
const promiseArray = [getIdcImplementTreeByGuid(this.selectedIdcs), getAllZoneLinkGroupByIdc()]
const [idcData, links] = await Promise.all(promiseArray)
if (idcData.statusCode === 'OK' && links.statusCode === 'OK') {
this.idcData = idcData.data
this.idcData = []
let logicNetZone = {}
idcData.data.forEach(_ => {
if (!_.data.regional_data_center) {
let obj = {
ciTypeId: _.ciTypeId,
guid: _.guid,
data: _.data
}
if (_.children instanceof Array) {
obj.children = _.children.filter(zone => zone.ciTypeId !== _.ciTypeId)
}
this.idcData.push(obj)
} else if (_.data.regional_data_center && _.children instanceof Array) {
_.children.forEach(zone => {
logicNetZone[zone.guid] = zone
})
}
})
idcData.data.forEach(_ => {
if (!_.data.regional_data_center && _.children instanceof Array) {
_.children.forEach(zone => {
if (zone.children instanceof Array) {
zone.children = zone.children.filter(item => !!logicNetZone[item.guid])
}
})
}
})
let allZoneLinkObj = {}
links.data.forEach(_ => {
if (_.linkList instanceof Array) {
Expand Down Expand Up @@ -263,6 +290,7 @@ export default {
'digraph G{',
'rankdir=TB;nodesep=0.5;',
`Node[shape=box,fontsize=${fontSize},labelloc=t,penwidth=2];`,
'Edge[fontsize=6];',
`size="${width},${height}";`
]
data.forEach(idc => {
Expand Down

0 comments on commit 8a859b9

Please sign in to comment.