Fix system name to now show

- expose system name
- add it to app initializer
This commit is contained in:
Jack Anderson 2022-08-22 15:47:48 +01:00 committed by Clemente Raposo
parent c42ddd6fbd
commit 8da0355c36
4 changed files with 63 additions and 3 deletions

View file

@ -9,6 +9,7 @@ parameters:
default_theme: true
module_name_map: true
action_name_map: true
system_name: true
classicview_routing_exclusions: true
default_decimal_seperator: true
default_number_grouping_seperator: true

View file

@ -475,6 +475,7 @@ export * from './services/record/validation/validators/required.validator';
export * from './services/statistics/series/mapper/series-mapper.service';
export * from './services/statistics/series/mapper/series-traverser.service';
export * from './services/statistics/series/mapper/data-type-mapper/data-type.series-mapper';
export * from './services/system-name/system-name.service';
export * from './services/ui/loading-buffer/loading-buffer.factory';
export * from './services/ui/loading-buffer/loading-buffer.service';
export * from './services/ui/max-columns-calculator/max-columns-calculator.service';

View file

@ -0,0 +1,55 @@
/**
* SuiteCRM is a customer relationship management program developed by SalesAgility Ltd.
* Copyright (C) 2021 SalesAgility Ltd.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SALESAGILITY, SALESAGILITY DISCLAIMS THE
* WARRANTY OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* In accordance with Section 7(b) of the GNU Affero General Public License
* version 3, these Appropriate Legal Notices must retain the display of the
* "Supercharged by SuiteCRM" logo. If the display of the logos is not reasonably
* feasible for technical reasons, the Appropriate Legal Notices must display
* the words "Supercharged by SuiteCRM".
*/
import {Inject, Injectable} from "@angular/core";
import {DOCUMENT} from "@angular/common";
import {SystemConfigStore} from "../../store/system-config/system-config.store";
@Injectable({providedIn: 'root'})
export class SystemNameService {
public constructor(protected systemConfig: SystemConfigStore, @Inject(DOCUMENT) doc?: any) {
this.docElement = doc as Document;
}
private docElement: Document;
public setSystemName(systemName: string) {
if (!systemName || systemName.length < 1){
systemName = 'SuiteCRM';
}
const head = this.docElement.documentElement.childNodes.item(0);
head.childNodes.forEach((child) => {
if (child.nodeName === 'TITLE') {
child.textContent = systemName;
}
});
}
}

View file

@ -42,7 +42,8 @@ import {
LoginAuthGuard,
LoginUiComponent,
RecordComponent,
SystemConfigStore
SystemConfigStore,
SystemNameService
} from 'core';
import {take} from 'rxjs/operators';
import {isFalse} from 'common';
@ -55,7 +56,8 @@ export class AppInit {
protected systemConfigStore: SystemConfigStore,
protected appStore: AppStateStore,
protected injector: Injector,
protected extensionLoader: ExtensionLoader
protected extensionLoader: ExtensionLoader,
protected systemNameService: SystemNameService
) {
}
@ -65,7 +67,8 @@ export class AppInit {
return new Promise<void>((resolve) => {
this.systemConfigStore.load().subscribe(() => {
this.appStore.init();
const systemName = this.systemConfigStore.getConfigValue('system_name');
this.systemNameService.setSystemName(systemName);
this.extensionLoader.load(this.injector).pipe(take(1)).subscribe(() => {
const routes = this.router.config;
const configRoutes = this.systemConfigStore.getConfigValue('module_routing');