3 angular.module('yardStickGui2App')
4 .controller('ReportController', ['$scope', '$state', '$stateParams', 'mainFactory', 'Upload', 'toaster', 'ngDialog',
5 function($scope, $state, $stateParams, mainFactory, Upload, toaster, ngDialog) {
12 getDetailTaskForList();
17 $scope.goBack = function goBack() {
18 window.history.back();
21 function getDetailTaskForList(id) {
22 mainFactory.getTaskDetail().get({
23 'taskId': $stateParams.taskId
24 }).$promise.then(function(response) {
25 if (response.status == 1) {
26 if (response.result.task.status == -1) {
27 response.result.task['stausWidth'] = '5%';
28 } else if (response.result.task.status == 0) {
29 response.result.task['stausWidth'] = '50%';
30 } else if (response.result.task.status == 1) {
31 response.result.task['stausWidth'] = '100%';
32 } else if (response.result.task.status == 2) {
33 response.result.task['stausWidth'] = 'red';
35 $scope.result = response.result.task;
36 $scope.testcaseinfo = response.result.task.result.testcases;
37 var key = Object.keys($scope.testcaseinfo);
38 $scope.testcaseResult = $scope.testcaseinfo[key];
40 $scope.envIdForTask = response.result.task.environment_id;
56 $scope.goToExternal = function goToExternal(id) {
57 var url = Grafana_URL +':'+$scope.jumpPort+'/dashboard/db'+ '/' + id;
59 window.open(url, '_blank');
62 function getItemIdDetail() {
63 $scope.displayContainerInfo = [];
64 mainFactory.ItemDetail().get({
65 'envId': $scope.envIdForTask
66 }).$promise.then(function(response) {
67 if (response.status == 1) {
68 if (response.result.environment.container_id.grafana != null) {
69 getConDetail(response.result.environment.container_id.grafana);
72 $scope.jumpPort = 3000;
87 function getConDetail(id) {
88 mainFactory.containerDetail().get({
90 }).$promise.then(function(response) {
91 if (response.status == 1) {
92 // $scope.podData = response.result;
93 $scope.jumpPort = response.result.container.port;
101 body: 'unknow error',