Matteo Scandolo | bf14f88 | 2016-06-02 10:01:34 -0700 | [diff] [blame] | 1 | /* |
| 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 Scandolo | a3844ec | 2016-06-02 15:45:19 -0700 | [diff] [blame] | 21 | 'ui.router', |
| 22 | 'ngResource', |
| 23 | 'ngAnimate', |
| 24 | 'ngCookies', |
Matteo Scandolo | 2c2c8af | 2016-06-03 15:36:02 -0700 | [diff] [blame] | 25 | 'ngMap', |
Matteo Scandolo | 0610760 | 2016-06-03 16:37:24 -0700 | [diff] [blame] | 26 | 'chart.js', |
Matteo Scandolo | be342fa | 2016-06-08 15:54:55 -0700 | [diff] [blame] | 27 | 'ngHttpCache', |
| 28 | 'xos.uiComponents', |
| 29 | 'ui.bootstrap.modal', |
| 30 | 'ui.bootstrap.tabs' |
Matteo Scandolo | a3844ec | 2016-06-02 15:45:19 -0700 | [diff] [blame] | 31 | ]; |
Matteo Scandolo | bf14f88 | 2016-06-02 10:01:34 -0700 | [diff] [blame] | 32 | |
Matteo Scandolo | a3844ec | 2016-06-02 15:45:19 -0700 | [diff] [blame] | 33 | angular.module('mCord', modules) |
| 34 | .config(function ($stateProvider, $urlRouterProvider, $httpProvider) { |
Matteo Scandolo | bf14f88 | 2016-06-02 10:01:34 -0700 | [diff] [blame] | 35 | |
| 36 | $httpProvider.interceptors.push('SetCSRFToken'); |
| 37 | |
Matteo Scandolo | a3844ec | 2016-06-02 15:45:19 -0700 | [diff] [blame] | 38 | $urlRouterProvider.otherwise('/'); |
| 39 | |
Matteo Scandolo | 8cb844e | 2016-06-02 11:39:02 -0700 | [diff] [blame] | 40 | $stateProvider |
| 41 | .state('home', { |
| 42 | url: '/', |
Matteo Scandolo | a3844ec | 2016-06-02 15:45:19 -0700 | [diff] [blame] | 43 | template: '<e-node-map></e-node-map>' |
Matteo Scandolo | bf14f88 | 2016-06-02 10:01:34 -0700 | [diff] [blame] | 44 | }) |
Matteo Scandolo | 8cb844e | 2016-06-02 11:39:02 -0700 | [diff] [blame] | 45 | .state('login', { |
| 46 | url: '/login', |
Matteo Scandolo | a3844ec | 2016-06-02 15:45:19 -0700 | [diff] [blame] | 47 | template: '<cord-login></cord-login>' |
Matteo Scandolo | 8cb844e | 2016-06-02 11:39:02 -0700 | [diff] [blame] | 48 | }) |
Matteo Scandolo | 5136587 | 2016-06-03 10:00:05 -0700 | [diff] [blame] | 49 | .state('enode', { |
| 50 | url: '/enode', |
Matteo Scandolo | 0610760 | 2016-06-03 16:37:24 -0700 | [diff] [blame] | 51 | template: '<e-node-list></e-node-list>' |
Matteo Scandolo | 5136587 | 2016-06-03 10:00:05 -0700 | [diff] [blame] | 52 | }) |
Matteo Scandolo | be342fa | 2016-06-08 15:54:55 -0700 | [diff] [blame] | 53 | .state('enode-details', { |
| 54 | url: '/enode/:id', |
| 55 | template: '<e-node-details></e-node-details>' |
| 56 | }) |
Matteo Scandolo | 5136587 | 2016-06-03 10:00:05 -0700 | [diff] [blame] | 57 | .state('profile', { |
| 58 | url: '/profile', |
Matteo Scandolo | eccf497 | 2016-06-13 11:32:05 -0700 | [diff] [blame] | 59 | template: '<profiles-list></profiles-list>' |
Matteo Scandolo | 5136587 | 2016-06-03 10:00:05 -0700 | [diff] [blame] | 60 | }) |
| 61 | .state('imsi', { |
| 62 | url: '/imsi', |
| 63 | template: '<imsi-list></imsi-list>' |
| 64 | }) |
Matteo Scandolo | ed9e3ec | 2016-06-13 15:20:11 -0700 | [diff] [blame] | 65 | .state('imsi-details', { |
| 66 | url: '/imsi/:id', |
| 67 | template: '<imsi-details></imsi-details>' |
| 68 | }) |
Matteo Scandolo | a3844ec | 2016-06-02 15:45:19 -0700 | [diff] [blame] | 69 | .state('services', { |
| 70 | url: '/services', |
Matteo Scandolo | bf14f88 | 2016-06-02 10:01:34 -0700 | [diff] [blame] | 71 | controller: 'CordBundleCtrl', |
| 72 | controllerAs: 'ctrl', |
Matteo Scandolo | a3844ec | 2016-06-02 15:45:19 -0700 | [diff] [blame] | 73 | templateUrl: 'app/view/services/services.html' |
Matteo Scandolo | bf14f88 | 2016-06-02 10:01:34 -0700 | [diff] [blame] | 74 | }); |
| 75 | }) |
Matteo Scandolo | bf14f88 | 2016-06-02 10:01:34 -0700 | [diff] [blame] | 76 | .constant('cordConfig', { |
| 77 | url: '', |
| 78 | userActivity: {}, //check if really needed |
| 79 | activeBundle: 1, |
| 80 | bundles: [ |
| 81 | { |
| 82 | "id": "family", |
| 83 | "name": "Education Bundle", |
| 84 | "desc": "Description for advanced bundle and the amazing thing it can do to managing Video Optimization.", |
| 85 | "functions": [ |
| 86 | { |
| 87 | "id": "cache", |
| 88 | "name": "Cache", |
| 89 | "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.", |
| 90 | "params": {} |
| 91 | }, |
| 92 | { |
| 93 | "id": "firewall", |
| 94 | "name": "Firewall", |
| 95 | "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.", |
| 96 | "params": {} |
| 97 | }, |
| 98 | { |
| 99 | "id": "video", |
| 100 | "name": "Video Optimization", |
| 101 | "desc": "This can provide different video transcoding formats to improve video quality during congestion.Priority based badwidth resource allocation is also available", |
| 102 | "params": { |
| 103 | "levels": ["enabled", "disabled"] |
| 104 | } |
| 105 | } |
| 106 | ] |
| 107 | }, |
| 108 | { |
| 109 | "id": "basic", |
| 110 | "name": "Basic Bundle", |
| 111 | "desc": "Description for basic bundle", |
| 112 | "functions": [ |
| 113 | { |
| 114 | "id": "cache", |
| 115 | "name": "Cache", |
| 116 | "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.", |
| 117 | "params": {} |
| 118 | }, |
| 119 | { |
| 120 | "id": "firewall", |
| 121 | "name": "Firewall", |
| 122 | "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.", |
| 123 | "params": {} |
| 124 | } |
| 125 | ] |
| 126 | } |
| 127 | ] |
| 128 | }) |
Matteo Scandolo | a3844ec | 2016-06-02 15:45:19 -0700 | [diff] [blame] | 129 | .run(function($rootScope, $location, cordConfig, User, NgMap){ |
Matteo Scandolo | bf14f88 | 2016-06-02 10:01:34 -0700 | [diff] [blame] | 130 | cordConfig.url = 'http://' + $location.host() + ':' + $location.port(); |
| 131 | |
| 132 | // basic authentication |
Matteo Scandolo | a3844ec | 2016-06-02 15:45:19 -0700 | [diff] [blame] | 133 | $rootScope.$on('$stateChangeStart', function() { |
Matteo Scandolo | bf14f88 | 2016-06-02 10:01:34 -0700 | [diff] [blame] | 134 | if(!User.isLoggedIn()){ |
| 135 | $location.path('/login'); |
| 136 | } |
| 137 | }); |
Matteo Scandolo | bf14f88 | 2016-06-02 10:01:34 -0700 | [diff] [blame] | 138 | }); |
| 139 | }()); |