some renames

This commit is contained in:
Dan Percic 2022-07-28 00:57:38 +03:00
parent b6536f736b
commit 0ea1bd1900
13 changed files with 35 additions and 35 deletions

View File

@ -4,7 +4,7 @@ import { MatIconModule } from '@angular/material/icon';
import { TranslateModule } from '@ngx-translate/core'; import { TranslateModule } from '@ngx-translate/core';
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
import { SortByPipe } from './sorting'; import { SortByPipe } from './sorting';
import { BaseAppConfig, CapitalizePipe, CommonUiOptions, HumanizePipe, ModuleWithOptions } from './utils'; import { CapitalizePipe, CommonUiOptions, HumanizePipe, IqserAppConfig, ModuleWithOptions } from './utils';
import { import {
HiddenActionComponent, HiddenActionComponent,
LogoComponent, LogoComponent,
@ -33,7 +33,7 @@ import { MatProgressBarModule } from '@angular/material/progress-bar';
import { ConfirmationDialogComponent } from './dialog'; import { ConfirmationDialogComponent } from './dialog';
import { MatTooltipModule } from '@angular/material/tooltip'; import { MatTooltipModule } from '@angular/material/tooltip';
import { HumanizeCamelCasePipe } from './utils/pipes/humanize-camel-case.pipe'; 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 { DefaultUserPreferenceService } from './services/default-user-preference.service';
import { HTTP_INTERCEPTORS } from '@angular/common/http'; import { HTTP_INTERCEPTORS } from '@angular/common/http';
@ -82,12 +82,12 @@ const pipes = [SortByPipe, HumanizePipe, CapitalizePipe, HumanizeCamelCasePipe];
}) })
export class CommonUiModule extends ModuleWithOptions { export class CommonUiModule extends ModuleWithOptions {
static forRoot< static forRoot<
UserPreference extends BaseUserPreferenceService, UserPreference extends IqserUserPreferenceService,
Config extends BaseConfigService<AppConfig>, Config extends IqserConfigService<AppConfig>,
AppConfig extends BaseAppConfig = BaseAppConfig, AppConfig extends IqserAppConfig = IqserAppConfig,
>(options: CommonUiOptions<UserPreference, Config, AppConfig>): ModuleWithProviders<CommonUiModule> { >(options: CommonUiOptions<UserPreference, Config, AppConfig>): ModuleWithProviders<CommonUiModule> {
const userPreferenceService = this._getService( const userPreferenceService = this._getService(
BaseUserPreferenceService, IqserUserPreferenceService,
DefaultUserPreferenceService, DefaultUserPreferenceService,
options.existingUserPreferenceService, options.existingUserPreferenceService,
); );
@ -116,7 +116,7 @@ export class CommonUiModule extends ModuleWithOptions {
useFactory: configServiceFactory, useFactory: configServiceFactory,
}, },
{ {
provide: BaseConfigService, provide: IqserConfigService,
useExisting: configService, useExisting: configService,
}, },
]; ];
@ -124,7 +124,7 @@ export class CommonUiModule extends ModuleWithOptions {
return [ return [
{ {
provide: BaseConfigService, provide: IqserConfigService,
useFactory: configServiceFactory, useFactory: configServiceFactory,
}, },
]; ];

View File

@ -1,8 +1,8 @@
import { inject, InjectionToken } from '@angular/core'; import { inject, InjectionToken } from '@angular/core';
import { BaseConfigService } from '../services'; import { IqserConfigService } from '../services';
import { HelpDocs } from './help-docs'; import { HelpDocs } from './help-docs';
export const HELP_DOCS = new InjectionToken<HelpDocs>('Links to user manual or 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', { 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,
}); });

View File

@ -1,7 +1,7 @@
import { HttpEvent, HttpHandler, HttpInterceptor, HttpRequest } from '@angular/common/http'; import { HttpEvent, HttpHandler, HttpInterceptor, HttpRequest } from '@angular/common/http';
import { inject, Injectable } from '@angular/core'; import { inject, Injectable } from '@angular/core';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { getConfig } from './base-config.service'; import { getConfig } from './iqser-config.service';
import { BASE_HREF } from '../utils'; import { BASE_HREF } from '../utils';
@Injectable() @Injectable()

View File

