summaryrefslogtreecommitdiffstats
path: root/usecaseui-monitor/src/main/webapp/app/uui/fusion/scripts/controller
diff options
context:
space:
mode:
authorzhangab <zhanganbing@chinamobile.com>2018-05-14 15:15:04 +0800
committerzhangab <zhanganbing@chinamobile.com>2018-05-14 15:15:09 +0800
commita3591f7fe0b20bd010b6daa5054a919aab6aa5fa (patch)
tree302ddf4af275a5b7e72cc1f2e327244f215243c0 /usecaseui-monitor/src/main/webapp/app/uui/fusion/scripts/controller
parentea506ea4aa4306bd594d747455291b18a030aa4e (diff)
add service scaling function
Change-Id: If01f30e0a4105d27086f2ada555c94334c54e4ec Issue-ID: USECASEUI-115 Signed-off-by: zhangab <zhanganbing@chinamobile.com>
Diffstat (limited to 'usecaseui-monitor/src/main/webapp/app/uui/fusion/scripts/controller')
-rw-r--r--usecaseui-monitor/src/main/webapp/app/uui/fusion/scripts/controller/left-menuController.js10
-rw-r--r--usecaseui-monitor/src/main/webapp/app/uui/fusion/scripts/controller/topological.js182
-rw-r--r--usecaseui-monitor/src/main/webapp/app/uui/fusion/scripts/controller/topology-diagram.js116
3 files changed, 0 insertions, 308 deletions
diff --git a/usecaseui-monitor/src/main/webapp/app/uui/fusion/scripts/controller/left-menuController.js b/usecaseui-monitor/src/main/webapp/app/uui/fusion/scripts/controller/left-menuController.js
index 03e90bc2..93608a69 100644
--- a/usecaseui-monitor/src/main/webapp/app/uui/fusion/scripts/controller/left-menuController.js
+++ b/usecaseui-monitor/src/main/webapp/app/uui/fusion/scripts/controller/left-menuController.js
@@ -31,16 +31,6 @@ app.controller('cmCtrl', ['$scope', function ($scope) {
url: 'app/uui/fusion/scripts/view-models/performance.html',
nclass: 'fa fa-cog'
}
- /*{
- name: 'Topological diagram',
- url: 'app/uui/fusion/scripts/view-models/topology.html',
- nclass: 'fa fa-cog'
- },
- {
- name: 'Device topological',
- url: 'app/uui/fusion/scripts/view-models/device-topological.html',
- nclass: 'fa fa-cog'
- }*/
];
$scope.currentTab = currentTab;
$scope.$watch('currentTab', function (newValue, oldValue) {
diff --git a/usecaseui-monitor/src/main/webapp/app/uui/fusion/scripts/controller/topological.js b/usecaseui-monitor/src/main/webapp/app/uui/fusion/scripts/controller/topological.js
deleted file mode 100644
index a63e9640..00000000
--- a/usecaseui-monitor/src/main/webapp/app/uui/fusion/scripts/controller/topological.js
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- Copyright (C) 2017 CMCC, Inc. and others. All rights reserved.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
-app.controller('devicetopologicalCtrl', ['$scope', '$http', function ($scope, $http) {
- $(document).ready(function () {
- var canvas = document.getElementById('canvas');
- var height = canvas.clientHeight;
- var width = canvas.clientWidth;
- var stage = new JTopo.Stage(canvas);
- var scene = new JTopo.Scene();
- // scene.background = '/app/uui/fusion/images/bg.jpg';
-
-
- function node(x, y, img, name, zIndex) {
- var node = new JTopo.Node(name);
- node.setImage('/iui/usecaseui/app/uui/fusion/images/' + img, true);
- node.setLocation(x, y);
- node.zIndex = zIndex;
- scene.add(node);
- return node;
- }
-
-
- function newFoldLink(nodeA, nodeZ, text, direction) {
- var link = new JTopo.FoldLink(nodeA, nodeZ, text);
- link.direction = direction || 'horizontal';
- link.lineWidth = 1; // 线宽
- // link.bundleOffset = 10; // 折线拐角处的长度
- link.bundleGap = 10; // 线条之间的间隔
- line.zIndex = 8;
- scene.add(link);
- return link;
- }
-
-
- function line(startX, startY, endX, endY, name) {
- var start = new JTopo.Node();
- start.setLocation(startX, startY);
- var end = new JTopo.Node();
- end.setLocation(endX, endY);
- var line = new JTopo.Link(start, end);
- line.text = name;
- line.zIndex = 5;
- scene.add(line);
- return line;
- }
-
- var container = new JTopo.Container();
- container.borderRadius = 200;
- container.setBound(0, 0, 300, 300);
- container.dragble = false;
- container.background = '/iui/usecaseui/app/uui/fusion/images/cloud_r.png';
-
- var container2 = new JTopo.Container()
- container2.borderRadius = 200;
- container2.setBound(0, 0, 300, 300);
- container2.dragble = false;
- container2.background = '/iui/usecaseui/app/uui/fusion/images/cloud_r.png';
-
- var routerX = width / 2 - 40;
- var routerY = height / 2;
-
- var router1 = node(routerX - 80, routerY - 40, 'router-all.png', '');
- var router2 = node(routerX + 80, routerY - 40, 'router-all.png', '');
- scene.add(new JTopo.Link(router1, router2));
-
- var gateway1 = node(routerX - 200, routerY + 80, 'gateway-all.png', '', 10);
- newFoldLink(gateway1, router1);
- var gateway2 = node(routerX + 200, routerY + 80, 'gateway-all.png', '', 10);
- newFoldLink(gateway2, router2);
-
- var ctrl_line = line(routerX - 460, routerY + 40, routerX - 160, routerY + 40);
- var data_line = line(routerX - 460, routerY + 20, routerX - 160, routerY + 20);
- var ctrl_line_2 = line(routerX + 485, routerY + 20, routerX + 185, routerY + 20);
- var data_line_2 = line(routerX + 485, routerY + 40, routerX + 185, routerY + 40);
-
- var c1_vnf_1 = node(routerX - 400, routerY - 70, 'vnf-all.png', '', 6);
- var c1_vnf_2 = node(routerX - 350, routerY - 70, 'vnf-all.png', '', 6);
- var c1_vnf_3 = node(routerX - 300, routerY - 70, 'vnf-all.png', '', 6);
-
- var c2_vnf_1 = node(routerX + 300, routerY - 70, 'vnf-all.png', '', 6);
- var c2_vnf_2 = node(routerX + 350, routerY - 70, 'vnf-all.png', '', 6);
- var c2_vnf_3 = node(routerX + 400, routerY - 70, 'vnf-all.png', '', 6);
-
- var ctline_c1_vnf1 = node(routerX - 390, routerY + 50, 'map_data_point_blue.png', '');
- var daline_c1_vnf1 = node(routerX - 380, routerY + 30, 'map_data_point_blue.png', '');
- newFoldLink(c1_vnf_1, ctline_c1_vnf1);
- newFoldLink(c1_vnf_1, daline_c1_vnf1);
-
- var ctline_c1_vnf2 = node(routerX - 340, routerY + 50, 'map_data_point_blue.png', '');
- var daline_c1_vnf2 = node(routerX - 330, routerY + 30, 'map_data_point_blue.png', '');
- newFoldLink(c1_vnf_2, ctline_c1_vnf2);
- newFoldLink(c1_vnf_2, daline_c1_vnf2);
-
-
- var ctline_c1_vnf3 = node(routerX - 290, routerY + 50, 'map_data_point_blue.png', '');
- var daline_c1_vnf3 = node(routerX - 280, routerY + 30, 'map_data_point_blue.png', '');
- newFoldLink(c1_vnf_3, ctline_c1_vnf3);
- newFoldLink(c1_vnf_3, daline_c1_vnf3);
-
-
- var ctline_gateway1 = node(routerX - 180, routerY + 50, 'map_data_point_blue.png', '');
- var daline_gateway1 = node(routerX - 190, routerY + 30, 'map_data_point_blue.png', '');
- newFoldLink(gateway1, ctline_gateway1);
- newFoldLink(gateway1, daline_gateway1);
-
- container.add(c1_vnf_1);
- container.add(c1_vnf_2);
- container.add(c1_vnf_3);
- container.add(gateway1);
- container.add(ctline_c1_vnf1);
- container.add(daline_c1_vnf1);
- container.add(ctline_c1_vnf2);
- container.add(daline_c1_vnf2);
- container.add(ctline_c1_vnf3);
- container.add(daline_c1_vnf3);
- container.add(ctline_gateway1);
- container.add(daline_gateway1);
- container.add(ctrl_line.nodeA);
- container.add(ctrl_line.nodeZ);
- container.add(data_line.nodeA);
- container.add(data_line.nodeZ);
-
- scene.add(container);
-
-
- var ctline_c2_vnf1 = node(routerX + 320, routerY + 30, 'map_data_point_blue.png', '');
- var daline_c2_vnf1 = node(routerX + 310, routerY + 50, 'map_data_point_blue.png', '');
- newFoldLink(c2_vnf_1, ctline_c2_vnf1);
- newFoldLink(c2_vnf_1, daline_c2_vnf1);
-
- var ctline_c2_vnf2 = node(routerX + 370, routerY + 30, 'map_data_point_blue.png', '');
- var daline_c2_vnf2 = node(routerX + 360, routerY + 50, 'map_data_point_blue.png', '');
- newFoldLink(c2_vnf_2, ctline_c2_vnf2);
- newFoldLink(c2_vnf_2, daline_c2_vnf2);
-
-
- var ctline_c2_vnf3 = node(routerX + 420, routerY + 30, 'map_data_point_blue.png', '');
- var daline_c2_vnf3 = node(routerX + 410, routerY + 50, 'map_data_point_blue.png', '');
- newFoldLink(c2_vnf_3, ctline_c2_vnf3);
- newFoldLink(c2_vnf_3, daline_c2_vnf3);
-
-
- var ctline_gateway2 = node(routerX + 240, routerY + 30, 'map_data_point_blue.png', '');
- var daline_gateway2 = node(routerX + 230, routerY + 50, 'map_data_point_blue.png', '');
- newFoldLink(gateway2, ctline_gateway2);
- newFoldLink(gateway2, daline_gateway2);
-
- container2.add(c2_vnf_1);
- container2.add(c2_vnf_2);
- container2.add(c2_vnf_3);
- container2.add(gateway2);
- container2.add(ctline_c2_vnf1);
- container2.add(daline_c2_vnf1);
- container2.add(ctline_c2_vnf2);
- container2.add(daline_c2_vnf2);
- container2.add(ctline_c2_vnf3);
- container2.add(daline_c2_vnf3);
- container2.add(ctline_gateway2);
- container2.add(daline_gateway2);
- container2.add(ctrl_line_2.nodeA);
- container2.add(ctrl_line_2.nodeZ);
- container2.add(data_line_2.nodeA);
- container2.add(data_line_2.nodeZ);
-
- scene.add(container2);
- stage.add(scene);
- });
-}]) \ No newline at end of file
diff --git a/usecaseui-monitor/src/main/webapp/app/uui/fusion/scripts/controller/topology-diagram.js b/usecaseui-monitor/src/main/webapp/app/uui/fusion/scripts/controller/topology-diagram.js
deleted file mode 100644
index d9d5078a..00000000
--- a/usecaseui-monitor/src/main/webapp/app/uui/fusion/scripts/controller/topology-diagram.js
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- Copyright (C) 2017 CMCC, Inc. and others. All rights reserved.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-app.controller('topologyCtrl', ['$scope', '$http', '$location', 'drawTree', '$timeout', function ($scope, $http, $location, drawTree, $timeout) {
-
- // 获取拓补图盒子
- var myChart = echarts.init(document.getElementById("tree-container"));
- // 请求数据,渲染选项标签
- $http({
- method: 'GET',
- url: global_url + '/topology/services'
- }).then(function successCallback(response) {
- $scope.serviceType = response.data;
- $scope.selectedName = response.data[0];
- }, function errorCallback(error) {
-
- }).then(function () {
- // 默认渲染第一条拓补图
- $http({
- method: 'GET',
- url: global_url + '/topology/' + $scope.selectedName.ServiceName,
- }).then(function successCallback(response) {
- drawTree.treeChart(false, response.data, myChart);
-
- }, function errorCallback(error) {
-
- })
- });
-
- // 点击切换拓补图
- $scope.selectedNameChanged = function (selectedName) {
- $http({
- method: 'GET',
- url: global_url + '/topology/' + selectedName.ServiceName,
- }).then(function successCallback(response) {
- drawTree.treeChart(true, response.data, myChart);
- }, function errorCallback(error) {
-
- })
- };
-
-}]).factory('drawTree', function () {
- function treeChart(isChange, data, myChart) {
-
- if (isChange) {
- myChart.clear(); //如果切换就清空下
- }
- data.symbol = "image://./app/uui/fusion/images/E2E.png";
- for (k in data.children) {
- data.children[k].symbol = "image://./app/uui/fusion/images/NS.png";
- if (data.children[k].children) {
- for (i in data.children[k].children) {
- if (data.children[k].children[i].isAlarm) {
- data.children[k].children[i].symbol = "image://./app/uui/fusion/images/vnf-alarm.png";
- } else {
- data.children[k].children[i].symbol = "image://./app/uui/fusion/images/vnf-1.png";
- }
- }
- }
- }
-
- var option = {
- tooltip: {
- trigger: 'item',
- triggerOn: 'mousemove'
- },
- series: [{
- type: 'tree',
- top: '20%',
- left: '7%',
- bottom: '20%',
- right: '10%',
- symbolSize: 50,
- orient: 'vertical',
- label: {
- normal: {
- position: 'bottom',
- fontSize: 16,
- color: '#000'
- }
- },
- leaves: {
- label: {
- normal: {
- position: 'right',
- verticalAlign: 'middle',
- align: 'left'
- }
- }
- },
- lineStyle: {
- width: 3,
- curveness: 0,
- },
- data: [data],
- expandAndCollapse: true
- }]
- }
- myChart.setOption(option, true);
- }
- return {
- treeChart: treeChart
- }
-}) \ No newline at end of file