blob: ae29894130517fd32713b1e76d9d1ced69b62dc6 [file] [log] [blame]
Steven Burrowsec1f45c2016-08-08 16:14:41 +01001/*
2 * Copyright 2016-present Open Networking Laboratory
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17/*
Steven Burrows1c5c8612016-10-05 13:45:13 -050018 ONOS GUI -- Topology View Module.
19 Module that contains the topology view variables
Steven Burrowsec1f45c2016-08-08 16:14:41 +010020 */
21
22(function () {
23 'use strict';
24
Steven Burrows1c5c8612016-10-05 13:45:13 -050025 // Injected Services
26 var flash;
27
28 // Internal State
29 var dimensions,
30 viewOptions = {
31 linkPortHighlighting: true
32 };
Steven Burrowsec1f45c2016-08-08 16:14:41 +010033
34 function newDim(_dimensions) {
35 dimensions = _dimensions;
36 }
37
38 function getDimensions() {
39 return dimensions;
40 }
41
Steven Burrows1c5c8612016-10-05 13:45:13 -050042 function togglePortHighlights(x) {
43 var kev = (x === 'keyev'),
44 on = kev ? !viewOptions.linkPortHighlighting : Boolean(x),
45 what = on ? 'Enable' : 'Disable';
46
47 viewOptions.linkPortHighlighting = on;
48 flash.flash(what + ' port highlighting');
49 return on;
50 }
51
52 function getPortHighlighting() {
53 return viewOptions.linkPortHighlighting;
54 }
55
Steven Burrowsec1f45c2016-08-08 16:14:41 +010056 angular.module('ovTopo2')
57 .factory('Topo2ViewService',
Steven Burrows1c5c8612016-10-05 13:45:13 -050058 ['FlashService',
59 function (_flash_) {
60
61 flash = _flash_;
62
Steven Burrowsec1f45c2016-08-08 16:14:41 +010063 return {
64 newDim: newDim,
Steven Burrows1c5c8612016-10-05 13:45:13 -050065 getDimensions: getDimensions,
66
67 togglePortHighlights: togglePortHighlights,
68 getPortHighlighting: getPortHighlighting
Steven Burrowsdfa52b02016-09-02 13:50:43 +010069 };
Steven Burrowsec1f45c2016-08-08 16:14:41 +010070 }
71 ]
72 );
73})();