[CORD-1771] fixing 'undefined successfully saved'

Change-Id: I5776ea059f4d0c184ee3eec2a75aa620af3df3b1
diff --git a/src/app/core/services/helpers/config.helpers.ts b/src/app/core/services/helpers/config.helpers.ts
index e4a0a70..f566e7a 100644
--- a/src/app/core/services/helpers/config.helpers.ts
+++ b/src/app/core/services/helpers/config.helpers.ts
@@ -153,6 +153,7 @@
           color: 'red',
           cb: (item) => {
             let obj = angular.copy(item);
+            const objName = (angular.isUndefined(obj.name)) ? 'instance' : obj.name;
 
             item.$delete()
               .then((res) => {
@@ -160,10 +161,10 @@
                   // TODO understand why it does not go directly in catch
                   throw new Error();
                 }
-                this.toastr.info(`${model.name} ${obj.name} succesfully deleted`);
+                this.toastr.info(`${model.name} ${objName} successfully deleted`);
               })
               .catch(() => {
-                this.toastr.error(`Error while deleting ${obj.name}`);
+                this.toastr.error(`Error while deleting ${objName}`);
               });
           }
         }
@@ -303,7 +304,7 @@
         return;
       }
 
-      const model = angular.copy(item);
+      const itemCopy = angular.copy(item);
 
       // TODO remove ManyToMany relations and save them separately (how??)
       delete item.networks;
@@ -315,24 +316,26 @@
         }
       });
 
+      const itemName = (angular.isUndefined(itemCopy.name)) ? model.name : itemCopy.name;
+
       item.$save()
         .then((res) => {
           formCfg.feedback = {
             show: true,
-            message: `${model.name} succesfully saved`,
+            message: `${itemName} successfully saved`,
             type: 'success',
             closeBtn: true
           };
-          this.toastr.success(`${model.name} succesfully saved`);
+          this.toastr.success(`${itemName} successfully saved`);
         })
         .catch(err => {
           formCfg.feedback = {
             show: true,
-            message: `Error while saving ${model.name}: ${err.error}. ${err.specific_error || ''}`,
+            message: `Error while saving ${itemName}: ${err.error}. ${err.specific_error || ''}`,
             type: 'danger',
             closeBtn: true
           };
-          this.toastr.error(err.specific_error || '', `Error while saving ${model.name}: ${err.error}`);
+          this.toastr.error(err.specific_error || '', `Error while saving ${itemName}: ${err.error}`);
         });
     };