|
@@ -1,10 +1,6 @@
|
1
|
1
|
angular.module('camotion')
|
2
|
|
- .controller('CommandsController', ['$scope', 'CommandsService', 'HelperService', '$q', 'luticateAuthCache',
|
3
|
|
- function($scope, CommandsService, HelperService, $q, luticateAuthCache) {
|
4
|
|
-
|
5
|
|
- $scope.foreighLoaded = false;
|
6
|
|
- $scope.hosts = {};
|
7
|
|
- $scope.commandTypes = {};
|
|
2
|
+ .controller('CommandsController', ['$scope', 'CommandsService',
|
|
3
|
+ function($scope, CommandsService) {
|
8
|
4
|
|
9
|
5
|
$scope.luTable = {
|
10
|
6
|
columns: [
|
|
@@ -14,63 +10,28 @@ angular.module('camotion')
|
14
|
10
|
getValue: function (item) {
|
15
|
11
|
return item.Name;
|
16
|
12
|
}
|
17
|
|
- },
|
18
|
|
- {
|
19
|
|
- name: "Type",
|
20
|
|
- width: 3,
|
21
|
|
- getValue: function (item) {
|
22
|
|
- return $scope.commandTypes[item.CommandTypeId].Name;
|
23
|
|
- }
|
24
|
|
- }, {
|
|
13
|
+ },{
|
25
|
14
|
name: "Description",
|
26
|
|
- width: 6,
|
|
15
|
+ width: 9,
|
27
|
16
|
getValue: function (item) {
|
28
|
17
|
return item.Description;
|
29
|
18
|
}
|
30
|
19
|
}
|
31
|
20
|
],
|
32
|
21
|
|
33
|
|
- canAdd: function()
|
34
|
|
- {
|
35
|
|
- return luticateAuthCache.hasAllEffectivePermissions([
|
36
|
|
- 'CAMOTION_COMMAND_ADD',
|
37
|
|
- 'CAMOTION_HOST_GET'
|
38
|
|
- ])
|
|
22
|
+ getLoadPagePromise: function (page, perPage, query, promise) {
|
|
23
|
+ return CommandsService.getAll({page: page, perPage: perPage, query: query}, promise);
|
39
|
24
|
},
|
40
|
25
|
|
41
|
|
- canDel: 'CAMOTION_COMMAND_DEL',
|
42
|
|
-
|
43
|
|
- canEdit: function()
|
|
26
|
+ canClick: function()
|
44
|
27
|
{
|
45
|
28
|
return true;
|
46
|
29
|
},
|
47
|
30
|
|
48
|
|
- getLoadPagePromise: function (page, perPage, query, promise) {
|
49
|
|
- var defer = $q.defer();
|
50
|
|
- CommandsService.getAll({page: page, perPage: perPage, query: query}, promise)
|
51
|
|
- .then(function(commands)
|
52
|
|
- {
|
53
|
|
- if (!$scope.foreighLoaded) {
|
54
|
|
- HelperService.getForeignEntities(CommandsService, promise).then(function (data) {
|
55
|
|
- $scope.hosts = data.hosts;
|
56
|
|
- $scope.commandTypes = data.types;
|
57
|
|
- $scope.foreighLoaded = true;
|
58
|
|
- defer.resolve(commands);
|
59
|
|
- }, defer.reject);
|
60
|
|
- }
|
61
|
|
- else {
|
62
|
|
- defer.resolve(commands);
|
63
|
|
- }
|
64
|
|
- }, defer.reject);
|
65
|
|
- return defer.promise;
|
66
|
|
- },
|
67
|
|
-
|
68
|
|
- getDelPromise: function (id, promise) {
|
69
|
|
- return CommandsService.del({command_id: id}, promise);
|
70
|
|
- },
|
71
|
|
-
|
72
|
|
- getEditController: function () {
|
73
|
|
- return "CommandEdit";
|
|
31
|
+ onItemClicked: function(command)
|
|
32
|
+ {
|
|
33
|
+ CommandsService.exec({command_id: command.Id});
|
|
34
|
+ console.log(command);
|
74
|
35
|
}
|
75
|
36
|
};
|
76
|
37
|
}]);
|