From 1fe11fb48972ce30b21a4423244642f0ed391b0c Mon Sep 17 00:00:00 2001 From: thuva4 Date: Sun, 11 Feb 2018 16:31:48 +0530 Subject: 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 --- .../scenarios/scenario/scenarioController.js | 23 ++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'testapi/opnfv_testapi/ui/components/scenarios/scenario') 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'); -- cgit 1.2.3-korg