Browse Source

fixed cameras types

develop
Robin Thoni 9 years ago
parent
commit
4dae286788

+ 4
- 4
admin/controllers/cameras.controller.js View File

4
 
4
 
5
             $scope.foreighLoaded = false;
5
             $scope.foreighLoaded = false;
6
             $scope.hosts = {};
6
             $scope.hosts = {};
7
-            $scope.entityTypes = {};
7
+            $scope.cameraTypes = {};
8
 
8
 
9
             $scope.luTable = {
9
             $scope.luTable = {
10
                 columns: [
10
                 columns: [
19
                         name: "Type",
19
                         name: "Type",
20
                         width: 3,
20
                         width: 3,
21
                         getValue: function (item) {
21
                         getValue: function (item) {
22
-                            return $scope.entityTypes[item.EntityTypeId].Name;
22
+                            return $scope.cameraTypes[item.CameraTypeId].Name;
23
                         }
23
                         }
24
                     }, {
24
                     }, {
25
                         name: "Description",
25
                         name: "Description",
51
                         .then(function(cameras)
51
                         .then(function(cameras)
52
                         {
52
                         {
53
                             if (!$scope.foreighLoaded) {
53
                             if (!$scope.foreighLoaded) {
54
-                                HelperService.getForeignEntities(promise).then(function (data) {
54
+                                HelperService.getForeignEntities(CamerasService, promise).then(function (data) {
55
                                     $scope.hosts = data.hosts;
55
                                     $scope.hosts = data.hosts;
56
-                                    $scope.entityTypes = data.entityTypes;
56
+                                    $scope.cameraTypes = data.types;
57
                                     $scope.foreighLoaded = true;
57
                                     $scope.foreighLoaded = true;
58
                                     defer.resolve(cameras);
58
                                     defer.resolve(cameras);
59
                                 }, defer.reject);
59
                                 }, defer.reject);

+ 11
- 11
admin/controllers/modals/cameraedit.controller.js View File

17
                     Description: "",
17
                     Description: "",
18
                     Data: null,
18
                     Data: null,
19
                     HostId: null,
19
                     HostId: null,
20
-                    EntityTypeId: null
20
+                    CameraTypeId: null
21
                 };
21
                 };
22
                 $scope.permission = "CAMOTION_CAMERA_ADD";
22
                 $scope.permission = "CAMOTION_CAMERA_ADD";
23
             }
23
             }
24
 
24
 
25
             $scope.hosts = {};
25
             $scope.hosts = {};
26
-            $scope.entityTypes = {};
26
+            $scope.cameraTypes = {};
27
             var promiseLoadForeign = {
27
             var promiseLoadForeign = {
28
                 id: "promiseLoadForeign",
28
                 id: "promiseLoadForeign",
29
                 groups: ["modal"]
29
                 groups: ["modal"]
30
             };
30
             };
31
 
31
 
32
-            HelperService.getForeignEntities(promiseLoadForeign).then(function(data)
32
+            HelperService.getForeignEntities(CamerasService, promiseLoadForeign).then(function(data)
33
             {
33
             {
34
                 $scope.hosts = data.hosts;
34
                 $scope.hosts = data.hosts;
35
-                $scope.entityTypes = data.entityTypes;
35
+                $scope.cameraTypes = data.types;
36
                 if ($scope.camera.Id == null) {
36
                 if ($scope.camera.Id == null) {
37
                     var keys = Object.keys($scope.hosts);
37
                     var keys = Object.keys($scope.hosts);
38
                     if (keys.length != 0) {
38
                     if (keys.length != 0) {
39
                         $scope.camera.HostId = $scope.hosts[keys[0]].Id;
39
                         $scope.camera.HostId = $scope.hosts[keys[0]].Id;
40
-                    }keys = Object.keys($scope.entityTypes);
40
+                    }keys = Object.keys($scope.cameraTypes);
41
                     if (keys.length != 0) {
41
                     if (keys.length != 0) {
42
-                        $scope.camera.EntityTypeId = $scope.entityTypes[keys[0]].Id;
43
-                        $scope.setEntityType($scope.entityTypes[keys[0]]);
42
+                        $scope.camera.CameraTypeId = $scope.cameraTypes[keys[0]].Id;
43
+                        $scope.setCamerayType($scope.cameraTypes[keys[0]]);
44
                     }
44
                     }
45
                 }
45
                 }
46
                 else if ($scope.camera.Data == null) {
46
                 else if ($scope.camera.Data == null) {
47
-                    $scope.setEntityType($scope.entityTypes[$scope.camera.EntityTypeId]);
47
+                    $scope.setCameraType($scope.cameraTypes[$scope.camera.CameraTypeId]);
48
                 }
48
                 }
49
             });
49
             });
50
 
50
 
74
                 }
74
                 }
75
             };
75
             };
76
 
76
 
77
-            $scope.setEntityType = function(entityType)
77
+            $scope.setCameraType = function(cameraType)
78
             {
78
             {
79
-                $scope.camera.EntityTypeId = entityType.Id;
80
-                $scope.camera.Data = JSON.parse($scope.entityTypes[$scope.camera.EntityTypeId].DefaultData);
79
+                $scope.camera.CameraTypeId = cameraType.Id;
80
+                $scope.camera.Data = JSON.parse($scope.cameraTypes[$scope.camera.CameraTypeId].DefaultData);
81
             };
81
             };
82
         }]);
