From 5db0fd884621a3c06fec22bc6ef13320277379f7 Mon Sep 17 00:00:00 2001 From: Vitalii Date: Fri, 21 Jul 2023 16:58:54 +0300 Subject: [PATCH] web/satellite: wire up vuetify access page to backend Added logic to list, sort, search and paginate access grants table for Vuetify POC Change-Id: I215a9ad4f894b6ac985cb6a3059fdcf007e3d914 --- web/satellite/package.json | 2 +- .../components/accessGrants/AccessGrants.vue | 4 +- web/satellite/src/types/accessGrants.ts | 2 + web/satellite/src/types/common.ts | 15 ++ .../src/components/AccessTableComponent.vue | 159 ++++++++++++------ 5 files changed, 124 insertions(+), 58 deletions(-) diff --git a/web/satellite/package.json b/web/satellite/package.json index 831b05269623..fa18106b4ab1 100644 --- a/web/satellite/package.json +++ b/web/satellite/package.json @@ -73,4 +73,4 @@ "browserslist": [ "defaults" ] -} \ No newline at end of file +} diff --git a/web/satellite/src/components/accessGrants/AccessGrants.vue b/web/satellite/src/components/accessGrants/AccessGrants.vue index 7a0e7099ea3f..2f2f0dafdb9c 100644 --- a/web/satellite/src/components/accessGrants/AccessGrants.vue +++ b/web/satellite/src/components/accessGrants/AccessGrants.vue @@ -244,7 +244,7 @@ async function onPageClick(index: number, limit: number): Promise { try { await agStore.getAccessGrants(index, projectsStore.state.selectedProject.id, limit); } catch (error) { - await notify.error(`Unable to fetch Access Grants. ${error.message}`, AnalyticsErrorEventSource.ACCESS_GRANTS_PAGE); + notify.error(`Unable to fetch Access Grants. ${error.message}`, AnalyticsErrorEventSource.ACCESS_GRANTS_PAGE); } } @@ -332,7 +332,7 @@ onMounted(async () => { await agStore.getAccessGrants(FIRST_PAGE, projectsStore.state.selectedProject.id); areGrantsFetching.value = false; } catch (error) { - await notify.error(`Unable to fetch Access Grants. ${error.message}`, AnalyticsErrorEventSource.ACCESS_GRANTS_PAGE); + notify.error(`Unable to fetch Access Grants. ${error.message}`, AnalyticsErrorEventSource.ACCESS_GRANTS_PAGE); } }); diff --git a/web/satellite/src/types/accessGrants.ts b/web/satellite/src/types/accessGrants.ts index c917b130d4af..2e9a8a0085fe 100644 --- a/web/satellite/src/types/accessGrants.ts +++ b/web/satellite/src/types/accessGrants.ts @@ -65,6 +65,8 @@ export interface AccessGrantsApi { export enum AccessGrantsOrderBy { NAME = 1, CREATED_AT, + name = 1, + createdAt = 2, } /** diff --git a/web/satellite/src/types/common.ts b/web/satellite/src/types/common.ts index 7bf7d6da554b..bc5728343744 100644 --- a/web/satellite/src/types/common.ts +++ b/web/satellite/src/types/common.ts @@ -4,6 +4,8 @@ export enum SortDirection { ASCENDING = 1, DESCENDING, + asc = 1, + desc = 2, } export enum OnboardingOS { @@ -40,3 +42,16 @@ export enum PricingPlanType { export type UUID = string export type MemorySize = string export type Time = string + +export function tableSizeOptions(itemCount: number): {title: string, value: number}[] { + const opts = [ + { title: '10', value: 10 }, + { title: '25', value: 25 }, + { title: '50', value: 50 }, + { title: '100', value: 100 }, + ]; + if (itemCount < 1000) { + return [{ title: 'All', value: itemCount }, ...opts]; + } + return opts; +} diff --git a/web/satellite/vuetify-poc/src/components/AccessTableComponent.vue b/web/satellite/vuetify-poc/src/components/AccessTableComponent.vue index 257093566683..30a792c027cb 100644 --- a/web/satellite/vuetify-poc/src/components/AccessTableComponent.vue +++ b/web/satellite/vuetify-poc/src/components/AccessTableComponent.vue @@ -11,85 +11,134 @@ hide-details /> - -