blob: 8f4a6180dca0f52016d55ff383440161a52a5269 [file] [log] [blame]
Simon Huntc2202d52014-12-16 13:30:15 -08001/*
Simon Hunt8ead3a22015-01-06 11:00:15 -08002 * Copyright 2014,2015 Open Networking Laboratory
Simon Huntc2202d52014-12-16 13:30:15 -08003 *
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/*
Simon Huntdc6362a2014-12-18 19:55:23 -080018 ONOS GUI -- Main Application Module
Simon Huntc2202d52014-12-16 13:30:15 -080019
20 @author Simon Hunt
21 */
Simon Hunt1eecfa22014-12-16 14:46:29 -080022
Simon Huntc2202d52014-12-16 13:30:15 -080023(function () {
24 'use strict';
25
Simon Hunt6cc53692015-01-07 11:33:45 -080026 var moduleDependencies = [
27 // view modules...
28 // TODO: inject view dependencies server side
29 // {INJECTED-VIEW-MODULE-DEPENDENCIES}
30 // NOTE: 'ov' == 'Onos View'...
31 'ovSample',
32 'ovTopo',
Bri Prebilic Cole7c92a3d2015-01-09 16:50:03 -080033 'ovDevice',
Simon Hunt6cc53692015-01-07 11:33:45 -080034 // (end of view modules)
35
36 // core modules...
Simon Huntef31fb22014-12-19 13:16:44 -080037 'ngRoute',
38 'onosUtil',
Simon Hunt6cc53692015-01-07 11:33:45 -080039 'onosSvg',
Simon Huntef31fb22014-12-19 13:16:44 -080040 'onosMast'
41 ];
42
Simon Hunt6cc53692015-01-07 11:33:45 -080043 var $log;
Simon Huntef31fb22014-12-19 13:16:44 -080044
Simon Hunt6cc53692015-01-07 11:33:45 -080045 angular.module('onosApp', moduleDependencies)
Simon Huntef31fb22014-12-19 13:16:44 -080046
47 .controller('OnosCtrl', [
48 '$log', '$route', '$routeParams', '$location',
Simon Hunt6cc53692015-01-07 11:33:45 -080049 'KeyService', 'ThemeService', 'GlyphService',
Simon Huntef31fb22014-12-19 13:16:44 -080050
Simon Hunt6cc53692015-01-07 11:33:45 -080051 function (_$log_, $route, $routeParams, $location, ks, ts, gs) {
52 var self = this;
Simon Huntdc6362a2014-12-18 19:55:23 -080053
Simon Hunt6cc53692015-01-07 11:33:45 -080054 $log = _$log_;
Simon Huntef31fb22014-12-19 13:16:44 -080055 self.$route = $route;
56 self.$routeParams = $routeParams;
57 self.$location = $location;
Simon Huntdc6362a2014-12-18 19:55:23 -080058 self.version = '1.1.0';
59
Simon Hunt6cc53692015-01-07 11:33:45 -080060 // initialize services...
Yuta HIGUCHI4f39bcd2014-12-18 20:46:14 -080061 ts.init();
Simon Hunt420691a2014-12-16 20:16:28 -080062 ks.installOn(d3.select('body'));
Simon Hunt6cc53692015-01-07 11:33:45 -080063 gs.init();
Simon Huntdc6362a2014-12-18 19:55:23 -080064
65 $log.log('OnosCtrl has been created');
Simon Huntef31fb22014-12-19 13:16:44 -080066
67 $log.debug('route: ', self.$route);
68 $log.debug('routeParams: ', self.$routeParams);
69 $log.debug('location: ', self.$location);
70 }])
71
72 .config(['$routeProvider', function ($routeProvider) {
73 // TODO: figure out a way of handling contributed views...
74 $routeProvider
75 .when('/', {
76 controller: 'OvSampleCtrl',
77 controllerAs: 'ctrl',
78 templateUrl: 'view/sample/sample.html'
79 })
80 .when('/topo', {
81 controller: 'OvTopoCtrl',
82 controllerAs: 'ctrl',
83 templateUrl: 'view/topo/topo.html'
84 })
Bri Prebilic Cole7c92a3d2015-01-09 16:50:03 -080085 .when('/device', {
86 controller: 'OvDeviceCtrl',
87 controllerAs: 'ctrl',
88 templateUrl: 'view/device/device.html'
89 })
Simon Huntef31fb22014-12-19 13:16:44 -080090 .otherwise({
91 redirectTo: '/'
92 })
Simon Huntc2202d52014-12-16 13:30:15 -080093 }]);
94
95}());