Procházet zdrojové kódy

fixed cameras types

develop
Robin Thoni před 9 roky
rodič
revize
4dae286788

+ 4
- 4
admin/controllers/cameras.controller.js Zobrazit soubor

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

+ 11
- 11
admin/controllers/modals/cameraedit.controller.js Zobrazit soubor

@@ -17,34 +17,34 @@ angular.module('camotionAdmin')
17 17
                     Description: "",
18 18
                     Data: null,
19 19
                     HostId: null,
20
-                    EntityTypeId: null
20
+                    CameraTypeId: null
21 21
                 };
22 22
                 $scope.permission = "CAMOTION_CAMERA_ADD";
23 23
             }
24 24
 
25 25
             $scope.hosts = {};
26
-            $scope.entityTypes = {};
26
+            $scope.cameraTypes = {};
27 27
             var promiseLoadForeign = {
28 28
                 id: "promiseLoadForeign",
29 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 34
                 $scope.hosts = data.hosts;
35
-                $scope.entityTypes = data.entityTypes;
35
+                $scope.cameraTypes = data.types;
36 36
                 if ($scope.camera.Id == null) {
37 37
                     var keys = Object.keys($scope.hosts);
38 38
                     if (keys.length != 0) {
39 39
                         $scope.camera.HostId = $scope.hosts[keys[0]].Id;
40
-                    }keys = Object.keys($scope.entityTypes);
40
+                    }keys = Object.keys($scope.cameraTypes);
41 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 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,9 +74,9 @@ angular.module('camotionAdmin')
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 Zobrazit soubor

@@ -27,11 +27,11 @@
27 27
         <label for="dropdownType" class="col-sm-2 control-label">Type</label>
28 28
         <div class="btn-group">
29 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 31
                 <span class="caret"></span>
32 32
             </button>
33 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 35
             </ul>
36 36
         </div>
37 37
     </div>

+ 4
- 4
sdk/helper.js Zobrazit soubor

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

Načítá se…
Zrušit
Uložit