diff options
author | thuva4 <tharma.thuva@gmail.com> | 2018-02-11 16:31:48 +0530 |
---|---|---|
committer | thuva4 <tharma.thuva@gmail.com> | 2018-02-11 16:34:23 +0530 |
commit | 1fe11fb48972ce30b21a4423244642f0ed391b0c (patch) | |
tree | 66663e52fed37c2a28d0aaf4bdf76fa8fa0ab42c /testapi/opnfv_testapi/ui/components | |
parent | 86f8a2036521e9401d8c9431e4b6412878e6d94f (diff) |
Add multiple customs in scenario page
implement function to add multiple customs with
a single add button click
JIRA: RELENG-344
Change-Id: I7c4ac409ee5d78a6a01b242368b02813f0df400f
Signed-off-by: thuva4 <tharma.thuva@gmail.com>
Diffstat (limited to 'testapi/opnfv_testapi/ui/components')
-rw-r--r-- | testapi/opnfv_testapi/ui/components/scenarios/modals/customModal.html | 30 | ||||
-rw-r--r-- | testapi/opnfv_testapi/ui/components/scenarios/scenario/scenarioController.js | 23 |
2 files changed, 46 insertions, 7 deletions
diff --git a/testapi/opnfv_testapi/ui/components/scenarios/modals/customModal.html b/testapi/opnfv_testapi/ui/components/scenarios/modals/customModal.html index 987cb1e..90e4544 100644 --- a/testapi/opnfv_testapi/ui/components/scenarios/modals/customModal.html +++ b/testapi/opnfv_testapi/ui/components/scenarios/modals/customModal.html @@ -6,11 +6,31 @@ <legend>{{customModalCtrl.data.text}}</legend> <div class="row"> <div class="update-project"> - <label for="cpid" class="control-label col-sm-4">Custom: </label> - <div class="col-sm-6"> - <input type="text" class="form-control" ng-model="customModalCtrl.custom"/> - <p class="help-block"></p> - </div> + <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> + <tr> + <td> + <div class="col-sm-12"> + <input type="text" class="form-control" ng-model="customModalCtrl.custom"/> + <p class="help-block"></p> + </div> + </td> + <td><input type="button" class="btn btn-primary" ng-click="customModalCtrl.add()" value="Add" /></td> + </tr> + </tfoot> + </table> </div> </div> </div> diff --git a/testapi/opnfv_testapi/ui/components/scenarios/scenario/scenarioController.js b/testapi/opnfv_testapi/ui/components/scenarios/scenario/scenarioController.js index 53eb13a..b76f63c 100644 --- a/testapi/opnfv_testapi/ui/components/scenarios/scenario/scenarioController.js +++ b/testapi/opnfv_testapi/ui/components/scenarios/scenario/scenarioController.js @@ -435,15 +435,34 @@ 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() { - ctrl.customs = [] - ctrl.customs.push(ctrl.custom) + var custom = ctrl.custom; + if(custom!="" && custom!=undefined ){ + ctrl.customs.push(custom); + } ctrl.data.successHandler(ctrl.customs,ctrl.data.project,ctrl.data.version,ctrl.data.installer); $uibModalInstance.dismiss('cancel'); |