-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhmssModule.js
More file actions
126 lines (112 loc) · 5.37 KB
/
hmssModule.js
File metadata and controls
126 lines (112 loc) · 5.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
var hmssModule = angular.module('hmssModule', ["google-maps"]);
define(['js/constants/Routes',
'js/controllers/location/LocationInterceptor',
'js/controllers/menus/MainMenuController',
'js/controllers/header/HeaderController'], function ()
{
function registerRoutes($routeProvider, routeTable) {
// ******************************************************** //
// Configuration for the application //
// ******************************************************** //
var unknownResourceRoute =
{
path: routeTable.ROUTE_UNKNOWN_RESOURCE.uri,
isPublic: true,
templateUrl: 'views/errors/UnknownResource.html',
dependencies: ['js/controllers/errors/UnknownResourceController']
};
var routeConfig =
{
// Set the default path to unknown resource
defaultPath: unknownResourceRoute,
routes: [
// Add the unknown resource path as an available route.
unknownResourceRoute,
// Insufficient Credentials
{
path: routeTable.ROUTE_INSUFFICIENT_CREDENTIALS.uri,
isPublic: true,
templateUrl: 'views/errors/AccessDenied.html',
dependencies: ['js/controllers/errors/InsufficientCredentialsController']
},
// Login
{
path: routeTable.ROUTE_LOGIN.uri,
isPublic: true,
templateUrl: 'views/forms/login.html',
dependencies: ['js/controllers/login/LoginController']
},
// Main
{
path: routeTable.ROUTE_MAIN.uri,
isPublic: true,
templateUrl: 'views/main.html',
dependencies: ['js/controllers/main/MainController']
},
// Labs
{
path: routeTable.ROUTE_LABS.uri,
isPublic: false,
templateUrl: 'views/labs.html',
dependencies: ['js/controllers/labs/LabsController']
},
// Intel
{
path: routeTable.ROUTE_INTEL.uri,
isPublic: false,
templateUrl: 'views/intel.html',
dependencies: ['js/controllers/intel/IntelController']
},
// Targets
{
path: routeTable.ROUTE_TARGETS.uri,
isPublic: false,
templateUrl: 'views/targets/targets.html',
dependencies: ['js/controllers/targets/TargetsController']
},
// Target Details
{
path: routeTable.ROUTE_TARGET_DETAIL.uri,
isPublic: false,
templateUrl: 'views/targets/targetDetails.html',
dependencies: ['js/controllers/targets/TargetDetailController']
},
,
// Target Detail Location
{
path: routeTable.ROUTE_TARGET_LOCATION.uri,
isPublic: false,
templateUrl: 'views/targets/targetLocation.html',
dependencies: ['js/controllers/targets/TargetLocationController']
},
// Tasks
{
path: routeTable.ROUTE_TASKS.uri,
isPublic: false,
templateUrl: 'views/tasks.html',
dependencies: ['js/controllers/tasks/TasksController']
}
]
};
angular.forEach(routeConfig.routes, function (route)
{
var rDep = DependencyResolver(route.dependencies);
$routeProvider.when(route.path, { path: route.path, templateUrl: route.templateUrl, isPublic: route.isPublic, resolve: rDep });
});
// Register the unknown resource view as the otherwise route.
$routeProvider.otherwise({ redirectTo: routeConfig.defaultPath.path });
};
function config($routeProvider, $httpProvider, $controllerProvider, $compileProvider, $filterProvider, $provide, ROUTES) {
delete $httpProvider.defaults.headers.common['X-Requested-With'];
// Register routes
registerRoutes($routeProvider, ROUTES);
// Once the application has been bootstrapped replace the existing pre-bootstrap methods with the
// registration methods.
hmssModule.controller = $controllerProvider.register;
hmssModule.directive = $compileProvider.directive;
hmssModule.filter = $filterProvider.register;
hmssModule.factory = $provide.factory;
hmssModule.service = $provide.service;
}
hmssModule.config(config);
});