Skip to content

Commit 927fb0e

Browse files
committed
update
1 parent a373978 commit 927fb0e

12 files changed

Lines changed: 77 additions & 77 deletions

File tree

ui/src/components/DynamicClientRegistrationSettings.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ const DEFAULT_REDIRECT_PATTERNS = [
7777
];
7878

7979
export function DynamicClientRegistrationSettings() {
80-
const { apiClients } = useAuth();
80+
const { clientApis } = useAuth();
8181
const [settings, setSettings] = useState<ClientRegistrationSettings>({
8282
enabled: true,
8383
requireHttps: true,
@@ -106,7 +106,7 @@ export function DynamicClientRegistrationSettings() {
106106
setLoading(true);
107107
setMessage(null);
108108

109-
const settingsData = await apiClients.admin.getAdminClientRegistrationSettings();
109+
const settingsData = await clientApis.admin.getAdminClientRegistrationSettings();
110110

111111
setSettings(settingsData);
112112
setMessage({ type: 'success', text: 'Settings loaded successfully' });
@@ -119,7 +119,7 @@ export function DynamicClientRegistrationSettings() {
119119
} finally {
120120
setLoading(false);
121121
}
122-
}, [apiClients]);
122+
}, [clientApis]);
123123

124124
useEffect(() => {
125125
loadSettings();
@@ -130,7 +130,7 @@ export function DynamicClientRegistrationSettings() {
130130
setSaving(true);
131131
setMessage(null);
132132

133-
await apiClients.admin.putAdminClientRegistrationSettings({
133+
await clientApis.admin.putAdminClientRegistrationSettings({
134134
getAdminClientRegistrationSettings200Response: settings as ClientRegistrationSettings
135135
});
136136

@@ -151,7 +151,7 @@ export function DynamicClientRegistrationSettings() {
151151
setSaving(true);
152152
setMessage(null);
153153

154-
await apiClients.admin.postAdminClientRegistrationResetDefaults();
154+
await clientApis.admin.postAdminClientRegistrationResetDefaults();
155155

156156
// Reload the settings after reset
157157
await loadSettings();

ui/src/components/FhirServersManager/FhirServersManager.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ interface MtlsConfig {
3939
}
4040

4141
export function FhirServersManager() {
42-
const { apiClients } = useAuth();
42+
const { clientApis } = useAuth();
4343
const [servers, setServers] = useState<FhirServerWithState[]>([]);
4444
const [loading, setLoading] = useState(true);
4545
const [error, setError] = useState<string | null>(null);
@@ -103,7 +103,7 @@ export function FhirServersManager() {
103103
try {
104104
setLoading(true);
105105
setError(null);
106-
const response = await apiClients.servers.getFhirServers();
106+
const response = await clientApis.servers.getFhirServers();
107107

108108
const mappedServers: FhirServerWithState[] = response.servers.map((server) => ({
109109
...server,
@@ -135,7 +135,7 @@ export function FhirServersManager() {
135135
} finally {
136136
setLoading(false);
137137
}
138-
}, [apiClients, checkServerSecurity]);
138+
}, [clientApis, checkServerSecurity]);
139139

140140
const handleAddServer = async (url: string) => {
141141
const existingServer = servers.find(server => server.url === url);
@@ -148,7 +148,7 @@ export function FhirServersManager() {
148148
setError(null);
149149
setUrlError(null);
150150

151-
await apiClients.servers.postFhirServers({
151+
await clientApis.servers.postFhirServers({
152152
postFhirServersRequest: {
153153
url: url
154154
} as CreateFhirServerRequest
@@ -197,7 +197,7 @@ export function FhirServersManager() {
197197
setError(null);
198198
setUrlError(null);
199199

200-
await apiClients.servers.putFhirServersByServerId({
200+
await clientApis.servers.putFhirServersByServerId({
201201
serverId: server.id,
202202
putFhirServersByServerIdRequest: {
203203
url: newUrl
@@ -226,7 +226,7 @@ export function FhirServersManager() {
226226
const fetchServerDetail = useCallback(async (serverId: string) => {
227227
try {
228228
setLoadingServerDetail(true);
229-
const response = await apiClients.servers.getFhirServersByServerId({ serverId });
229+
const response = await clientApis.servers.getFhirServersByServerId({ serverId });
230230
setSelectedServer({id: serverId, ...response});
231231
setActiveTab('details');
232232
} catch (err) {
@@ -235,7 +235,7 @@ export function FhirServersManager() {
235235
} finally {
236236
setLoadingServerDetail(false);
237237
}
238-
}, [apiClients]);
238+
}, [clientApis]);
239239

240240
const handleConfigureMtls = (server: FhirServerWithState) => {
241241
setSelectedServerForMtls(server);

ui/src/components/HealthcareUsersManager/HealthcareUsersManager.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ function transformApiUser(apiUser: GetAdminHealthcareUsers200ResponseInner): Hea
147147
}
148148

149149
export function HealthcareUsersManager() {
150-
const { isAuthenticated, apiClients } = useAuth();
150+
const { isAuthenticated, clientApis } = useAuth();
151151

152152
// Store hooks for FHIR servers and healthcare users
153153
const { servers: fhirServers } = useFhirServers();
@@ -169,7 +169,7 @@ export function HealthcareUsersManager() {
169169
setLoading(true);
170170
setError(null);
171171

172-
const apiUsers = await apiClients.healthcareUsers.getAdminHealthcareUsers();
172+
const apiUsers = await clientApis.healthcareUsers.getAdminHealthcareUsers();
173173

174174
const transformedUsers = apiUsers.map(transformApiUser);
175175
setUsers(transformedUsers);
@@ -180,7 +180,7 @@ export function HealthcareUsersManager() {
180180
} finally {
181181
setLoading(false);
182182
}
183-
}, [apiClients.healthcareUsers]);
183+
}, [clientApis.healthcareUsers]);
184184

185185
useEffect(() => {
186186
if (isAuthenticated) {
@@ -197,7 +197,7 @@ export function HealthcareUsersManager() {
197197
try {
198198
const newEnabled = currentStatus === 'inactive';
199199

200-
await apiClients.healthcareUsers.putAdminHealthcareUsersByUserId({
200+
await clientApis.healthcareUsers.putAdminHealthcareUsersByUserId({
201201
userId: id,
202202
putAdminHealthcareUsersByUserIdRequest: {
203203
enabled: newEnabled
@@ -218,7 +218,7 @@ export function HealthcareUsersManager() {
218218

219219
const deleteUser = async (id: string) => {
220220
try {
221-
await apiClients.healthcareUsers.deleteAdminHealthcareUsersByUserId({ userId: id });
221+
await clientApis.healthcareUsers.deleteAdminHealthcareUsersByUserId({ userId: id });
222222

223223
// Remove user from local state
224224
setUsers(users.filter(user => user.id !== id));
@@ -304,7 +304,7 @@ export function HealthcareUsersManager() {
304304
clientRoles: (formData.clientRoles && Object.keys(formData.clientRoles).length > 0) ? formData.clientRoles : undefined,
305305
};
306306

307-
const createdUser = await apiClients.healthcareUsers.postAdminHealthcareUsers({
307+
const createdUser = await clientApis.healthcareUsers.postAdminHealthcareUsers({
308308
postAdminHealthcareUsersRequest: createRequest
309309
});
310310

@@ -349,7 +349,7 @@ export function HealthcareUsersManager() {
349349
clientRoles: Object.keys(formData.clientRoles).length > 0 ? formData.clientRoles : undefined,
350350
};
351351

352-
const updatedUser = await apiClients.healthcareUsers.putAdminHealthcareUsersByUserId({
352+
const updatedUser = await clientApis.healthcareUsers.putAdminHealthcareUsersByUserId({
353353
userId: formData.id,
354354
putAdminHealthcareUsersByUserIdRequest: updateRequest
355355
});

ui/src/components/IdPManager/IdPManager.tsx

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ export type IdPFormData = {
106106
};
107107

108108
export function IdPManager() {
109-
const { isAuthenticated, apiClients } = useAuth();
109+
const { isAuthenticated, clientApis } = useAuth();
110110
const [idps, setIdps] = useState<IdP[]>([]);
111111
const [loading, setLoading] = useState(true);
112112
const [showAddForm, setShowAddForm] = useState(false);
@@ -151,12 +151,12 @@ export function IdPManager() {
151151
}
152152

153153
// Try to fetch real data from backend
154-
const countResponse = await apiClients.identityProviders.getAdminIdpsCount();
154+
const countResponse = await clientApis.identityProviders.getAdminIdpsCount();
155155

156156
// If we get real data from the backend, fetch the full list
157157
if (countResponse.total && countResponse.total > 0) {
158158
// Fetch the actual identity providers list
159-
const providersResponse = await apiClients.identityProviders.getAdminIdps();
159+
const providersResponse = await clientApis.identityProviders.getAdminIdps();
160160

161161
// Transform backend data to match our interface
162162
const transformedIdps = providersResponse.map((provider) => {
@@ -189,11 +189,11 @@ export function IdPManager() {
189189
};
190190

191191
loadIdPs();
192-
}, [isAuthenticated, apiClients.identityProviders]);
192+
}, [isAuthenticated, clientApis.identityProviders]);
193193

194194
const handleAddIdp = async (formData: IdPFormData) => {
195195
try {
196-
if (isAuthenticated && apiClients.identityProviders) {
196+
if (isAuthenticated && clientApis.identityProviders) {
197197
// Try to add via backend API
198198
const config: Record<string, unknown> = {
199199
displayName: formData.displayName || formData.name,
@@ -224,7 +224,7 @@ export function IdPManager() {
224224
if (formData.metadataUrl) config.metadataDescriptorUrl = formData.metadataUrl;
225225
config.enabled = formData.enabled;
226226

227-
const response = await apiClients.identityProviders.postAdminIdps({
227+
const response = await clientApis.identityProviders.postAdminIdps({
228228
postAdminIdpsRequest: {
229229
alias: formData.name.toLowerCase().replace(/\s+/g, '-'),
230230
providerId: formData.type.toLowerCase(),
@@ -235,7 +235,7 @@ export function IdPManager() {
235235
console.log('IdP added successfully:', response);
236236

237237
// Reload IdPs from backend
238-
const providersResponse = await apiClients.identityProviders.getAdminIdps();
238+
const providersResponse = await clientApis.identityProviders.getAdminIdps();
239239
const transformedIdps = providersResponse.map((provider) => {
240240
const config = provider.config as Record<string, unknown> | undefined;
241241
return {
@@ -298,9 +298,9 @@ export function IdPManager() {
298298

299299
const handleUpdateIdp = async (updatedIdp: IdP) => {
300300
try {
301-
if (isAuthenticated && apiClients.identityProviders) {
301+
if (isAuthenticated && clientApis.identityProviders) {
302302
// Try to update via backend API
303-
await apiClients.identityProviders.putAdminIdpsByAlias({
303+
await clientApis.identityProviders.putAdminIdpsByAlias({
304304
alias: updatedIdp.id,
305305
putAdminIdpsByAliasRequest: {
306306
displayName: updatedIdp.name,
@@ -313,7 +313,7 @@ export function IdPManager() {
313313
});
314314

315315
// Reload IdPs from backend
316-
const providersResponse = await apiClients.identityProviders.getAdminIdps();
316+
const providersResponse = await clientApis.identityProviders.getAdminIdps();
317317
const transformedIdps = providersResponse.map((provider) => {
318318
const config = provider.config as Record<string, unknown> | undefined;
319319
return {
@@ -384,12 +384,12 @@ export function IdPManager() {
384384

385385
const handleDeleteIdp = async (id: string) => {
386386
try {
387-
if (isAuthenticated && apiClients.identityProviders) {
387+
if (isAuthenticated && clientApis.identityProviders) {
388388
// Try to delete via backend API
389-
await apiClients.identityProviders.deleteAdminIdpsByAlias({ alias: id });
389+
await clientApis.identityProviders.deleteAdminIdpsByAlias({ alias: id });
390390

391391
// Reload IdPs from backend
392-
const providersResponse = await apiClients.identityProviders.getAdminIdps();
392+
const providersResponse = await clientApis.identityProviders.getAdminIdps();
393393
const transformedIdps = providersResponse.map((provider) => {
394394
const config = provider.config as Record<string, unknown> | undefined;
395395
return {

ui/src/components/KeycloakConfigForm.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
Shield,
1111
Info
1212
} from 'lucide-react';
13-
import { createApiClients } from '@/lib/apiClient';
13+
import { createClientApis } from '@/lib/apiClient';
1414
import { useTranslation } from 'react-i18next';
1515

1616
interface KeycloakConfigFormProps {
@@ -29,7 +29,7 @@ export function KeycloakConfigForm({ onSuccess, onCancel }: KeycloakConfigFormPr
2929
const [error, setError] = useState<string | null>(null);
3030
const { t } = useTranslation();
3131

32-
const apiClients = createApiClients(); // No auth needed for these endpoints
32+
const clientApis = createClientApis(); // No auth needed for these endpoints
3333

3434
const handleTest = async () => {
3535
if (!baseUrl.trim() || !realm.trim()) {
@@ -42,7 +42,7 @@ export function KeycloakConfigForm({ onSuccess, onCancel }: KeycloakConfigFormPr
4242
setError(null);
4343

4444
try {
45-
const result = await apiClients.admin.postAdminKeycloakConfigTest({
45+
const result = await clientApis.admin.postAdminKeycloakConfigTest({
4646
postAdminKeycloakConfigTestRequest: {
4747
baseUrl: baseUrl.trim(),
4848
realm: realm.trim()
@@ -74,7 +74,7 @@ export function KeycloakConfigForm({ onSuccess, onCancel }: KeycloakConfigFormPr
7474
setError(null);
7575

7676
try {
77-
const result = await apiClients.admin.postAdminKeycloakConfigConfigure({
77+
const result = await clientApis.admin.postAdminKeycloakConfigConfigure({
7878
postAdminKeycloakConfigConfigureRequest: {
7979
baseUrl: baseUrl.trim(),
8080
realm: realm.trim(),

ui/src/components/LaunchContextManager.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ export function LaunchContextManager() {
230230
const { contextSets, addContextSet, updateContextSet, deleteContextSet } = useLaunchContextSets();
231231

232232
// Use auth store to get authenticated client APIs and auth state
233-
const { isAuthenticated, profile, apiClients } = useAuth();
233+
const { isAuthenticated, profile, clientApis } = useAuth();
234234

235235
// Track if templates have been initialized to prevent infinite loops
236236
const templatesInitialized = useRef(false);
@@ -336,7 +336,7 @@ export function LaunchContextManager() {
336336
setError(null);
337337
try {
338338
// Use auth store's client APIs with automatic error handling
339-
const response = await apiClients.launchContexts.getAdminLaunchContexts();
339+
const response = await clientApis.launchContexts.getAdminLaunchContexts();
340340
setLaunchContextUsers(response);
341341
console.log('Successfully loaded launch contexts:', response.length);
342342
} catch (err) {
@@ -351,7 +351,7 @@ export function LaunchContextManager() {
351351

352352
loadLaunchContextsImmediate();
353353
}
354-
}, [activeTab, isAuthenticated, profile, apiClients.launchContexts]);
354+
}, [activeTab, isAuthenticated, profile, clientApis.launchContexts]);
355355

356356
// Handle saving a context set from the builder
357357
const handleSaveContextSet = (contextSetData: Omit<ContextSet, 'id' | 'createdAt' | 'updatedAt'>) => {

ui/src/components/LoginForm.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useState, useEffect, useCallback } from 'react';
22
import { useAuthStore } from '../stores/authStore';
3-
import { createApiClients } from '../lib/apiClient';
3+
import { createClientApis } from '../lib/apiClient';
44
import { openidService } from '../service/openid-service';
55
import type { GetAuthIdentityProviders200ResponseInner } from '../lib/api-client/models';
66
import { KeycloakConfigForm } from './KeycloakConfigForm';
@@ -32,8 +32,8 @@ export function LoginForm() {
3232
const fetchAvailableIdps = useCallback(async () => {
3333
try {
3434
setLoadingIdps(true);
35-
const apiClients = createApiClients(); // No token needed for public IdP list
36-
const idps = await apiClients.auth.getAuthIdentityProviders();
35+
const clientApis = createClientApis(); // No token needed for public IdP list
36+
const idps = await clientApis.auth.getAuthIdentityProviders();
3737

3838
// Filter to only show enabled identity providers
3939
const enabledIdps = idps.filter((idp: GetAuthIdentityProviders200ResponseInner) => idp.enabled !== false);

ui/src/components/SmartAppsManager/SmartAppsManager.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ const mockApps: SmartApp[] = [
145145

146146
export function SmartAppsManager() {
147147
const { smartAppsManagerTab, setSmartAppsManagerTab } = useAppStore();
148-
const { apiClients } = useAuth();
148+
const { clientApis } = useAuth();
149149
const [apps, setApps] = useState<SmartApp[]>([]);
150150
const [loading, setLoading] = useState(true);
151151
const [backendApps, setBackendApps] = useState<SmartApp[]>([]);
@@ -174,7 +174,7 @@ export function SmartAppsManager() {
174174
const fetchApps = async () => {
175175
try {
176176
setLoading(true);
177-
const fetchedApps = await apiClients.smartApps.getAdminSmartApps();
177+
const fetchedApps = await clientApis.smartApps.getAdminSmartApps();
178178

179179
setBackendApps(fetchedApps);
180180

@@ -207,7 +207,7 @@ export function SmartAppsManager() {
207207
};
208208

209209
fetchApps();
210-
}, [apiClients.smartApps]);
210+
}, [clientApis.smartApps]);
211211

212212
const handleAddApp = (appData: SmartAppFormData) => {
213213
// Convert form data to SmartApp format for UI display

0 commit comments

Comments
 (0)