ソースを参照

command exec

develop
Robin Thoni 9年前
コミット
d21dc1b335
3個のファイルの変更17行の追加51行の削除
  1. 11
    50
      camotion/controllers/commands.controller.js
  2. 1
    1
      camotion/views/commands.html
  3. 5
    0
      sdk/commands.js

+ 11
- 50
camotion/controllers/commands.controller.js ファイルの表示

@@ -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
     }]);

+ 1
- 1
camotion/views/commands.html ファイルの表示

@@ -1,4 +1,4 @@
1 1
 <!-- Page Content -->
2 2
 <div class="container">
3
-    <lu-edit-table options="luTable" class="row col-sm-8 col-sm-offset-2"></lu-edit-table>
3
+    <lu-basic-table options="luTable" class="row col-sm-8 col-sm-offset-2"></lu-basic-table>
4 4
 </div>

+ 5
- 0
sdk/commands.js ファイルの表示

@@ -39,6 +39,11 @@
39 39
                 return luticateRequest.post("/api/commands/" + data.command_id + "/del", null, null, promise);
40 40
             };
41 41
 
42
+            CommandsService.exec = function(data, promise)
43
+            {
44
+                return luticateRequest.post("/api/commands/" + data.command_id + "/exec", null, null, promise);
45
+            };
46
+
42 47
             return CommandsService;
43 48
         }]);
44 49
 })();

読み込み中…
キャンセル
保存