diff --git a/README.md b/README.md index 40fb44fe42..4d6b468755 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ The most common commands are defined in `package.json`. | `nx run dsp-app:serve:test-server` | `npm run start-with-test-server` | | `nx run dsp-app:serve:dev-server` | `npm run start-with-dev-server` | | `nx run dsp-app:serve:ls-test-server` | `npm run start-with-ls-test-server` | -| `nx run dsp-app:serve:staging-server` | `npm run start-with-staging-server` | +| `nx run dsp-app:serve:stage-server` | `npm run start-with-stage-server` | | `nx run dsp-app:serve:0845-test-server` | `npm run start-with-0845-server` | | `nx run dsp-app:lint` | `npm run lint-ci` | | `nx run dsp-app:lint --fix` | `npm run lint-local` | diff --git a/apps/dsp-app/project.json b/apps/dsp-app/project.json index d900d7e131..907b314b08 100644 --- a/apps/dsp-app/project.json +++ b/apps/dsp-app/project.json @@ -12,7 +12,9 @@ "targets": { "build": { "executor": "@angular-devkit/build-angular:browser", - "outputs": ["{options.outputPath}"], + "outputs": [ + "{options.outputPath}" + ], "options": { "outputPath": "dist/apps/dsp-app", "index": "apps/dsp-app/src/index.html", @@ -37,7 +39,9 @@ "output": "/assets/" } ], - "styles": ["apps/dsp-app/src/styles.scss"], + "styles": [ + "apps/dsp-app/src/styles.scss" + ], "scripts": [ "node_modules/openseadragon/build/openseadragon/openseadragon.min.js" ] @@ -133,11 +137,11 @@ "vendorChunk": false, "buildOptimizer": false }, - "staging-server": { + "stage-server": { "fileReplacements": [ { "replace": "apps/dsp-app/src/environments/environment.ts", - "with": "apps/dsp-app/src/environments/environment.staging-server.ts" + "with": "apps/dsp-app/src/environments/environment.stage-server.ts" } ], "optimization": false, @@ -175,8 +179,8 @@ "0845-test-server": { "browserTarget": "dsp-app:build:ls-test-server" }, - "staging-server": { - "browserTarget": "dsp-app:build:staging-server" + "stage-server": { + "browserTarget": "dsp-app:build:stage-server" } } }, @@ -188,10 +192,14 @@ }, "lint": { "executor": "@nx/linter:eslint", - "outputs": ["{options.outputFile}"], + "outputs": [ + "{options.outputFile}" + ], "options": { - "lintFilePatterns": ["apps/dsp-app/**/*.{ts,html}"] - } + "lintFilePatterns": [ + "apps/dsp-app/**/*.{ts,html}" + ] + } }, "test": { "executor": "@angular-devkit/build-angular:karma", @@ -201,7 +209,9 @@ "tsConfig": "apps/dsp-app/tsconfig.spec.json", "inlineStyleLanguage": "scss", "karmaConfig": "apps/dsp-app/karma.conf.js", - "styles": ["apps/dsp-app/src/styles.scss"], + "styles": [ + "apps/dsp-app/src/styles.scss" + ], "scripts": [ "node_modules/openseadragon/build/openseadragon/openseadragon.min.js" ], @@ -243,4 +253,4 @@ } } } -} +} \ No newline at end of file diff --git a/apps/dsp-app/src/app/project/ontology-classes/ontology-class-item/ontology-class-item.component.ts b/apps/dsp-app/src/app/project/ontology-classes/ontology-class-item/ontology-class-item.component.ts index 0fff0ebcac..71745b84f6 100644 --- a/apps/dsp-app/src/app/project/ontology-classes/ontology-class-item/ontology-class-item.component.ts +++ b/apps/dsp-app/src/app/project/ontology-classes/ontology-class-item/ontology-class-item.component.ts @@ -12,7 +12,12 @@ import { import { ActivatedRoute } from '@angular/router'; import { ClassDefinition, Constants } from '@dasch-swiss/dsp-js'; import { RouteConstants } from '@dasch-swiss/vre/shared/app-config'; -import { OntologyService } from '@dasch-swiss/vre/shared/app-helper-services'; +import { + ComponentCommunicationEventService, + EmitEvent, + Events, + OntologyService, +} from '@dasch-swiss/vre/shared/app-helper-services'; import { IClassItemsKeyValuePairs, LoadClassItemsCountAction, @@ -21,11 +26,6 @@ import { import { Actions, Select, Store, ofActionSuccessful } from '@ngxs/store'; import { Observable, Subject, Subscription, combineLatest } from 'rxjs'; import { map, takeUntil } from 'rxjs/operators'; -import { - ComponentCommunicationEventService, - EmitEvent, - Events, -} from '../../../main/services/component-communication-event.service'; @Component({ changeDetection: ChangeDetectionStrategy.OnPush, diff --git a/apps/dsp-app/src/app/project/project.component.ts b/apps/dsp-app/src/app/project/project.component.ts index 0282ec7613..6946a0016c 100644 --- a/apps/dsp-app/src/app/project/project.component.ts +++ b/apps/dsp-app/src/app/project/project.component.ts @@ -14,12 +14,15 @@ import { ReadOntology, ReadProject } from '@dasch-swiss/dsp-js'; import { ClassAndPropertyDefinitions } from '@dasch-swiss/dsp-js/src/models/v2/ontologies/ClassAndPropertyDefinitions'; import { getAllEntityDefinitionsAsArray } from '@dasch-swiss/vre/shared/app-api'; import { RouteConstants } from '@dasch-swiss/vre/shared/app-config'; -import { ProjectService } from '@dasch-swiss/vre/shared/app-helper-services'; +import { + ComponentCommunicationEventService, + Events, + ProjectService, +} from '@dasch-swiss/vre/shared/app-helper-services'; import { OntologiesSelectors, ProjectsSelectors } from '@dasch-swiss/vre/shared/app-state'; import { Actions, Select, Store } from '@ngxs/store'; import { Observable, Subject, Subscription, combineLatest } from 'rxjs'; import { filter, map, take, takeUntil } from 'rxjs/operators'; -import { ComponentCommunicationEventService, Events } from '../main/services/component-communication-event.service'; import { ProjectBase } from './project-base'; type AvailableRoute = diff --git a/apps/dsp-app/src/app/workspace/resource/properties/properties.component.ts b/apps/dsp-app/src/app/workspace/resource/properties/properties.component.ts index 1a8e2a5d57..1553541e0a 100644 --- a/apps/dsp-app/src/app/workspace/resource/properties/properties.component.ts +++ b/apps/dsp-app/src/app/workspace/resource/properties/properties.component.ts @@ -38,17 +38,19 @@ import { } from '@dasch-swiss/dsp-js'; import { ProjectApiService } from '@dasch-swiss/vre/shared/app-api'; import { DspApiConnectionToken } from '@dasch-swiss/vre/shared/app-config'; -import { OntologyService, ProjectService, SortingService } from '@dasch-swiss/vre/shared/app-helper-services'; +import { + Events as CommsEvents, + ComponentCommunicationEventService, + EmitEvent, + OntologyService, + ProjectService, + SortingService, +} from '@dasch-swiss/vre/shared/app-helper-services'; import { NotificationService } from '@dasch-swiss/vre/shared/app-notification'; import { LoadClassItemsCountAction } from '@dasch-swiss/vre/shared/app-state'; import { Store } from '@ngxs/store'; -import { forkJoin, Observable, Subscription } from 'rxjs'; +import { Observable, Subscription, forkJoin } from 'rxjs'; import { ConfirmationWithComment, DialogComponent } from '../../../main/dialog/dialog.component'; -import { - ComponentCommunicationEventService, - EmitEvent, - Events as CommsEvents, -} from '../../../main/services/component-communication-event.service'; import { DspResource } from '../dsp-resource'; import { RepresentationConstants } from '../representation/file-representation'; import { IncomingService } from '../services/incoming.service'; diff --git a/apps/dsp-app/src/app/workspace/resource/resource-instance-form/resource-instance-form.component.ts b/apps/dsp-app/src/app/workspace/resource/resource-instance-form/resource-instance-form.component.ts index ed9d68fc56..2a9085f1d2 100644 --- a/apps/dsp-app/src/app/workspace/resource/resource-instance-form/resource-instance-form.component.ts +++ b/apps/dsp-app/src/app/workspace/resource/resource-instance-form/resource-instance-form.component.ts @@ -11,7 +11,6 @@ import { import { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms'; import { ActivatedRoute, Router } from '@angular/router'; import { - ApiResponseError, Constants, CreateFileValue, CreateResource, @@ -24,16 +23,17 @@ import { ResourcePropertyDefinition, } from '@dasch-swiss/dsp-js'; import { DspApiConnectionToken } from '@dasch-swiss/vre/shared/app-config'; -import { DefaultClass, DefaultResourceClasses } from '@dasch-swiss/vre/shared/app-helper-services'; +import { + Events as CommsEvents, + ComponentCommunicationEventService, + DefaultClass, + DefaultResourceClasses, + EmitEvent, +} from '@dasch-swiss/vre/shared/app-helper-services'; import { NotificationService } from '@dasch-swiss/vre/shared/app-notification'; import { LoadClassItemsCountAction } from '@dasch-swiss/vre/shared/app-state'; import { Store } from '@ngxs/store'; import { tap } from 'rxjs/operators'; -import { - ComponentCommunicationEventService, - EmitEvent, - Events as CommsEvents, -} from '../../../main/services/component-communication-event.service'; import { ResourceService } from '../services/resource.service'; import { SelectPropertiesComponent } from './select-properties/select-properties.component'; diff --git a/apps/dsp-app/src/app/workspace/results/list-view/list-view.component.ts b/apps/dsp-app/src/app/workspace/results/list-view/list-view.component.ts index 596c5025ab..586692adaf 100644 --- a/apps/dsp-app/src/app/workspace/results/list-view/list-view.component.ts +++ b/apps/dsp-app/src/app/workspace/results/list-view/list-view.component.ts @@ -19,15 +19,11 @@ import { ReadResourceSequence, } from '@dasch-swiss/dsp-js'; import { DspApiConnectionToken, RouteConstants } from '@dasch-swiss/vre/shared/app-config'; +import { ComponentCommunicationEventService, EmitEvent, Events } from '@dasch-swiss/vre/shared/app-helper-services'; import { NotificationService } from '@dasch-swiss/vre/shared/app-notification'; import { Store } from '@ngxs/store'; import { Subject, Subscription, combineLatest, of } from 'rxjs'; import { map, takeUntil, tap } from 'rxjs/operators'; -import { - ComponentCommunicationEventService, - EmitEvent, - Events, -} from '../../../main/services/component-communication-event.service'; /** * query: search query. It can be gravserch query or fulltext string query. @@ -138,6 +134,7 @@ export class ListViewComponent implements OnChanges, OnInit, OnDestroy { ngOnInit(): void { this.componentCommsSubscriptions.push( + this._componentCommsService.on(Events.loginSuccess, () => this.initSearch()), this._componentCommsService.on(Events.resourceChanged, () => this._doSearch()), this._componentCommsService.on(Events.resourceDeleted, () => this._doSearch()) ); diff --git a/apps/dsp-app/src/app/workspace/search/fulltext-search/fulltext-search.component.ts b/apps/dsp-app/src/app/workspace/search/fulltext-search/fulltext-search.component.ts index eab30b79ed..0e5b9b74c7 100644 --- a/apps/dsp-app/src/app/workspace/search/fulltext-search/fulltext-search.component.ts +++ b/apps/dsp-app/src/app/workspace/search/fulltext-search/fulltext-search.component.ts @@ -16,14 +16,14 @@ import { import { MatMenuTrigger } from '@angular/material/menu'; import { ApiResponseError, Constants, ReadProject } from '@dasch-swiss/dsp-js'; import { ProjectApiService } from '@dasch-swiss/vre/shared/app-api'; -import { SortingService } from '@dasch-swiss/vre/shared/app-helper-services'; -import { NotificationService } from '@dasch-swiss/vre/shared/app-notification'; -import { Subscription } from 'rxjs'; -import { tap } from 'rxjs/operators'; import { ComponentCommunicationEventService, Events, -} from '../../../main/services/component-communication-event.service'; + SortingService, +} from '@dasch-swiss/vre/shared/app-helper-services'; +import { NotificationService } from '@dasch-swiss/vre/shared/app-notification'; +import { Subscription } from 'rxjs'; +import { tap } from 'rxjs/operators'; import { SearchParams } from '../../results/list-view/list-view.component'; export interface PrevSearchItem { diff --git a/apps/dsp-app/src/config/config.staging-server.json b/apps/dsp-app/src/config/config.stage-server.json similarity index 74% rename from apps/dsp-app/src/config/config.staging-server.json rename to apps/dsp-app/src/config/config.stage-server.json index ed26aa5622..44ffcb9b94 100644 --- a/apps/dsp-app/src/config/config.staging-server.json +++ b/apps/dsp-app/src/config/config.stage-server.json @@ -1,11 +1,11 @@ { "dspRelease": "2023.05.03", "apiProtocol": "https", - "apiHost": "api.staging.dasch.swiss", + "apiHost": "api.stage.dasch.swiss", "apiPort": 443, "apiPath": "", "iiifProtocol": "https", - "iiifHost": "iiif.staging.dasch.swiss", + "iiifHost": "iiif.stage.dasch.swiss", "iiifPort": 443, "iiifPath": "", "geonameToken": "knora", @@ -13,10 +13,10 @@ "logErrors": true, "iriBase": "http://rdfh.ch", "instrumentation": { - "environment": "staging-server", + "environment": "stage-server", "rollbar": { "enabled": false, "accessToken": "" } } -} +} \ No newline at end of file diff --git a/apps/dsp-app/src/environments/environment.staging-server.ts b/apps/dsp-app/src/environments/environment.stage-server.ts similarity index 96% rename from apps/dsp-app/src/environments/environment.staging-server.ts rename to apps/dsp-app/src/environments/environment.stage-server.ts index 88f29f9f8f..56f174bf58 100644 --- a/apps/dsp-app/src/environments/environment.staging-server.ts +++ b/apps/dsp-app/src/environments/environment.stage-server.ts @@ -7,7 +7,7 @@ import packageJson from '../../../../package.json'; export const environment = { - name: 'staging-server', + name: 'stage-server', production: false, version: packageJson.version, }; diff --git a/libs/vre/shared/app-config/src/lib/app-config/app-config.service.ts b/libs/vre/shared/app-config/src/lib/app-config/app-config.service.ts index 9c58379cad..c03e515004 100644 --- a/libs/vre/shared/app-config/src/lib/app-config/app-config.service.ts +++ b/libs/vre/shared/app-config/src/lib/app-config/app-config.service.ts @@ -36,7 +36,7 @@ export class AppConfigService { const prodMode = env.includes('prod') || env.includes('production'); let color = 'primary'; if (!prodMode) { - if (env.includes('staging') || env.includes('dev')) { + if (env.includes('stage') || env.includes('dev')) { color = 'accent'; } else if (env.includes('test')) { color = 'warn'; diff --git a/libs/vre/shared/app-helper-services/src/index.ts b/libs/vre/shared/app-helper-services/src/index.ts index 9b964c2f6d..ddd84432b9 100644 --- a/libs/vre/shared/app-helper-services/src/index.ts +++ b/libs/vre/shared/app-helper-services/src/index.ts @@ -1,3 +1,4 @@ +export * from './lib/component-communication-event.service'; export * from './lib/default-data/default-properties'; export * from './lib/default-data/default-resource-classes'; export * from './lib/ontology-class.service'; diff --git a/apps/dsp-app/src/app/main/services/component-communication-event.service.spec.ts b/libs/vre/shared/app-helper-services/src/lib/component-communication-event.service.spec.ts similarity index 100% rename from apps/dsp-app/src/app/main/services/component-communication-event.service.spec.ts rename to libs/vre/shared/app-helper-services/src/lib/component-communication-event.service.spec.ts diff --git a/apps/dsp-app/src/app/main/services/component-communication-event.service.ts b/libs/vre/shared/app-helper-services/src/lib/component-communication-event.service.ts similarity index 97% rename from apps/dsp-app/src/app/main/services/component-communication-event.service.ts rename to libs/vre/shared/app-helper-services/src/lib/component-communication-event.service.ts index b34274597c..2ff2028489 100644 --- a/apps/dsp-app/src/app/main/services/component-communication-event.service.ts +++ b/libs/vre/shared/app-helper-services/src/lib/component-communication-event.service.ts @@ -16,7 +16,7 @@ export class ComponentCommunicationEventService { return this._subject$ .pipe( // filter down based on event name to any events that are emitted out of the subject from the emit method below. - filter((e: EmitEvent) => e.name === event && (e.value == null || e.value === true)), + filter((e: EmitEvent) => e.name === event && (e.value == null || e.value === true)) as any, map((e: EmitEvent) => e.value) ) .subscribe(action); // subscribe to the subject to get the data. diff --git a/libs/vre/shared/app-session/src/lib/auth.service.ts b/libs/vre/shared/app-session/src/lib/auth.service.ts index f7fed3710b..a88ccedac9 100644 --- a/libs/vre/shared/app-session/src/lib/auth.service.ts +++ b/libs/vre/shared/app-session/src/lib/auth.service.ts @@ -1,8 +1,12 @@ import { Inject, Injectable } from '@angular/core'; - import { ApiResponseData, ApiResponseError, KnoraApiConnection, LoginResponse } from '@dasch-swiss/dsp-js'; import { DspApiConnectionToken } from '@dasch-swiss/vre/shared/app-config'; import { AppError } from '@dasch-swiss/vre/shared/app-error-handler'; +import { + Events as CommsEvents, + ComponentCommunicationEventService, + EmitEvent, +} from '@dasch-swiss/vre/shared/app-helper-services'; import { ClearListsAction, ClearOntologiesAction, @@ -22,7 +26,8 @@ export class AuthService { private store: Store, private _accessTokenService: AccessTokenService, @Inject(DspApiConnectionToken) - private _dspApiConnection: KnoraApiConnection + private _dspApiConnection: KnoraApiConnection, + private _componentCommsService: ComponentCommunicationEventService ) {} isCredentialsValid$() { @@ -52,6 +57,7 @@ export class AuthService { const encodedJWT = (response as ApiResponseData).body.token; this._accessTokenService.storeToken(encodedJWT); this._dspApiConnection.v2.jsonWebToken = encodedJWT; + this._componentCommsService.emit(new EmitEvent(CommsEvents.loginSuccess)); }), catchError(error => { if ((error instanceof ApiResponseError && error.status === 400) || error.status === 401) { diff --git a/package.json b/package.json index 9677e36e9d..25c24ef9cd 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "start-with-dev-server": "nx run dsp-app:serve:dev-server", "start-with-ls-test-server": "nx run dsp-app:serve:ls-test-server", "start-with-0845-test-server": "nx run dsp-app:serve:0845-test-server", - "start-with-staging-server": "nx run dsp-app:serve:staging-server", + "start-with-stage-server": "nx run dsp-app:serve:stage-server", "generate-openapi-module": "cd libs/vre/open-api && rm -rf src/lib/generated && npx openapi-generator-cli generate", "e2e-local": "cd apps/dsp-app && npx cypress open", "e2e-ci-dev": "nx run dsp-app:e2e:development", @@ -151,4 +151,4 @@ "publishConfig": { "registry": "https://npm.pkg.github.com/dasch-swiss" } -} +} \ No newline at end of file