From 9b62a9a8735a74071a3750557c99ed7c5bc9f251 Mon Sep 17 00:00:00 2001 From: Rohan Date: Thu, 7 Nov 2024 13:39:03 +0530 Subject: [PATCH] fix: add empty state for service accounts --- .../[team]/access/service-accounts/page.tsx | 98 +++++++++++-------- .../[app]/access/service-accounts/page.tsx | 98 +++++++++++-------- 2 files changed, 114 insertions(+), 82 deletions(-) diff --git a/frontend/app/[team]/access/service-accounts/page.tsx b/frontend/app/[team]/access/service-accounts/page.tsx index 30c369b4..9b4432c0 100644 --- a/frontend/app/[team]/access/service-accounts/page.tsx +++ b/frontend/app/[team]/access/service-accounts/page.tsx @@ -40,57 +40,73 @@ export default function ServiceAccounts({ params }: { params: { team: string } }

Manage service accounts.

- {userCanCreateSA && ( + {userCanCreateSA && data?.serviceAccounts.length > 0 && (
)} {userCanReadSA ? ( - - - - - + data?.serviceAccounts.length === 0 ? ( + + + + } + > + <> + + + + ) : ( +
- Account name - - Role -
+ + + + - - - - - {data?.serviceAccounts.map((account: ServiceAccountType) => ( - - + + + + + {data?.serviceAccounts.map((account: ServiceAccountType) => ( + + - + - + - - - ))} - -
+ Account name + + Role + - Created -
-
- -
- {account.name} -
+ Created +
+
+ +
+ {account.name} +
- - + + - {relativeTimeFromDates(new Date(account.createdAt))} - + {relativeTimeFromDates(new Date(account.createdAt))} + - - - -
+ + + + + + + ))} + + + ) ) : ( {userCanReadAppSA ? (
- {userCanAddAppSA && ( + {userCanAddAppSA && data?.appServiceAccounts.length > 0 && (
)} - - - - - - - {userCanRemoveAppSA && } - - - - {data?.appServiceAccounts.map((account: ServiceAccountType) => ( - - + )} + + ))} + +
- Account - - Environment Access -
-
- -
-
-
- {account.name} - + {data?.appServiceAccounts.length === 0 ? ( + + +
+ } + > + <> + + + + ) : ( + + + + + + + {userCanRemoveAppSA && } + + + + {data?.appServiceAccounts.map((account: ServiceAccountType) => ( + + - - +
+
+ {account.name} + +
+
+ - {userCanRemoveAppSA && ( - )} - - ))} - -
+ Account + + Environment Access +
+
+
- -
-
- -
-
-
- +
+
+ + {userCanRemoveAppSA && ( +
+
+ +
+
+ )}
) : (