@ -1,9 +1,9 @@
import { inject, Injectable } from '@angular/core'; import { inject, Injectable } from '@angular/core';
import { BASE_HREF } from '../utils'; import { BASE_HREF } from '../utils';
import { BaseUserPreferenceService } from './base-user-preference.service'; import { IqserUserPreferenceService } from './iqser-user-preference.service';
@Injectable() @Injectable()
export class DefaultUserPreferenceService extends BaseUserPreferenceService { export class DefaultUserPreferenceService extends IqserUserPreferenceService {
protected readonly _defaultModelPath = 'attributes'; protected readonly _defaultModelPath = 'attributes';
protected readonly _devFeaturesEnabledKey = inject(BASE_HREF) + '.enable-dev-features'; protected readonly _devFeaturesEnabledKey = inject(BASE_HREF) + '.enable-dev-features';
} }

View File

@ -5,7 +5,7 @@ export * from './generic.service';
export * from './composite-route.guard'; export * from './composite-route.guard';
export * from './stats.service'; export * from './stats.service';
export * from './entities-map.service'; export * from './entities-map.service';
export * from './base-user-preference.service'; export * from './iqser-user-preference.service';
export * from './language.service'; export * from './language.service';
export * from './base-config.service'; export * from './iqser-config.service';
export * from './api-path.interceptor'; export * from './api-path.interceptor';

View File

@ -1,9 +1,9 @@
import { inject } from '@angular/core'; import { inject } from '@angular/core';
import { Title } from '@angular/platform-browser'; import { Title } from '@angular/platform-browser';
import { CacheApiService, wipeAllCaches } from '../caching'; 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 _cacheApiService = inject(CacheApiService);
protected readonly _titleService = inject(Title); protected readonly _titleService = inject(Title);
@ -33,6 +33,6 @@ export class BaseConfigService<T extends BaseAppConfig = BaseAppConfig> {
} }
} }
export function getConfig<T extends BaseAppConfig = BaseAppConfig>() { export function getConfig<T extends IqserAppConfig = IqserAppConfig>() {
return inject<BaseConfigService<T>>(BaseConfigService).values; return inject<IqserConfigService<T>>(IqserConfigService).values;
} }

View File

