some renames
This commit is contained in:
parent
b6536f736b
commit
0ea1bd1900
@ -4,7 +4,7 @@ import { MatIconModule } from '@angular/material/icon';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||
import { SortByPipe } from './sorting';
|
||||
import { BaseAppConfig, CapitalizePipe, CommonUiOptions, HumanizePipe, ModuleWithOptions } from './utils';
|
||||
import { CapitalizePipe, CommonUiOptions, HumanizePipe, IqserAppConfig, ModuleWithOptions } from './utils';
|
||||
import {
|
||||
HiddenActionComponent,
|
||||
LogoComponent,
|
||||
@ -33,7 +33,7 @@ import { MatProgressBarModule } from '@angular/material/progress-bar';
|
||||
import { ConfirmationDialogComponent } from './dialog';
|
||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||
import { HumanizeCamelCasePipe } from './utils/pipes/humanize-camel-case.pipe';
|
||||
import { ApiPathInterceptor, BaseConfigService, BaseUserPreferenceService } from './services';
|
||||
import { ApiPathInterceptor, IqserConfigService, IqserUserPreferenceService } from './services';
|
||||
import { DefaultUserPreferenceService } from './services/default-user-preference.service';
|
||||
import { HTTP_INTERCEPTORS } from '@angular/common/http';
|
||||
|
||||
@ -82,12 +82,12 @@ const pipes = [SortByPipe, HumanizePipe, CapitalizePipe, HumanizeCamelCasePipe];
|
||||
})
|
||||
export class CommonUiModule extends ModuleWithOptions {
|
||||
static forRoot<
|
||||
UserPreference extends BaseUserPreferenceService,
|
||||
Config extends BaseConfigService<AppConfig>,
|
||||
AppConfig extends BaseAppConfig = BaseAppConfig,
|
||||
UserPreference extends IqserUserPreferenceService,
|
||||
Config extends IqserConfigService<AppConfig>,
|
||||
AppConfig extends IqserAppConfig = IqserAppConfig,
|
||||
>(options: CommonUiOptions<UserPreference, Config, AppConfig>): ModuleWithProviders<CommonUiModule> {
|
||||
const userPreferenceService = this._getService(
|
||||
BaseUserPreferenceService,
|
||||
IqserUserPreferenceService,
|
||||
DefaultUserPreferenceService,
|
||||
options.existingUserPreferenceService,
|
||||
);
|
||||
@ -116,7 +116,7 @@ export class CommonUiModule extends ModuleWithOptions {
|
||||
useFactory: configServiceFactory,
|
||||
},
|
||||
{
|
||||
provide: BaseConfigService,
|
||||
provide: IqserConfigService,
|
||||
useExisting: configService,
|
||||
},
|
||||
];
|
||||
@ -124,7 +124,7 @@ export class CommonUiModule extends ModuleWithOptions {
|
||||
|
||||
return [
|
||||
{
|
||||
provide: BaseConfigService,
|
||||
provide: IqserConfigService,
|
||||
useFactory: configServiceFactory,
|
||||
},
|
||||
];
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
import { inject, InjectionToken } from '@angular/core';
|
||||
import { BaseConfigService } from '../services';
|
||||
import { IqserConfigService } from '../services';
|
||||
import { HelpDocs } from './help-docs';
|
||||
|
||||
export const HELP_DOCS = new InjectionToken<HelpDocs>('Links to user manual or help docs');
|
||||
export const MANUAL_BASE_URL = new InjectionToken<string>('Base manual URL', {
|
||||
factory: () => inject(BaseConfigService).values.MANUAL_BASE_URL,
|
||||
factory: () => inject(IqserConfigService).values.MANUAL_BASE_URL,
|
||||
});
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { HttpEvent, HttpHandler, HttpInterceptor, HttpRequest } from '@angular/common/http';
|
||||
import { inject, Injectable } from '@angular/core';
|
||||
import { Observable } from 'rxjs';
|
||||
import { getConfig } from './base-config.service';
|
||||
import { getConfig } from './iqser-config.service';
|
||||
import { BASE_HREF } from '../utils';
|
||||
|
||||
@Injectable()
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
import { inject, Injectable } from '@angular/core';
|
||||
import { BASE_HREF } from '../utils';
|
||||
import { BaseUserPreferenceService } from './base-user-preference.service';
|
||||
import { IqserUserPreferenceService } from './iqser-user-preference.service';
|
||||
|
||||
@Injectable()
|
||||
export class DefaultUserPreferenceService extends BaseUserPreferenceService {
|
||||
export class DefaultUserPreferenceService extends IqserUserPreferenceService {
|
||||
protected readonly _defaultModelPath = 'attributes';
|
||||
protected readonly _devFeaturesEnabledKey = inject(BASE_HREF) + '.enable-dev-features';
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@ export * from './generic.service';
|
||||
export * from './composite-route.guard';
|
||||
export * from './stats.service';
|
||||
export * from './entities-map.service';
|
||||
export * from './base-user-preference.service';
|
||||
export * from './iqser-user-preference.service';
|
||||
export * from './language.service';
|
||||
export * from './base-config.service';
|
||||
export * from './iqser-config.service';
|
||||
export * from './api-path.interceptor';
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
import { inject } from '@angular/core';
|
||||
import { Title } from '@angular/platform-browser';
|
||||
import { CacheApiService, wipeAllCaches } from '../caching';
|
||||
import { BaseAppConfig } from '../utils';
|
||||
import { IqserAppConfig } from '../utils';
|
||||
|
||||
export class BaseConfigService<T extends BaseAppConfig = BaseAppConfig> {
|
||||
export class IqserConfigService<T extends IqserAppConfig = IqserAppConfig> {
|
||||
protected readonly _cacheApiService = inject(CacheApiService);
|
||||
protected readonly _titleService = inject(Title);
|
||||
|
||||
@ -33,6 +33,6 @@ export class BaseConfigService<T extends BaseAppConfig = BaseAppConfig> {
|
||||
}
|
||||
}
|
||||
|
||||
export function getConfig<T extends BaseAppConfig = BaseAppConfig>() {
|
||||
return inject<BaseConfigService<T>>(BaseConfigService).values;
|
||||
export function getConfig<T extends IqserAppConfig = IqserAppConfig>() {
|
||||
return inject<IqserConfigService<T>>(IqserConfigService).values;
|
||||
}
|
||||
@ -11,7 +11,7 @@ const KEYS = {
|
||||
} as const;
|
||||
|
||||
@Injectable()
|
||||
export abstract class BaseUserPreferenceService extends GenericService<UserAttributes> {
|
||||
export abstract class IqserUserPreferenceService extends GenericService<UserAttributes> {
|
||||
protected abstract readonly _devFeaturesEnabledKey: string;
|
||||
#userAttributes: UserAttributes = {};
|
||||
|
||||
@ -9,7 +9,7 @@ import arraySupport from 'dayjs/plugin/arraySupport';
|
||||
import localeData from 'dayjs/plugin/localeData';
|
||||
import { registerLocaleData } from '@angular/common';
|
||||
import localeDe from '@angular/common/locales/de';
|
||||
import { BaseUserPreferenceService } from './base-user-preference.service';
|
||||
import { IqserUserPreferenceService } from './iqser-user-preference.service';
|
||||
|
||||
dayjs.extend(arraySupport);
|
||||
dayjs.extend(localeData);
|
||||
@ -20,7 +20,7 @@ dayjs.extend(localeData);
|
||||
export class LanguageService {
|
||||
constructor(
|
||||
private readonly _translateService: TranslateService,
|
||||
private readonly _userPreferenceService: BaseUserPreferenceService,
|
||||
private readonly _userPreferenceService: IqserUserPreferenceService,
|
||||
private readonly _dateAdapter: DateAdapter<Dayjs>,
|
||||
) {
|
||||
registerLocaleData(localeDe);
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { ActivatedRouteSnapshot, Router } from '@angular/router';
|
||||
import { KeycloakAuthGuard, KeycloakService } from 'keycloak-angular';
|
||||
import { BaseConfigService } from '../../services';
|
||||
import { IqserConfigService } from '../../services';
|
||||
import { IqserUserService } from '../services/iqser-user.service';
|
||||
|
||||
@Injectable()
|
||||
@ -9,7 +9,7 @@ export class IqserAuthGuard extends KeycloakAuthGuard {
|
||||
constructor(
|
||||
protected readonly _router: Router,
|
||||
protected readonly _keycloak: KeycloakService,
|
||||
private readonly _configService: BaseConfigService,
|
||||
private readonly _configService: IqserConfigService,
|
||||
private readonly _userService: IqserUserService,
|
||||
) {
|
||||
super(_router, _keycloak);
|
||||
|
||||
@ -10,7 +10,7 @@ import { IqserUsersModuleOptions } from './types/iqser-users-module-options';
|
||||
import { IqserUser } from './iqser-user.model';
|
||||
import { IqserRoleGuard } from './guards/iqser-role-guard.service';
|
||||
import { IqserAuthGuard } from './guards/iqser-auth-guard.service';
|
||||
import { BaseConfigService } from '../services';
|
||||
import { IqserConfigService } from '../services';
|
||||
import { NamePipe } from './name.pipe';
|
||||
import { InitialsAvatarComponent } from './components/initials-avatar/initials-avatar.component';
|
||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||
@ -19,7 +19,7 @@ import { UserButtonComponent } from './components/user-button/user-button.compon
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
|
||||
function getKeycloakOptions(baseUrl: string, configService: BaseConfigService): KeycloakOptions {
|
||||
function getKeycloakOptions(baseUrl: string, configService: IqserConfigService): KeycloakOptions {
|
||||
let url: string = configService.values.OAUTH_URL;
|
||||
url = url.replace(/\/$/, ''); // remove trailing slash
|
||||
const realm = url.substring(url.lastIndexOf('/') + 1, url.length);
|
||||
@ -48,7 +48,7 @@ function configureAutomaticRedirectToLoginScreen(keyCloakService: KeycloakServic
|
||||
|
||||
export function keycloakInitializer(
|
||||
keycloakService: KeycloakService,
|
||||
configService: BaseConfigService,
|
||||
configService: IqserConfigService,
|
||||
baseUrl: string,
|
||||
): () => Promise<void> {
|
||||
const x = keycloakService.init(getKeycloakOptions(baseUrl, configService));
|
||||
@ -82,7 +82,7 @@ export class IqserUsersModule extends ModuleWithOptions {
|
||||
provide: APP_INITIALIZER,
|
||||
useFactory: keycloakInitializer,
|
||||
multi: true,
|
||||
deps: [KeycloakService, BaseConfigService, BASE_HREF],
|
||||
deps: [KeycloakService, IqserConfigService, BASE_HREF],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
@ -19,5 +19,5 @@ export * from './headers-configuration';
|
||||
export * from './context.component';
|
||||
export * from './tokens';
|
||||
export * from './module-with-options';
|
||||
export * from './base-app-config';
|
||||
export * from './iqser-app-config';
|
||||
export * from './types/common-ui-options';
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
export interface BaseAppConfig {
|
||||
export interface IqserAppConfig {
|
||||
readonly API_URL: string;
|
||||
readonly APP_NAME: string;
|
||||
readonly FRONTEND_APP_VERSION: string;
|
||||
@ -1,11 +1,11 @@
|
||||
import { BaseConfigService, BaseUserPreferenceService } from '../../services';
|
||||
import { IqserConfigService, IqserUserPreferenceService } from '../../services';
|
||||
import { Type } from '@angular/core';
|
||||
import { BaseAppConfig } from '../base-app-config';
|
||||
import { IqserAppConfig } from '../iqser-app-config';
|
||||
|
||||
export interface CommonUiOptions<
|
||||
UserPreference extends BaseUserPreferenceService,
|
||||
Config extends BaseConfigService<AppConfig>,
|
||||
AppConfig extends BaseAppConfig,
|
||||
UserPreference extends IqserUserPreferenceService,
|
||||
Config extends IqserConfigService<AppConfig>,
|
||||
AppConfig extends IqserAppConfig,
|
||||
> {
|
||||
existingUserPreferenceService?: Type<UserPreference>;
|
||||
configService?: Type<Config>;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user