|
@@ -7,6 +7,7 @@ angular.module('camotionAdmin')
|
7
|
7
|
function($scope, CamerasService, data, dialogs, $q, luticateAuthCache, HelperService) {
|
8
|
8
|
if (data != null) {
|
9
|
9
|
$scope.camera = data;
|
|
10
|
+ $scope.camera.Data = JSON.parse($scope.camera.Data);
|
10
|
11
|
$scope.camera.camera_id = $scope.camera.Id;
|
11
|
12
|
$scope.permission = "CAMOTION_CAMERA_EDIT";
|
12
|
13
|
}
|
|
@@ -14,7 +15,7 @@ angular.module('camotionAdmin')
|
14
|
15
|
$scope.camera = {
|
15
|
16
|
Name: "",
|
16
|
17
|
Description: "",
|
17
|
|
- Token: "",
|
|
18
|
+ Data: null,
|
18
|
19
|
HostId: null,
|
19
|
20
|
EntityTypeId: null
|
20
|
21
|
};
|
|
@@ -39,13 +40,18 @@ angular.module('camotionAdmin')
|
39
|
40
|
}keys = Object.keys($scope.entityTypes);
|
40
|
41
|
if (keys.length != 0) {
|
41
|
42
|
$scope.camera.EntityTypeId = $scope.entityTypes[keys[0]].Id;
|
|
43
|
+ $scope.setEntityType($scope.entityTypes[keys[0]]);
|
42
|
44
|
}
|
43
|
45
|
}
|
|
46
|
+ else if ($scope.camera.Data == null) {
|
|
47
|
+ $scope.setEntityType($scope.entityTypes[$scope.camera.EntityTypeId]);
|
|
48
|
+ }
|
44
|
49
|
});
|
45
|
50
|
|
46
|
51
|
$scope.submitForm = function()
|
47
|
52
|
{
|
48
|
53
|
if (luticateAuthCache.hasEffectivePermission($scope.permission)) {
|
|
54
|
+ $scope.camera.Data = JSON.stringify($scope.camera.Data);
|
49
|
55
|
if ($scope.camera.Id != null) {
|
50
|
56
|
var promiseEditCamera = {
|
51
|
57
|
id: "promiseEditCamera",
|
|
@@ -67,4 +73,10 @@ angular.module('camotionAdmin')
|
67
|
73
|
return defer.promise;
|
68
|
74
|
}
|
69
|
75
|
};
|
|
76
|
+
|
|
77
|
+ $scope.setEntityType = function(entityType)
|
|
78
|
+ {
|
|
79
|
+ $scope.camera.EntityTypeId = entityType.Id;
|
|
80
|
+ $scope.camera.Data = JSON.parse($scope.entityTypes[$scope.camera.EntityTypeId].DefaultData);
|
|
81
|
+ };
|
70
|
82
|
}]);
|