mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-11 03:53:02 +00:00
functional base href from ui config namespace property
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { CommonModule, APP_BASE_HREF } from '@angular/common';
|
||||
import { HttpModule } from '@angular/http';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { RouterModule } from '@angular/router';
|
||||
@@ -39,7 +39,11 @@ export function getConfig() {
|
||||
return ENV_CONFIG;
|
||||
}
|
||||
|
||||
export function getMetaReducers(config: GlobalConfig): MetaReducer<AppState>[] {
|
||||
export function getBase() {
|
||||
return ENV_CONFIG.ui.nameSpace;
|
||||
}
|
||||
|
||||
export function getMetaReducers(config: GlobalConfig): Array<MetaReducer<AppState>> {
|
||||
return config.production ? appMetaReducers : [...appMetaReducers, storeFreeze];
|
||||
}
|
||||
|
||||
@@ -63,6 +67,10 @@ export function getMetaReducers(config: GlobalConfig): MetaReducer<AppState>[] {
|
||||
provide: GLOBAL_CONFIG,
|
||||
useFactory: (getConfig)
|
||||
},
|
||||
{
|
||||
provide: APP_BASE_HREF,
|
||||
useFactory: (getBase)
|
||||
},
|
||||
{
|
||||
provide: META_REDUCERS,
|
||||
useFactory: getMetaReducers,
|
||||
|
@@ -10,6 +10,6 @@ import { GlobalConfig } from '../../../config';
|
||||
*/
|
||||
export class RESTURLCombiner extends URLCombiner {
|
||||
constructor(EnvConfig: GlobalConfig, ...parts: string[]) {
|
||||
super(EnvConfig.rest.baseUrl, EnvConfig.rest.nameSpace, ...parts);
|
||||
super(EnvConfig.rest.baseUrl, ...parts);
|
||||
}
|
||||
}
|
||||
|
@@ -9,6 +9,6 @@ import { GlobalConfig } from '../../../config';
|
||||
*/
|
||||
export class UIURLCombiner extends URLCombiner {
|
||||
constructor(EnvConfig: GlobalConfig, ...parts: string[]) {
|
||||
super(EnvConfig.ui.baseUrl, EnvConfig.ui.nameSpace, ...parts);
|
||||
super(EnvConfig.ui.baseUrl, ...parts);
|
||||
}
|
||||
}
|
||||
|
@@ -77,7 +77,7 @@ function buildBaseUrls(): void {
|
||||
getProtocol(ENV_CONFIG[key].ssl),
|
||||
getHost(ENV_CONFIG[key].host),
|
||||
getPort(ENV_CONFIG[key].port),
|
||||
getContextPath(ENV_CONFIG[key].contextPath)
|
||||
getNameSpace(ENV_CONFIG[key].nameSpace)
|
||||
].join('');
|
||||
}
|
||||
}
|
||||
@@ -95,8 +95,8 @@ function getPort(port: number): string {
|
||||
return port ? (port !== 80 && port !== 443) ? ':' + port : '' : '';
|
||||
}
|
||||
|
||||
function getContextPath(contextPath: string): string {
|
||||
return contextPath ? '/' + contextPath : '';
|
||||
function getNameSpace(nameSpace: string): string {
|
||||
return nameSpace ? nameSpace.charAt(0) === '/' ? nameSpace : '/' + nameSpace : '';
|
||||
}
|
||||
|
||||
function isDefined(value: any): boolean {
|
||||
|
Reference in New Issue
Block a user