aboutsummaryrefslogtreecommitdiffstats
path: root/gui
diff options
context:
space:
mode:
Diffstat (limited to 'gui')
-rw-r--r--gui/app/index.html1
-rw-r--r--gui/app/scripts/controllers/projectDetail.controller.js20
-rw-r--r--gui/app/scripts/controllers/taskLog.controller.js34
-rw-r--r--gui/app/scripts/factory/main.factory.js8
-rw-r--r--gui/app/scripts/router.config.js10
-rw-r--r--gui/app/views/projectdetail.html1
-rw-r--r--gui/app/views/taskLog.html39
7 files changed, 97 insertions, 16 deletions
diff --git a/gui/app/index.html b/gui/app/index.html
index 5592656cc..d959b14d2 100644
--- a/gui/app/index.html
+++ b/gui/app/index.html
@@ -100,6 +100,7 @@
<script src="scripts/controllers/suitedetail.controller.js"></script>
<script src="scripts/controllers/suitecreate.controller.js"></script>
<script src="scripts/controllers/task.controller.js"></script>
+ <script src="scripts/controllers/taskLog.controller.js"></script>
<script src="scripts/controllers/report.controller.js"></script>
<script src="scripts/controllers/project.controller.js"></script>
<script src="scripts/controllers/projectDetail.controller.js"></script>
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();
+}]);
diff --git a/gui/app/scripts/factory/main.factory.js b/gui/app/scripts/factory/main.factory.js
index f8e9df9a1..44fbeb39f 100644
--- a/gui/app/scripts/factory/main.factory.js
+++ b/gui/app/scripts/factory/main.factory.js
@@ -178,6 +178,14 @@ angular.module('yardStickGui2App')
})
},
+ getTaskLog: function(){
+ return $resource(Base_URL + '/api/v2/yardstick/tasks/:taskId/log?index=:index', { taskId: "@taskId", index: "@index" }, {
+ 'get': {
+ method: 'GET'
+ }
+ })
+ },
+
taskAddEnv: function() {
return $resource(Base_URL + '/api/v2/yardstick/tasks/:taskId', { taskId: "@taskId" }, {
'put': {
diff --git a/gui/app/scripts/router.config.js b/gui/app/scripts/router.config.js
index b42954272..9d3c045bd 100644
--- a/gui/app/scripts/router.config.js
+++ b/gui/app/scripts/router.config.js
@@ -143,6 +143,16 @@ angular.module('yardStickGui2App')
}
})
+ .state('app2.taskLog', {
+ url: '/task/:taskId/log',
+ templateUrl: 'views/taskLog.html',
+ controller: 'TaskLogController',
+ params: { taskId: null },
+ ncyBreadcrumb: {
+ label: 'TaskLog'
+ }
+
+ })
.state('app2.report', {
url: '/report/:taskId',
templateUrl: 'views/report.html',
diff --git a/gui/app/views/projectdetail.html b/gui/app/views/projectdetail.html
index 357a26add..405ff5af0 100644
--- a/gui/app/views/projectdetail.html
+++ b/gui/app/views/projectdetail.html
@@ -47,6 +47,7 @@
<li role="menuitem" ng-show="task.status!=0"><a ng-click="runAtaskForTable(task.uuid)">run</a></li>
<li role="menuitem" ng-show="task.status!=0"><a ng-click="gotoModify(task.uuid)">modify</a></li>
+ <li role="menuitem" ng-show="task.status!=-1"><a ng-click="gotoLog(task.uuid)">log</a></li>
<li role="menuitem" ng-show="task.status!=-1 && task.status!=0"><a ng-click="gotoReport(task.uuid)" style="color:#2ecc71">reporting</a></li>
<li role="menuitem"><a ng-click="openDeleteEnv(task.uuid,'task')">delete</a></li>
diff --git a/gui/app/views/taskLog.html b/gui/app/views/taskLog.html
new file mode 100644
index 000000000..f90eb22b8
--- /dev/null
+++ b/gui/app/views/taskLog.html
@@ -0,0 +1,39 @@
+<div class="content">
+ <i class="fa fa-arrow-left fa-1x" aria-hidden="true" style="color: #999;cursor:pointer" ng-click="goBack()">Back</i>
+ <h3>Log</h3>
+ <hr/>
+ <div style="display:flex;flex-direction:row">
+ <div>
+ <div style="margin-top:5px;">Task: {{ taskId }}</div>
+ </div>
+ <div class="progree-parent" style="margin-top:10px;margin-left:20px">
+ <div class="progree-child" ng-show="taskStatus==0" style="width:50%"></div>
+ <div class="progree-child" ng-show="taskStatus==1" style="width:100%"></div>
+ </div>
+ <i class="fa fa-check" aria-hidden="true" style="margin-top:10px;margin-left:5px;color: #2ecc71;" ng-show="taskStatus==1">finish</i>
+ <i class="fa fa-spinner" aria-hidden="true" style="margin-top:10px;margin-left:5px;color: #2ecc71;" ng-show="taskStatus==0">runing</i>
+ </div>
+ <div class="box">
+ <div class="line-block" ng-repeat="line in logLines track by $index">
+ <span>{{ line }}</span>
+ </div>
+ </div>
+</div>
+
+<style>
+ .box {
+ width: 90%%;
+ border-radius: 5px;
+ border: 1px solid #e8e8e8;
+ line-height: 180%;
+ margin-top: 20px;
+ }
+
+ .line-block {
+ margin-left: 10px;
+ }
+
+ .content {
+ height: 90%;
+ }
+</style>