@@ -26,7 +26,7 @@ import {
26
26
TAPAppMeta ,
27
27
TAPTopicSyntax
28
28
} from '../../displayServices/APAppsDisplayService/APAppsDisplayService' ;
29
- import APBusinessGroupsDisplayService , { TAPBusinessGroupDisplayList } from '../../displayServices/APBusinessGroupsDisplayService' ;
29
+ import APBusinessGroupsDisplayService , { TAPBusinessGroupDisplay , TAPBusinessGroupDisplayList } from '../../displayServices/APBusinessGroupsDisplayService' ;
30
30
import APRbacDisplayService from '../../displayServices/APRbacDisplayService' ;
31
31
import APOrganizationUsersDisplayService , {
32
32
TAPCheckOrganizationUserIdExistsResult , TAPOrganizationUserDisplay , TAPOrganizationUserDisplayList
@@ -230,15 +230,15 @@ class APAdminPortalAppsDisplayService extends APAppsDisplayService {
230
230
if ( ownerId === undefined ) throw new Error ( `${ logName } : ownerId === undefined` ) ;
231
231
switch ( apAppType ) {
232
232
case EAPApp_Type . USER :
233
- console . log ( `${ logName } : looking for userId=${ ownerId } ` ) ;
233
+ // console.log(`${logName}: looking for userId=${ownerId}`);
234
234
// check cache if defined
235
235
if ( cache_ApOrganizationUserDisplayList !== undefined ) {
236
236
const cached_ApOrganizationUserDisplay : TAPOrganizationUserDisplay | undefined = cache_ApOrganizationUserDisplayList . find ( ( x ) => {
237
237
return x . apEntityId . id === ownerId ;
238
238
} ) ;
239
239
if ( cached_ApOrganizationUserDisplay !== undefined ) return true ;
240
240
}
241
- console . log ( `${ logName } : not in cache, userId=${ ownerId } ` ) ;
241
+ // console.log(`${logName}: not in cache, userId=${ownerId}`);
242
242
// not in cache
243
243
const result : TAPCheckOrganizationUserIdExistsResult = await APOrganizationUsersDisplayService . apsCheck_OrganizationUserIdExists ( {
244
244
organizationId : organizationId ,
@@ -272,9 +272,10 @@ class APAdminPortalAppsDisplayService extends APAppsDisplayService {
272
272
connectorAppApiProductList : AppApiProducts ;
273
273
complete_ApOrganizationBusinessGroupDisplayList ?: TAPBusinessGroupDisplayList ;
274
274
} ) : Promise < TAPAppMeta > {
275
- const funcName = 'create_ApAppMeta ' ;
275
+ const funcName = 'create_ApAdminPortalAppDisplay_ApAppMeta ' ;
276
276
const logName = `${ this . ComponentName } .${ funcName } ()` ;
277
277
if ( connectorOwnerId === undefined ) throw new Error ( `${ logName } : connectorOwnerId === undefined` ) ;
278
+
278
279
const apAppType : EAPApp_Type = this . map_ConnectorAppType_To_ApAppType ( { connectorAppType : connectorAppType } ) ;
279
280
if ( isOwnerInternal === undefined ) isOwnerInternal = await this . apiCheck_isOwnerIdInternal ( {
280
281
organizationId : organizationId ,
@@ -283,10 +284,28 @@ class APAdminPortalAppsDisplayService extends APAppsDisplayService {
283
284
cache_ApOrganizationUserDisplayList : cache_ApOrganizationUserDisplayList ,
284
285
complete_ApOrganizationBusinessGroupDisplayList : complete_ApOrganizationBusinessGroupDisplayList
285
286
} ) ;
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
+
286
304
return {
287
305
apAppType : apAppType ,
288
306
apAppOwnerType : isOwnerInternal ? EAPApp_OwnerType . INTERNAL : EAPApp_OwnerType . EXTERNAL ,
289
307
appOwnerId : connectorOwnerId ,
308
+ appOwnerDisplayName : appOwnerDisplayName
290
309
} ;
291
310
}
292
311
0 commit comments