diff options
author | chenjiankun <chenjiankun1@huawei.com> | 2018-03-16 02:44:42 +0000 |
---|---|---|
committer | chenjiankun <chenjiankun1@huawei.com> | 2018-03-16 02:44:42 +0000 |
commit | 4b8f53542a6871c863fbaba16dd5e0e35cf05ce5 (patch) | |
tree | ed9175591b81fe3ce566bfaf8599d59d722c2bd2 /gui/app | |
parent | c3f91fac56cd938c408c62ff44f5ff039b1fd8e6 (diff) |
Add SUT page in GUI
JIRA: YARDSTICK-1076
We need to show SUT information in GUI.
Change-Id: I885773894fc9f6aa5975b39383af1fdf1b88b8bb
Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
Diffstat (limited to 'gui/app')
-rw-r--r-- | gui/app/index.html | 1 | ||||
-rw-r--r-- | gui/app/scripts/controllers/container.controller.js | 5 | ||||
-rw-r--r-- | gui/app/scripts/controllers/content.controller.js | 7 | ||||
-rw-r--r-- | gui/app/scripts/controllers/sut.controller.js | 58 | ||||
-rw-r--r-- | gui/app/scripts/factory/main.factory.js | 7 | ||||
-rw-r--r-- | gui/app/scripts/router.config.js | 9 | ||||
-rw-r--r-- | gui/app/views/container.html | 2 | ||||
-rw-r--r-- | gui/app/views/layout/sideNav.html | 5 | ||||
-rw-r--r-- | gui/app/views/sut.html | 33 |
9 files changed, 125 insertions, 2 deletions
diff --git a/gui/app/index.html b/gui/app/index.html index d959b14d2..2ea1cabe7 100644 --- a/gui/app/index.html +++ b/gui/app/index.html @@ -93,6 +93,7 @@ <script src="scripts/controllers/detail.controller.js"></script> <script src="scripts/controllers/image.controller.js"></script> <script src="scripts/controllers/pod.controller.js"></script> + <script src="scripts/controllers/sut.controller.js"></script> <script src="scripts/controllers/container.controller.js"></script> <script src="scripts/controllers/testcase.controller.js"></script> <script src="scripts/controllers/testcasedetail.controller.js"></script> diff --git a/gui/app/scripts/controllers/container.controller.js b/gui/app/scripts/controllers/container.controller.js index 3ad200a91..a7d5f0309 100644 --- a/gui/app/scripts/controllers/container.controller.js +++ b/gui/app/scripts/controllers/container.controller.js @@ -127,10 +127,15 @@ angular.module('yardStickGui2App') function chooseResult(name) { $scope.selectContainer = name; } + $scope.goBack = function goBack() { $state.go('app.projectList'); } + $scope.goNext = function goNext() { + $state.go('app.sut', {uuid: $scope.uuid}); + } + $scope.openDeleteEnv = function openDeleteEnv(id, name) { $scope.deleteName = name; $scope.deleteId = id; diff --git a/gui/app/scripts/controllers/content.controller.js b/gui/app/scripts/controllers/content.controller.js index 0288fa540..90a3f1433 100644 --- a/gui/app/scripts/controllers/content.controller.js +++ b/gui/app/scripts/controllers/content.controller.js @@ -49,6 +49,7 @@ angular.module('yardStickGui2App') $scope.gotoOpenrcPage = gotoOpenrcPage; $scope.gotoPodPage = gotoPodPage; $scope.gotoContainerPage = gotoContainerPage; + $scope.gotoSUTPage = gotoSUTPage; $scope.gotoTestcase = gotoTestcase; $scope.gotoEnviron = gotoEnviron; $scope.gotoSuite = gotoSuite; @@ -95,6 +96,12 @@ angular.module('yardStickGui2App') $state.go('app.container', { uuid: $scope.uuid }); } + function gotoSUTPage() { + $scope.path = $location.path(); + $scope.uuid = $scope.path.split('/').pop(); + $state.go('app.sut', { uuid: $scope.uuid }); + } + function gotoTestcase() { $state.go('app.testcase'); } diff --git a/gui/app/scripts/controllers/sut.controller.js b/gui/app/scripts/controllers/sut.controller.js new file mode 100644 index 000000000..092aabc41 --- /dev/null +++ b/gui/app/scripts/controllers/sut.controller.js @@ -0,0 +1,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 }); + } + + } + ]); diff --git a/gui/app/scripts/factory/main.factory.js b/gui/app/scripts/factory/main.factory.js index 7637a9ff3..16e9c81fe 100644 --- a/gui/app/scripts/factory/main.factory.js +++ b/gui/app/scripts/factory/main.factory.js @@ -58,6 +58,13 @@ angular.module('yardStickGui2App') } }) }, + SUTDetail: function() { + return $resource(Base_URL + '/api/v2/yardstick/environments/:envId/sut', { envId: "@envId" }, { + 'get': { + method: 'GET' + } + }) + }, ImageDetail: function() { return $resource(Base_URL + '/api/v2/yardstick/images/:image_id', { image_id: "@image_id" }, { 'get': { diff --git a/gui/app/scripts/router.config.js b/gui/app/scripts/router.config.js index da2eb086b..75d5372fb 100644 --- a/gui/app/scripts/router.config.js +++ b/gui/app/scripts/router.config.js @@ -116,6 +116,15 @@ angular.module('yardStickGui2App') label: 'Container Manage' } }) + .state('app.sut', { + url: '/envsut/:uuid', + templateUrl: 'views/sut.html', + controller: 'SUTController', + params: { uuid: null }, + ncyBreadcrumb: { + label: 'SUT Manage' + } + }) .state('app.projectList', { url: '/project', templateUrl: 'views/projectList.html', diff --git a/gui/app/views/container.html b/gui/app/views/container.html index b3d78bfb1..ea5902996 100644 --- a/gui/app/views/container.html +++ b/gui/app/views/container.html @@ -5,7 +5,7 @@ <div style="width:750px;"> <h3>{{envName}} -- Container - <!--<button class="btn btn-default" style="float:right">Go Next</button>--> + <button class="btn btn-default" ng-click="goNext()" style="float:right">Next</button> </h3> <!--<p>In this process, you can input your define openrc config or upload a openrc file</p>--> diff --git a/gui/app/views/layout/sideNav.html b/gui/app/views/layout/sideNav.html index 6c4426307..2333d22d5 100644 --- a/gui/app/views/layout/sideNav.html +++ b/gui/app/views/layout/sideNav.html @@ -42,6 +42,9 @@ <div class="panel-body " style="border:none;text-align: right;cursor:pointer" ng-click="gotoContainerPage()" ng-class="{active:$state.includes('app.container')}"> Container </div> + <div class="panel-body " style="border:none;text-align: right;cursor:pointer" ng-click="gotoSUTPage()" ng-class="{active:$state.includes('app.sut')}"> + SUT + </div> <div class="panel-body " style="border:none;text-align: right;"> Others </div> @@ -151,4 +154,4 @@ .active.panel-body { background-color: #dfe3e4; } -</style>
\ No newline at end of file +</style> diff --git a/gui/app/views/sut.html b/gui/app/views/sut.html new file mode 100644 index 000000000..8cf1fcd6c --- /dev/null +++ b/gui/app/views/sut.html @@ -0,0 +1,33 @@ +<!--sut management--> + +<div class="content"> + <div style="display:flex;flex-direction:row;"> + <div style="width:750px;"> + + <h3>{{envName}} -- SUT + <!--<button class="btn btn-default" style="float:right">Go Next</button>--> + + </h3> + + <h2>Hosts</h2> + <div ng-repeat="(host, info) in sutInfo"> + <hr/> + <div class="results-table" style="margin-top:30px;"> + <table class="table table-striped table-hover"> + <tbody style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis;"> + <tr ng-repeat="record in info"> + <td>{{ record[0] }}</td> + <td>{{ record[1] }}</td> + </tr> + </tbody> + </table> + </div> + </div> + </div> + </div> + +</div> +<toaster-container></toaster-container> + +<style> +</style> |