@ -11,7 +11,7 @@ const KEYS = {
} as const; } as const;
@Injectable() @Injectable()
export abstract class BaseUserPreferenceService extends GenericService<UserAttributes> { export abstract class IqserUserPreferenceService extends GenericService<UserAttributes> {
protected abstract readonly _devFeaturesEnabledKey: string; protected abstract readonly _devFeaturesEnabledKey: string;
#userAttributes: UserAttributes = {}; #userAttributes: UserAttributes = {};

View File

@ -9,7 +9,7 @@ import arraySupport from 'dayjs/plugin/arraySupport';
import localeData from 'dayjs/plugin/localeData'; import localeData from 'dayjs/plugin/localeData';
import { registerLocaleData } from '@angular/common'; import { registerLocaleData } from '@angular/common';
import localeDe from '@angular/common/locales/de'; 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(arraySupport);
dayjs.extend(localeData); dayjs.extend(localeData);
@ -20,7 +20,7 @@ dayjs.extend(localeData);
export class LanguageService { export class LanguageService {
constructor( constructor(
private readonly _translateService: TranslateService, private readonly _translateService: TranslateService,
private readonly _userPreferenceService: BaseUserPreferenceService, private readonly _userPreferenceService: IqserUserPreferenceService,
private readonly _dateAdapter: DateAdapter<Dayjs>, private readonly _dateAdapter: DateAdapter<Dayjs>,
) { ) {
registerLocaleData(localeDe); registerLocaleData(localeDe);

View File

@ -1,7 +1,7 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { ActivatedRouteSnapshot, Router } from '@angular/router'; import { ActivatedRouteSnapshot, Router } from '@angular/router';
import { KeycloakAuthGuard, KeycloakService } from 'keycloak-angular'; import { KeycloakAuthGuard, KeycloakService } from 'keycloak-angular';
import { BaseConfigService } from '../../services'; import { IqserConfigService } from '../../services';
import { IqserUserService } from '../services/iqser-user.service'; import { IqserUserService } from '../services/iqser-user.service';
@Injectable() @Injectable()
@ -9,7 +9,7 @@ export class IqserAuthGuard extends KeycloakAuthGuard {
constructor( constructor(
protected readonly _router: Router, protected readonly _router: Router,
protected readonly _keycloak: KeycloakService, protected readonly _keycloak: KeycloakService,
private readonly _configService: BaseConfigService, private readonly _configService: IqserConfigService,
private readonly _userService: IqserUserService, private readonly _userService: IqserUserService,
) { ) {
super(_router, _keycloak); super(_router, _keycloak);

View File

@ -10,7 +10,7 @@ import { IqserUsersModuleOptions } from './types/iqser-users-module-options';
import { IqserUser } from './iqser-user.model'; import { IqserUser } from './iqser-user.model';
import { IqserRoleGuard } from './guards/iqser-role-guard.service'; import { IqserRoleGuard } from './guards/iqser-role-guard.service';
import { IqserAuthGuard } from './guards/iqser-auth-guard.service'; import { IqserAuthGuard } from './guards/iqser-auth-guard.service';
import { BaseConfigService } from '../services'; import { IqserConfigService } from '../services';
import { NamePipe } from './name.pipe'; import { NamePipe } from './name.pipe';
import { InitialsAvatarComponent } from './components/initials-avatar/initials-avatar.component'; import { InitialsAvatarComponent } from './components/initials-avatar/initials-avatar.component';
import { MatTooltipModule } from '@angular/material/tooltip'; 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 { MatIconModule } from '@angular/material/icon';
import { MatButtonModule } from '@angular/material/button'; 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; let url: string = configService.values.OAUTH_URL;
url = url.replace(/\/$/, ''); // remove trailing slash url = url.replace(/\/$/, ''); // remove trailing slash
const realm = url.substring(url.lastIndexOf('/') + 1, url.length); const realm = url.substring(url.lastIndexOf('/') + 1, url.length);
@ -48,7 +48,7 @@ function configureAutomaticRedirectToLoginScreen(keyCloakService: KeycloakServic
export function keycloakInitializer( export function keycloakInitializer(
keycloakService: KeycloakService, keycloakService: KeycloakService,
configService: BaseConfigService, configService: IqserConfigService,
baseUrl: string, baseUrl: string,
): () => Promise<void> { ): () => Promise<void> {
const x = keycloakService.init(getKeycloakOptions(baseUrl, configService)); const x = keycloakService.init(getKeycloakOptions(baseUrl, configService));
@ -82,7 +82,7 @@ export class IqserUsersModule extends ModuleWithOptions {
provide: APP_INITIALIZER, provide: APP_INITIALIZER,
useFactory: keycloakInitializer, useFactory: keycloakInitializer,
multi: true, multi: true,
deps: [KeycloakService, BaseConfigService, BASE_HREF], deps: [KeycloakService, IqserConfigService, BASE_HREF],
}, },
], ],
}; };

View File

@ -19,5 +19,5 @@ export * from './headers-configuration';
export * from './context.component'; export * from './context.component';
export * from './tokens'; export * from './tokens';
export * from './module-with-options'; export * from './module-with-options';
export * from './base-app-config'; export * from './iqser-app-config';
export * from './types/common-ui-options'; export * from './types/common-ui-options';

View File

@ -1,4 +1,4 @@
export interface BaseAppConfig { export interface IqserAppConfig {
readonly API_URL: string; readonly API_URL: string;
readonly APP_NAME: string; readonly APP_NAME: string;
readonly FRONTEND_APP_VERSION: string; readonly FRONTEND_APP_VERSION: string;

View File

@ -1,11 +1,11 @@
import { BaseConfigService, BaseUserPreferenceService } from '../../services'; import { IqserConfigService, IqserUserPreferenceService } from '../../services';
import { Type } from '@angular/core'; import { Type } from '@angular/core';
import { BaseAppConfig } from '../base-app-config'; import { IqserAppConfig } from '../iqser-app-config';
export interface CommonUiOptions< export interface CommonUiOptions<
UserPreference extends BaseUserPreferenceService, UserPreference extends IqserUserPreferenceService,
Config extends BaseConfigService<AppConfig>, Config extends IqserConfigService<AppConfig>,
AppConfig extends BaseAppConfig, AppConfig extends IqserAppConfig,
> { > {
existingUserPreferenceService?: Type<UserPreference>; existingUserPreferenceService?: Type<UserPreference>;
configService?: Type<Config>; configService?: Type<Config>;