Merge branch 'develop' into main
commit
9ce2e1d73b
|
@ -110,6 +110,14 @@ class ResendFailedMessageProcessor extends BroodsOutboxProcessor implements Gene
|
||||||
$dataSent = $outboxRequest->data['sent'];
|
$dataSent = $outboxRequest->data['sent'];
|
||||||
$response = $this->Broods->sendRequest($brood, $url, true, $dataSent);
|
$response = $this->Broods->sendRequest($brood, $url, true, $dataSent);
|
||||||
$jsonReply = $response->getJson();
|
$jsonReply = $response->getJson();
|
||||||
|
if (is_null($jsonReply)) {
|
||||||
|
$jsonReply = [
|
||||||
|
'success' => false,
|
||||||
|
'errors' => [
|
||||||
|
__('Brood returned an invalid JSON.')
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
$success = !empty($jsonReply['success']);
|
$success = !empty($jsonReply['success']);
|
||||||
$messageSuccess = __('Message successfully sent to `{0}`', $brood->name);
|
$messageSuccess = __('Message successfully sent to `{0}`', $brood->name);
|
||||||
$messageFail = __('Could not send message to `{0}`.', $brood->name);
|
$messageFail = __('Could not send message to `{0}`.', $brood->name);
|
||||||
|
@ -126,7 +134,7 @@ class ResendFailedMessageProcessor extends BroodsOutboxProcessor implements Gene
|
||||||
[],
|
[],
|
||||||
$success,
|
$success,
|
||||||
$success ? $messageSuccess : $messageFail,
|
$success ? $messageSuccess : $messageFail,
|
||||||
[]
|
$jsonReply['errors'] ?? []
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,7 @@ class CRUDComponent extends Component
|
||||||
$this->Controller->restResponsePayload = $this->RestResponse->viewData($data, 'json');
|
$this->Controller->restResponsePayload = $this->RestResponse->viewData($data, 'json');
|
||||||
} else {
|
} else {
|
||||||
$this->Controller->loadComponent('Paginator');
|
$this->Controller->loadComponent('Paginator');
|
||||||
$data = $this->Controller->Paginator->paginate($query);
|
$data = $this->Controller->Paginator->paginate($query, $this->Controller->paginate ?? []);
|
||||||
if (isset($options['afterFind'])) {
|
if (isset($options['afterFind'])) {
|
||||||
$function = $options['afterFind'];
|
$function = $options['afterFind'];
|
||||||
if (is_callable($options['afterFind'])) {
|
if (is_callable($options['afterFind'])) {
|
||||||
|
|
|
@ -20,6 +20,12 @@ class InboxController extends AppController
|
||||||
public $quickFilterFields = ['scope', 'action', ['title' => true], ['comment' => true]];
|
public $quickFilterFields = ['scope', 'action', ['title' => true], ['comment' => true]];
|
||||||
public $containFields = ['Users'];
|
public $containFields = ['Users'];
|
||||||
|
|
||||||
|
public $paginate = [
|
||||||
|
'order' => [
|
||||||
|
'Inbox.created' => 'desc'
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
public function beforeFilter(EventInterface $event)
|
public function beforeFilter(EventInterface $event)
|
||||||
{
|
{
|
||||||
parent::beforeFilter($event);
|
parent::beforeFilter($event);
|
||||||
|
|
|
@ -304,7 +304,17 @@ class LocalToolsController extends AppController
|
||||||
throw new MethodNotAllowedException(__('No local tool ID supplied.'));
|
throw new MethodNotAllowedException(__('No local tool ID supplied.'));
|
||||||
}
|
}
|
||||||
$params['local_tool_id'] = $postParams['local_tool_id'];
|
$params['local_tool_id'] = $postParams['local_tool_id'];
|
||||||
|
try {
|
||||||
$encodingResult = $this->LocalTools->encodeConnection($params);
|
$encodingResult = $this->LocalTools->encodeConnection($params);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$encodingResult = [
|
||||||
|
'inboxResult' => [
|
||||||
|
'success' => false,
|
||||||
|
'message' => __('Error while trying to encode connection'),
|
||||||
|
'errors' => [$e->getMessage()],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
$inboxResult = $encodingResult['inboxResult'];
|
$inboxResult = $encodingResult['inboxResult'];
|
||||||
if ($inboxResult['success']) {
|
if ($inboxResult['success']) {
|
||||||
if ($this->ParamHandler->isRest()) {
|
if ($this->ParamHandler->isRest()) {
|
||||||
|
|
|
@ -9,6 +9,7 @@ use Cake\Core\Configure;
|
||||||
use Cake\Http\Client;
|
use Cake\Http\Client;
|
||||||
use Cake\Http\Client\Response;
|
use Cake\Http\Client\Response;
|
||||||
use Cake\Http\Exception\NotFoundException;
|
use Cake\Http\Exception\NotFoundException;
|
||||||
|
use Cake\Http\Client\Exception\NetworkException;
|
||||||
use Cake\ORM\TableRegistry;
|
use Cake\ORM\TableRegistry;
|
||||||
use Cake\Error\Debugger;
|
use Cake\Error\Debugger;
|
||||||
|
|
||||||
|
@ -69,7 +70,14 @@ class BroodsTable extends AppTable
|
||||||
{
|
{
|
||||||
$brood = $this->find()->where(['id' => $id])->first();
|
$brood = $this->find()->where(['id' => $id])->first();
|
||||||
$start = microtime(true);
|
$start = microtime(true);
|
||||||
|
try {
|
||||||
$response = $this->HTTPClientGET('/instance/status.json', $brood);
|
$response = $this->HTTPClientGET('/instance/status.json', $brood);
|
||||||
|
} catch (NetworkException $e) {
|
||||||
|
return [
|
||||||
|
'error' => __('Could not query status'),
|
||||||
|
'reason' => $e->getMessage(),
|
||||||
|
];
|
||||||
|
}
|
||||||
$ping = ((int)(100 * (microtime(true) - $start)));
|
$ping = ((int)(100 * (microtime(true) - $start)));
|
||||||
$errors = [
|
$errors = [
|
||||||
403 => [
|
403 => [
|
||||||
|
|
|
@ -62,8 +62,11 @@ class InboxTable extends AppTable
|
||||||
$this->Broods = \Cake\ORM\TableRegistry::getTableLocator()->get('Broods');
|
$this->Broods = \Cake\ORM\TableRegistry::getTableLocator()->get('Broods');
|
||||||
$this->Individuals = \Cake\ORM\TableRegistry::getTableLocator()->get('Individuals');
|
$this->Individuals = \Cake\ORM\TableRegistry::getTableLocator()->get('Individuals');
|
||||||
$errors = [];
|
$errors = [];
|
||||||
|
$originUrl = trim($entryData['origin'], '/');
|
||||||
$brood = $this->Broods->find()
|
$brood = $this->Broods->find()
|
||||||
->where(['url' => $entryData['origin']])
|
->where([
|
||||||
|
'url IN' => [$originUrl, "{$originUrl}/"]
|
||||||
|
])
|
||||||
->first();
|
->first();
|
||||||
if (empty($brood)) {
|
if (empty($brood)) {
|
||||||
$errors[] = __('Unkown brood `{0}`', $entryData['data']['cerebrateURL']);
|
$errors[] = __('Unkown brood `{0}`', $entryData['data']['cerebrateURL']);
|
||||||
|
|
|
@ -52,7 +52,8 @@ echo $this->element('genericElements/IndexTable/index_table', [
|
||||||
'name' => __('Changed'),
|
'name' => __('Changed'),
|
||||||
'sort' => 'changed',
|
'sort' => 'changed',
|
||||||
'data_path' => 'changed',
|
'data_path' => 'changed',
|
||||||
'element' => 'json'
|
'element' => 'json',
|
||||||
|
'class' => 'text-break'
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'title' => __('Logs'),
|
'title' => __('Logs'),
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
<?php
|
<?php
|
||||||
echo $this->element('genericElements/IndexTable/index_table', $data);
|
echo $this->element('genericElements/IndexTable/index_table', $data);
|
||||||
echo '</div>';
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -29,4 +29,3 @@
|
||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
?>
|
?>
|
||||||
</div>
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
$tagsHtml = $this->Tag->tags($entity['tags'], [
|
$tagsHtml = $this->Tag->tags($entity['tags'], [
|
||||||
'allTags' => [],
|
'allTags' => $allTags ?? [],
|
||||||
'picker' => true,
|
'picker' => true,
|
||||||
'editable' => true,
|
'editable' => true,
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -55,8 +55,10 @@ function attachTestConnectionResultHtml(result, $container) {
|
||||||
$testResultDiv.append(getKVHtml('Internal error', result, ['text-danger fw-bold']))
|
$testResultDiv.append(getKVHtml('Internal error', result, ['text-danger fw-bold']))
|
||||||
} else {
|
} else {
|
||||||
if (result['error']) {
|
if (result['error']) {
|
||||||
|
if (result['ping']) {
|
||||||
|
$testResultDiv.append('Status', 'OK', ['text-danger'], `${result['ping']} ms`);
|
||||||
|
}
|
||||||
$testResultDiv.append(
|
$testResultDiv.append(
|
||||||
getKVHtml('Status', 'OK', ['text-danger'], `${result['ping']} ms`),
|
|
||||||
getKVHtml('Status', `Error: ${result['error']}`, ['text-danger']),
|
getKVHtml('Status', `Error: ${result['error']}`, ['text-danger']),
|
||||||
getKVHtml('Reason', result['reason'], ['text-danger'])
|
getKVHtml('Reason', result['reason'], ['text-danger'])
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue