From d1be444ef7c4f208aec30ae74ac5b6769d5297ac Mon Sep 17 00:00:00 2001 From: alx652 Date: Tue, 16 Jun 2026 15:41:49 -0400 Subject: [PATCH 1/5] debugging changes codex --- angular.json | 1 + codex.notes.txt | 30 ++++++++++++++++++++++++++++++ package.json | 5 ++++- src/index.html | 2 +- 4 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 codex.notes.txt diff --git a/angular.json b/angular.json index 213df23ee..1e3da7207 100644 --- a/angular.json +++ b/angular.json @@ -212,6 +212,7 @@ ] }, "fda.local": { + "baseHref": "/ginas/app/ui/", "assets": [ { "glob": "**/*", diff --git a/codex.notes.txt b/codex.notes.txt new file mode 100644 index 000000000..88b71773d --- /dev/null +++ b/codex.notes.txt @@ -0,0 +1,30 @@ +• Fixed the remaining hang. + + There were two separate issues: + + 1. Angular needed to serve under /ginas/app/ui/ + - angular.json:214: added baseHref + - package.json:23: added --serve-path=/ginas/app/ui/ + + 2. Spring Cloud Gateway MVC was hanging while proxying to Angular’s dev server through Java HttpClient + - /Users/welscha2/Documents/d/fda/gsrs3/ci/gsrs-ci/gateway/src/main/resources/gateway-env.conf:39: changed frontend URI to http://127.0.0.1:4200 + - /Users/welscha2/Documents/d/fda/gsrs3/ci/gsrs-ci/gateway/src/main/java/gsrs/ncats/gateway/GatewayRestClientConfiguration.java:14: forces + SimpleClientHttpRequestFactory + + - /Users/welscha2/Documents/d/fda/gsrs3/ci/gsrs-ci/gateway/src/main/java/gsrs/ncats/gateway/BodylessGatewayRequestFilter.java:22: prevents + bodyless GET/HEAD-style requests from being treated as streaming bodies + + Verification now passes through the gateway: + + http://localhost:8081/ginas/app/ui/ 200 + http://localhost:8081/ginas/app/ui/runtime.js 200 + http://localhost:8081/ginas/app/ui/main.js 200 + http://localhost:8081/ginas/app/ui/assets/data/config.json 200 + + The proxied index also contains: + + + + The gateway is currently running on port 8081 from the Maven session I restarted. Existing unrelated dirty files were left alone, including package- + lock.json, src/index.html, and ../substances/roles_config.json. + diff --git a/package.json b/package.json index 890a6d2d3..1e936cc88 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,10 @@ "build:gsrs: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", "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", + + "orig_start:fda:local": "npm run process-dojo && ng serve --configuration=fda.local", + "cdx1_start:fda:local": "npm run process-dojo && ng serve --host 0.0.0.0 --port 4200 --allowed-hosts=true --serve-path=/ginas/app/ui/ --configuration=fda.local", + "start:fda:local": "npm run process-dojo && ng serve --host 0.0.0.0 --port 4200 --allowed-hosts=true --serve-path=/ginas/app/ui/ --configuration=fda.local", "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/index.html b/src/index.html index 2c174c744..a8c5d48d8 100644 --- a/src/index.html +++ b/src/index.html @@ -9,7 +9,7 @@ GSRS - + From c1fe3c7ff13ffe02addab8187d5051f54df5a6d9 Mon Sep 17 00:00:00 2001 From: alx652 Date: Wed, 17 Jun 2026 15:05:26 -0400 Subject: [PATCH 2/5] save version issue and experiment with no ginas app --- angular.json | 1 - package.json | 8 +++---- .../substance-overview.component.html | 2 +- src/app/core/substance/substance.service.ts | 23 ++++++++++++++++--- src/environments/environment.fda.local3x.ts | 12 ++++++++++ 5 files changed, 37 insertions(+), 9 deletions(-) create mode 100644 src/environments/environment.fda.local3x.ts diff --git a/angular.json b/angular.json index 1e3da7207..213df23ee 100644 --- a/angular.json +++ b/angular.json @@ -212,7 +212,6 @@ ] }, "fda.local": { - "baseHref": "/ginas/app/ui/", "assets": [ { "glob": "**/*", diff --git a/package.json b/package.json index 1e936cc88..8221cabd5 100644 --- a/package.json +++ b/package.json @@ -19,10 +19,10 @@ "build:gsrs: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", "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", - - "orig_start:fda:local": "npm run process-dojo && ng serve --configuration=fda.local", - "cdx1_start:fda:local": "npm run process-dojo && ng serve --host 0.0.0.0 --port 4200 --allowed-hosts=true --serve-path=/ginas/app/ui/ --configuration=fda.local", - "start:fda:local": "npm run process-dojo && ng serve --host 0.0.0.0 --port 4200 --allowed-hosts=true --serve-path=/ginas/app/ui/ --configuration=fda.local", + "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 --serve-path=/ginas/app/ui/ --configuration=fda.local", + "start:fda:local3x": "npm run process-dojo && ng serve --host 0.0.0.0 --serve-path=/ui/ --configuration=fda.local", + "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..ffc27ccbd 100644 --- a/src/app/core/substance/substance.service.ts +++ b/src/app/core/substance/substance.service.ts @@ -806,8 +806,26 @@ export class SubstanceService extends BaseHttpService { return this.http.get>(url, { withCredentials: true }); } + adjustBackendUrlWithRestPrefix(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; } + 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; + } + 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 +834,16 @@ 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); + const _matchOldValue = this.adjustBackendUrlWithRestPrefix('/api/v1/', restApiPrefix, match.oldValue); + return this.http.get(_matchOldValue, options); })); } else { diff --git a/src/environments/environment.fda.local3x.ts b/src/environments/environment.fda.local3x.ts new file mode 100644 index 000000000..58f1d17f4 --- /dev/null +++ b/src/environments/environment.fda.local3x.ts @@ -0,0 +1,12 @@ +import { baseEnvironment } from 'src/environments'; + +export const environment = baseEnvironment; +environment.appId = 'fda'; +environment.clasicBaseHref = '/ginas/app/'; +environment.baseHref = ''; + +environment.appId = 'fda'; +environment.isAnalyticsPrivate = true; +environment.structureEditor = 'jsdraw'; + +export { FdaModule as EnvironmentModule } from '../app/fda/fda.module'; From eb7eab45d2dc79bd4b28c1f880e7f1c3a420b275 Mon Sep 17 00:00:00 2001 From: alx652 Date: Wed, 17 Jun 2026 16:01:38 -0400 Subject: [PATCH 3/5] adjust index.html --- angular.json | 29 +++++++++++++++++++++ package.json | 2 +- src/environments/environment.fda.local3x.ts | 2 +- 3 files changed, 31 insertions(+), 2 deletions(-) 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 8221cabd5..2c2c522e8 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "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 --serve-path=/ginas/app/ui/ --configuration=fda.local", - "start:fda:local3x": "npm run process-dojo && ng serve --host 0.0.0.0 --serve-path=/ui/ --configuration=fda.local", + "start:fda:local3x": "npm run process-dojo && ng serve --host 0.0.0.0 --serve-path=/ginas/app/ui/ --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", diff --git a/src/environments/environment.fda.local3x.ts b/src/environments/environment.fda.local3x.ts index 58f1d17f4..481b5ed83 100644 --- a/src/environments/environment.fda.local3x.ts +++ b/src/environments/environment.fda.local3x.ts @@ -3,7 +3,7 @@ import { baseEnvironment } from 'src/environments'; export const environment = baseEnvironment; environment.appId = 'fda'; environment.clasicBaseHref = '/ginas/app/'; -environment.baseHref = ''; +environment.baseHref = '/ginas/app/ui/'; environment.appId = 'fda'; environment.isAnalyticsPrivate = true; From 40afe753cef5dcdfb83609d37b36c6c5052a7399 Mon Sep 17 00:00:00 2001 From: alx652 Date: Wed, 17 Jun 2026 18:55:02 -0400 Subject: [PATCH 4/5] add notes --- codex.notes.txt | 30 --------------------- package.json | 4 +-- src/environments/environment.fda.local3x.ts | 1 + 3 files changed, 2 insertions(+), 33 deletions(-) delete mode 100644 codex.notes.txt diff --git a/codex.notes.txt b/codex.notes.txt deleted file mode 100644 index 88b71773d..000000000 --- a/codex.notes.txt +++ /dev/null @@ -1,30 +0,0 @@ -• Fixed the remaining hang. - - There were two separate issues: - - 1. Angular needed to serve under /ginas/app/ui/ - - angular.json:214: added baseHref - - package.json:23: added --serve-path=/ginas/app/ui/ - - 2. Spring Cloud Gateway MVC was hanging while proxying to Angular’s dev server through Java HttpClient - - /Users/welscha2/Documents/d/fda/gsrs3/ci/gsrs-ci/gateway/src/main/resources/gateway-env.conf:39: changed frontend URI to http://127.0.0.1:4200 - - /Users/welscha2/Documents/d/fda/gsrs3/ci/gsrs-ci/gateway/src/main/java/gsrs/ncats/gateway/GatewayRestClientConfiguration.java:14: forces - SimpleClientHttpRequestFactory - - - /Users/welscha2/Documents/d/fda/gsrs3/ci/gsrs-ci/gateway/src/main/java/gsrs/ncats/gateway/BodylessGatewayRequestFilter.java:22: prevents - bodyless GET/HEAD-style requests from being treated as streaming bodies - - Verification now passes through the gateway: - - http://localhost:8081/ginas/app/ui/ 200 - http://localhost:8081/ginas/app/ui/runtime.js 200 - http://localhost:8081/ginas/app/ui/main.js 200 - http://localhost:8081/ginas/app/ui/assets/data/config.json 200 - - The proxied index also contains: - - - - The gateway is currently running on port 8081 from the Maven session I restarted. Existing unrelated dirty files were left alone, including package- - lock.json, src/index.html, and ../substances/roles_config.json. - diff --git a/package.json b/package.json index 2c2c522e8..d9d3caea4 100644 --- a/package.json +++ b/package.json @@ -20,9 +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 --serve-path=/ginas/app/ui/ --configuration=fda.local", - "start:fda:local3x": "npm run process-dojo && ng serve --host 0.0.0.0 --serve-path=/ginas/app/ui/ --configuration=fda.local3x", - + "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/environments/environment.fda.local3x.ts b/src/environments/environment.fda.local3x.ts index 481b5ed83..8cf8cfc75 100644 --- a/src/environments/environment.fda.local3x.ts +++ b/src/environments/environment.fda.local3x.ts @@ -4,6 +4,7 @@ export const environment = baseEnvironment; environment.appId = 'fda'; environment.clasicBaseHref = '/ginas/app/'; environment.baseHref = '/ginas/app/ui/'; +environment.baseHref = ''; environment.appId = 'fda'; environment.isAnalyticsPrivate = true; From e383024b1700f9d578f6949a8f6cd70b06cd0190 Mon Sep 17 00:00:00 2001 From: alx652 Date: Thu, 25 Jun 2026 17:25:02 -0400 Subject: [PATCH 5/5] add restApiPrefix method to utils service --- src/app/core/substance/substance.service.ts | 31 ++++++------------- .../substances-browse.component.ts | 8 +++++ src/app/core/utils/utils.service.ts | 18 +++++++++++ 3 files changed, 36 insertions(+), 21 deletions(-) diff --git a/src/app/core/substance/substance.service.ts b/src/app/core/substance/substance.service.ts index ffc27ccbd..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); } @@ -806,23 +809,6 @@ export class SubstanceService extends BaseHttpService { return this.http.get>(url, { withCredentials: true }); } - adjustBackendUrlWithRestPrefix(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; } - 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; - } - getSubstanceDetails(id: string, version?: string | number): Observable { const url = `${this.apiBaseUrl}substances(${id})`; const restApiPrefix = this.configService.configData.restApiPrefix || ''; @@ -842,7 +828,9 @@ export class SubstanceService extends BaseHttpService { `No @edits entry found for version=${v} on substance(${id}).` )); } - const _matchOldValue = this.adjustBackendUrlWithRestPrefix('/api/v1/', restApiPrefix, match.oldValue); + // /api/v1/substances + // /ginas/app/api/v1/substances + const _matchOldValue = this.utilsService.adjustBackendUrlWithRestApiPrefix('/api/v1', restApiPrefix, match.oldValue); return this.http.get(_matchOldValue, options); })); @@ -1116,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; + } }