Skip to content
This repository was archived by the owner on Feb 20, 2024. It is now read-only.

Commit f662c9a

Browse files
Merge pull request #28 from solace-iot-team/mtn-0-1-7
Mtn 0 1 7
2 parents 1c0d3f8 + 968fdc2 commit f662c9a

File tree

9 files changed

+87
-26
lines changed

9 files changed

+87
-26
lines changed

ReleaseNotes.md

+18
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,24 @@
22

33
Solace Async API Management.
44

5+
## Version 0.1.8
6+
* [API-M Admin & Developer Portal](https://github.com/solace-iot-team/async-apim/tree/main/apim-portal): 0.1.8
7+
* [API-M Server OpenAPI](https://github.com/solace-iot-team/async-apim/blob/main/apim-server/server/common/api.yml): 0.1.0
8+
* [API-M Server](https://github.com/solace-iot-team/async-apim/tree/main/apim-server): 0.1.0
9+
* [API-M Connector OpenAPI](https://github.com/solace-iot-team/platform-api): 0.7.11
10+
11+
#### API-M Admin & Developer Portal
12+
13+
**Enhancements:**
14+
* **Admin Portal:Manage Apps**
15+
- owner for internal business group / team apps now shows the display name and not the id
16+
* **Healthcheck**
17+
- increased timeout from 500ms to 1s when running healthcheck
18+
19+
**Fixes:**
20+
* **Developer Portal:Business Group Apps: List**
21+
- error handling when the team does not exist yet in the Connector
22+
523
## Version 0.1.7
624
* [API-M Admin & Developer Portal](https://github.com/solace-iot-team/async-apim/tree/main/apim-portal): 0.1.7
725
* [API-M Server OpenAPI](https://github.com/solace-iot-team/async-apim/blob/main/apim-server/server/common/api.yml): 0.1.0

apim-portal/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "async-apim-portal",
3-
"version": "0.1.7",
3+
"version": "0.1.8",
44
"description": "Solace Async API Management Portal",
55
"repository": {
66
"type": "git",

apim-portal/src/admin-portal/components/ManageApps/ListApps.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,8 @@ export const ListApps: React.FC<IListAppsProps> = (props: IListAppsProps) => {
246246
const appTypeBodyTemplate = (row: TManagedObject): string => {
247247
return row.apAppMeta.apAppType;
248248
}
249-
const ownerIdBodyTemplate = (row: TManagedObject): string => {
250-
return row.apAppMeta.appOwnerId;
249+
const ownerDisplayNameBodyTemplate = (row: TManagedObject): string => {
250+
return row.apAppMeta.appOwnerDisplayName;
251251
}
252252
const ownerTypeBodyTemplate = (row: TManagedObject): string => {
253253
return row.apAppMeta.apAppOwnerType;
@@ -258,7 +258,7 @@ export const ListApps: React.FC<IListAppsProps> = (props: IListAppsProps) => {
258258
const sortField = APAdminPortalAppsDisplayService.nameOf_ApEntityId('displayName');
259259
const filterField = APDisplayUtils.nameOf<TManagedObject>('apSearchContent');
260260
const statusField = APDisplayUtils.nameOf<TManagedObject>('apAdminPortalAppStatus');
261-
const ownerIdField = APAdminPortalAppsDisplayService.nameOf_ApAppMeta('appOwnerId');
261+
const ownerDisplayNameField = APAdminPortalAppsDisplayService.nameOf_ApAppMeta('appOwnerDisplayName');
262262
const ownerTypeField = APAdminPortalAppsDisplayService.nameOf_ApAppMeta('apAppOwnerType');
263263
const appTypeField = APAdminPortalAppsDisplayService.nameOf_ApAppMeta('apAppType');
264264
const develAppStatusField = 'connectorAppListItem.status';
@@ -289,7 +289,7 @@ export const ListApps: React.FC<IListAppsProps> = (props: IListAppsProps) => {
289289
>
290290
<Column header="Name" body={nameBodyTemplate} filterField={filterField} sortField={sortField} sortable />
291291
<Column header="Type" body={appTypeBodyTemplate} field={appTypeField} sortable />
292-
<Column header="Owner Id" body={ownerIdBodyTemplate} field={ownerIdField} sortable />
292+
<Column header="Owner" body={ownerDisplayNameBodyTemplate} field={ownerDisplayNameField} sortable />
293293
<Column header="Owner Type" body={ownerTypeBodyTemplate} field={ownerTypeField} sortable style={{ width: '9em' }}/>
294294
<Column header="Status" field={statusField} sortable style={{ width: "13em"}} />
295295
{Config.getUseDevelTools() &&

apim-portal/src/admin-portal/displayServices/APAdminPortalAppsDisplayService.ts

+23-4
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import {
2626
TAPAppMeta,
2727
TAPTopicSyntax
2828
} from '../../displayServices/APAppsDisplayService/APAppsDisplayService';
29-
import APBusinessGroupsDisplayService, { TAPBusinessGroupDisplayList } from '../../displayServices/APBusinessGroupsDisplayService';
29+
import APBusinessGroupsDisplayService, { TAPBusinessGroupDisplay, TAPBusinessGroupDisplayList } from '../../displayServices/APBusinessGroupsDisplayService';
3030
import APRbacDisplayService from '../../displayServices/APRbacDisplayService';
3131
import APOrganizationUsersDisplayService, {
3232
TAPCheckOrganizationUserIdExistsResult, TAPOrganizationUserDisplay, TAPOrganizationUserDisplayList
@@ -230,15 +230,15 @@ class APAdminPortalAppsDisplayService extends APAppsDisplayService {
230230
if(ownerId === undefined) throw new Error(`${logName}: ownerId === undefined`);
231231
switch(apAppType) {
232232
case EAPApp_Type.USER:
233-
console.log(`${logName}: looking for userId=${ownerId}`);
233+
// console.log(`${logName}: looking for userId=${ownerId}`);
234234
// check cache if defined
235235
if(cache_ApOrganizationUserDisplayList !== undefined) {
236236
const cached_ApOrganizationUserDisplay: TAPOrganizationUserDisplay | undefined = cache_ApOrganizationUserDisplayList.find( (x) => {
237237
return x.apEntityId.id === ownerId;
238238
});
239239
if(cached_ApOrganizationUserDisplay !== undefined) return true;
240240
}
241-
console.log(`${logName}: not in cache, userId=${ownerId}`);
241+
// console.log(`${logName}: not in cache, userId=${ownerId}`);
242242
// not in cache
243243
const result: TAPCheckOrganizationUserIdExistsResult = await APOrganizationUsersDisplayService.apsCheck_OrganizationUserIdExists({
244244
organizationId: organizationId,
@@ -272,9 +272,10 @@ class APAdminPortalAppsDisplayService extends APAppsDisplayService {
272272
connectorAppApiProductList: AppApiProducts;
273273
complete_ApOrganizationBusinessGroupDisplayList?: TAPBusinessGroupDisplayList;
274274
}): Promise<TAPAppMeta> {
275-
const funcName = 'create_ApAppMeta';
275+
const funcName = 'create_ApAdminPortalAppDisplay_ApAppMeta';
276276
const logName = `${this.ComponentName}.${funcName}()`;
277277
if(connectorOwnerId === undefined) throw new Error(`${logName}: connectorOwnerId === undefined`);
278+
278279
const apAppType: EAPApp_Type = this.map_ConnectorAppType_To_ApAppType({ connectorAppType: connectorAppType });
279280
if(isOwnerInternal === undefined) isOwnerInternal = await this.apiCheck_isOwnerIdInternal({
280281
organizationId: organizationId,
@@ -283,10 +284,28 @@ class APAdminPortalAppsDisplayService extends APAppsDisplayService {
283284
cache_ApOrganizationUserDisplayList: cache_ApOrganizationUserDisplayList,
284285
complete_ApOrganizationBusinessGroupDisplayList: complete_ApOrganizationBusinessGroupDisplayList
285286
});
287+
// need it to determined business group display name if a team app
288+
let appOwnerDisplayName: string = connectorOwnerId;
289+
if(apAppType === EAPApp_Type.TEAM && isOwnerInternal) {
290+
if(complete_ApOrganizationBusinessGroupDisplayList === undefined) {
291+
// get the organization business group list
292+
complete_ApOrganizationBusinessGroupDisplayList = await APBusinessGroupsDisplayService.apsGetList_ApBusinessGroupSystemDisplayList({
293+
organizationId: organizationId
294+
});
295+
}
296+
const apOrganizationBusinessGroupDisplay: TAPBusinessGroupDisplay | undefined = complete_ApOrganizationBusinessGroupDisplayList.find( (x) => {
297+
return x.apEntityId.id === connectorOwnerId;
298+
});
299+
if(apOrganizationBusinessGroupDisplay === undefined) throw new Error(`${logName}: apOrganizationBusinessGroupDisplay === undefined`);
300+
if(apOrganizationBusinessGroupDisplay.apExternalReference !== undefined) appOwnerDisplayName = apOrganizationBusinessGroupDisplay.apExternalReference.displayName;
301+
else appOwnerDisplayName = apOrganizationBusinessGroupDisplay.apEntityId.displayName;
302+
}
303+
286304
return {
287305
apAppType: apAppType,
288306
apAppOwnerType: isOwnerInternal ? EAPApp_OwnerType.INTERNAL : EAPApp_OwnerType.EXTERNAL,
289307
appOwnerId: connectorOwnerId,
308+
appOwnerDisplayName: appOwnerDisplayName
290309
};
291310
}
292311

apim-portal/src/developer-portal/components/DeveloperPortalManageApps/DeveloperPortalManageTeamApps/DeveloperPortalManageTeamApps.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ export const DeveloperPortalManageTeamApps: React.FC<IDeveloperPortalManageTeamA
419419
/>
420420
}
421421
{showViewComponent && managedObjectEntityId &&
422-
<DeveloperPortalViewApp
422+
<DeveloperPortalViewApp
423423
key={`${ComponentName}_DeveloperPortalViewApp_${refreshCounter}`}
424424
appType={EAppType.TEAM}
425425
organizationId={props.organizationEntityId.id}

apim-portal/src/developer-portal/displayServices/APDeveloperPortalTeamAppsDisplayService.ts

+31-12
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ class APDeveloperPortalTeamAppsDisplayService extends APDeveloperPortalAppsDispl
4444
return {
4545
apAppType: EAPApp_Type.TEAM,
4646
apAppOwnerType: EAPApp_OwnerType.INTERNAL,
47-
appOwnerId: ownerId
47+
appOwnerId: ownerId,
48+
// do we need the business group display name here?
49+
appOwnerDisplayName: ownerId
4850
};
4951
}
5052

@@ -189,22 +191,39 @@ class APDeveloperPortalTeamAppsDisplayService extends APDeveloperPortalAppsDispl
189191
return apDeveloperPortalTeamAppDisplay;
190192
}
191193

194+
/**
195+
* Returns list of team apps.
196+
*/
192197
public apiGetList_ApDeveloperPortalTeamAppListDisplayList = async({ organizationId, teamId }: {
193198
organizationId: string;
194199
teamId: string;
195200
}): Promise<TAPDeveloperPortalAppListDisplayList> => {
201+
const funcName = 'apiGetList_ApDeveloperPortalTeamAppListDisplayList';
202+
const logName = `${this.ComponentName}.${funcName}()`;
196203

197-
const connectorAppResponseList: Array<AppResponse> = await AppsService.listTeamApps({
198-
organizationName: organizationId,
199-
teamName: teamId
200-
});
201-
202-
return await this.apiGetList_ApDeveloperPortalAppListDisplayList({
203-
organizationId: organizationId,
204-
ownerId: teamId,
205-
connectorAppResponseList: connectorAppResponseList
206-
});
207-
204+
let anyError: any = undefined;
205+
try {
206+
const connectorAppResponseList: Array<AppResponse> = await AppsService.listTeamApps({
207+
organizationName: organizationId,
208+
teamName: teamId
209+
});
210+
return await this.apiGetList_ApDeveloperPortalAppListDisplayList({
211+
organizationId: organizationId,
212+
ownerId: teamId,
213+
connectorAppResponseList: connectorAppResponseList
214+
});
215+
} catch(e: any) {
216+
if(APClientConnectorOpenApi.isInstanceOfApiError(e)) {
217+
const apiError: ApiError = e;
218+
if(apiError.status === 404) return [];
219+
else anyError = e;
220+
} else anyError = e;
221+
}
222+
if(anyError) {
223+
APClientConnectorOpenApi.logError(logName, anyError);
224+
throw anyError;
225+
}
226+
return [];
208227
}
209228

210229
/**

apim-portal/src/developer-portal/displayServices/APDeveloperPortalUserAppsDisplayService.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ class APDeveloperPortalUserAppsDisplayService extends APDeveloperPortalAppsDispl
4242
return {
4343
apAppType: EAPApp_Type.USER,
4444
apAppOwnerType: EAPApp_OwnerType.INTERNAL,
45-
appOwnerId: ownerId
45+
appOwnerId: ownerId,
46+
appOwnerDisplayName: ownerId
4647
};
4748
}
4849

apim-portal/src/displayServices/APAppsDisplayService/APAppsDisplayService.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ export type TAPAppCredentialsDisplay = {
6363
export type TAPAppMeta = {
6464
apAppType: EAPApp_Type;
6565
appOwnerId: string;
66+
appOwnerDisplayName: string;
6667
apAppOwnerType: EAPApp_OwnerType;
6768
}
6869

@@ -140,13 +141,15 @@ export class APAppsDisplayService {
140141
return {
141142
apAppType: EAPApp_Type.USER,
142143
apAppOwnerType: EAPApp_OwnerType.UNKNOWN,
143-
appOwnerId: connectorAppResponseGeneric.ownerId
144+
appOwnerId: connectorAppResponseGeneric.ownerId,
145+
appOwnerDisplayName: connectorAppResponseGeneric.ownerId,
144146
};
145147
case AppResponseGeneric.appType.TEAM:
146148
return {
147149
apAppType: EAPApp_Type.TEAM,
148150
apAppOwnerType: EAPApp_OwnerType.UNKNOWN,
149-
appOwnerId: connectorAppResponseGeneric.ownerId
151+
appOwnerId: connectorAppResponseGeneric.ownerId,
152+
appOwnerDisplayName: connectorAppResponseGeneric.ownerId,
150153
};
151154
default:
152155
Globals.assertNever(logName, connectorAppResponseGeneric.appType);
@@ -175,6 +178,7 @@ export class APAppsDisplayService {
175178
return {
176179
apAppType: EAPApp_Type.UNKNOWN,
177180
appOwnerId: '',
181+
appOwnerDisplayName: '',
178182
apAppOwnerType: EAPApp_OwnerType.UNKNOWN
179183
}
180184
}

apim-portal/src/utils/APClientRaw.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { APTimeoutError } from './APError';
77
import { APFetch, APFetchResult } from './APFetch';
88
import { APSClientOpenApi } from './APSClientOpenApi';
99

10-
const FetchTimeout_ms: number = 500;
10+
const FetchTimeout_ms: number = 1000;
1111

1212
export type APClientRawResult = {
1313
readonly url: string;

0 commit comments

Comments
 (0)