From b46863af8008e0f43748073cecbe75525e2ccc40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C5=A1per=20Grom?= Date: Tue, 20 Aug 2024 15:49:02 +0300 Subject: [PATCH] add loading state --- .../list/organization-common-list-table.vue | 4 +- .../pages/organization-common-page.vue | 55 +++++++++++-------- 2 files changed, 35 insertions(+), 24 deletions(-) diff --git a/frontend/src/modules/organization/components/list/organization-common-list-table.vue b/frontend/src/modules/organization/components/list/organization-common-list-table.vue index 98e17f27a6..fe8b3e5235 100644 --- a/frontend/src/modules/organization/components/list/organization-common-list-table.vue +++ b/frontend/src/modules/organization/components/list/organization-common-list-table.vue @@ -54,7 +54,7 @@ -
+
-
@@ -94,7 +94,7 @@ - + diff --git a/frontend/src/modules/organization/pages/organization-common-page.vue b/frontend/src/modules/organization/pages/organization-common-page.vue index bc4c6af7e1..27c165d022 100644 --- a/frontend/src/modules/organization/pages/organization-common-page.vue +++ b/frontend/src/modules/organization/pages/organization-common-page.vue @@ -10,26 +10,36 @@ class="pb-1" @fetch="fetch($event)" /> -
- {{ pluralize('organization', totalOrganizations, true) }} -
- - - +
+
+
+
+
+
+ {{ pluralize('organization', totalOrganizations, true) }} +
+ + + +
@@ -60,6 +70,7 @@ const savedBody = ref({}); const pagination = ref({ page: 1, perPage: 20, + total: 0, }); const sorting = ref('displayName_ASC'); @@ -72,6 +83,7 @@ const getOrganizations = (body?: any) => { ...savedBody.value, ...body, }; + loading.value = true; OrganizationService.organizationsList({ ...savedBody.value, orderBy: sorting.value, @@ -79,9 +91,11 @@ const getOrganizations = (body?: any) => { }) .then((data: Pagination) => { organizations.value = data.rows; + pagination.value.total = data.count; }) .catch((err: Error) => { organizations.value = []; + pagination.value.total = 0; }) .finally(() => { loading.value = false; @@ -104,9 +118,6 @@ const getOrganizationsCount = () => { const fetch = ({ filter, body, }: FilterQuery) => { - if (!loading.value) { - loading.value = true; - } getOrganizations({ ...body, filter,