summaryrefslogtreecommitdiffstats
path: root/testapi/opnfv_testapi/ui/components/scenarios/scenariosController.js
diff options
context:
space:
mode:
Diffstat (limited to 'testapi/opnfv_testapi/ui/components/scenarios/scenariosController.js')
-rw-r--r--testapi/opnfv_testapi/ui/components/scenarios/scenariosController.js31
1 files changed, 22 insertions, 9 deletions
diff --git a/testapi/opnfv_testapi/ui/components/scenarios/scenariosController.js b/testapi/opnfv_testapi/ui/components/scenarios/scenariosController.js
index fd137e5..98e4089 100644
--- a/testapi/opnfv_testapi/ui/components/scenarios/scenariosController.js
+++ b/testapi/opnfv_testapi/ui/components/scenarios/scenariosController.js
@@ -65,7 +65,7 @@
}
function openDeleteModal(name){
- confirmModal("Delete",ctrl.deleteScenario,name);
+ confirmModal("Delete", 'scenarios', ctrl.deleteScenario,name);
}
function deleteScenario(name){
@@ -82,15 +82,23 @@
}
function openBatchDeleteModal(){
- confirmModal("Delete",ctrl.deleteBatchScenario);
+ var deleteObjects = []
+ ctrl.checkBox.forEach(function(scenario, index){
+ if(!ctrl.showError){
+ if(scenario){
+ deleteObjects.push(ctrl.data.scenarios[index].name);
+ }
+ }
+ });
+ confirmModal("Delete", 'scenarios', ctrl.deleteBatchScenario, deleteObjects);
}
function deleteBatchScenario(){
var index;
var checkedBox = [];
- ctrl.checkBox.forEach(function(project, index){
+ ctrl.checkBox.forEach(function(scenario, index){
if(!ctrl.showError){
- if(project){
+ if(scenario){
deleteScenario(ctrl.data.scenarios[index].name);
}
}
@@ -119,7 +127,6 @@
}
function createScenario(scenario) {
- console.log(scenario)
ctrl.scenarioRequest =
$http.post(ctrl.url, scenario).success(function (data){
ctrl.showCreateSuccess = true;
@@ -262,7 +269,6 @@
}
function openVersionModal(){
- console.log("Hello");
$uibModal.open({
templateUrl: 'testapi-ui/components/scenarios/modals/versionModal.html',
controller: 'versionModalCtrl as versionModalCtrl',
@@ -375,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(){
@@ -410,6 +418,7 @@
ctrl.cancel = cancel;
ctrl.data = angular.copy(data);
ctrl.open = open;
+ ctrl.customs = []
/**
@@ -417,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');
}