summaryrefslogtreecommitdiffstats
path: root/testapi/opnfv_testapi
diff options
context:
space:
mode:
authorthuva4 <tharma.thuva@gmail.com>2018-02-23 11:57:55 +0530
committerthuva4 <tharma.thuva@gmail.com>2018-02-23 11:57:55 +0530
commit46c625505ef01ea23c807e37237e3af5a9a23373 (patch)
treefb8bfa8f2116d21bd429b0d45d197cee97f31ea3 /testapi/opnfv_testapi
parent86f8a2036521e9401d8c9431e4b6412878e6d94f (diff)
Add resource name in confirm modal
Add resorce(Pod) name in delete confime modal in a line JIRA: RELENG-342 Change-Id: I629afc85bc7868fca19dce64c2c57eb195eaade7 Signed-off-by: thuva4 <tharma.thuva@gmail.com>
Diffstat (limited to 'testapi/opnfv_testapi')
-rw-r--r--testapi/opnfv_testapi/ui/components/pods/podsController.js11
-rw-r--r--testapi/opnfv_testapi/ui/shared/alerts/confirmModal.html2
-rw-r--r--testapi/opnfv_testapi/ui/shared/alerts/confirmModalFactory.js26
3 files changed, 33 insertions, 6 deletions
diff --git a/testapi/opnfv_testapi/ui/components/pods/podsController.js b/testapi/opnfv_testapi/ui/components/pods/podsController.js
index 95e3571..38e084d 100644
--- a/testapi/opnfv_testapi/ui/components/pods/podsController.js
+++ b/testapi/opnfv_testapi/ui/components/pods/podsController.js
@@ -137,7 +137,6 @@
function batchDelete(){
var index;
var checkedBox = [];
- console.log(ctrl.checkBox)
for(index in ctrl.checkBox){
if(!ctrl.showError){
if(ctrl.checkBox[index]){
@@ -153,7 +152,13 @@
* message
*/
function openBatchDeleteModal() {
- confirmModal("Delete",ctrl.batchDelete);
+ var deleteObjects = []
+ for(var index in ctrl.checkBox){
+ if(ctrl.checkBox[index]){
+ deleteObjects.push(ctrl.data.pods[index].name)
+ }
+ }
+ confirmModal("Delete", 'pods', ctrl.batchDelete, deleteObjects);
}
/**
@@ -162,7 +167,7 @@
*/
function openDeleteModal(name) {
console.log(name)
- confirmModal("Delete", ctrl.podDelete, name);
+ confirmModal("Delete", 'pod', ctrl.podDelete, name);
}
/**
diff --git a/testapi/opnfv_testapi/ui/shared/alerts/confirmModal.html b/testapi/opnfv_testapi/ui/shared/alerts/confirmModal.html
index e5397e0..417af37 100644
--- a/testapi/opnfv_testapi/ui/shared/alerts/confirmModal.html
+++ b/testapi/opnfv_testapi/ui/shared/alerts/confirmModal.html
@@ -10,7 +10,7 @@
</div>
<div class="Delete" ng-class="{ 'hidden': confirmModal.data.text!='Delete' }">
<div class="form-group">
- <label for="confirmText"> You are about to delete.</label>
+ <label for="confirmText"> You are about to delete following {{confirmModal.data.resource}} : {{confirmModal.deleteObjects}} </label>
<br>
Do you want to proceed?
</div>
diff --git a/testapi/opnfv_testapi/ui/shared/alerts/confirmModalFactory.js b/testapi/opnfv_testapi/ui/shared/alerts/confirmModalFactory.js
index 5e79775..5b0b3e2 100644
--- a/testapi/opnfv_testapi/ui/shared/alerts/confirmModalFactory.js
+++ b/testapi/opnfv_testapi/ui/shared/alerts/confirmModalFactory.js
@@ -11,7 +11,7 @@
* Opens confirm modal dialog with input textbox
*/
function confirmModal($uibModal) {
- return function(text, successHandler, name) {
+ return function(text, resource, successHandler, name) {
$uibModal.open({
templateUrl: '/testapi-ui/shared/alerts/confirmModal.html',
controller: 'CustomConfirmModalController as confirmModal',
@@ -20,8 +20,10 @@
data: function () {
return {
text: text,
+ resource: resource,
successHandler: successHandler,
name: name
+
};
}
}
@@ -44,8 +46,26 @@
ctrl.confirm = confirm;
ctrl.cancel = cancel;
-
+ ctrl.buildDeleteObjects = buildDeleteObjects;
ctrl.data = angular.copy(data);
+
+ function buildDeleteObjects(){
+ ctrl.deleteObjects = '';
+ if (typeof ctrl.data.name === 'string') {
+ ctrl.deleteObjects = ctrl.data.name
+ }
+ else{
+ for(var index in ctrl.data.name){
+ if(index==0){
+ ctrl.deleteObjects += ctrl.data.name[index]
+ }
+ else{
+ ctrl.deleteObjects += ", "+ ctrl.data.name[index]
+ }
+
+ }
+ }
+ }
/**
* Initiate confirmation and call the success handler with the
* input text.
@@ -63,5 +83,7 @@
function cancel() {
$uibModalInstance.dismiss('cancel');
}
+
+ ctrl.buildDeleteObjects();
}
})();