blob: b9523a15b171785d955a5813bc7ebe92e2fd53bf [file] [log] [blame]
Matteo Scandolobf14f882016-06-02 10:01:34 -07001/*
Brian O'Connor8fb63ec2017-08-03 22:46:35 -07002 * Copyright 2015 Open Networking Foundation
Matteo Scandolobf14f882016-06-02 10:01:34 -07003 *
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',
Matteo Scandoloeccf4972016-06-13 11:32:05 -070059 template: '<profiles-list></profiles-list>'
Matteo Scandolo51365872016-06-03 10:00:05 -070060 })
Matteo Scandoloe23060c2016-06-14 14:50:23 -070061 .state('profile-details', {
62 url: '/profile/:id',
63 template: '<profile-details></profile-details>'
64 })
Matteo Scandolo51365872016-06-03 10:00:05 -070065 .state('imsi', {
66 url: '/imsi',
67 template: '<imsi-list></imsi-list>'
68 })
Matteo Scandoloed9e3ec2016-06-13 15:20:11 -070069 .state('imsi-details', {
70 url: '/imsi/:id',
71 template: '<imsi-details></imsi-details>'
72 })
Matteo Scandoloa3844ec2016-06-02 15:45:19 -070073 .state('services', {
74 url: '/services',
Matteo Scandolobf14f882016-06-02 10:01:34 -070075 controller: 'CordBundleCtrl',
76 controllerAs: 'ctrl',
Matteo Scandoloa3844ec2016-06-02 15:45:19 -070077 templateUrl: 'app/view/services/services.html'
Matteo Scandolobf14f882016-06-02 10:01:34 -070078 });
79 })
Matteo Scandolobf14f882016-06-02 10:01:34 -070080 .constant('cordConfig', {
81 url: '',
82 userActivity: {}, //check if really needed
83 activeBundle: 1,
84 bundles: [
85 {
86 "id": "family",
87 "name": "Education Bundle",
88 "desc": "Description for advanced bundle and the amazing thing it can do to managing Video Optimization.",
89 "functions": [
90 {
91 "id": "cache",
92 "name": "Cache",
93 "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.",
94 "params": {}
95 },
96 {
97 "id": "firewall",
98 "name": "Firewall",
99 "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.",
100 "params": {}
101 },
102 {
103 "id": "video",
104 "name": "Video Optimization",
105 "desc": "This can provide different video transcoding formats to improve video quality during congestion.Priority based badwidth resource allocation is also available",
106 "params": {
107 "levels": ["enabled", "disabled"]
108 }
109 }
110 ]
111 },
112 {
113 "id": "basic",
114 "name": "Basic Bundle",
115 "desc": "Description for basic bundle",
116 "functions": [
117 {
118 "id": "cache",
119 "name": "Cache",
120 "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.",
121 "params": {}
122 },
123 {
124 "id": "firewall",
125 "name": "Firewall",
126 "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.",
127 "params": {}
128 }
129 ]
130 }
131 ]
132 })
Matteo Scandoloa3844ec2016-06-02 15:45:19 -0700133 .run(function($rootScope, $location, cordConfig, User, NgMap){
Matteo Scandolobf14f882016-06-02 10:01:34 -0700134 cordConfig.url = 'http://' + $location.host() + ':' + $location.port();
135
136 // basic authentication
Matteo Scandoloa3844ec2016-06-02 15:45:19 -0700137 $rootScope.$on('$stateChangeStart', function() {
Matteo Scandolobf14f882016-06-02 10:01:34 -0700138 if(!User.isLoggedIn()){
139 $location.path('/login');
140 }
141 });
Matteo Scandolobf14f882016-06-02 10:01:34 -0700142 });
143}());