From 3ed5af776ab92b74338ad9e50adcbd33b4f97303 Mon Sep 17 00:00:00 2001 From: Sami Mokaddem Date: Tue, 21 Dec 2021 12:34:37 +0100 Subject: [PATCH] fix: [local_tool:batchApiAction] Various UI and backend fixes --- src/Controller/LocalToolsController.php | 6 +++++- src/Lib/default/local_tool_connectors/MispConnector.php | 2 +- templates/LocalTools/connector_index.php | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Controller/LocalToolsController.php b/src/Controller/LocalToolsController.php index 55340f4..a0d31b9 100644 --- a/src/Controller/LocalToolsController.php +++ b/src/Controller/LocalToolsController.php @@ -68,7 +68,11 @@ class LocalToolsController extends AppController foreach ($connections as $connection) { $actionDetails = $this->LocalTools->getActionDetails($actionName); $params['connection'] = $connection; - $tmpResult = $this->LocalTools->action($this->ACL->getUser()['id'], $connection->connector, $actionName, $params, $this->request); + try { + $tmpResult = $this->LocalTools->action($this->ACL->getUser()['id'], $connection->connector, $actionName, $params, $this->request); + } catch (\Exception $e) { + $tmpResult = ['success' => false, 'message' => $e->getMessage(), 'data' => []]; + } $tmpResult['connection'] = $connection; $results[$connection->id] = $tmpResult; $successes += $tmpResult['success'] ? 1 : 0; diff --git a/src/Lib/default/local_tool_connectors/MispConnector.php b/src/Lib/default/local_tool_connectors/MispConnector.php index 5bfa86a..c955cba 100644 --- a/src/Lib/default/local_tool_connectors/MispConnector.php +++ b/src/Lib/default/local_tool_connectors/MispConnector.php @@ -819,7 +819,7 @@ class MispConnector extends CommonConnectorTools [ 'field' => 'connection_ids', 'type' => 'hidden', - 'value' => $params['connection_ids'] + 'value' => json_encode($params['connection_ids']) ], [ 'field' => 'method', diff --git a/templates/LocalTools/connector_index.php b/templates/LocalTools/connector_index.php index 4acd291..ed5d221 100644 --- a/templates/LocalTools/connector_index.php +++ b/templates/LocalTools/connector_index.php @@ -155,7 +155,7 @@ echo $this->element('genericElements/IndexTable/index_table', [ tableData ) const $footer = $(modalObject.ajaxApi.statusNode).parent() - modalObject.ajaxApi.statusNode.remove() + modalObject.ajaxApi.options.statusNode.remove() const $cancelButton = $footer.find('button[data-dismiss="modal"]') $cancelButton.text('').removeClass('btn-secondary').addClass('btn-primary') }