summaryrefslogtreecommitdiffstats
path: root/gui/app/scripts/controllers/report.controller.js
diff options
context:
space:
mode:
authorchenjiankun <chenjiankun1@huawei.com>2017-07-24 04:13:56 +0000
committerchenjiankun <chenjiankun1@huawei.com>2017-07-27 04:02:50 +0000
commitedbe3568a052da8afd24b6877c4c6fdcc7627ba3 (patch)
tree54e1870ad8171471a97c1e07bd9a0f4146e07bb1 /gui/app/scripts/controllers/report.controller.js
parent869d5fdb0b7a6070a78b4ec21d6b6c1cba14da6c (diff)
Yardstick GUI & GUI deployment
JIRA: YARDSTICK-758 As E release plan, we have the need of yardstick GUI. This patch is GUI front end code and deployment. The backend code is yardstick API. Change-Id: Ib15f78bcc50168c7828beff97256e9939c6da809 Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
Diffstat (limited to 'gui/app/scripts/controllers/report.controller.js')
-rw-r--r--gui/app/scripts/controllers/report.controller.js115
1 files changed, 115 insertions, 0 deletions
diff --git a/gui/app/scripts/controllers/report.controller.js b/gui/app/scripts/controllers/report.controller.js
new file mode 100644
index 000000000..9b6b5958b
--- /dev/null
+++ b/gui/app/scripts/controllers/report.controller.js
@@ -0,0 +1,115 @@
+'use strict';
+
+angular.module('yardStickGui2App')
+ .controller('ReportController', ['$scope', '$state', '$stateParams', 'mainFactory', 'Upload', 'toaster', 'ngDialog',
+ function($scope, $state, $stateParams, mainFactory, Upload, toaster, ngDialog) {
+
+
+ init();
+
+
+ function init() {
+ getDetailTaskForList();
+
+
+
+ }
+ $scope.goBack = function goBack() {
+ window.history.back();
+ }
+
+ function getDetailTaskForList(id) {
+ mainFactory.getTaskDetail().get({
+ 'taskId': $stateParams.taskId
+ }).$promise.then(function(response) {
+ if (response.status == 1) {
+ if (response.result.task.status == -1) {
+ response.result.task['stausWidth'] = '5%';
+ } else if (response.result.task.status == 0) {
+ response.result.task['stausWidth'] = '50%';
+ } else if (response.result.task.status == 1) {
+ response.result.task['stausWidth'] = '100%';
+ } else if (response.result.task.status == 2) {
+ response.result.task['stausWidth'] = 'red';
+ }
+ $scope.result = response.result.task;
+ $scope.testcaseinfo = response.result.task.result.testcases;
+ var key = Object.keys($scope.testcaseinfo);
+ $scope.testcaseResult = $scope.testcaseinfo[key];
+
+ $scope.envIdForTask = response.result.task.environment_id;
+ getItemIdDetail();
+
+
+ }
+ }, function(error) {
+ toaster.pop({
+ type: 'error',
+ title: 'fail',
+ body: 'unknow error',
+ timeout: 3000
+ });
+
+ })
+ }
+
+ $scope.goToExternal = function goToExternal(id) {
+ var url = External_URL + ':' + $scope.jumpPort + '/dashboard/db' + '/' + id;
+
+ window.open(url, '_blank');
+ }
+
+ function getItemIdDetail() {
+ $scope.displayContainerInfo = [];
+ mainFactory.ItemDetail().get({
+ 'envId': $scope.envIdForTask
+ }).$promise.then(function(response) {
+ if (response.status == 1) {
+ if (response.result.environment.container_id.grafana != null) {
+ getConDetail(response.result.environment.container_id.grafana);
+
+ } else {
+ $scope.jumpPort = 3000;
+ }
+
+
+ }
+ }, function(error) {
+ toaster.pop({
+ type: 'error',
+ title: 'fail',
+ body: 'unknow error',
+ timeout: 3000
+ });
+ })
+ }
+
+ function getConDetail(id) {
+ mainFactory.containerDetail().get({
+ 'containerId': id
+ }).$promise.then(function(response) {
+ if (response.status == 1) {
+ // $scope.podData = response.result;
+ $scope.jumpPort = response.result.container.port;
+
+ }
+
+ }, function(error) {
+ toaster.pop({
+ type: 'error',
+ title: 'fail',
+ body: 'unknow error',
+ timeout: 3000
+ });
+ })
+
+ }
+
+
+
+
+
+
+
+ }
+ ]);