Simon Hunt | c2202d5 | 2014-12-16 13:30:15 -0800 | [diff] [blame] | 1 | /* |
Simon Hunt | 8ead3a2 | 2015-01-06 11:00:15 -0800 | [diff] [blame] | 2 | * Copyright 2014,2015 Open Networking Laboratory |
Simon Hunt | c2202d5 | 2014-12-16 13:30:15 -0800 | [diff] [blame] | 3 | * |
| 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 Hunt | dc6362a | 2014-12-18 19:55:23 -0800 | [diff] [blame] | 18 | ONOS GUI -- Main Application Module |
Simon Hunt | c2202d5 | 2014-12-16 13:30:15 -0800 | [diff] [blame] | 19 | |
| 20 | @author Simon Hunt |
| 21 | */ |
Simon Hunt | 1eecfa2 | 2014-12-16 14:46:29 -0800 | [diff] [blame] | 22 | |
Simon Hunt | c2202d5 | 2014-12-16 13:30:15 -0800 | [diff] [blame] | 23 | (function () { |
| 24 | 'use strict'; |
| 25 | |
Simon Hunt | ef31fb2 | 2014-12-19 13:16:44 -0800 | [diff] [blame] | 26 | 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 Hunt | dc6362a | 2014-12-18 19:55:23 -0800 | [diff] [blame] | 52 | var $log = _$log_, |
| 53 | self = this; |
| 54 | |
Simon Hunt | ef31fb2 | 2014-12-19 13:16:44 -0800 | [diff] [blame] | 55 | self.$route = $route; |
| 56 | self.$routeParams = $routeParams; |
| 57 | self.$location = $location; |
Simon Hunt | dc6362a | 2014-12-18 19:55:23 -0800 | [diff] [blame] | 58 | self.version = '1.1.0'; |
| 59 | |
| 60 | // initialize onos (main app) controller here... |
Yuta HIGUCHI | 4f39bcd | 2014-12-18 20:46:14 -0800 | [diff] [blame] | 61 | ts.init(); |
Simon Hunt | 420691a | 2014-12-16 20:16:28 -0800 | [diff] [blame] | 62 | ks.installOn(d3.select('body')); |
Simon Hunt | dc6362a | 2014-12-18 19:55:23 -0800 | [diff] [blame] | 63 | |
| 64 | $log.log('OnosCtrl has been created'); |
Simon Hunt | ef31fb2 | 2014-12-19 13:16:44 -0800 | [diff] [blame] | 65 | |
| 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 Hunt | c2202d5 | 2014-12-16 13:30:15 -0800 | [diff] [blame] | 87 | }]); |
| 88 | |
| 89 | }()); |