blob: f9c6cd76297a29f0c7d028333ed557825af51752 [file] [log] [blame]
Bri Prebilic Coleff3dc672015-05-06 12:59:38 -07001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2015-present Open Networking Laboratory
Bri Prebilic Coleff3dc672015-05-06 12:59:38 -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 -- Group View Module
19 */
20
21(function () {
22 'use strict';
23
24 // injected references
Bri Prebilic Cole9b1fb9a2015-07-01 13:57:11 -070025 var $log, $scope, $location, fs, tbs, ns;
Bri Prebilic Coleff3dc672015-05-06 12:59:38 -070026
27 angular.module('ovGroup', [])
28 .controller('OvGroupCtrl',
Bri Prebilic Cole98142262015-05-28 17:14:47 -070029 ['$log', '$scope', '$location', '$sce',
Bri Prebilic Cole9b1fb9a2015-07-01 13:57:11 -070030 'FnService', 'TableBuilderService', 'NavService',
Bri Prebilic Coleff3dc672015-05-06 12:59:38 -070031
Bri Prebilic Cole9b1fb9a2015-07-01 13:57:11 -070032 function (_$log_, _$scope_, _$location_, $sce, _fs_, _tbs_, _ns_) {
Bri Prebilic Coleff3dc672015-05-06 12:59:38 -070033 var params;
34 $log = _$log_;
35 $scope = _$scope_;
36 $location = _$location_;
37 fs = _fs_;
Bri Prebilic Coleff3dc672015-05-06 12:59:38 -070038 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.flowTip = 'Show flow view for this device';
42 $scope.portTip = 'Show port view for this device';
Jian Li1f544732015-12-30 23:36:37 -080043 $scope.meterTip = 'Show meter view for selected device';
Kavitha Alagesanc0874532016-08-23 16:22:13 -070044 $scope.briefTip = 'Switch to brief view';
45 $scope.detailTip = 'Switch to detailed view';
46 $scope.brief = true;
Bri Prebilic Coleff3dc672015-05-06 12:59:38 -070047 params = $location.search();
48 if (params.hasOwnProperty('devId')) {
49 $scope.devId = params['devId'];
50 }
51
52 tbs.buildTable({
53 scope: $scope,
54 tag: 'group',
55 query: params
56 });
57
Bri Prebilic Cole76f632c2015-05-28 17:06:02 -070058 $scope.$watch('tableData', function () {
59 if (!fs.isEmptyObject($scope.tableData)) {
60 $scope.tableData.forEach(function (group) {
61 group.buckets = $sce.trustAsHtml(group.buckets);
62 });
63 }
64 });
65
Bri Prebilic Cole9b1fb9a2015-07-01 13:57:11 -070066 $scope.nav = function (path) {
67 if ($scope.devId) {
68 ns.navTo(path, { devId: $scope.devId });
69 }
70 };
Kavitha Alagesanc0874532016-08-23 16:22:13 -070071 $scope.briefToggle = function () {
72 $scope.brief = !$scope.brief;
73 };
Bri Prebilic Cole9b1fb9a2015-07-01 13:57:11 -070074
Bri Prebilic Coleff3dc672015-05-06 12:59:38 -070075 $log.log('OvGroupCtrl has been created');
76 }]);
77}());