aboutsummaryrefslogtreecommitdiffstats
path: root/gui/app/scripts/controllers/content.controller.js
blob: 0288fa5401700d595b924b9d7912186f5b1f7ef7 (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
137
138
139
140
141
142
143
144
'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.ifshowEnvChild = false;

            $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;
                } else if (location.hash.indexOf('envDetail') > -1 || location.hash.indexOf('envimageDetail') > -1 ||
                    location.hash.indexOf('envpodupload') > -1 || location.hash.indexOf('envcontainer') > -1) {
                    $scope.ifshowEnvChild = true;
                    $scope.activeStatus=0;
                }else{
                    $scope.ifshowEnvChild=false;
                    $scope.activeStatus=-1;
                }

            })


            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('app.testcase');
            }

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

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

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

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

            function gotoReport() {
                $state.go('app.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('app.environment');
                    return;
                } else {
                    window.history.back();
                }

            }






        }
    ]);