summaryrefslogtreecommitdiffstats
path: root/utils/test/reporting/pages/app/scripts/controllers/testvisual.controller.js
blob: 894e10f775722fa76ad0a48ea03954cdb23a84a4 (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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
'use strict';

/**
 * @ngdoc function
 * @name opnfvdashBoardAngularApp.controller:testVisualController
 * @description
 * # TableController
 * Controller of the opnfvdashBoardAngularApp
 */
angular.module('opnfvApp')
    .controller('testVisualController', ['$scope', '$state', '$stateParams', 'TableFactory', 'ngDialog', '$http', '$loading',
        function($scope, $state, $stateParams, TableFactory, ngDialog, $http, $loading) {
            $scope.dovet = "50,168,177,443";
            $scope.functest = "194,173,356,442";
            $scope.yardstick = "377,183,521,412";
            $scope.vsperf = "542,185,640,414";
            $scope.stor = "658,187,750,410";
            $scope.qtip = "769,190,852,416";
            $scope.bottlenecks = "870,192,983,419";
            $scope.noPopArea1 = "26,8,1190,180";
            $scope.noPopArea2 = "1018,193,1190,590";
            $scope.noPopArea3 = "37,455,1003,584";

            init();
            $scope.showSelectValue = 0;
            $scope.scenarioList = ["os_nosdn_kvm_noha", "os_nosdn_kvm_no", "os_nosdn_kvm_"];

            function init() {
                $scope.myTrigger = myTrigger;
                $scope.openTestDetail = openTestDetail;
                $scope.pop = pop;
                $scope.getDetail = getDetail;
                getUrl();



            }

            function myTrigger(name) {
                $loading.start('Key');
                $scope.tableData = null;
                $scope.modalName = name;

                TableFactory.getProjectTestCases(name).then(function(response) {
                    if (response.status == 200) {
                        $scope.tableData = response.data;

                        $scope.tableData = constructObjectArray($scope.tableData);
                        console.log($scope.tableData);
                        $loading.finish('Key');
                    }
                }, function(error) {

                })

            }

            //construct key value for tableData
            function constructObjectArray(array) {
                var templateArray = [];
                for (var i = 0; i < array.length; i++) {
                    var key = Object.keys(array[i])[0];
                    var value = array[i][key];
                    var temp = {
                        'key': key,
                        'value': value
                    };
                    templateArray.push(temp);

                }

                return templateArray;
            }

            function getDetail(casename) {
                TableFactory.getProjectTestCaseDetail().get({
                    'project': $scope.modalName,
                    'testcase': casename
                }).$promise.then(function(response) {
                    if (response != null) {
                        $scope.name_modal = response.name;
                        $scope.description_modal = response.description;
                        openTestDetail();
                    }
                })

            }


            function openTestDetail() {
                ngDialog.open({
                    template: 'views/modal/testcasedetail.html',
                    className: 'ngdialog-theme-default',
                    scope: $scope,
                    showClose: false
                })
            }

            function getUrl() {
                TableFactory.getProjectUrl().get({

                }).$promise.then(function(response) {
                    if (response != null) {
                        $scope.functesturl = response.functest;
                        $scope.yardstickurl = response.yardstick;
                        $scope.vsperfurl = response.vsperf;
                        $scope.storperfurl = response.storperf;
                        $scope.qtipurl = response.qtip;
                        $scope.bottlenecksurl = response.bottlenecks;
                        $scope.doveturl = null;
                    }
                })
            }










        }
    ]);