blob: 484384634dff06a8bff82651c17fe54b9e8c016b [file] [log] [blame]
Matteo Scandolobf14f882016-06-02 10:01:34 -07001/*
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 () {
18 'use strict';
19
20 var modules = [
Matteo Scandoloa3844ec2016-06-02 15:45:19 -070021 'ui.router',
22 'ngResource',
23 'ngAnimate',
24 'ngCookies',
Matteo Scandolo2c2c8af2016-06-03 15:36:02 -070025 'ngMap',
Matteo Scandolo06107602016-06-03 16:37:24 -070026 'chart.js',
Matteo Scandolobe342fa2016-06-08 15:54:55 -070027 'ngHttpCache',
28 'xos.uiComponents',
29 'ui.bootstrap.modal',
30 'ui.bootstrap.tabs'
Matteo Scandoloa3844ec2016-06-02 15:45:19 -070031 ];
Matteo Scandolobf14f882016-06-02 10:01:34 -070032
Matteo Scandoloa3844ec2016-06-02 15:45:19 -070033 angular.module('mCord', modules)
34 .config(function ($stateProvider, $urlRouterProvider, $httpProvider) {
Matteo Scandolobf14f882016-06-02 10:01:34 -070035
36 $httpProvider.interceptors.push('SetCSRFToken');
37
Matteo Scandoloa3844ec2016-06-02 15:45:19 -070038 $urlRouterProvider.otherwise('/');
39
Matteo Scandolo8cb844e2016-06-02 11:39:02 -070040 $stateProvider
41 .state('home', {
42 url: '/',
Matteo Scandoloa3844ec2016-06-02 15:45:19 -070043 template: '<e-node-map></e-node-map>'
Matteo Scandolobf14f882016-06-02 10:01:34 -070044 })
Matteo Scandolo8cb844e2016-06-02 11:39:02 -070045 .state('login', {
46 url: '/login',
Matteo Scandoloa3844ec2016-06-02 15:45:19 -070047 template: '<cord-login></cord-login>'
Matteo Scandolo8cb844e2016-06-02 11:39:02 -070048 })
Matteo Scandolo51365872016-06-03 10:00:05 -070049 .state('enode', {
50 url: '/enode',
Matteo Scandolo06107602016-06-03 16:37:24 -070051 template: '<e-node-list></e-node-list>'
Matteo Scandolo51365872016-06-03 10:00:05 -070052 })
Matteo Scandolobe342fa2016-06-08 15:54:55 -070053 .state('enode-details', {
54 url: '/enode/:id',
55 template: '<e-node-details></e-node-details>'
56 })
Matteo Scandolo51365872016-06-03 10:00:05 -070057 .state('profile', {
58 url: '/profile',
59 template: '<profile-list></profile-list>'
60 })
61 .state('imsi', {
62 url: '/imsi',
63 template: '<imsi-list></imsi-list>'
64 })
Matteo Scandoloa3844ec2016-06-02 15:45:19 -070065 .state('services', {
66 url: '/services',
Matteo Scandolobf14f882016-06-02 10:01:34 -070067 controller: 'CordBundleCtrl',
68 controllerAs: 'ctrl',
Matteo Scandoloa3844ec2016-06-02 15:45:19 -070069 templateUrl: 'app/view/services/services.html'
Matteo Scandolobf14f882016-06-02 10:01:34 -070070 });
71 })
Matteo Scandolobf14f882016-06-02 10:01:34 -070072 .constant('cordConfig', {
73 url: '',
74 userActivity: {}, //check if really needed
75 activeBundle: 1,
76 bundles: [
77 {
78 "id": "family",
79 "name": "Education Bundle",
80 "desc": "Description for advanced bundle and the amazing thing it can do to managing Video Optimization.",
81 "functions": [
82 {
83 "id": "cache",
84 "name": "Cache",
85 "desc": "Local content and frequently used content are served from local cache service entity. This will increase the quality of service by reduced delay and by avoiding the bottleneck of the legacy cloud based content services.",
86 "params": {}
87 },
88 {
89 "id": "firewall",
90 "name": "Firewall",
91 "desc": "This provides security services that control the incoming and outgoing network traffic. Enhanced features like IPS (Intrusion Prevention System), threat analysis and content filtering are also available.",
92 "params": {}
93 },
94 {
95 "id": "video",
96 "name": "Video Optimization",
97 "desc": "This can provide different video transcoding formats to improve video quality during congestion.Priority based badwidth resource allocation is also available",
98 "params": {
99 "levels": ["enabled", "disabled"]
100 }
101 }
102 ]
103 },
104 {
105 "id": "basic",
106 "name": "Basic Bundle",
107 "desc": "Description for basic bundle",
108 "functions": [
109 {
110 "id": "cache",
111 "name": "Cache",
112 "desc": "Local content and frequently used content are served from local cache service entity. This will increase the quality of service by reduced delay and by avoiding the bottleneck of the legacy cloud based content services.",
113 "params": {}
114 },
115 {
116 "id": "firewall",
117 "name": "Firewall",
118 "desc": "This provides security services that control the incoming and outgoing network traffic. Enhanced features like IPS (Intrusion Prevention System), threat analysis and content filtering are also available.",
119 "params": {}
120 }
121 ]
122 }
123 ]
124 })
Matteo Scandoloa3844ec2016-06-02 15:45:19 -0700125 .run(function($rootScope, $location, cordConfig, User, NgMap){
Matteo Scandolobf14f882016-06-02 10:01:34 -0700126 cordConfig.url = 'http://' + $location.host() + ':' + $location.port();
127
128 // basic authentication
Matteo Scandoloa3844ec2016-06-02 15:45:19 -0700129 $rootScope.$on('$stateChangeStart', function() {
Matteo Scandolobf14f882016-06-02 10:01:34 -0700130 if(!User.isLoggedIn()){
131 $location.path('/login');
132 }
133 });
Matteo Scandolobf14f882016-06-02 10:01:34 -0700134 });
135}());