Author: bricks
Date: 2017-02-16 10:35:09 +0100 (Thu, 16 Feb 2017)
New Revision: 27677

Modified:
   trunk/gsa/ChangeLog
   trunk/gsa/src/html/classic/ng/src/web/targets/dialogcontainer.js
Log:
* src/html/classic/ng/src/web/targets/dialogcontainer.js: Allow to save a
target in TargetDialogContainer.

Modified: trunk/gsa/ChangeLog
===================================================================
--- trunk/gsa/ChangeLog 2017-02-16 09:35:07 UTC (rev 27676)
+++ trunk/gsa/ChangeLog 2017-02-16 09:35:09 UTC (rev 27677)
@@ -1,5 +1,10 @@
 2017-02-16 Bj�rn Ricks <bjoern.ri...@greenbone.net>
 
+       * src/html/classic/ng/src/web/targets/dialogcontainer.js: Allow to save 
a
+       target in TargetDialogContainer.
+
+2017-02-16 Bj�rn Ricks <bjoern.ri...@greenbone.net>
+
        * src/html/classic/ng/src/web/targets/dialog.js: Update TargetDialog to 
allow
        editing of targets.
 

Modified: trunk/gsa/src/html/classic/ng/src/web/targets/dialogcontainer.js
===================================================================
--- trunk/gsa/src/html/classic/ng/src/web/targets/dialogcontainer.js    
2017-02-16 09:35:07 UTC (rev 27676)
+++ trunk/gsa/src/html/classic/ng/src/web/targets/dialogcontainer.js    
2017-02-16 09:35:09 UTC (rev 27677)
@@ -78,10 +78,18 @@
     let {gmp} = this.context;
     let {onSave} = this.props;
 
-    return gmp.target.create(data).then(target => {
+    let promise;
+    if (data && data.id) {
+      promise = gmp.target.save(data);
+    }
+    else {
+      promise = gmp.target.create(data);
+    }
+    return promise.then(target => {
       if (onSave) {
-        onSave(target);
+        return onSave(target);
       }
+      return undefined;
     });
   }
 

_______________________________________________
Openvas-commits mailing list
Openvas-commits@wald.intevation.org
https://lists.wald.intevation.org/cgi-bin/mailman/listinfo/openvas-commits

Reply via email to