blob: 2941f17343cf6a5f380b7b3478594af0b30c5f7f [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',
33 // (end of view modules)
34
35 // core modules...
Simon Huntef31fb22014-12-19 13:16:44 -080036 'ngRoute',
37 'onosUtil',
Simon Hunt6cc53692015-01-07 11:33:45 -080038 'onosSvg',
Simon Huntef31fb22014-12-19 13:16:44 -080039 'onosMast'
40 ];
41
Simon Hunt6cc53692015-01-07 11:33:45 -080042 var $log;
Simon Huntef31fb22014-12-19 13:16:44 -080043
Simon Hunt6cc53692015-01-07 11:33:45 -080044 angular.module('onosApp', moduleDependencies)
Simon Huntef31fb22014-12-19 13:16:44 -080045
46 .controller('OnosCtrl', [
47 '$log', '$route', '$routeParams', '$location',
Simon Hunt6cc53692015-01-07 11:33:45 -080048 'KeyService', 'ThemeService', 'GlyphService',
Simon Huntef31fb22014-12-19 13:16:44 -080049
Simon Hunt6cc53692015-01-07 11:33:45 -080050 function (_$log_, $route, $routeParams, $location, ks, ts, gs) {
51 var self = this;
Simon Huntdc6362a2014-12-18 19:55:23 -080052
Simon Hunt6cc53692015-01-07 11:33:45 -080053 $log = _$log_;
Simon Huntef31fb22014-12-19 13:16:44 -080054 self.$route = $route;
55 self.$routeParams = $routeParams;
56 self.$location = $location;
Simon Huntdc6362a2014-12-18 19:55:23 -080057 self.version = '1.1.0';
58
Simon Hunt6cc53692015-01-07 11:33:45 -080059 // initialize services...
Yuta HIGUCHI4f39bcd2014-12-18 20:46:14 -080060 ts.init();
Simon Hunt420691a2014-12-16 20:16:28 -080061 ks.installOn(d3.select('body'));
Simon Hunt6cc53692015-01-07 11:33:45 -080062 gs.init();
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}());