diff options
Diffstat (limited to 'gui')
-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/projectDetail.controller.js | 34 | ||||
-rw-r--r-- | gui/app/scripts/controllers/sut.controller.js | 58 | ||||
-rw-r--r-- | gui/app/scripts/controllers/taskModify.controller.js | 63 | ||||
-rw-r--r-- | gui/app/scripts/factory/main.factory.js | 15 | ||||
-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/modal/taskCreate.html | 19 | ||||
-rw-r--r-- | gui/app/views/sut.html | 33 | ||||
-rw-r--r-- | gui/app/views/taskmodify.html | 23 |
13 files changed, 245 insertions, 29 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/projectDetail.controller.js b/gui/app/scripts/controllers/projectDetail.controller.js index e8468045d..353e02bcf 100644 --- a/gui/app/scripts/controllers/projectDetail.controller.js +++ b/gui/app/scripts/controllers/projectDetail.controller.js @@ -439,15 +439,36 @@ angular.module('yardStickGui2App') $scope.displayTable = false; $scope.contentInfo = response.result.testcase; + $scope.optionalParams = response.result.args; } }, function(error) { - toaster.pop({ - type: 'error', - title: 'fail', - body: 'unknow error', - timeout: 3000 - }); + mainFactory.errorHandler2(error); + }) + } + + + function addParamsToTask(){ + var params = {} + angular.forEach($scope.optionalParams, function(value, name){ + if(value.value){ + params[name] = value.value; + } + }); + + mainFactory.taskAddParams().put({ + 'taskId': $scope.newUUID, + 'action': 'add_params', + 'args': { + 'params': params + } + }).$promise.then(function(resp) { + if (resp.status == 1) { + } else { + mainFactory.errorHandler1(resp); + } + }, function(error) { + mainFactory.errorHandler2(error); }) } @@ -530,6 +551,7 @@ angular.module('yardStickGui2App') function confirmAddCaseOrSuite(content) { if ($scope.selectType.name == "Test Case") { addCasetoTask(content); + addParamsToTask(); } else { addSuitetoTask(content); } 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/controllers/taskModify.controller.js b/gui/app/scripts/controllers/taskModify.controller.js index 757d65866..c9672fea8 100644 --- a/gui/app/scripts/controllers/taskModify.controller.js +++ b/gui/app/scripts/controllers/taskModify.controller.js @@ -20,6 +20,7 @@ angular.module('yardStickGui2App') $scope.constructTestSuit = constructTestSuit; $scope.constructTestCase = constructTestCase; $scope.getTestDeatil = getTestDeatil; + $scope.getTestcaseArgs = getTestcaseArgs; $scope.confirmToServer = confirmToServer; $scope.addEnvToTask = addEnvToTask; } @@ -46,6 +47,8 @@ angular.module('yardStickGui2App') getItemIdDetail($scope.taskDetailData.environment_id); } + getTestcaseArgs(); + } }, function(error) { toaster.pop({ @@ -277,7 +280,6 @@ angular.module('yardStickGui2App') function getTestDeatil() { - if ($scope.selectType.name == 'Test Case') { getTestcaseDetail(); } else { @@ -307,6 +309,29 @@ angular.module('yardStickGui2App') } + function getTestcaseArgs(){ + mainFactory.getTestcaseDetail().get({ + 'testcasename': $scope.taskDetailData.case_name + }).$promise.then(function(resp){ + if(resp.status == 1){ + $scope.optionalParams = resp.result.args; + var params = $scope.taskDetailData.params; + if(params){ + angular.forEach($scope.optionalParams, function(value, name){ + if(name in params){ + value.value = params[name]; + } + }); + } + }else{ + mainFactory.errorHandler1(resp); + } + }, function(error){ + mainFactory.errorHandler2(error); + }); + } + + function getTestcaseDetail() { mainFactory.getTestcaseDetail().get({ 'testcasename': $scope.selectCase @@ -316,15 +341,13 @@ angular.module('yardStickGui2App') $scope.displayTable = false; $scope.contentInfo = response.result.testcase; + $scope.optionalParams = response.result.args; + }else{ + mainFactory.errorHandler1(response); } }, function(error) { - toaster.pop({ - type: 'error', - title: 'fail', - body: 'unknow error', - timeout: 3000 - }); + mainFactory.errorHandler2(error); }) } @@ -426,12 +449,38 @@ angular.module('yardStickGui2App') if ($scope.selectCase == 'Test Case' || $scope.taskDetailData.suite == false) { addCasetoTask(content); + addParamsToTask(); } else { addSuitetoTask(content); } } + function addParamsToTask(){ + var params = {} + angular.forEach($scope.optionalParams, function(value, name){ + if(value.value){ + params[name] = value.value; + } + }); + + mainFactory.taskAddParams().put({ + 'taskId': $stateParams.taskId, + 'action': 'add_params', + 'args': { + 'params': params + } + }).$promise.then(function(resp) { + if (resp.status == 1) { + } else { + mainFactory.errorHandler1(resp); + } + }, function(error) { + mainFactory.errorHandler2(error); + }) + } + + function addEnvToTask() { mainFactory.taskAddEnv().put({ diff --git a/gui/app/scripts/factory/main.factory.js b/gui/app/scripts/factory/main.factory.js index 7637a9ff3..f75369336 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': { @@ -214,6 +221,14 @@ angular.module('yardStickGui2App') } }) }, + + taskAddParams: function() { + return $resource(Base_URL + '/api/v2/yardstick/tasks/:taskId', { taskId: "@taskId" }, { + 'put': { + method: 'PUT' + } + }) + }, //delete operate deleteEnv: function() { return $resource(Base_URL + '/api/v2/yardstick/environments/:env_id', { env_id: '@env_id' }, { 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/modal/taskCreate.html b/gui/app/views/modal/taskCreate.html index 2d7f1dc3b..ab6ff0ca1 100644 --- a/gui/app/views/modal/taskCreate.html +++ b/gui/app/views/modal/taskCreate.html @@ -80,13 +80,20 @@ </div> </div> - <div ng-show="displayTable==false"> - <textarea ng-model="contentInfo" spellcheck="false"> - - - </textarea> - + <div ng-show="displayTable==false" style="display:flex;flex-direction:row;justify-content:space-between;margin-top:10px;"> + <textarea class="col-md-8" ng-model="contentInfo" style="margin-top:5px;" spellcheck="false"></textarea> + <div class="col-md-4" style="border:1px solid #e8e8e8;margin-top:5px;margin-left:10px;padding-top:30px;"> + <h4>Optional Paramters:</h4> + <form class="form-horizontal col-md-offset-2" style="margin-top:20px"> + <div ng-repeat="(name, value) in optionalParams" class="form-group"> + <label for="param{{$index}}" class="col-md-5" style="font-weight:normal;">{{ name }}:</label> + <div class="col-md-5"> + <input type="text" ng-model="value.value" class="form-control" id="param{{$index}}"> + </div> + </div> + </form> + </div> </div> 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> diff --git a/gui/app/views/taskmodify.html b/gui/app/views/taskmodify.html index d12df4ba2..24b3d945f 100644 --- a/gui/app/views/taskmodify.html +++ b/gui/app/views/taskmodify.html @@ -42,11 +42,20 @@ <button class="btn btn-default" style="float:right" ng-disabled="sourceShow==null" ng-click="confirmToServer(contentInfo,taskDetailData.content)">Confirm</button> </div> - - <textarea ng-model="taskDetailData.content" ng-show="sourceShow==false" style="margin-top:5px;" spellcheck="false"> - - - </textarea> + <div ng-show="sourceShow==false" style="display:flex;flex-direction:row;justify-content:space-between;margin-top:10px;"> + <textarea class="col-md-8" ng-model="taskDetailData.content" style="margin-top:5px;" spellcheck="false"></textarea> + <div class="col-md-4" style="border:1px solid #e8e8e8;margin-top:5px;margin-left:10px;padding-top:30px;"> + <h4>Optional Paramters:</h4> + <form class="form-horizontal col-md-offset-2" style="margin-top:20px"> + <div ng-repeat="(name, value) in optionalParams" class="form-group"> + <label for="param{{$index}}" class="col-md-5" style="font-weight:normal;">{{ name }}:</label> + <div class="col-md-5"> + <input type="text" ng-model="value.value" class="form-control" id="param{{$index}}"> + </div> + </div> + </form> + </div> + </div> <div ng-show="sourceShow==true"> <div style="display:flex;flex-direction:row"> @@ -102,9 +111,7 @@ <div ng-show="displayTable==false"> <textarea ng-model="contentInfo" spellcheck="false"> - </textarea> - - + </textarea> </div> </div> |