blob: c07e1a09d3b2a270372fc34f0389ce5fe1bf74a3 [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',
26 'chart.js'
Matteo Scandoloa3844ec2016-06-02 15:45:19 -070027 ];
Matteo Scandolobf14f882016-06-02 10:01:34 -070028
Matteo Scandoloa3844ec2016-06-02 15:45:19 -070029 angular.module('mCord', modules)
30 .config(function ($stateProvider, $urlRouterProvider, $httpProvider) {
Matteo Scandolobf14f882016-06-02 10:01:34 -070031
32 $httpProvider.interceptors.push('SetCSRFToken');
33
Matteo Scandoloa3844ec2016-06-02 15:45:19 -070034 $urlRouterProvider.otherwise('/');
35
Matteo Scandolo8cb844e2016-06-02 11:39:02 -070036 $stateProvider
37 .state('home', {
38 url: '/',
Matteo Scandoloa3844ec2016-06-02 15:45:19 -070039 template: '<e-node-map></e-node-map>'
Matteo Scandolobf14f882016-06-02 10:01:34 -070040 })
Matteo Scandolo8cb844e2016-06-02 11:39:02 -070041 .state('login', {
42 url: '/login',
Matteo Scandoloa3844ec2016-06-02 15:45:19 -070043 template: '<cord-login></cord-login>'
Matteo Scandolo8cb844e2016-06-02 11:39:02 -070044 })
Matteo Scandolo51365872016-06-03 10:00:05 -070045 .state('enode', {
46 url: '/enode',
47 template: '<enode-list></enode-list>'
48 })
49 .state('profile', {
50 url: '/profile',
51 template: '<profile-list></profile-list>'
52 })
53 .state('imsi', {
54 url: '/imsi',
55 template: '<imsi-list></imsi-list>'
56 })
Matteo Scandoloa3844ec2016-06-02 15:45:19 -070057 .state('services', {
58 url: '/services',
Matteo Scandolobf14f882016-06-02 10:01:34 -070059 controller: 'CordBundleCtrl',
60 controllerAs: 'ctrl',
Matteo Scandoloa3844ec2016-06-02 15:45:19 -070061 templateUrl: 'app/view/services/services.html'
Matteo Scandolobf14f882016-06-02 10:01:34 -070062 });
63 })
Matteo Scandolobf14f882016-06-02 10:01:34 -070064 .constant('cordConfig', {
65 url: '',
66 userActivity: {}, //check if really needed
67 activeBundle: 1,
68 bundles: [
69 {
70 "id": "family",
71 "name": "Education Bundle",
72 "desc": "Description for advanced bundle and the amazing thing it can do to managing Video Optimization.",
73 "functions": [
74 {
75 "id": "cache",
76 "name": "Cache",
77 "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.",
78 "params": {}
79 },
80 {
81 "id": "firewall",
82 "name": "Firewall",
83 "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.",
84 "params": {}
85 },
86 {
87 "id": "video",
88 "name": "Video Optimization",
89 "desc": "This can provide different video transcoding formats to improve video quality during congestion.Priority based badwidth resource allocation is also available",
90 "params": {
91 "levels": ["enabled", "disabled"]
92 }
93 }
94 ]
95 },
96 {
97 "id": "basic",
98 "name": "Basic Bundle",
99 "desc": "Description for basic bundle",
100 "functions": [
101 {
102 "id": "cache",
103 "name": "Cache",
104 "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.",
105 "params": {}
106 },
107 {
108 "id": "firewall",
109 "name": "Firewall",
110 "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.",
111 "params": {}
112 }
113 ]
114 }
115 ]
116 })
Matteo Scandoloa3844ec2016-06-02 15:45:19 -0700117 .run(function($rootScope, $location, cordConfig, User, NgMap){
Matteo Scandolobf14f882016-06-02 10:01:34 -0700118 cordConfig.url = 'http://' + $location.host() + ':' + $location.port();
119
120 // basic authentication
Matteo Scandoloa3844ec2016-06-02 15:45:19 -0700121 $rootScope.$on('$stateChangeStart', function() {
Matteo Scandolobf14f882016-06-02 10:01:34 -0700122 if(!User.isLoggedIn()){
123 $location.path('/login');
124 }
125 });
Matteo Scandolobf14f882016-06-02 10:01:34 -0700126 });
127}());