aboutsummaryrefslogtreecommitdiffstats
path: root/gui/app/scripts/controllers/sut.controller.js
blob: 092aabc41b95690a78f9d6b804122100be4d8626 (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
'use strict';

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


            init();
            $scope.showloading = false;
            $scope.loadingOPENrc = false;

            function init() {


                $scope.uuid = $stateParams.uuid;
                $scope.sutInfo = {};
                getItemIdDetail();
                getSUTDetail();

            }

            function getItemIdDetail() {
                mainFactory.ItemDetail().get({
                    'envId': $scope.uuid
                }).$promise.then(function(response) {
                    if (response.status == 1) {
                        $scope.envName = response.result.environment.name;
                    }else{
                        mainFactory.errorHandler1(response);
                    }
                }, function(error) {
                    mainFactory.errorHandler2(error);
                })
            }

            function getSUTDetail(){
                mainFactory.SUTDetail().get({
                    'envId': $scope.uuid
                }).$promise.then(function(resp){
                    $scope.sutInfo = resp.result.sut;
                    console.log($scope.sutInfo);
                }, function(error){
                })
            }

            $scope.goBack = function goBack() {
                $state.go('app.projectList');
            }


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

        }
    ]);