blob: cad9cab91be16e58ae3a83897793575bfb39b2f5 [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 Huntef31fb22014-12-19 13:16:44 -080026 var coreDependencies = [
27 'ngRoute',
28 'onosUtil',
29 'onosMast'
30 ];
31
32 var viewDependencies = [
33 // TODO: inject view dependencies server side
34 // NOTE: 'ov' == 'Onos View'...
35 // {INJECTED-VIEW-MODULE-DEPENDENCIES}
36 'ovSample',
37 'ovTopo',
38 // NOTE: dummy element allows all previous entries to end with comma
39 '___dummy___'
40 ];
41
42 var dependencies = coreDependencies.concat(viewDependencies);
43 dependencies.pop(); // remove dummy
44
45 angular.module('onosApp', dependencies)
46
47 .controller('OnosCtrl', [
48 '$log', '$route', '$routeParams', '$location',
49 'KeyService', 'ThemeService',
50
51 function (_$log_, $route, $routeParams, $location, ks, ts) {
Simon Huntdc6362a2014-12-18 19:55:23 -080052 var $log = _$log_,
53 self = this;
54
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
60 // initialize onos (main app) controller here...
Yuta HIGUCHI4f39bcd2014-12-18 20:46:14 -080061 ts.init();
Simon Hunt420691a2014-12-16 20:16:28 -080062 ks.installOn(d3.select('body'));
Simon Huntdc6362a2014-12-18 19:55:23 -080063
64 $log.log('OnosCtrl has been created');
Simon Huntef31fb22014-12-19 13:16:44 -080065
66 $log.debug('route: ', self.$route);
67 $log.debug('routeParams: ', self.$routeParams);
68 $log.debug('location: ', self.$location);
69 }])
70
71 .config(['$routeProvider', function ($routeProvider) {
72 // TODO: figure out a way of handling contributed views...
73 $routeProvider
74 .when('/', {
75 controller: 'OvSampleCtrl',
76 controllerAs: 'ctrl',
77 templateUrl: 'view/sample/sample.html'
78 })
79 .when('/topo', {
80 controller: 'OvTopoCtrl',
81 controllerAs: 'ctrl',
82 templateUrl: 'view/topo/topo.html'
83 })
84 .otherwise({
85 redirectTo: '/'
86 })
Simon Huntc2202d52014-12-16 13:30:15 -080087 }]);
88
89}());