GUI -- Sketched out structure for multi-views; each with own controller, template html and css.
- routes currently hard-coded... some thought needed to handle views contributed at runtime.
Change-Id: Ied012744d74e46c5072143283364557f9485056c
diff --git a/web/gui/src/main/webapp/app/onos.js b/web/gui/src/main/webapp/app/onos.js
index 73af667..9769857 100644
--- a/web/gui/src/main/webapp/app/onos.js
+++ b/web/gui/src/main/webapp/app/onos.js
@@ -23,12 +23,38 @@
(function () {
'use strict';
- angular.module('onosApp', ['onosUtil', 'onosMast'])
- .controller('OnosCtrl', ['$log', 'KeyService', 'ThemeService',
- function (_$log_, ks, ts) {
+ var coreDependencies = [
+ 'ngRoute',
+ 'onosUtil',
+ 'onosMast'
+ ];
+
+ var viewDependencies = [
+ // TODO: inject view dependencies server side
+ // NOTE: 'ov' == 'Onos View'...
+ // {INJECTED-VIEW-MODULE-DEPENDENCIES}
+ 'ovSample',
+ 'ovTopo',
+ // NOTE: dummy element allows all previous entries to end with comma
+ '___dummy___'
+ ];
+
+ var dependencies = coreDependencies.concat(viewDependencies);
+ dependencies.pop(); // remove dummy
+
+ angular.module('onosApp', dependencies)
+
+ .controller('OnosCtrl', [
+ '$log', '$route', '$routeParams', '$location',
+ 'KeyService', 'ThemeService',
+
+ function (_$log_, $route, $routeParams, $location, ks, ts) {
var $log = _$log_,
self = this;
+ self.$route = $route;
+ self.$routeParams = $routeParams;
+ self.$location = $location;
self.version = '1.1.0';
// initialize onos (main app) controller here...
@@ -36,6 +62,28 @@
ks.installOn(d3.select('body'));
$log.log('OnosCtrl has been created');
+
+ $log.debug('route: ', self.$route);
+ $log.debug('routeParams: ', self.$routeParams);
+ $log.debug('location: ', self.$location);
+ }])
+
+ .config(['$routeProvider', function ($routeProvider) {
+ // TODO: figure out a way of handling contributed views...
+ $routeProvider
+ .when('/', {
+ controller: 'OvSampleCtrl',
+ controllerAs: 'ctrl',
+ templateUrl: 'view/sample/sample.html'
+ })
+ .when('/topo', {
+ controller: 'OvTopoCtrl',
+ controllerAs: 'ctrl',
+ templateUrl: 'view/topo/topo.html'
+ })
+ .otherwise({
+ redirectTo: '/'
+ })
}]);
}());