BASEPATH
This commit is contained in:
@@ -2,6 +2,7 @@ import { NgModule, enableProdMode } from '@angular/core';
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { ExtraOptions, PreloadAllModules, RouterModule } from '@angular/router';
|
||||
import { APP_BASE_HREF } from '@angular/common';
|
||||
import { MarkdownModule } from 'ngx-markdown';
|
||||
import { TreoModule } from '@treo';
|
||||
import { TreoConfigModule } from '@treo/services/config';
|
||||
@@ -11,7 +12,7 @@ import { appConfig } from 'app/core/config/app.config';
|
||||
import { mockDataServices } from 'app/data/mock';
|
||||
import { LayoutModule } from 'app/layout/layout.module';
|
||||
import { AppComponent } from 'app/app.component';
|
||||
import { appRoutes } from 'app/app.routing';
|
||||
import { appRoutes, getAppBaseHref } from 'app/app.routing';
|
||||
|
||||
const routerConfig: ExtraOptions = {
|
||||
scrollPositionRestoration: 'enabled',
|
||||
@@ -54,7 +55,13 @@ if (process.env.NODE_ENV === 'production') {
|
||||
],
|
||||
bootstrap : [
|
||||
AppComponent
|
||||
]
|
||||
],
|
||||
providers: [
|
||||
{
|
||||
provide: APP_BASE_HREF,
|
||||
useValue: getAppBaseHref()
|
||||
}
|
||||
],
|
||||
})
|
||||
export class AppModule
|
||||
{
|
||||
|
||||
@@ -2,6 +2,17 @@ import { Route } from '@angular/router';
|
||||
import { LayoutComponent } from 'app/layout/layout.component';
|
||||
import { EmptyLayoutComponent } from 'app/layout/layouts/empty/empty.component';
|
||||
|
||||
// @formatter:off
|
||||
export function getAppBaseHref(): string {
|
||||
return getBasePath() + '/web';
|
||||
}
|
||||
|
||||
// @formatter:off
|
||||
// tslint:disable:max-line-length
|
||||
export function getBasePath(): string {
|
||||
return window.location.pathname.split('/web').slice(0, 1)[0];
|
||||
}
|
||||
|
||||
// @formatter:off
|
||||
// tslint:disable:max-line-length
|
||||
export const appRoutes: Route[] = [
|
||||
|
||||
@@ -5,6 +5,7 @@ import { MatFormField } from '@angular/material/form-field';
|
||||
import { Subject } from 'rxjs';
|
||||
import { debounceTime, filter, map, takeUntil } from 'rxjs/operators';
|
||||
import { TreoAnimations } from '@treo/animations/public-api';
|
||||
import { getBasePath } from 'app/app.routing';
|
||||
|
||||
@Component({
|
||||
selector : 'search',
|
||||
@@ -199,7 +200,7 @@ export class SearchComponent implements OnInit, OnDestroy
|
||||
})
|
||||
)
|
||||
.subscribe((value) => {
|
||||
this._httpClient.post('api/common/search', {query: value})
|
||||
this._httpClient.post(getBasePath() + '/api/common/search', {query: value})
|
||||
.subscribe((response: any) => {
|
||||
this.results = response.results;
|
||||
});
|
||||
|
||||
@@ -2,6 +2,7 @@ import { Injectable } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { BehaviorSubject, Observable } from 'rxjs';
|
||||
import { tap } from 'rxjs/operators';
|
||||
import { getBasePath } from 'app/app.routing';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -45,7 +46,7 @@ export class DashboardService
|
||||
*/
|
||||
getData(): Observable<any>
|
||||
{
|
||||
return this._httpClient.get('/api/summary').pipe(
|
||||
return this._httpClient.get(getBasePath() + '/api/summary').pipe(
|
||||
tap((response: any) => {
|
||||
this._data.next(response);
|
||||
})
|
||||
|
||||
@@ -2,6 +2,7 @@ import { Injectable } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { BehaviorSubject, Observable } from 'rxjs';
|
||||
import { tap } from 'rxjs/operators';
|
||||
import { getBasePath } from 'app/app.routing';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -45,7 +46,7 @@ export class DetailService
|
||||
*/
|
||||
getData(wwn): Observable<any>
|
||||
{
|
||||
return this._httpClient.get(`/api/device/${wwn}/details`).pipe(
|
||||
return this._httpClient.get(getBasePath() + `/api/device/${wwn}/details`).pipe(
|
||||
tap((response: any) => {
|
||||
this._data.next(response);
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user