This repository has been archived by the owner on Apr 13, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
/
app.js
72 lines (62 loc) · 1.78 KB
/
app.js
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
(function(window, angular, undefined) {
'use strict';
// declare app level module
var app = angular.module('app', [
// angular and third-party modules
'ngRoute',
'ngCookies',
'ui.bootstrap',
// components
'valueDirectives',
'holder',
'panel',
'goProController',
'proxyStatus',
'cameraStatus',
'blurOnClick',
'groupControl',
'queuedCommands',
'byteBreakdown',
// pages
'page.cameras',
'page.debug',
]);
app.value('version', '0.2.4');
app.value('api_root', 'http://localhost:8000');
app.value('poll_rate', 1000); // ms
// app routing
app.config(['$routeProvider', '$httpProvider', '$locationProvider',
function($routeProvider, $httpProvider, $locationProvider) {
// html5mode
$locationProvider.html5Mode(true);
// routes
$routeProvider.when('/', {
templateUrl: 'pages/cameras/cameras.html',
controller: 'CamerasCtrl',
reloadOnSearch: false
});
$routeProvider.when('/debug', {
templateUrl: 'pages/debug/debug.html',
controller: 'DebugCtrl',
reloadOnSearch: false
});
$routeProvider.otherwise({redirectTo: '/'});
}]);
// layout controller
app.controller('LayoutCtrl', ['$scope', '$rootScope', '$location', 'SyncedCameras', 'SyncedCommands',
function ($scope, $rootScope, $location, SyncedCameras, SyncedCommands) {
$scope.isActive = function (navBarPath) {
return navBarPath === $location.path().split('/')[1];
};
$rootScope.$on('$routeChangeStart', function(){
$scope.navCollapsed = true;
});
// init the model syncing
SyncedCameras.init();
SyncedCommands.init();
}]);
// a generic static content controller
app.controller('StaticCtrl', ['$scope', function ($scope) {}]);
// hide moment Date() fallback warning
window.moment.suppressDeprecationWarnings = true;
})(window, window.angular);