mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
fix(ui): logs pagination
This commit is contained in:
@@ -580,7 +580,7 @@ App::get('/v1/database/collections/:collectionId/logs')
|
||||
}
|
||||
|
||||
$response->dynamic(new Document([
|
||||
'sum' => $audit->getLogsByResourceCount($resource),
|
||||
'sum' => $audit->countLogsByResource($resource),
|
||||
'logs' => $output,
|
||||
]), Response::MODEL_LOG_LIST);
|
||||
});
|
||||
@@ -1805,12 +1805,14 @@ App::get('/v1/database/collections/:collectionId/documents/:documentId/logs')
|
||||
->label('sdk.response.model', Response::MODEL_LOG_LIST)
|
||||
->param('collectionId', '', new UID(), 'Collection unique ID.')
|
||||
->param('documentId', null, new UID(), 'Document unique ID.')
|
||||
->param('limit', 25, new Range(0, 100), 'Maximum number of logs to return in response. Use this value to manage pagination. By default will return maximum 25 results. Maximum of 100 results allowed per request.', true)
|
||||
->param('offset', 0, new Range(0, 900000000), 'Offset value. The default value is 0. Use this param to manage pagination.', true)
|
||||
->inject('response')
|
||||
->inject('dbForInternal')
|
||||
->inject('dbForExternal')
|
||||
->inject('locale')
|
||||
->inject('geodb')
|
||||
->action(function ($collectionId, $documentId, $response, $dbForInternal, $dbForExternal, $locale, $geodb) {
|
||||
->action(function ($collectionId, $documentId, $limit, $offset, $response, $dbForInternal, $dbForExternal, $locale, $geodb) {
|
||||
/** @var Appwrite\Utopia\Response $response */
|
||||
/** @var Utopia\Database\Document $project */
|
||||
/** @var Utopia\Database\Database $dbForInternal */
|
||||
@@ -1831,8 +1833,8 @@ App::get('/v1/database/collections/:collectionId/documents/:documentId/logs')
|
||||
}
|
||||
|
||||
$audit = new Audit($dbForInternal);
|
||||
|
||||
$logs = $audit->getLogsByResource('document/'.$document->getId());
|
||||
$resource = 'document/'.$document->getId();
|
||||
$logs = $audit->getLogsByResource($resource, $limit, $offset);
|
||||
|
||||
$output = [];
|
||||
|
||||
@@ -1891,8 +1893,10 @@ App::get('/v1/database/collections/:collectionId/documents/:documentId/logs')
|
||||
$output[$i]['countryName'] = $locale->getText('locale.country.unknown');
|
||||
}
|
||||
}
|
||||
|
||||
$response->dynamic(new Document(['logs' => $output]), Response::MODEL_LOG_LIST);
|
||||
$response->dynamic(new Document([
|
||||
'sum' => $audit->countLogsByResource($resource),
|
||||
'logs' => $output,
|
||||
]), Response::MODEL_LOG_LIST);
|
||||
});
|
||||
|
||||
App::patch('/v1/database/collections/:collectionId/documents/:documentId')
|
||||
|
||||
Reference in New Issue
Block a user