diff --git a/angular.json b/angular.json
index 213df23ee..672fe38aa 100644
--- a/angular.json
+++ b/angular.json
@@ -235,6 +235,32 @@
"with": "src/environments/environment.fda.local.ts"
}
]
+ },
+ "fda.local3x": {
+ "baseHref": "/ginas/app/ui/",
+ "assets": [
+ {
+ "glob": "**/*",
+ "input": "src/app/core/assets/",
+ "output": "/assets/"
+ },
+ {
+ "glob": "config.json",
+ "input": "src/app/fda/config/",
+ "output": "/assets/data/"
+ },
+ {
+ "glob": "**/*",
+ "input": "src/app/fda/assets",
+ "output": "/assets/"
+ }
+ ],
+ "fileReplacements": [
+ {
+ "replace": "src/environments/environment.ts",
+ "with": "src/environments/environment.fda.local3x.ts"
+ }
+ ]
}
}
},
@@ -250,6 +276,9 @@
"fda.local": {
"buildTarget": "gsrs-client:build:fda.local"
},
+ "fda.local3x": {
+ "buildTarget": "gsrs-client:build:fda.local3x"
+ },
"fda.pre-prod": {
"buildTarget": "gsrs-client:build:fda.pre-prod"
},
diff --git a/package.json b/package.json
index 890a6d2d3..d9d3caea4 100644
--- a/package.json
+++ b/package.json
@@ -20,6 +20,7 @@
"build:gsrs:prod": "npm run clear-libs-src && ng build --base-href=/ginas/app/ui/ --configuration=fda.prod && node process-index.js && cd lib && extract-zip dojo-custom-jsdraw.zip && cd .. && npm run copy-libs-dist && npm run build-server",
"start:fda:dev": "npm run process-dojo && ng serve --configuration=fda.dev --sourceMap=true",
"start:fda:local": "npm run process-dojo && ng serve --configuration=fda.local",
+ "start:fda:local3x": "npm run process-dojo && ng serve --host 0.0.0.0 --configuration=fda.local3x",
"start:fda:pre-prod": "npm run process-dojo && ng serve --configuration=fda.pre-prod --sourceMap=true",
"start:fda:prod": "npm run process-dojo && ng serve --configuration=fda.prod --sourceMap=true",
"build:fda:pre-prod": "npm run clear-libs-src && ng build --base-href=/ginas/app/beta/ --configuration=fda.pre-prod --sourceMap=true && node process-index.js && cd lib && extract-zip dojo-custom-jsdraw.zip && cd .. && npm run copy-libs-dist && npm run build-server",
diff --git a/src/app/core/substance-details/substance-overview/substance-overview.component.html b/src/app/core/substance-details/substance-overview/substance-overview.component.html
index 065de0c3d..79cf5f5bb 100644
--- a/src/app/core/substance-details/substance-overview/substance-overview.component.html
+++ b/src/app/core/substance-details/substance-overview/substance-overview.component.html
@@ -51,7 +51,7 @@
-
diff --git a/src/app/core/substance/substance.service.ts b/src/app/core/substance/substance.service.ts
index 80dcfc83a..c97dd6e68 100644
--- a/src/app/core/substance/substance.service.ts
+++ b/src/app/core/substance/substance.service.ts
@@ -1,4 +1,4 @@
-import { Injectable } from '@angular/core';
+import { Injectable, inject } from '@angular/core';
import { HttpClient, HttpParams, HttpClientJsonpModule, HttpParameterCodec } from '@angular/common/http';
import { BehaviorSubject, concatMap, filter, interval, Observable, Observer, Subject, throwError } from 'rxjs';
import { ConfigService } from '../config/config.service';
@@ -25,9 +25,12 @@ import {Facet, FacetQueryResponse} from '@gsrs-core/facets-manager';
import { StructuralUnit } from '@gsrs-core/substance';
import {HierarchyNode} from '@gsrs-core/substances-browse/substance-hierarchy/hierarchy.model';
import { SubstanceDependenciesImageNode } from '@gsrs-core/substance-details/substance-dependencies-image/substance-dependencies-image.model';
-
import { AuthService } from "@gsrs-core/auth";
+import { SubstancesBrowseComponent } from '@gsrs-core/substances-browse/substances-browse.component';
+
class CustomEncoder implements HttpParameterCodec {
+
+
encodeKey(key: string): string {
return encodeURIComponent(key);
}
@@ -61,7 +64,7 @@ export class SubstanceService extends BaseHttpService {
private authService: AuthService,
public configService: ConfigService,
private sanitizer: DomSanitizer,
- private utilsService: UtilsService,
+ private utilsService: UtilsService
) {
super(configService);
}
@@ -808,6 +811,7 @@ export class SubstanceService extends BaseHttpService {
getSubstanceDetails(id: string, version?: string | number): Observable
{
const url = `${this.apiBaseUrl}substances(${id})`;
+ const restApiPrefix = this.configService.configData.restApiPrefix || '';
let params = new HttpParams();
params = params.append('view', 'internal');
const options = {
@@ -816,17 +820,18 @@ export class SubstanceService extends BaseHttpService {
if (version !== undefined && version !== null) {
const v = String(version);
const editurl = `${this.apiBaseUrl}substances(${id})/@edits`;
-
return this.http.get(editurl, { withCredentials: true }).pipe(
switchMap((response: any[]) => {
const match = (response ?? []).find(resp => String(resp?.version) === v);
-
if(!match?.oldValue) {
return throwError(() => new Error(
`No @edits entry found for version=${v} on substance(${id}).`
));
}
- return this.http.get(match.oldValue, options);
+ // /api/v1/substances
+ // /ginas/app/api/v1/substances
+ const _matchOldValue = this.utilsService.adjustBackendUrlWithRestApiPrefix('/api/v1', restApiPrefix, match.oldValue);
+ return this.http.get(_matchOldValue, options);
}));
} else {
@@ -1099,6 +1104,7 @@ export class SubstanceService extends BaseHttpService {
search = 'substances';
}
const url = `${this.configService.configData.apiBaseUrl}api/v1/${search}/export/${etag}`;
+ console.log("this is the url:" + url);
return this.http.get< any>(url);
}
diff --git a/src/app/core/substances-browse/substances-browse.component.ts b/src/app/core/substances-browse/substances-browse.component.ts
index a92605c46..b5fdef1e8 100644
--- a/src/app/core/substances-browse/substances-browse.component.ts
+++ b/src/app/core/substances-browse/substances-browse.component.ts
@@ -726,6 +726,14 @@ export class SubstancesBrowseComponent implements OnInit, AfterViewInit, OnDestr
}
this.substanceService.getExportOptions(pagingResponse.etag).subscribe(response => {
this.exportOptions = response.filter(exp => {
+ // this is experimental, pending discussion on how gateway works
+ if (exp?.link?.url) {
+ exp.link.url = this.utilsService.adjustBackendUrlWithRestApiPrefix(
+ "/api/v1",
+ this.configService.configData.restApiPrefix||'',
+ exp.link.url
+ );
+ }
if (exp.extension) {
//TODO Make this generic somehow, so addditional-type exports are isolated
if ((exp.extension === 'appxlsx') || (exp.extension === 'prodxlsx') ||
diff --git a/src/app/core/utils/utils.service.ts b/src/app/core/utils/utils.service.ts
index 19b4edbcf..64c97c186 100644
--- a/src/app/core/utils/utils.service.ts
+++ b/src/app/core/utils/utils.service.ts
@@ -312,4 +312,22 @@ export class UtilsService {
const lq =targetField + ':"^' + s +'"';
return lq;
}
+
+ adjustBackendUrlWithRestApiPrefix(searchFragment: string, restPrefix: string, url: string) {
+ // Consider instead to decompose and recompose the url in case search
+ // terms appear in query params, etc.
+ // Consider making global function that can be used
+ // in lots of places
+ if (!restPrefix) { return url; }
+ if (!searchFragment) { return url; }
+ if (!url) { return url; }
+ const _restPrefix = restPrefix.trim();
+ const _searchFragment = searchFragment.trim();
+ if( _restPrefix.trim().length == 0) { return url; }
+ if( _searchFragment.trim().length == 0) { return url; }
+ if (url.indexOf(_restPrefix) > -1) { return url; }
+ if (!(url.indexOf(_searchFragment) > -1)) { return url; }
+ url = url.replace(_searchFragment, _restPrefix + _searchFragment);
+ return url;
+ }
}
diff --git a/src/environments/environment.fda.local3x.ts b/src/environments/environment.fda.local3x.ts
new file mode 100644
index 000000000..8cf8cfc75
--- /dev/null
+++ b/src/environments/environment.fda.local3x.ts
@@ -0,0 +1,13 @@
+import { baseEnvironment } from 'src/environments';
+
+export const environment = baseEnvironment;
+environment.appId = 'fda';
+environment.clasicBaseHref = '/ginas/app/';
+environment.baseHref = '/ginas/app/ui/';
+environment.baseHref = '';
+
+environment.appId = 'fda';
+environment.isAnalyticsPrivate = true;
+environment.structureEditor = 'jsdraw';
+
+export { FdaModule as EnvironmentModule } from '../app/fda/fda.module';
diff --git a/src/index.html b/src/index.html
index 2c174c744..a8c5d48d8 100644
--- a/src/index.html
+++ b/src/index.html
@@ -9,7 +9,7 @@
GSRS
-
+