diff options
author | thuva4 <tharma.thuva@gmail.com> | 2018-03-09 22:42:05 +0530 |
---|---|---|
committer | thuva4 <tharma.thuva@gmail.com> | 2018-03-09 22:42:05 +0530 |
commit | 0326a542bfae2126e8fa087c266bee5253f05991 (patch) | |
tree | 13de448d3f59100d75e2acb26766c0e8f447ec8f /testapi | |
parent | f3a5531761a38cf40d0469209145394b31af2088 (diff) |
Add multple customs to scenario
User can add multiple customs by giving a
comma or space sperated string
JIRA: RELENG-344
Change-Id: I8e4b37fc476f39e10321755f1e67fe3605178406
Signed-off-by: thuva4 <tharma.thuva@gmail.com>
Diffstat (limited to 'testapi')
5 files changed, 16 insertions, 46 deletions
diff --git a/testapi/opnfv_testapi/tests/UI/e2e/scenarioControllerSpec.js b/testapi/opnfv_testapi/tests/UI/e2e/scenarioControllerSpec.js index 14f3089..7777721 100644 --- a/testapi/opnfv_testapi/tests/UI/e2e/scenarioControllerSpec.js +++ b/testapi/opnfv_testapi/tests/UI/e2e/scenarioControllerSpec.js @@ -1040,10 +1040,7 @@ describe('testing the scenarios page for user', function () { buttonAdd.click() var custom = element(by.model('customModalCtrl.custom')); browser.wait(EC.visibilityOf(custom), 5000); - custom.sendKeys('testC'); - var buttonAddCustom = element(by.xpath('//*[@id="ng-app"]/body/div[3]/div/div/div/div[1]/div/fieldset/div/div/div/table/tfoot/tr/td[2]/input')) - buttonAddCustom.click(); - custom.sendKeys('testB'); + custom.sendKeys('testC,testD,'); var buttonOk = element(by.xpath('//*[@id="ng-app"]/body/div[3]/div/div/div/div[2]/button[1]')) buttonOk.click() expect(element(by.cssContainingText(".alert","Customs are successfully updated.")) diff --git a/testapi/opnfv_testapi/ui/components/scenarios/modals/customModal.html b/testapi/opnfv_testapi/ui/components/scenarios/modals/customModal.html index 90e4544..0cd2663 100644 --- a/testapi/opnfv_testapi/ui/components/scenarios/modals/customModal.html +++ b/testapi/opnfv_testapi/ui/components/scenarios/modals/customModal.html @@ -8,18 +8,7 @@ <div class="update-project"> <label for="cpid" class="control-label col-sm-4">Custom: </label> <table cellpadding="0" cellspacing="0"> - <tbody ng-repeat="custom in customModalCtrl.customs"> - <tr> - <td> - <div class="col-sm-12"> - <input type="text" class="form-control" value="{{custom}}" disabled/> - <p class="help-block"></p> - </div> - </td> - <td><input type="button" class="btn btn-danger" ng-click="customModalCtrl.remove($index)" value="Remove" /></td> - </tr> - </tbody> - <tfoot> + <tbody> <tr> <td> <div class="col-sm-12"> @@ -27,9 +16,8 @@ <p class="help-block"></p> </div> </td> - <td><input type="button" class="btn btn-primary" ng-click="customModalCtrl.add()" value="Add" /></td> </tr> - </tfoot> + </tbody> </table> </div> </div> diff --git a/testapi/opnfv_testapi/ui/components/scenarios/modals/projectModal.html b/testapi/opnfv_testapi/ui/components/scenarios/modals/projectModal.html index 0a14be9..171cc33 100644 --- a/testapi/opnfv_testapi/ui/components/scenarios/modals/projectModal.html +++ b/testapi/opnfv_testapi/ui/components/scenarios/modals/projectModal.html @@ -38,7 +38,7 @@ </tr> </thead> <tbody> - <tr ng-repeat-start="(index, custom) in projectModalCtrl.project.customs" style="padding:9px"> + <tr ng-repeat-start="custom in projectModalCtrl.project.customs" style="padding:9px"> <td>{{custom}}</td> </tr> <tr ng-repeat-end=> diff --git a/testapi/opnfv_testapi/ui/components/scenarios/scenario/scenarioController.js b/testapi/opnfv_testapi/ui/components/scenarios/scenario/scenarioController.js index 36e54f5..51f4242 100644 --- a/testapi/opnfv_testapi/ui/components/scenarios/scenario/scenarioController.js +++ b/testapi/opnfv_testapi/ui/components/scenarios/scenario/scenarioController.js @@ -434,35 +434,15 @@ ctrl.confirm = confirm; ctrl.cancel = cancel; ctrl.data = angular.copy(data); - ctrl.open = open; - ctrl.add = add; - ctrl.remove = remove; ctrl.customs = []; - function add() { - var custom = ctrl.custom; - if(custom!="" && custom!=undefined ){ - ctrl.customs.push(custom); - ctrl.custom = ""; - } - }; - - function remove(index) { - // var name = ctrl.customs[index].Name; - ctrl.customs.splice(index, 1); - - } - - /** - * Initiate confirmation and call the success handler with the - * inputs. - */ function confirm() { var custom = ctrl.custom; if(custom!="" && custom!=undefined ){ - ctrl.customs.push(custom); + ctrl.customs = custom.split(/[ ,]+/).filter(Boolean); } + console.log(ctrl.customs) ctrl.data.successHandler(ctrl.customs,ctrl.data.project,ctrl.data.version,ctrl.data.installer); $uibModalInstance.dismiss('cancel'); diff --git a/testapi/opnfv_testapi/ui/components/scenarios/scenariosController.js b/testapi/opnfv_testapi/ui/components/scenarios/scenariosController.js index dff9f26..98e4089 100644 --- a/testapi/opnfv_testapi/ui/components/scenarios/scenariosController.js +++ b/testapi/opnfv_testapi/ui/components/scenarios/scenariosController.js @@ -127,7 +127,6 @@ } function createScenario(scenario) { - console.log(scenario) ctrl.scenarioRequest = $http.post(ctrl.url, scenario).success(function (data){ ctrl.showCreateSuccess = true; @@ -270,7 +269,6 @@ } function openVersionModal(){ - console.log("Hello"); $uibModal.open({ templateUrl: 'testapi-ui/components/scenarios/modals/versionModal.html', controller: 'versionModalCtrl as versionModalCtrl', @@ -383,8 +381,10 @@ $uibModalInstance.dismiss('cancel'); } - function handleModalCustom(custom){ - ctrl.project.customs.push(custom); + function handleModalCustom(customs){ + for (var custom in customs){ + ctrl.project.customs.push(customs[custom]); + } } function openCustomModal(){ @@ -418,6 +418,7 @@ ctrl.cancel = cancel; ctrl.data = angular.copy(data); ctrl.open = open; + ctrl.customs = [] /** @@ -425,7 +426,11 @@ * inputs. */ function confirm() { - ctrl.data.successHandler(ctrl.custom); + var custom = ctrl.custom; + if(custom!="" && custom!=undefined ){ + ctrl.customs = custom.split(/[ ,]+/).filter(Boolean); + } + ctrl.data.successHandler(ctrl.customs); $uibModalInstance.dismiss('cancel'); } |