blob: f8d816c565fa6950987efc079d51964783293e48 [file] [log] [blame]
Simon Hunt1002cd82015-04-23 14:44:03 -07001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2015-present Open Networking Laboratory
Simon Hunt1002cd82015-04-23 14:44:03 -07003 *
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/*
18 ONOS GUI -- Flow View Module
19 */
20
21(function () {
22 'use strict';
23
Bri Prebilic Colecdc188d2015-04-24 16:40:11 -070024 // injected references
Bri Prebilic Cole9b1fb9a2015-07-01 13:57:11 -070025 var $log, $scope, $location, fs, tbs, ns;
Bri Prebilic Colecdc188d2015-04-24 16:40:11 -070026
Simon Hunt1002cd82015-04-23 14:44:03 -070027 angular.module('ovFlow', [])
28 .controller('OvFlowCtrl',
Bri Prebilic Cole3d4d01c2015-04-30 13:48:36 -070029 ['$log', '$scope', '$location',
Bri Prebilic Cole9b1fb9a2015-07-01 13:57:11 -070030 'FnService', 'TableBuilderService', 'NavService',
Simon Hunt1002cd82015-04-23 14:44:03 -070031
Bri Prebilic Cole9b1fb9a2015-07-01 13:57:11 -070032 function (_$log_, _$scope_, _$location_, _fs_, _tbs_, _ns_) {
Bri Prebilic Colee568ead2015-05-01 09:51:28 -070033 var params;
Bri Prebilic Colecdc188d2015-04-24 16:40:11 -070034 $log = _$log_;
35 $scope = _$scope_;
36 $location = _$location_;
37 fs = _fs_;
38 tbs = _tbs_;
Bri Prebilic Cole9b1fb9a2015-07-01 13:57:11 -070039 ns = _ns_;
Simon Hunt20856ec2015-11-16 15:58:14 -080040 $scope.deviceTip = 'Show device table';
Bri Prebilic Coleeef67ae2015-07-01 16:26:59 -070041 $scope.portTip = 'Show port view for this device';
42 $scope.groupTip = 'Show group view for this device';
Jian Li1f544732015-12-30 23:36:37 -080043 $scope.meterTip = 'Show meter view for selected device';
Bri Prebilic Colecdc188d2015-04-24 16:40:11 -070044
45 params = $location.search();
46 if (params.hasOwnProperty('devId')) {
Bri Prebilic Colee568ead2015-05-01 09:51:28 -070047 $scope.devId = params['devId'];
Bri Prebilic Colecdc188d2015-04-24 16:40:11 -070048 }
49
50 tbs.buildTable({
Bri Prebilic Colecdc188d2015-04-24 16:40:11 -070051 scope: $scope,
52 tag: 'flow',
53 query: params
54 });
Bri Prebilic Cole3d4d01c2015-04-30 13:48:36 -070055
Bri Prebilic Cole9b1fb9a2015-07-01 13:57:11 -070056 $scope.nav = function (path) {
57 if ($scope.devId) {
58 ns.navTo(path, { devId: $scope.devId });
59 }
60 };
61
Simon Hunt1002cd82015-04-23 14:44:03 -070062 $log.log('OvFlowCtrl has been created');
63 }]);
64}());