From e8965ebf0966ec220f256c060760687c7a3b35ec Mon Sep 17 00:00:00 2001 From: Matt Mundell Date: Thu, 4 Jan 2024 11:52:23 +0200 Subject: [PATCH] Change: fetch trash targets concurrently --- src/gmp/commands/trashcan.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/gmp/commands/trashcan.js b/src/gmp/commands/trashcan.js index b5cdbc6858..72c6894d36 100644 --- a/src/gmp/commands/trashcan.js +++ b/src/gmp/commands/trashcan.js @@ -66,7 +66,10 @@ class Trashcan extends HttpCommand { } get() { - return this.httpGet({cmd: 'get_trash'}).then(response => { + const targets = this.httpGet({cmd: 'get_trash_targets'}); + const rest = this.httpGet({cmd: 'get_trash'}); + return Promise.all([targets, rest]).then(([response_targets, response]) => { + const targets_data = response_targets.data.get_trash; const trash_data = response.data.get_trash; const data = {}; if (isDefined(trash_data.get_alerts_response)) { @@ -146,9 +149,10 @@ class Trashcan extends HttpCommand { Tag.fromElement(model), ); } - if (isDefined(trash_data.get_targets_response)) { - data.target_list = map(trash_data.get_targets_response.target, model => - Target.fromElement(model), + if (isDefined(targets_data.get_targets_response)) { + data.target_list = map( + targets_data.get_targets_response.target, + model => Target.fromElement(model), ); } if (isDefined(trash_data.get_tasks_response)) {