@@ -16,7 +16,6 @@ import {
1616} from '@raystack/apsara' ;
1717import deleteIcon from '~/client/assets/delete.svg' ;
1818import keyIcon from '~/client/assets/key.svg' ;
19- import exclamationTriangleIcon from '~/client/assets/exclamation-triangle.svg' ;
2019import { useQuery } from '@connectrpc/connect-query' ;
2120import { create } from '@bufbuild/protobuf' ;
2221import {
@@ -31,6 +30,7 @@ import { PERMISSIONS, shouldShowComponent } from '~/utils';
3130import { DEFAULT_DATE_FORMAT } from '~/client/utils/constants' ;
3231import { ViewContainer } from '~/client/components/view-container' ;
3332import { ViewHeader } from '~/client/components/view-header' ;
33+ import type { Slot } from '~/shared/types' ;
3434import {
3535 getColumns ,
3636 type ServiceAccountMenuPayload
@@ -50,10 +50,14 @@ const manageAccessDialogHandle = Dialog.createHandle<string>();
5050
5151export interface ServiceAccountsViewProps {
5252 onServiceAccountClick ?: ( id : string ) => void ;
53+ slots ?: {
54+ addAccountButton ?: Slot < { onClick : ( ) => void ; disabled : boolean } > ;
55+ } ;
5356}
5457
5558export function ServiceAccountsView ( {
56- onServiceAccountClick
59+ onServiceAccountClick,
60+ slots
5761} : ServiceAccountsViewProps ) {
5862 const {
5963 activeOrganization : organization ,
@@ -126,6 +130,8 @@ export function ServiceAccountsView({
126130 [ dateFormat , canUpdateWorkspace ]
127131 ) ;
128132
133+ const handleAddServiceAccount = ( ) => addDialogHandle . open ( null ) ;
134+
129135 const handleCreated = ( serviceUserId : string ) => {
130136 onServiceAccountClick ?.( serviceUserId ) ;
131137 } ;
@@ -167,15 +173,22 @@ export function ServiceAccountsView({
167173 heading = "No Service Account Found"
168174 subHeading = { `Create a new account to use the APIs of ${ t . appName ( ) } platform` }
169175 primaryAction = {
170- < Button
171- variant = "solid"
172- color = "accent"
173- size = "small"
174- onClick = { ( ) => addDialogHandle . open ( null ) }
175- data-test-id = "frontier-sdk-new-service-account-btn"
176- >
177- Add service account
178- </ Button >
176+ slots ?. addAccountButton ? (
177+ slots . addAccountButton ( {
178+ onClick : handleAddServiceAccount ,
179+ disabled : false
180+ } )
181+ ) : (
182+ < Button
183+ variant = "solid"
184+ color = "accent"
185+ size = "small"
186+ onClick = { handleAddServiceAccount }
187+ data-test-id = "frontier-sdk-new-service-account-btn"
188+ >
189+ Add service account
190+ </ Button >
191+ )
179192 }
180193 />
181194 ) : (
@@ -207,6 +220,11 @@ export function ServiceAccountsView({
207220 </ Flex >
208221 { isLoading ? (
209222 < Skeleton height = "34px" width = "160px" />
223+ ) : slots ?. addAccountButton ? (
224+ slots . addAccountButton ( {
225+ onClick : handleAddServiceAccount ,
226+ disabled : ! canUpdateWorkspace
227+ } )
210228 ) : (
211229 < Tooltip >
212230 < Tooltip . Trigger
@@ -216,7 +234,7 @@ export function ServiceAccountsView({
216234 < Button
217235 variant = "solid"
218236 color = "accent"
219- onClick = { ( ) => addDialogHandle . open ( null ) }
237+ onClick = { handleAddServiceAccount }
220238 disabled = { ! canUpdateWorkspace }
221239 data-test-id = "frontier-sdk-add-service-account-btn"
222240 >
0 commit comments