blob: 9f07b5eef33d694221236018dc325542666f1e82 [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',
Bri Prebilic Cole4fab8af2015-01-15 16:40:47 -080040 'onosRemote',
Simon Huntef31fb22014-12-19 13:16:44 -080041 'onosMast'
42 ];
43
Simon Hunt6cc53692015-01-07 11:33:45 -080044 var $log;
Simon Huntef31fb22014-12-19 13:16:44 -080045
Simon Hunt6cc53692015-01-07 11:33:45 -080046 angular.module('onosApp', moduleDependencies)
Simon Huntef31fb22014-12-19 13:16:44 -080047
48 .controller('OnosCtrl', [
49 '$log', '$route', '$routeParams', '$location',
Simon Hunt6cc53692015-01-07 11:33:45 -080050 'KeyService', 'ThemeService', 'GlyphService',
Simon Huntef31fb22014-12-19 13:16:44 -080051
Simon Hunt6cc53692015-01-07 11:33:45 -080052 function (_$log_, $route, $routeParams, $location, ks, ts, gs) {
53 var self = this;
Simon Huntdc6362a2014-12-18 19:55:23 -080054
Simon Hunt6cc53692015-01-07 11:33:45 -080055 $log = _$log_;
Simon Huntef31fb22014-12-19 13:16:44 -080056 self.$route = $route;
57 self.$routeParams = $routeParams;
58 self.$location = $location;
Simon Huntdc6362a2014-12-18 19:55:23 -080059 self.version = '1.1.0';
60
Simon Hunt6cc53692015-01-07 11:33:45 -080061 // initialize services...
Yuta HIGUCHI4f39bcd2014-12-18 20:46:14 -080062 ts.init();
Simon Hunt420691a2014-12-16 20:16:28 -080063 ks.installOn(d3.select('body'));
Simon Hunt6cc53692015-01-07 11:33:45 -080064 gs.init();
Simon Huntdc6362a2014-12-18 19:55:23 -080065
66 $log.log('OnosCtrl has been created');
Simon Huntef31fb22014-12-19 13:16:44 -080067
68 $log.debug('route: ', self.$route);
69 $log.debug('routeParams: ', self.$routeParams);
70 $log.debug('location: ', self.$location);
71 }])
72
73 .config(['$routeProvider', function ($routeProvider) {
74 // TODO: figure out a way of handling contributed views...
75 $routeProvider
76 .when('/', {
77 controller: 'OvSampleCtrl',
78 controllerAs: 'ctrl',
79 templateUrl: 'view/sample/sample.html'
80 })
81 .when('/topo', {
82 controller: 'OvTopoCtrl',
83 controllerAs: 'ctrl',
84 templateUrl: 'view/topo/topo.html'
85 })
Bri Prebilic Cole7c92a3d2015-01-09 16:50:03 -080086 .when('/device', {
87 controller: 'OvDeviceCtrl',
88 controllerAs: 'ctrl',
89 templateUrl: 'view/device/device.html'
90 })
Simon Huntef31fb22014-12-19 13:16:44 -080091 .otherwise({
92 redirectTo: '/'
93 })
Simon Huntc2202d52014-12-16 13:30:15 -080094 }]);
95
96}());