diff --git a/apps/asctb-reporter/project.json b/apps/asctb-reporter/project.json index b4f908bf0..5831af357 100644 --- a/apps/asctb-reporter/project.json +++ b/apps/asctb-reporter/project.json @@ -35,6 +35,7 @@ }, "configurations": { "production": { + "baseHref": "/ui/asctb-reporter/", "fileReplacements": [ { "replace": "apps/asctb-reporter/src/environments/environment.ts", @@ -62,6 +63,7 @@ ] }, "staging": { + "baseHref": "/ui--staging/asctb-reporter/", "fileReplacements": [ { "replace": "apps/asctb-reporter/src/environments/environment.ts", diff --git a/apps/asctb-reporter/src/index.html b/apps/asctb-reporter/src/index.html index 0c4f7770a..05f239cb5 100644 --- a/apps/asctb-reporter/src/index.html +++ b/apps/asctb-reporter/src/index.html @@ -3,7 +3,6 @@ HuBMAP CCF ASCT+B Reporter - diff --git a/apps/ccf-body-ui-wc/project.json b/apps/ccf-body-ui-wc/project.json index 88664c9d0..c65143df2 100644 --- a/apps/ccf-body-ui-wc/project.json +++ b/apps/ccf-body-ui-wc/project.json @@ -33,6 +33,7 @@ }, "configurations": { "production": { + "baseHref": "/ui/ccf-body-ui-wc/", "budgets": [ { "type": "initial", @@ -53,6 +54,34 @@ ], "outputHashing": "none" }, + "staging": { + "baseHref": "/ui--staging/ccf-body-ui-wc/", + "fileReplacements": [ + { + "replace": "apps/ccf-body-ui-wc/src/environments/environment.ts", + "with": "apps/ccf-body-ui-wc/src/environments/environment.staging.ts" + } + ], + "optimization": true, + "outputHashing": "none", + "sourceMap": false, + "namedChunks": false, + "extractLicenses": true, + "vendorChunk": false, + "buildOptimizer": true, + "budgets": [ + { + "type": "initial", + "maximumWarning": "2mb", + "maximumError": "5mb" + }, + { + "type": "anyComponentStyle", + "maximumWarning": "6kb", + "maximumError": "10kb" + } + ] + }, "development": { "buildOptimizer": false, "optimization": false, @@ -71,7 +100,7 @@ "namedChunks": true } }, - "defaultConfiguration": "production" + "defaultConfiguration": "" }, "serve": { "executor": "@angular-devkit/build-angular:dev-server", diff --git a/apps/ccf-body-ui-wc/src/index.html b/apps/ccf-body-ui-wc/src/index.html index e5c162359..e6b851c83 100644 --- a/apps/ccf-body-ui-wc/src/index.html +++ b/apps/ccf-body-ui-wc/src/index.html @@ -3,7 +3,6 @@ HuBMAP CCF Body UI - diff --git a/apps/ccf-eui/project.json b/apps/ccf-eui/project.json index c3b533b08..13025ace2 100644 --- a/apps/ccf-eui/project.json +++ b/apps/ccf-eui/project.json @@ -39,6 +39,7 @@ }, "configurations": { "production": { + "baseHref": "/ui/ccf-eui/", "fileReplacements": [ { "replace": "apps/ccf-eui/src/environments/environment.ts", @@ -66,6 +67,7 @@ ] }, "staging": { + "baseHref": "/ui--staging/ccf-eui/", "fileReplacements": [ { "replace": "apps/ccf-eui/src/environments/environment.ts", diff --git a/apps/ccf-organ-info/project.json b/apps/ccf-organ-info/project.json index 36d5e7554..edf8f41b4 100644 --- a/apps/ccf-organ-info/project.json +++ b/apps/ccf-organ-info/project.json @@ -33,6 +33,7 @@ }, "configurations": { "production": { + "baseHref": "/ui/ccf-organ-info/", "budgets": [ { "type": "initial", @@ -54,6 +55,7 @@ "outputHashing": "none" }, "staging": { + "baseHref": "/ui--staging/ccf-organ-info/", "budgets": [ { "type": "initial", @@ -92,7 +94,7 @@ "namedChunks": true } }, - "defaultConfiguration": "production" + "defaultConfiguration": "" }, "serve": { "executor": "@angular-devkit/build-angular:dev-server", diff --git a/apps/ccf-organ-info/src/index.html b/apps/ccf-organ-info/src/index.html index 6d18d33d7..090e62091 100644 --- a/apps/ccf-organ-info/src/index.html +++ b/apps/ccf-organ-info/src/index.html @@ -3,7 +3,6 @@ HuBMAP CCF Organ Info Component - diff --git a/apps/ccf-rui/project.json b/apps/ccf-rui/project.json index dde37d2ef..0d08a1f36 100644 --- a/apps/ccf-rui/project.json +++ b/apps/ccf-rui/project.json @@ -35,6 +35,7 @@ }, "configurations": { "production": { + "baseHref": "/ui/ccf-rui/", "fileReplacements": [ { "replace": "apps/ccf-rui/src/environments/environment.ts", @@ -62,6 +63,7 @@ ] }, "staging": { + "baseHref": "/ui--staging/ccf-rui/", "fileReplacements": [ { "replace": "apps/ccf-rui/src/environments/environment.ts", diff --git a/apps/ccf-rui/src/app/app-web-component.component.ts b/apps/ccf-rui/src/app/app-web-component.component.ts index 474ede9dc..565176061 100644 --- a/apps/ccf-rui/src/app/app-web-component.component.ts +++ b/apps/ccf-rui/src/app/app-web-component.component.ts @@ -30,6 +30,7 @@ function parseOrgan(value: unknown): string | Organ { export class AppWebComponent extends BaseWebComponent { @Input() baseHref!: string; @Input() useDownload!: string | boolean; + @Input() referenceData!: string; @Input() user!: string | User; @Input() organ!: string | Organ; @Input() editRegistration!: string | SpatialEntityJsonLd; diff --git a/apps/ccf-rui/src/app/core/store/reference-data/reference-data.state.ts b/apps/ccf-rui/src/app/core/store/reference-data/reference-data.state.ts index d1a28fd50..a6f347781 100644 --- a/apps/ccf-rui/src/app/core/store/reference-data/reference-data.state.ts +++ b/apps/ccf-rui/src/app/core/store/reference-data/reference-data.state.ts @@ -8,7 +8,7 @@ import { SpatialPlacementJsonLd, SpatialSceneNode } from 'ccf-body-ui'; import { ExtractionSet, SpatialEntity } from 'ccf-database'; import { ALL_ORGANS, GlobalConfigState, GlobalsService, OrganInfo } from 'ccf-shared'; import { EMPTY, Observable, from } from 'rxjs'; -import { catchError, map, switchMap } from 'rxjs/operators'; +import { catchError, switchMap } from 'rxjs/operators'; import { environment } from '../../../../environments/environment'; import { GlobalConfig } from '../../services/config/config'; @@ -94,8 +94,7 @@ export class ReferenceDataState extends NgxsImmutableDataRepository { - return this.globalConfig.getOption('baseHref').pipe( - map((baseHref) => (baseHref ?? '') + 'assets/reference-organ-data.json'), + return this.globalConfig.getOption('referenceData').pipe( switchMap((url) => from(fetch(url)).pipe( switchMap((data) => data.json()), diff --git a/apps/ccf-rui/src/app/core/store/scene/scene.state.ts b/apps/ccf-rui/src/app/core/store/scene/scene.state.ts index c997df530..f83299dc8 100644 --- a/apps/ccf-rui/src/app/core/store/scene/scene.state.ts +++ b/apps/ccf-rui/src/app/core/store/scene/scene.state.ts @@ -43,8 +43,6 @@ interface Collision { const NODE_COLLISION_THROTTLE_DURATION = 10; -const DEFAULT_COLLISIONS_ENDPOINT = 'https://pfn8zf2gtu.us-east-2.awsapprunner.com/get-collisions'; - function getNodeBbox(model: SpatialSceneNode): AABB { const mat = new Matrix4(model.transformMatrix); const lowerBound = mat.transformAsPoint([-1, -1, -1], []); @@ -360,10 +358,12 @@ export class SceneState extends NgxsImmutableDataRepository imp private getCollisions(jsonld: unknown): Observable { return this.globalConfig.getOption('collisionsEndpoint').pipe( - switchMap((endpoint = DEFAULT_COLLISIONS_ENDPOINT) => - this.http.post(endpoint, JSON.stringify(jsonld), { - headers: { 'Content-Type': 'application/json' }, - }), + switchMap((endpoint) => + endpoint + ? this.http.post(endpoint, JSON.stringify(jsonld), { + headers: { 'Content-Type': 'application/json' }, + }) + : of(undefined), ), catchError(() => of(undefined)), take(1), diff --git a/apps/ccf-rui/src/environments/environment.prod.ts b/apps/ccf-rui/src/environments/environment.prod.ts index 927abe5ec..c2189a5a7 100644 --- a/apps/ccf-rui/src/environments/environment.prod.ts +++ b/apps/ccf-rui/src/environments/environment.prod.ts @@ -15,6 +15,8 @@ export const environment = { header: true, homeUrl: 'https://portal.hubmapconsortium.org/', logoTooltip: 'Human BioMolecular Atlas Project', + collisionsEndpoint: 'https://apps.humanatlas.io/api/v1/collisions', + referenceData: 'https://cdn.jsdelivr.net/gh/hubmapconsortium/ccf-ui@gh-pages/rui/assets/reference-organ-data.json', }, skipUnsavedChangesConfirmation: false, googleAnalyticsToken: window.location.hostname === 'portal.hubmapconsortium.org' ? 'G-1WRJHN9FM6' : 'G-J9HWV9QPJ4', diff --git a/apps/ccf-rui/src/environments/environment.staging.ts b/apps/ccf-rui/src/environments/environment.staging.ts index 8edafd759..1a289405a 100644 --- a/apps/ccf-rui/src/environments/environment.staging.ts +++ b/apps/ccf-rui/src/environments/environment.staging.ts @@ -15,6 +15,8 @@ export const environment = { header: true, homeUrl: 'https://portal.hubmapconsortium.org/', logoTooltip: 'Human BioMolecular Atlas Project', + collisionsEndpoint: 'https://apps.humanatlas.io/api/v1/collisions', + referenceData: 'https://cdn.jsdelivr.net/gh/hubmapconsortium/ccf-ui@gh-pages/rui/assets/reference-organ-data.json', }, skipUnsavedChangesConfirmation: false, googleAnalyticsToken: 'G-ERNVZ1Q4KE', diff --git a/apps/ccf-rui/src/environments/environment.ts b/apps/ccf-rui/src/environments/environment.ts index e1369d816..0c5deca29 100644 --- a/apps/ccf-rui/src/environments/environment.ts +++ b/apps/ccf-rui/src/environments/environment.ts @@ -19,6 +19,8 @@ export const environment = { header: true, homeUrl: 'https://portal.hubmapconsortium.org/', logoTooltip: 'Human BioMolecular Atlas Project', + collisionsEndpoint: 'https://apps.humanatlas.io/api/v1/collisions', + referenceData: 'https://cdn.jsdelivr.net/gh/hubmapconsortium/ccf-ui@gh-pages/rui/assets/reference-organ-data.json', }, skipUnsavedChangesConfirmation: true, googleAnalyticsToken: 'G-B3DT7XPMRT', diff --git a/apps/ccf-rui/src/index.html b/apps/ccf-rui/src/index.html index 2937a2f9c..1b1174ad2 100644 --- a/apps/ccf-rui/src/index.html +++ b/apps/ccf-rui/src/index.html @@ -3,7 +3,6 @@ HuBMAP CCF Registration User Interface (CCF-RUI) - diff --git a/apps/ftu-ui-small-wc/project.json b/apps/ftu-ui-small-wc/project.json index e6e4654a1..2ac7a3dda 100644 --- a/apps/ftu-ui-small-wc/project.json +++ b/apps/ftu-ui-small-wc/project.json @@ -26,6 +26,7 @@ }, "configurations": { "production": { + "baseHref": "/ui/ftu-ui-small-wc/", "budgets": [ { "type": "initial", @@ -47,6 +48,19 @@ "extractLicenses": false, "sourceMap": true, "namedChunks": true + }, + "staging": { + "baseHref": "/ui--staging/ftu-ui-small-wc/", + "outputHashing": "none" + }, + "preview": { + "baseHref": "/apps/ftu-ui-small-wc/", + "buildOptimizer": false, + "optimization": false, + "vendorChunk": true, + "extractLicenses": false, + "sourceMap": true, + "namedChunks": true } }, "defaultConfiguration": "production" diff --git a/apps/ftu-ui/project.json b/apps/ftu-ui/project.json index b0cf8c69b..d03f99545 100644 --- a/apps/ftu-ui/project.json +++ b/apps/ftu-ui/project.json @@ -25,7 +25,7 @@ }, "configurations": { "production": { - "baseHref": "/hra-ui/apps/ftu-ui/", + "baseHref": "/ui/ftu-ui/", "outputHashing": "none", "budgets": [ { @@ -49,7 +49,7 @@ "namedChunks": true }, "staging": { - "baseHref": "/apps/ftu-ui/", + "baseHref": "/ui--staging/ftu-ui/", "outputHashing": "none" }, "preview": { diff --git a/apps/humanatlas.io/project.json b/apps/humanatlas.io/project.json index 4f6720399..4ee9d3817 100644 --- a/apps/humanatlas.io/project.json +++ b/apps/humanatlas.io/project.json @@ -37,6 +37,7 @@ }, "configurations": { "production": { + "baseHref": "/ui/humanatlas.io/", "budgets": [ { "type": "initial", @@ -66,7 +67,7 @@ "namedChunks": true }, "staging": { - "baseHref": "/apps/humanatlas.io/", + "baseHref": "/ui--staging/humanatlas.io/", "outputHashing": "none" }, "preview": { diff --git a/apps/humanatlas.io/src/index.html b/apps/humanatlas.io/src/index.html index 194474cf7..c93918ed5 100644 --- a/apps/humanatlas.io/src/index.html +++ b/apps/humanatlas.io/src/index.html @@ -3,7 +3,6 @@ Human Reference Atlas Portal - diff --git a/apps/medical-illustration/project.json b/apps/medical-illustration/project.json index 04213be2a..63ca413ea 100644 --- a/apps/medical-illustration/project.json +++ b/apps/medical-illustration/project.json @@ -24,6 +24,7 @@ }, "configurations": { "production": { + "baseHref": "/ui/medical-illustration/", "budgets": [ { "type": "initial", @@ -45,9 +46,22 @@ "extractLicenses": false, "sourceMap": true, "namedChunks": true + }, + "staging": { + "baseHref": "/ui--staging/medical-illustration/", + "outputHashing": "none" + }, + "preview": { + "baseHref": "/apps/medical-illustration/", + "buildOptimizer": false, + "optimization": false, + "vendorChunk": true, + "extractLicenses": false, + "sourceMap": true, + "namedChunks": true } }, - "defaultConfiguration": "production" + "defaultConfiguration": "" }, "serve": { "executor": "@angular-devkit/build-angular:dev-server", @@ -77,6 +91,9 @@ "options": { "jestConfig": "apps/medical-illustration/jest.config.ts" } + }, + "build-webcomponent": { + "command": "node tools/scripts/build-webcomponent.mjs medical-illustration" } }, "tags": ["app", "webcomponent"], diff --git a/apps/medical-illustration/webcomponent-example.html b/apps/medical-illustration/src/webcomponent-example.html similarity index 100% rename from apps/medical-illustration/webcomponent-example.html rename to apps/medical-illustration/src/webcomponent-example.html diff --git a/apps/medical-illustration/webcomponent-multiple-illustrations-example.html b/apps/medical-illustration/src/webcomponent-multiple-illustrations-example.html similarity index 100% rename from apps/medical-illustration/webcomponent-multiple-illustrations-example.html rename to apps/medical-illustration/src/webcomponent-multiple-illustrations-example.html diff --git a/tools/scripts/build-webcomponent.mjs b/tools/scripts/build-webcomponent.mjs index 5a284a6bc..9c6a6c9b2 100644 --- a/tools/scripts/build-webcomponent.mjs +++ b/tools/scripts/build-webcomponent.mjs @@ -11,11 +11,12 @@ async function build(app_name) { `${distDir}/runtime*.js`, `${distDir}/polyfills*.js`, `${distDir}/scripts*.js`, + `${distDir}/vendor*.js`, `${distDir}/main*.js`, ]); - if (jsFiles.length !== 4) { - console.log('Failed to find all application js files'); + if (jsFiles.length === 0) { + console.log('Failed to find application js files'); exit(1); }