summaryrefslogtreecommitdiffstats
path: root/testapi/opnfv_testapi/ui/shared/alerts/confirmModalFactory.js
diff options
context:
space:
mode:
Diffstat (limited to 'testapi/opnfv_testapi/ui/shared/alerts/confirmModalFactory.js')
-rw-r--r--testapi/opnfv_testapi/ui/shared/alerts/confirmModalFactory.js39
1 files changed, 36 insertions, 3 deletions
diff --git a/testapi/opnfv_testapi/ui/shared/alerts/confirmModalFactory.js b/testapi/opnfv_testapi/ui/shared/alerts/confirmModalFactory.js
index 5e79775..0286341 100644
--- a/testapi/opnfv_testapi/ui/shared/alerts/confirmModalFactory.js
+++ b/testapi/opnfv_testapi/ui/shared/alerts/confirmModalFactory.js
@@ -11,17 +11,19 @@
* 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',
+ templateUrl: 'testapi-ui/shared/alerts/confirmModal.html',
controller: 'CustomConfirmModalController as confirmModal',
size: 'md',
resolve: {
data: function () {
return {
text: text,
+ resource: resource,
successHandler: successHandler,
name: name
+
};
}
}
@@ -44,8 +46,37 @@
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 if (ctrl.data.name instanceof Array){
+ for(var index in ctrl.data.name){
+ if(index==0){
+ ctrl.deleteObjects += ctrl.data.name[index]
+ }
+ else{
+ ctrl.deleteObjects += ", "+ ctrl.data.name[index]
+ }
+
+ }
+ }
+ else{
+ for(var index in ctrl.data.name[ctrl.data.resource]){
+ if(index==0){
+ ctrl.deleteObjects += ctrl.data.name[ctrl.data.resource][index]
+ }
+ else{
+ ctrl.deleteObjects += ", "+ ctrl.data.name[ctrl.data.resource][index]
+ }
+
+ }
+ }
+ }
/**
* Initiate confirmation and call the success handler with the
* input text.
@@ -63,5 +94,7 @@
function cancel() {
$uibModalInstance.dismiss('cancel');
}
+
+ ctrl.buildDeleteObjects();
}
})();