summaryrefslogtreecommitdiffstats
path: root/gui/app/scripts/controllers/content.controller.js
blob: d2bc19eea46ed5f6406dd36e3d91c3a426bce5d3 (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
126
127
128
129
130
131
132
133
134
135
136
'use strict';

angular.module('yardStickGui2App')
    .controller('ContentController', ['$scope', '$state', '$stateParams', 'mainFactory', 'Upload', 'toaster', '$location', '$localStorage',
        function($scope, $state, $stateParams, mainFactory, Upload, toaster, $location, $localStorage) {




            init();
            $scope.showEnvironment = false;
            $scope.counldGoDetail = false;
            $scope.activeStatus = 0;

            $scope.$watch(function() {
                return location.hash
            }, function(newvalue, oldvalue) {
                if (location.hash.indexOf('project') > -1) {
                    $scope.projectShow = true;
                    $scope.taskShow = false;
                    $scope.reportShow = false;
                } else if (location.hash.indexOf('task') > -1) {
                    $scope.taskShow = true;
                    $scope.projectShow = true;
                } else if (location.hash.indexOf('report') > -1) {
                    $scope.reportShow = true;
                    $scope.taskShow = true;
                    $scope.projectShow = true;
                }

            })


            function init() {


                $scope.showEnvironments = showEnvironments;
                $scope.showSteps = $location.path().indexOf('project');
                $scope.test = test;
                $scope.gotoUploadPage = gotoUploadPage;
                $scope.gotoOpenrcPage = gotoOpenrcPage;
                $scope.gotoPodPage = gotoPodPage;
                $scope.gotoContainerPage = gotoContainerPage;
                $scope.gotoTestcase = gotoTestcase;
                $scope.gotoEnviron = gotoEnviron;
                $scope.gotoSuite = gotoSuite;
                $scope.gotoProject = gotoProject;
                $scope.gotoTask = gotoTask;
                $scope.gotoReport = gotoReport;
                $scope.stepsStatus = $localStorage.stepsStatus;
                $scope.goBack = goBack;


            }



            function showEnvironments() {
                $scope.showEnvironment = true;
            }

            function test() {
                alert('test');
            }

            function gotoOpenrcPage() {
                $scope.path = $location.path();
                $scope.uuid = $scope.path.split('/').pop();
                $state.go('app.environmentDetail', { uuid: $scope.uuid })
            }

            function gotoUploadPage() {
                $scope.path = $location.path();
                $scope.uuid = $scope.path.split('/').pop();
                $state.go('app.uploadImage', { uuid: $scope.uuid });
            }

            function gotoPodPage() {
                $scope.path = $location.path();
                $scope.uuid = $scope.path.split('/').pop();
                $state.go('app.podUpload', { uuid: $scope.uuid });
            }

            function gotoContainerPage() {
                $scope.path = $location.path();
                $scope.uuid = $scope.path.split('/').pop();
                $state.go('app.container', { uuid: $scope.uuid });
            }

            function gotoTestcase() {
                $state.go('app2.testcase');
            }

            function gotoEnviron() {
                if ($location.path().indexOf('env') > -1 || $location.path().indexOf('environment') > -1) {
                    $scope.counldGoDetail = true;
                }
                $state.go('app2.environment');
            }

            function gotoSuite() {
                $state.go('app2.testsuite');
            }

            function gotoProject() {
                $state.go('app2.projectList');
            }

            function gotoTask() {
                $state.go('app2.tasklist');
            }

            function gotoReport() {
                $state.go('app2.report');
            }

            function goBack() {
                if ($location.path().indexOf('main/environment')) {
                    return;
                } else if ($location.path().indexOf('main/envDetail/') || $location.path().indexOf('main/imageDetail/') ||
                    $location.path().indexOf('main/podupload/') || $location.path().indexOf('main/container/')) {
                    $state.go('app2.environment');
                    return;
                } else {
                    window.history.back();
                }

            }






        }
    ]);