blob: 758f0e0b8b0e69d63c37b518fc7fb83c7422c106 [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',
25 'ngMap'
26 ];
Matteo Scandolobf14f882016-06-02 10:01:34 -070027
Matteo Scandoloa3844ec2016-06-02 15:45:19 -070028 angular.module('mCord', modules)
29 .config(function ($stateProvider, $urlRouterProvider, $httpProvider) {
Matteo Scandolobf14f882016-06-02 10:01:34 -070030
31 $httpProvider.interceptors.push('SetCSRFToken');
32
Matteo Scandoloa3844ec2016-06-02 15:45:19 -070033 $urlRouterProvider.otherwise('/');
34
Matteo Scandolo8cb844e2016-06-02 11:39:02 -070035 $stateProvider
36 .state('home', {
37 url: '/',
Matteo Scandoloa3844ec2016-06-02 15:45:19 -070038 template: '<e-node-map></e-node-map>'
Matteo Scandolobf14f882016-06-02 10:01:34 -070039 })
Matteo Scandolo8cb844e2016-06-02 11:39:02 -070040 .state('login', {
41 url: '/login',
Matteo Scandoloa3844ec2016-06-02 15:45:19 -070042 template: '<cord-login></cord-login>'
Matteo Scandolo8cb844e2016-06-02 11:39:02 -070043 })
Matteo Scandoloa3844ec2016-06-02 15:45:19 -070044 .state('services', {
45 url: '/services',
Matteo Scandolobf14f882016-06-02 10:01:34 -070046 controller: 'CordBundleCtrl',
47 controllerAs: 'ctrl',
Matteo Scandoloa3844ec2016-06-02 15:45:19 -070048 templateUrl: 'app/view/services/services.html'
Matteo Scandolobf14f882016-06-02 10:01:34 -070049 });
50 })
Matteo Scandolobf14f882016-06-02 10:01:34 -070051 .constant('cordConfig', {
52 url: '',
53 userActivity: {}, //check if really needed
54 activeBundle: 1,
55 bundles: [
56 {
57 "id": "family",
58 "name": "Education Bundle",
59 "desc": "Description for advanced bundle and the amazing thing it can do to managing Video Optimization.",
60 "functions": [
61 {
62 "id": "cache",
63 "name": "Cache",
64 "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.",
65 "params": {}
66 },
67 {
68 "id": "firewall",
69 "name": "Firewall",
70 "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.",
71 "params": {}
72 },
73 {
74 "id": "video",
75 "name": "Video Optimization",
76 "desc": "This can provide different video transcoding formats to improve video quality during congestion.Priority based badwidth resource allocation is also available",
77 "params": {
78 "levels": ["enabled", "disabled"]
79 }
80 }
81 ]
82 },
83 {
84 "id": "basic",
85 "name": "Basic Bundle",
86 "desc": "Description for basic bundle",
87 "functions": [
88 {
89 "id": "cache",
90 "name": "Cache",
91 "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.",
92 "params": {}
93 },
94 {
95 "id": "firewall",
96 "name": "Firewall",
97 "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.",
98 "params": {}
99 }
100 ]
101 }
102 ]
103 })
Matteo Scandoloa3844ec2016-06-02 15:45:19 -0700104 .run(function($rootScope, $location, cordConfig, User, NgMap){
Matteo Scandolobf14f882016-06-02 10:01:34 -0700105 cordConfig.url = 'http://' + $location.host() + ':' + $location.port();
106
107 // basic authentication
Matteo Scandoloa3844ec2016-06-02 15:45:19 -0700108 $rootScope.$on('$stateChangeStart', function() {
Matteo Scandolobf14f882016-06-02 10:01:34 -0700109 if(!User.isLoggedIn()){
110 $location.path('/login');
111 }
112 });
Matteo Scandoloa3844ec2016-06-02 15:45:19 -0700113
114 NgMap.getMap().then(function(map) {
115 console.log(map.getCenter());
116 console.log('markers', map.markers);
117 console.log('shapes', map.shapes);
118 });
Matteo Scandolobf14f882016-06-02 10:01:34 -0700119 });
120}());