summaryrefslogtreecommitdiffstats
path: root/gui/app/scripts/controllers/taskLog.controller.js
diff options
context:
space:
mode:
authorchenjiankun <chenjiankun1@huawei.com>2017-08-09 03:23:58 +0000
committerchenjiankun <chenjiankun1@huawei.com>2017-08-11 09:29:58 +0000
commit43bf12d6ab7bcaea16dc75ed4ccbe3895cf51da3 (patch)
tree234d642e36564dab4e9d48cff09c0b93901c252f /gui/app/scripts/controllers/taskLog.controller.js
parent55234666785b0fdc81365da4dac5563e954f8a09 (diff)
Add real time log view in GUI
JIRA: YARDSTICK-775 We have GUI now, but we can't see real time log in GUI view. So I add real time log view in GUI. Change-Id: Ie83f327ef0a94302afa6b3def764fec6ef5818d1 Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
Diffstat (limited to 'gui/app/scripts/controllers/taskLog.controller.js')
-rw-r--r--gui/app/scripts/controllers/taskLog.controller.js34
1 files changed, 34 insertions, 0 deletions
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();
+}]);