1
0
Fork 0
mirror of synced 2024-06-01 18:39:57 +12:00

Fixed pagination

This commit is contained in:
Eldad Fux 2021-08-16 00:32:27 +03:00
parent 826a4527a0
commit adc86fbac5
5 changed files with 19 additions and 12 deletions

View file

@ -1211,11 +1211,9 @@ App::get('/v1/database/collections/:collectionId/documents')
}
}
$documents = $dbForExternal->find($collectionId, $queries, $limit, $offset, $orderAttributes, $orderTypes, $afterDocument ?? null);
$response->dynamic(new Document([
'sum' => \count($documents),
'documents' => $documents,
'sum' => $dbForExternal->count($collectionId, $queries, APP_LIMIT_COUNT),
'documents' => $dbForExternal->find($collectionId, $queries, $limit, $offset, $orderAttributes, $orderTypes, $afterDocument ?? null),
]), Response::MODEL_DOCUMENT_LIST);
});

View file

@ -56,7 +56,7 @@ $logs = $this->getParam('logs', null);
<p class="margin-bottom-no">Add your first document to get started</p>
</div>
<div xdata-ls-if="({{project-documents.sum}})" class="margin-top-negative">
<div data-ls-if="({{project-documents.sum}})" class="margin-top-negative">
<div class="margin-bottom-small margin-end-small text-align-end text-size-small"><span data-ls-bind="{{project-documents.sum}}"></span> documents found</div>
<div class="box margin-bottom y-scroll text-size-small">
@ -90,7 +90,8 @@ $logs = $this->getParam('logs', null);
data-param-collection-id="{{router.params.id}}"
data-param-search="{{router.params.search}}"
data-param-limit="<?php echo APP_PAGING_LIMIT; ?>"
data-param-order-type="DESC"
data-param-order-types="DESC"
data-param-order-types-cast-to="array"
data-scope="sdk"
data-name="project-documents"
data-success="state"
@ -106,7 +107,8 @@ $logs = $this->getParam('logs', null);
data-param-collection-id="{{router.params.id}}"
data-param-search="{{router.params.search}}"
data-param-limit="<?php echo APP_PAGING_LIMIT; ?>"
data-param-order-type="DESC"
data-param-order-types="DESC"
data-param-order-types-cast-to="array"
data-scope="sdk"
data-name="project-documents"
data-success="state"
@ -115,9 +117,13 @@ $logs = $this->getParam('logs', null);
</form>
</div>
<a data-ls-attrs="href=/console/database/document?collection={{router.params.id}}&project={{router.params.project}}&buster={{project-collection.dateUpdated}}" class="button">
<a data-ls-if="0 < {{project-collection.attributes.length}}" data-ls-attrs="href=/console/database/document?collection={{router.params.id}}&project={{router.params.project}}&buster={{project-collection.dateUpdated}}" class="button">
Add Document
</a>
<button disabled data-ls-if="!{{project-collection.attributes.length}}">
Add Document
</button >
</div>
</li>
<li data-state="/console/database/collection/attributes?id={{router.params.id}}&project={{router.params.project}}">
@ -372,6 +378,9 @@ $logs = $this->getParam('logs', null);
<?php echo $logs->render(); ?>
</li>
<li data-state="/console/database/collection/usage?id={{router.params.id}}&project={{router.params.project}}">
<h2>Usage</h2>
</li>
<li data-state="/console/database/collection/settings?id={{router.params.id}}&project={{router.params.project}}">
<h2>Settings</h2>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -54,8 +54,8 @@
}
.badge {
background: #f02d65;
color: white;
background: var(--config-color-focus);
color: var(--config-color-background-fade);
display: inline-block;
border-radius: 15px;
width: 15px;