82
         }]);

+ 2
- 2
admin/views/modals/cameraedit.html View File

27
         <label for="dropdownType" class="col-sm-2 control-label">Type</label>
27
         <label for="dropdownType" class="col-sm-2 control-label">Type</label>
28
         <div class="btn-group">
28
         <div class="btn-group">
29
             <button class="btn btn-default dropdown-toggle" type="button" id="dropdownType" data-toggle="dropdown">
29
             <button class="btn btn-default dropdown-toggle" type="button" id="dropdownType" data-toggle="dropdown">
30
-                {{ entityTypes[camera.EntityTypeId].Name }}
30
+                {{ cameraTypes[camera.CameraTypeId].Name }}
31
                 <span class="caret"></span>
31
                 <span class="caret"></span>
32
             </button>
32
             </button>
33
             <ul class="dropdown-menu">
33
             <ul class="dropdown-menu">
34
-                <li ng-repeat="type in entityTypes"><a ng-click="setEntityType(type)" href="">{{ type.Name }}</a></li>
34
+                <li ng-repeat="type in cameraTypes"><a ng-click="setCameraType(type)" href="">{{ type.Name }}</a></li>
35
             </ul>
35
             </ul>
36
         </div>
36
         </div>
37
     </div>
37
     </div>

+ 4
- 4
sdk/helper.js View File

6
     'use strict';
6
     'use strict';
7
 
7
 
8
     angular.module('camotionAdmin')
8
     angular.module('camotionAdmin')
9
-        .factory('HelperService', ['HostsService', 'CamerasService', '$q', function (HostsService, CamerasService, $q) {
9
+        .factory('HelperService', ['HostsService', '$q', function (HostsService, $q) {
10
 
10
 
11
             var HelperService = {};
11
             var HelperService = {};
12
 
12
 
13
-            HelperService.getForeignEntities = function (promise) {
13
+            HelperService.getForeignEntities = function (service, promise) {
14
                 var defer = $q.defer();
14
                 var defer = $q.defer();
15
                 HostsService.getAll({}, promise).then(function (hosts) {
15
                 HostsService.getAll({}, promise).then(function (hosts) {
16
                     var hostsArray = {};
16
                     var hostsArray = {};
18
                         var host = hosts.Data[i];
18
                         var host = hosts.Data[i];
19
                         hostsArray[host.Id] = host;
19
                         hostsArray[host.Id] = host;
20
                     }
20
                     }
21
-                    CamerasService.getAllTypes(promise).then(function(types)
21
+                    service.getAllTypes(promise).then(function(types)
22
                     {
22
                     {
23
                         var typesArray = {};
23
                         var typesArray = {};
24
                         for (var i = 0; i < types.Data.length; ++i) {
24
                         for (var i = 0; i < types.Data.length; ++i) {
27
                         }
27
                         }
28
                         defer.resolve({
28
                         defer.resolve({
29
                             hosts: hostsArray,
29
                             hosts: hostsArray,
30
-                            entityTypes: typesArray
30
+                            types: typesArray
31
                         });
31
                         });
32
                     }, defer.reject);
32
                     }, defer.reject);
33
                 }, defer.reject);
33
                 }, defer.reject);

Loading…
Cancel
Save