blob: 17722b7da748f39a622d781bb7b5c18cbcc312ba (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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();
}]);
|