summaryrefslogtreecommitdiffstats
path: root/gui/app/scripts/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'gui/app/scripts/controllers')
-rw-r--r--gui/app/scripts/controllers/projectDetail.controller.js20
-rw-r--r--gui/app/scripts/controllers/taskLog.controller.js34
2 files changed, 38 insertions, 16 deletions
diff --git a/gui/app/scripts/controllers/projectDetail.controller.js b/gui/app/scripts/controllers/projectDetail.controller.js
index 4ab4a055a..a616f3ee7 100644
--- a/gui/app/scripts/controllers/projectDetail.controller.js
+++ b/gui/app/scripts/controllers/projectDetail.controller.js
@@ -671,20 +671,8 @@ angular.module('yardStickGui2App')
})
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ $scope.gotoLog = function gotoLog(task_id) {
+ $state.go('app2.taskLog', { taskId: task_id });
+ }
}
- ]); \ No newline at end of file
+ ]);
diff --git a/gui/app/scripts/controllers/taskLog.controller.js b/gui/app/scripts/controllers/taskLog.controller.js
new file mode 100644
index 000000000..17722b7da
--- /dev/null
+++ b/gui/app/scripts/controllers/taskLog.controller.js
@@ -0,0 +1,34 @@
+'use strict';
+
+angular.module('yardStickGui2App').controller('TaskLogController', ['$scope', '$stateParams', '$http', '$interval', 'mainFactory', function ($scope, $stateParams, $http, $interval, mainFactory) {
+ $scope.logLines = [];
+ $scope.getLog = getLog;
+ $scope.taskId = $stateParams.taskId;
+ $scope.taskStatus = 0;
+ $scope.index = 0;
+
+ $scope.goBack = function goBack() {
+ window.history.back();
+ }
+
+ function getLog(){
+
+ function get_data(){
+ mainFactory.getTaskLog().get({'taskId': $scope.taskId, 'index': $scope.index}).$promise.then(function(data){
+ angular.forEach(data.result.data, function(ele){
+ $scope.logLines.push(ele);
+ $scope.index = data.result.index;
+ });
+
+ if(data.status == 1){
+ $interval.cancel($scope.intervalTask);
+ $scope.taskStatus = 1;
+ }
+ });
+ }
+
+ $scope.intervalTask = $interval(get_data, 2000);
+ }
+
+ getLog();
+}]);