diff --git a/nezha-fronted/package-lock.json b/nezha-fronted/package-lock.json index e2cb255e5..95ff7b88d 100644 --- a/nezha-fronted/package-lock.json +++ b/nezha-fronted/package-lock.json @@ -4066,6 +4066,20 @@ "d3-timer": "2", "d3-transition": "2", "d3-zoom": "2" + }, + "dependencies": { + "d3-zoom": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/d3-zoom/-/d3-zoom-2.0.0.tgz", + "integrity": "sha512-fFg7aoaEm9/jf+qfstak0IYpnesZLiMX6GZvXtUSdv8RH2o4E2qeelgdU09eKS6wGuiGMfcnMI0nTIqWzRHGpw==", + "requires": { + "d3-dispatch": "1 - 2", + "d3-drag": "2", + "d3-interpolate": "1 - 2", + "d3-selection": "2", + "d3-transition": "2" + } + } } }, "d3-array": { @@ -4288,15 +4302,15 @@ } }, "d3-zoom": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/d3-zoom/-/d3-zoom-2.0.0.tgz", - "integrity": "sha512-fFg7aoaEm9/jf+qfstak0IYpnesZLiMX6GZvXtUSdv8RH2o4E2qeelgdU09eKS6wGuiGMfcnMI0nTIqWzRHGpw==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/d3-zoom/-/d3-zoom-3.0.0.tgz", + "integrity": "sha512-b8AmV3kfQaqWAuacbPuNbL6vahnOJflOhexLzMMNLga62+/nh0JzvJ0aO/5a5MVgUFGS7Hu1P9P03o3fJkDCyw==", "requires": { - "d3-dispatch": "1 - 2", - "d3-drag": "2", - "d3-interpolate": "1 - 2", - "d3-selection": "2", - "d3-transition": "2" + "d3-dispatch": "1 - 3", + "d3-drag": "2 - 3", + "d3-interpolate": "1 - 3", + "d3-selection": "2 - 3", + "d3-transition": "2 - 3" } }, "dashdash": { diff --git a/nezha-fronted/package.json b/nezha-fronted/package.json index 830601601..d7878bb3b 100644 --- a/nezha-fronted/package.json +++ b/nezha-fronted/package.json @@ -26,6 +26,7 @@ "cytoscape": "^3.15.2", "d3": "^6.7.0", "d3-hexbin": "^0.2.2", + "d3-zoom": "^3.0.0", "echarts": "^5.2.2", "element-ui": "^2.15.3", "file-saver": "^2.0.2", diff --git a/nezha-fronted/src/components/chart/chart.vue b/nezha-fronted/src/components/chart/chart.vue index c7e918173..54ba83ac2 100644 --- a/nezha-fronted/src/components/chart/chart.vue +++ b/nezha-fronted/src/components/chart/chart.vue @@ -172,6 +172,15 @@ :is-fullscreen="isFullscreen" @chartIsNoData="chartIsNoData" > + @@ -198,7 +207,8 @@ import chartUrl from './chart/chartUrl' import chartValue from './chart/chartValue' import chartHexagonD3 from './chart/chartHexagonD3' import chartMap from './chart/chartMap' -import { getOption, isTimeSeries, isHexagon, isUrl, isText, isChartPie, isChartBar, isTreemap, isLog, isStat, isDiagram, isGroup, isAutotopology, isMap, isAssetInfo, isEndpointInfo, isTable, isGauge, isClock } from './chart/tools' +import chartTopology from './chart/chartTopology' +import { getOption, isTimeSeries, isHexagon, isUrl, isText, isChartPie, isChartBar, isTreemap, isLog, isStat, isDiagram, isGroup, isAutotopology, isMap, isAssetInfo, isEndpointInfo, isTable, isGauge, isClock, isTopology } from './chart/tools' import lodash from 'lodash' export default { @@ -224,7 +234,8 @@ export default { chartUrl, chartValue, chartHexagonD3, - chartMap + chartMap, + chartTopology }, props: { chartInfo: Object, @@ -283,6 +294,7 @@ export default { isTable, isGauge, isClock, + isTopology, chartIsNoData (flag) { this.chartChildrenData = flag }, diff --git a/nezha-fronted/src/components/chart/chart/chartTopology.vue b/nezha-fronted/src/components/chart/chart/chartTopology.vue new file mode 100644 index 000000000..cd4789f17 --- /dev/null +++ b/nezha-fronted/src/components/chart/chart/chartTopology.vue @@ -0,0 +1,287 @@ + + + + + diff --git a/nezha-fronted/src/components/chart/chart/options/graph.js b/nezha-fronted/src/components/chart/chart/options/graph.js new file mode 100644 index 000000000..47f3af027 --- /dev/null +++ b/nezha-fronted/src/components/chart/chart/options/graph.js @@ -0,0 +1,1190 @@ +//$Id$ + +/* This file contains source for d3 map */ + +var view = (function() { + var initializeView = function (baseCIName) { + if(attributes.assetDetailsTab || attributes.iframe) { + jQuery(".svgbdy").css("padding-top", 0); //no i18n + } + if(attributes.iframe) { + jQuery('#zoom-slider').css("height", "80px"); //no i18n + } + if(attributes.assetDetailsTab) { + jQuery("body").removeClass("svgbdy") + } + if(attributes.adminDetailsTab){ + jQuery("body").css("overflow", "auto"); //NO I18N + } + if(attributes.editable != undefined && attributes.editable == false) { + jQuery("#save").remove(); + } + if(!attributes.viewId) { + jQuery("#saved-view-header").hide(); + if(!attributes.newView) { + jQuery("#ciNameLabel").text(baseCIName); + jQuery("#savethisviewLabel").remove(); + jQuery("#saveviewbtn").text(getMessageForKey("ae.cmdb.businessview.save.title")); //no i18n + } + } + else { + jQuery("#ciNameLabel").remove(); // set ci name in ui + jQuery("#new-view-header").remove(); + jQuery("#saved-view-header").show(); + } + } + + var showProgressIndicator = function() { + invokeProgressIndicator(null, 'sdp.common.loading', 'progress', null, false, 200, 200); // no i18n + } + + var removeProgressIndicator = function () { + jQuery('[id^=_DIALOG_LAYER]').remove(); + } + + return { + initializeView: initializeView, + showProgressIndicator: showProgressIndicator, + removeProgressIndicator: removeProgressIndicator + }; +})(); + +var header = (function() { + var buildViewDropdown = function (data, currentViewId) { + var dropdown = jQuery("#viewsDropDown"); + dropdown.empty(); + if(data.length != 0) { + jQuery.each(data, function() { + var viewNameDecoded = this.name; + viewNameDecoded = viewNameDecoded.replace(/\+/g, '%20'); + viewNameDecoded = decodeURIComponent(viewNameDecoded); + if(viewNameDecoded.length > 25) { + dropdown.append(jQuery("