summaryrefslogtreecommitdiffstats
path: root/testapi/opnfv_testapi/ui/components/scenarios
diff options
context:
space:
mode:
Diffstat (limited to 'testapi/opnfv_testapi/ui/components/scenarios')
-rw-r--r--testapi/opnfv_testapi/ui/components/scenarios/modals/customModal.html18
-rw-r--r--testapi/opnfv_testapi/ui/components/scenarios/modals/projectModal.html2
-rw-r--r--testapi/opnfv_testapi/ui/components/scenarios/scenario/scenario.html4
-rw-r--r--testapi/opnfv_testapi/ui/components/scenarios/scenario/scenarioController.js21
-rw-r--r--testapi/opnfv_testapi/ui/components/scenarios/scenariosController.js31
5 files changed, 50 insertions, 26 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..0cd2663 100644
--- a/testapi/opnfv_testapi/ui/components/scenarios/modals/customModal.html
+++ b/testapi/opnfv_testapi/ui/components/scenarios/modals/customModal.html
@@ -6,11 +6,19 @@
<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>
+ <tr>
+ <td>
+ <div class="col-sm-12">
+ <input type="text" class="form-control" ng-model="customModalCtrl.custom"/>
+ <p class="help-block"></p>
+ </div>
+ </td>
+ </tr>
+ </tbody>
+ </table>
</div>
</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/scenario.html b/testapi/opnfv_testapi/ui/components/scenarios/scenario/scenario.html
index 2a73e9b..4f0a580 100644
--- a/testapi/opnfv_testapi/ui/components/scenarios/scenario/scenario.html
+++ b/testapi/opnfv_testapi/ui/components/scenarios/scenario/scenario.html
@@ -12,6 +12,10 @@
<td width="90%" class="podsTableLeftTd">{{ctrl.data.scenarios[0].name}}</td>
</tr>
<tr style="padding:9px">
+ <td class="podsTableTd">Creator&nbsp;:</td>
+ <td width="90%" class="podsTableLeftTd">{{ctrl.data.scenarios[0].creator}}</td>
+ </tr>
+ <tr style="padding:9px">
<td class="podsTableTd">Created&nbsp;at&nbsp;:</td>
<td width="90%" class="podsTableLeftTd">{{ctrl.data.scenarios[0].creation_date}}</td>
</tr>
diff --git a/testapi/opnfv_testapi/ui/components/scenarios/scenario/scenarioController.js b/testapi/opnfv_testapi/ui/components/scenarios/scenario/scenarioController.js
index 9935649..a0cd5eb 100644
--- a/testapi/opnfv_testapi/ui/components/scenarios/scenario/scenarioController.js
+++ b/testapi/opnfv_testapi/ui/components/scenarios/scenario/scenarioController.js
@@ -219,7 +219,7 @@
var data = {
"installers": installers
}
- confirmModal("Delete",ctrl.deleteInstaller,data);
+ confirmModal("Delete", 'installers', ctrl.deleteInstaller, data);
}
function addInstaller(installer){
@@ -273,7 +273,7 @@
"version": versions,
"installer": installer
}
- confirmModal("Delete",ctrl.deleteVersion,data);
+ confirmModal("Delete", "version", ctrl.deleteVersion, data);
}
function deleteVersion(data){
@@ -359,7 +359,7 @@
"version": version,
"installer": installer
}
- confirmModal("Delete",ctrl.deleteCustom,data);
+ confirmModal("Delete", 'customs', ctrl.deleteCustom, data);
}
function deleteCustom(data){
@@ -402,7 +402,7 @@
"version": version,
"installer": installer
}
- confirmModal("Delete",ctrl.deleteProject,data);
+ confirmModal("Delete", 'projects', ctrl.deleteProject, data);
}
function deleteProject(data){
@@ -434,16 +434,15 @@
ctrl.confirm = confirm;
ctrl.cancel = cancel;
ctrl.data = angular.copy(data);
- ctrl.open = open;
+ ctrl.customs = [];
- /**
- * 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 = 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 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');
}