|
|
|
@ -27,7 +27,6 @@ import { |
|
|
|
OAuth2ClientInfo, |
|
|
|
platformTypeTranslations |
|
|
|
} from '@shared/models/oauth2.models'; |
|
|
|
import { UtilsService } from '@core/services/utils.service'; |
|
|
|
import { TranslateService } from '@ngx-translate/core'; |
|
|
|
import { DatePipe } from '@angular/common'; |
|
|
|
import { EntityType, entityTypeTranslations } from '@shared/models/entity-type.models'; |
|
|
|
@ -40,11 +39,11 @@ import { PageLink } from '@shared/models/page/page-link'; |
|
|
|
@Injectable() |
|
|
|
export class ClientsTableConfigResolver implements Resolve<EntityTableConfig<OAuth2Client, PageLink, OAuth2ClientInfo>> { |
|
|
|
|
|
|
|
private readonly config: EntityTableConfig<OAuth2Client, PageLink, OAuth2ClientInfo> = new EntityTableConfig<OAuth2Client, PageLink, OAuth2ClientInfo>(); |
|
|
|
private readonly config: EntityTableConfig<OAuth2Client, PageLink, OAuth2ClientInfo> = |
|
|
|
new EntityTableConfig<OAuth2Client, PageLink, OAuth2ClientInfo>(); |
|
|
|
|
|
|
|
constructor(private translate: TranslateService, |
|
|
|
private datePipe: DatePipe, |
|
|
|
private utilsService: UtilsService, |
|
|
|
private oauth2Service: OAuth2Service) { |
|
|
|
this.config.tableTitle = this.translate.instant('admin.oauth2.clients'); |
|
|
|
this.config.selectionEnabled = false; |
|
|
|
@ -53,9 +52,7 @@ export class ClientsTableConfigResolver implements Resolve<EntityTableConfig<OAu |
|
|
|
this.config.entityTranslations = entityTypeTranslations.get(EntityType.OAUTH2_CLIENT); |
|
|
|
this.config.entityResources = { |
|
|
|
helpLinkId: null, |
|
|
|
helpLinkIdForEntity(entity: OAuth2Client): string { |
|
|
|
return getProviderHelpLink(entity.additionalInfo.providerName); |
|
|
|
} |
|
|
|
helpLinkIdForEntity: (entity: OAuth2Client) => getProviderHelpLink(entity.additionalInfo.providerName) |
|
|
|
}; |
|
|
|
this.config.entityComponent = ClientComponent; |
|
|
|
this.config.headerComponent = ClientTableHeaderComponent; |
|
|
|
@ -66,20 +63,16 @@ export class ClientsTableConfigResolver implements Resolve<EntityTableConfig<OAu |
|
|
|
new DateEntityTableColumn<OAuth2ClientInfo>('createdTime', 'common.created-time', this.datePipe, '170px'), |
|
|
|
new EntityTableColumn<OAuth2ClientInfo>('title', 'admin.oauth2.title', '350px'), |
|
|
|
new EntityTableColumn<OAuth2ClientInfo>('platforms', 'admin.oauth2.allowed-platforms', '100%', |
|
|
|
(clientInfo) => { |
|
|
|
return clientInfo.platforms && clientInfo.platforms.length ? |
|
|
|
clientInfo.platforms.map(platform => this.translate.instant(platformTypeTranslations.get(platform))).join(', ') : |
|
|
|
this.translate.instant('admin.oauth2.all-platforms'); |
|
|
|
}, () => ({}), false) |
|
|
|
(clientInfo) => clientInfo.platforms && clientInfo.platforms.length ? |
|
|
|
clientInfo.platforms.map(platform => this.translate.instant(platformTypeTranslations.get(platform))).join(', ') : |
|
|
|
this.translate.instant('admin.oauth2.all-platforms'), () => ({}), false) |
|
|
|
); |
|
|
|
|
|
|
|
this.config.deleteEntityTitle = (client) => this.translate.instant('admin.oauth2.delete-client-title', {clientName: client.title}); |
|
|
|
this.config.deleteEntityContent = () => this.translate.instant('admin.oauth2.delete-client-text'); |
|
|
|
this.config.entitiesFetchFunction = pageLink => this.oauth2Service.findTenantOAuth2ClientInfos(pageLink); |
|
|
|
this.config.loadEntity = id => this.oauth2Service.getOAuth2ClientById(id.id); |
|
|
|
this.config.saveEntity = client => { |
|
|
|
return this.oauth2Service.saveOAuth2Client(client); |
|
|
|
} |
|
|
|
this.config.saveEntity = client => this.oauth2Service.saveOAuth2Client(client); |
|
|
|
this.config.deleteEntity = id => this.oauth2Service.deleteOauth2Client(id.id); |
|
|
|
} |
|
|
|
|
|
|
|
|