blob: 0b4d853a2c4a0c2a1e3ed6c7612c6cbe7c05fb01 [file] [log] [blame]
Matteo Scandolo4eb4ccb2016-01-26 11:02:16 -08001/*
2 * Copyright 2015 Open Networking Laboratory
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(function () {
Matteo Scandolo9fb53f72016-01-26 11:34:15 -080018 'use strict';
Matteo Scandolo4eb4ccb2016-01-26 11:02:16 -080019
Matteo Scandolo9fb53f72016-01-26 11:34:15 -080020 var modules = [
21 'ngRoute',
22 'ngResource',
23 'ngAnimate',
Matteo Scandolo61bea662016-01-26 17:21:39 -080024 'cordRest',
Matteo Scandolo9fb53f72016-01-26 11:34:15 -080025 'cordMast',
26 'cordFoot',
27 'cordNav',
28 'cordLogin',
29 'cordHome',
30 'cordUser',
31 'cordBundle'
Matteo Scandoloc6036502016-01-26 15:17:10 -080032 ];
Matteo Scandolo4eb4ccb2016-01-26 11:02:16 -080033
Matteo Scandoloc6036502016-01-26 15:17:10 -080034 angular.module('cordGui', modules)
Matteo Scandolo9fb53f72016-01-26 11:34:15 -080035 .config(['$routeProvider', function ($routeProvider) {
36 $routeProvider
37 .when('/login', {
38 controller: 'CordLoginCtrl',
39 controllerAs: 'ctrl',
40 templateUrl: 'app/view/login/login.html'
41 })
42 .when('/home', {
43 controller: 'CordHomeCtrl',
44 controllerAs: 'ctrl',
45 templateUrl: 'app/view/home/home.html'
46 })
47 .when('/user', {
48 controller: 'CordUserCtrl',
49 controllerAs: 'ctrl',
50 templateUrl: 'app/view/user/user.html'
51 })
52 .when('/bundle', {
53 controller: 'CordBundleCtrl',
54 controllerAs: 'ctrl',
55 templateUrl: 'app/view/bundle/bundle.html'
56 })
57 .otherwise({
58 redirectTo: '/login'
59 });
60 }])
Matteo Scandolo61bea662016-01-26 17:21:39 -080061 .controller('CordCtrl', ['$scope', '$location', 'cordConfig',
62 function ($scope, $location, cordConfig) {
Matteo Scandolo9fb53f72016-01-26 11:34:15 -080063 $scope.shared = {
Matteo Scandolo61bea662016-01-26 17:21:39 -080064 url: 'http://' + $location.host() + ':' + $location.port()
Matteo Scandolo9fb53f72016-01-26 11:34:15 -080065 };
Matteo Scandolo61bea662016-01-26 17:21:39 -080066 $scope.shared.userActivity = cordConfig.userActivity;
Matteo Scandolo9fb53f72016-01-26 11:34:15 -080067 $scope.page = {};
Matteo Scandolo61bea662016-01-26 17:21:39 -080068 }])
69 .constant('cordConfig', {
70 url: '',
71 userActivity: {}, //check if really needed
72 bundles: [
73 {
74 "id": "family",
75 "name": "Family Bundle",
76 "desc": "Description for family bundle",
77 "functions": [
78 {
79 "id": "internet",
80 "name": "Internet",
81 "desc": "Basic internet connectivity.",
82 "params": {}
83 },
84 {
85 "id": "firewall",
86 "name": "Firewall",
87 "desc": "Normal firewall protection.",
88 "params": {}
89 },
90 {
91 "id": "url_filter",
92 "name": "Parental Control",
93 "desc": "Variable levels of URL filtering.",
94 "params": {
95 "level": "PG",
96 "levels": [ "PG", "PG-13", "R" ]
97 }
98 }
99 ]
100 },
101 {
102 "id": "basic",
103 "name": "Basic Bundle",
104 "desc": "Description for basic bundle",
105 "functions": [
106 {
107 "id": "internet",
108 "name": "Internet",
109 "desc": "Basic internet connectivity.",
110 "params": {}
111 },
112 {
113 "id": "firewall",
114 "name": "Firewall",
115 "desc": "Normal firewall protection.",
116 "params": {}
117 }
118 ]
119 }
120 ]
121 })
122 .run(function($location, cordConfig){
123 cordConfig.url = 'http://' + $location.host() + ':' + $location.port();
124 });
Matteo Scandolo4eb4ccb2016-01-26 11:02:16 -0800125}());