src/lib/service/config/config.service.ts
Collection of all Configurations
Methods |
|
Public getAgentConfig |
getAgentConfig()
|
Defined in src/lib/service/config/config.service.ts:140
|
Getter for the Agent Configuration
Returns :
any
|
Public getClientLocales |
getClientLocales()
|
Defined in src/lib/service/config/config.service.ts:88
|
Getter for the available client locales
Returns :
any[]
available client locales |
getContextPath |
getContextPath()
|
Defined in src/lib/service/config/config.service.ts:60
|
Returns :
string
|
Public getDashboardBackgroundImage |
getDashboardBackgroundImage()
|
Defined in src/lib/service/config/config.service.ts:105
|
Get the dashboards background image
Returns :
string
background image uri for the dashboards background image |
Public getDefaultClientLocale |
getDefaultClientLocale()
|
Defined in src/lib/service/config/config.service.ts:132
|
Get the default client locale
Returns :
any
ISO string of the locale |
getLoginBase |
getLoginBase()
|
Defined in src/lib/service/config/config.service.ts:56
|
Returns :
string
|
Public getNavigationBarImage |
getNavigationBarImage()
|
Defined in src/lib/service/config/config.service.ts:122
|
Get the navigation bar image (Logo) only accepts svg.
Returns :
string
background image uri for the Navigationbar (Logo) |
Public getRaw | ||||||||
getRaw(property: string)
|
||||||||
Defined in src/lib/service/config/config.service.ts:71
|
||||||||
Returns nested property of config | complete config by default
Parameters :
Returns :
any
|
Public getSideBarHeaderImage |
getSideBarHeaderImage()
|
Defined in src/lib/service/config/config.service.ts:113
|
Get the sidebars header background image
Returns :
string
background image uri for the sidebars header background image |
Public getSupportedClientLocales |
getSupportedClientLocales()
|
Defined in src/lib/service/config/config.service.ts:96
|
Getter for the supported client locales
Returns :
string[]
supported client locales |
Public getUri | ||||||||
getUri(property: string)
|
||||||||
Defined in src/lib/service/config/config.service.ts:80
|
||||||||
Getter for the URI
Parameters :
Returns :
string
value of the property from the URI-Section of the config |
import {Injectable} from '@angular/core';
import {TranslateService} from '@ngx-translate/core';
import {Utils} from '../../util/utils';
import {EventService} from '../events/event.service';
import {EnaioConfig} from './config.interface';
import {EnaioEvent} from '../events/events';
/**
* Collection of all Configurations
*/
@Injectable({
providedIn: 'root'
})
export class Config {
private cfg: EnaioConfig = null;
private fixServiceUris = null;
/**
* @ignore
*/
constructor(private translate: TranslateService, private event: EventService) {
}
/**
* @ignore
*/
private initializeGrid() {
this.event.trigger(EnaioEvent.EO_LICENSE_GRID);
}
/**
* @ignore
* Set during app init (see CoreInit)
*/
public set(cfg: EnaioConfig) {
this.cfg = cfg;
this.fixServiceUris = new Map<string, string>([
['serviceBase', '/rest-ws/service'],
['searchBase', '/search'],
['contextBase', '/structure'],
['inboxBase', '/inboxservice'],
['bpmBase', '/bpm'],
['agentBase', '/agent'],
['statusBase', '/status']]);
const languages = this.getClientLocales().map(lang => lang.iso);
this.translate.addLangs(languages);
this.translate.setDefaultLang(this.getDefaultClientLocale());
this.initializeGrid();
}
/**
* @Deprecated replaced by getContextPath
*/
getLoginBase(): string {
return this.getContextPath();
}
getContextPath(): string {
let cp = this.getUri('contextPath')
// TODO: remove when not supported anymore
|| this.getUri('loginBase');
return (cp && cp !== '/') ? cp : '';
}
/**
* Returns nested property of config | complete config by default
* @param property The name of the property to be retrieved
*/
public getRaw(property: string): any {
return property ? Utils.getProperty(this.cfg, property) : this.cfg;
}
/**
* Getter for the URI
* @param property The name of the property/uri to be retrieved
* @returns value of the property from the URI-Section of the config
*/
public getUri(property: string): string {
return (this.cfg['uri'] && this.cfg['uri'][property]) || this.fixServiceUris.get(property);
}
/**
* Getter for the available client locales
* @returns available client locales
*/
public getClientLocales(): any[] {
return this.cfg['languages'];
}
/**
* Getter for the supported client locales
* @returns supported client locales
*/
public getSupportedClientLocales(): string[] {
return ['en', 'de', 'ar', 'es', 'pt', 'fr', 'zh', 'lv', 'ru', 'it', 'nl', 'sk', 'pl', 'uk', 'ja', 'ko', 'hi', 'bn', 'de-CH', 'zh-Hant',
'th', 'vi', 'en-GB', 'he', 'fi', 'se', 'da', 'nb', 'nn', 'id', 'ms'];
}
/**
* Get the dashboards background image
* @returns background image uri for the dashboards background image
*/
public getDashboardBackgroundImage(): string {
return this.cfg['dashboardBackgroundImage'];
}
/**
* Get the sidebars header background image
* @returns background image uri for the sidebars header background image
*/
public getSideBarHeaderImage(): string {
return this.cfg['sideBarHeaderImage'];
}
/**
* Get the navigation bar image (Logo)
* only accepts svg.
* @returns background image uri for the Navigationbar (Logo)
*/
public getNavigationBarImage(): string {
let logo = this.cfg['navBarLogo'];
logo = logo.endsWith('.svg') ? logo : `<svg></svg>`;
return logo;
}
/**
* Get the default client locale
* @returns ISO string of the locale
*/
public getDefaultClientLocale() {
const lang = this.getClientLocales().find(_ => _.fallback);
return lang ? lang.iso : 'en';
}
/**
* Getter for the Agent Configuration
*/
public getAgentConfig(): any {
return this.cfg['agent'];
}
}