diff --git a/src/app/app-init.service.spec.ts b/src/app/app-init.service.spec.ts index 2321cefec6..630477d0db 100644 --- a/src/app/app-init.service.spec.ts +++ b/src/app/app-init.service.spec.ts @@ -8,6 +8,7 @@ describe('TestService', () => { let service: AppInitService; const config: IConfig = { + dspRelease: '2022.01.01', apiProtocol: 'http', apiHost: '0.0.0.0', apiPort: 3333, @@ -74,6 +75,10 @@ describe('TestService', () => { }); it('should process the fully specified config', async () => { + expect(service.dspConfig.release).toEqual('2022.01.01'); + expect(service.dspConfig.environment).toEqual('dev'); + expect(service.dspConfig.color).toEqual('accent'); + expect(service.dspConfig.production).toEqual(false); expect(service.dspApiConfig.apiProtocol).toEqual('http'); expect(service.dspApiConfig.apiHost).toEqual('0.0.0.0'); expect(service.dspApiConfig.apiPort).toEqual(3333); diff --git a/src/app/app-init.service.ts b/src/app/app-init.service.ts index b3b179309d..fc7bc24e89 100644 --- a/src/app/app-init.service.ts +++ b/src/app/app-init.service.ts @@ -1,16 +1,23 @@ import { Inject, Injectable } from '@angular/core'; import { KnoraApiConfig } from '@dasch-swiss/dsp-js'; -import { DspInstrumentationConfig, DspRollbarConfig, DspDataDogConfig } from './main/declarations/dsp-instrumentation-config'; -import { DspIiifConfig } from './main/declarations/dsp-iiif-config'; -import { DspAppConfig } from './main/declarations/dsp-app-config'; import { IConfig } from './main/declarations/app-config'; import { APP_CONFIG } from './main/declarations/dsp-api-tokens'; +import { DspAppConfig } from './main/declarations/dsp-app-config'; +import { DspConfig } from './main/declarations/dsp-config'; +import { DspIiifConfig } from './main/declarations/dsp-iiif-config'; +import { DspDataDogConfig, DspInstrumentationConfig, DspRollbarConfig } from './main/declarations/dsp-instrumentation-config'; @Injectable({ providedIn: 'root' }) export class AppInitService { + private _dspConfig: DspConfig; + + get dspConfig(): DspConfig { + return this._dspConfig; + } + private _dspApiConfig: KnoraApiConfig; get dspApiConfig(): KnoraApiConfig { @@ -43,6 +50,24 @@ export class AppInitService { throw new Error('config misses required members: apiProtocol and/or apiHost'); } + const prodMode = (this._config.instrumentation.environment === ('prod' || 'production')); + + let color = 'primary'; + if (!prodMode) { + if (this._config.instrumentation.environment.includes('staging') || this._config.instrumentation.environment.includes('dev')) { + color = 'accent'; + } else if (this._config.instrumentation.environment.includes('test')){ + color = 'warn'; + } + } + + this._dspConfig = new DspConfig( + this._config.dspRelease, + this._config.instrumentation.environment, + prodMode, + color + ); + // make input type safe const apiPort = (typeof this._config.apiPort === 'number' ? this._config.apiPort : null); const apiPath = (typeof this._config.apiPath === 'string' ? this._config.apiPath : ''); diff --git a/src/app/main/declarations/app-config.ts b/src/app/main/declarations/app-config.ts index e3ffa29bed..e395d36c25 100644 --- a/src/app/main/declarations/app-config.ts +++ b/src/app/main/declarations/app-config.ts @@ -1,4 +1,5 @@ export interface IConfig { + dspRelease: string; apiProtocol: 'http' | 'https'; apiHost: string; apiPort: number; diff --git a/src/app/main/declarations/dsp-config.ts b/src/app/main/declarations/dsp-config.ts new file mode 100644 index 0000000000..01a38022de --- /dev/null +++ b/src/app/main/declarations/dsp-config.ts @@ -0,0 +1,11 @@ +/** + * main DSP (DaSCH Service Platform) config + */ +export class DspConfig { + constructor( + public release: string, + public environment: string, + public production: boolean, + public color: string + ){ } +} diff --git a/src/app/main/footer/footer.component.html b/src/app/main/footer/footer.component.html index 8522329257..382bd37f22 100644 --- a/src/app/main/footer/footer.component.html +++ b/src/app/main/footer/footer.component.html @@ -19,7 +19,7 @@

- Data and Service Center for the Humanities + Swiss National Data and Service Center for the Humanities location_on Gewerbestrasse 24, 4123 Allschwil diff --git a/src/app/main/grid/grid.component.scss b/src/app/main/grid/grid.component.scss index ac2d2ffc96..47f733e9a5 100644 --- a/src/app/main/grid/grid.component.scss +++ b/src/app/main/grid/grid.component.scss @@ -9,7 +9,7 @@ justify-items: stretch; align-items: stretch; align-content: space-evenly; - margin: 90px -15px 0 0; + margin: 48px -15px 0 0; padding: 0; list-style: none; diff --git a/src/app/main/header/header.component.html b/src/app/main/header/header.component.html index 5f9e2d16af..85fe56aaa6 100644 --- a/src/app/main/header/header.component.html +++ b/src/app/main/header/header.component.html @@ -4,7 +4,13 @@

DaSCH Service Platform

DSP

-

{{appVersion}}

+

+ {{dsp.release}} + + {{dsp.environment}} + {{dsp.release}} + +

@@ -43,3 +49,8 @@

DSP

+ + diff --git a/src/app/main/header/header.component.scss b/src/app/main/header/header.component.scss index 5d4b944fc0..2f7f2ed5e4 100644 --- a/src/app/main/header/header.component.scss +++ b/src/app/main/header/header.component.scss @@ -9,10 +9,11 @@ .home-button { display: inline-block; .mat-icon { - margin: 6px 6px 6px 0; + margin: 0 6px 6px 0; min-width: 40px; height: auto; max-height: 40px; + padding-bottom: 6px; &.small { width: 40px; @@ -40,6 +41,9 @@ } } @media (max-width: 1024px) { + .development.badge { + font-weight: normal; + } .desktop-only { display: none; } diff --git a/src/app/main/header/header.component.spec.ts b/src/app/main/header/header.component.spec.ts index 4215c4f784..c137899c65 100644 --- a/src/app/main/header/header.component.spec.ts +++ b/src/app/main/header/header.component.spec.ts @@ -63,6 +63,12 @@ describe('HeaderComponent', () => { let componentCommsService: ComponentCommunicationEventService; + const appInitSpy = { + dspConfig: { + release: '2022.01.01' + } + }; + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ declarations: [ @@ -94,6 +100,10 @@ describe('HeaderComponent', () => { provide: DspApiConnectionToken, useValue: new KnoraApiConnection(TestConfig.ApiConfig) }, + { + provide: AppInitService, + useValue: appInitSpy + }, ComponentCommunicationEventService ] }).compileComponents(); diff --git a/src/app/main/header/header.component.ts b/src/app/main/header/header.component.ts index 91937fc445..2012aabd28 100644 --- a/src/app/main/header/header.component.ts +++ b/src/app/main/header/header.component.ts @@ -4,14 +4,14 @@ import { MatIconRegistry } from '@angular/material/icon'; import { DomSanitizer } from '@angular/platform-browser'; import { NavigationStart, Router } from '@angular/router'; import { Subscription } from 'rxjs'; +import { AppInitService } from 'src/app/app-init.service'; import { DialogComponent } from 'src/app/main/dialog/dialog.component'; import { ComponentCommunicationEventService, Events } from 'src/app/main/services/component-communication-event.service'; import { SearchParams } from 'src/app/workspace/results/list-view/list-view.component'; +import { DspConfig } from '../declarations/dsp-config'; import { NotificationService } from '../services/notification.service'; import { SessionService } from '../services/session.service'; -const { version: appVersion } = require('../../../../package.json'); - @Component({ selector: 'app-header', templateUrl: './header.component.html', @@ -23,11 +23,12 @@ export class HeaderComponent implements OnInit, OnDestroy { show = false; searchParams: SearchParams; - appVersion: string = 'v' + appVersion; + dsp: DspConfig; componentCommsSubscription: Subscription; constructor( + private _appInitService: AppInitService, private _componentCommsService: ComponentCommunicationEventService, private _dialog: MatDialog, private _domSanitizer: DomSanitizer, @@ -51,6 +52,9 @@ export class HeaderComponent implements OnInit, OnDestroy { }); } }); + + this.dsp = this._appInitService.dspConfig; + } ngOnInit() { diff --git a/src/app/main/help/help.component.html b/src/app/main/help/help.component.html index af1521044e..21e560c7fe 100644 --- a/src/app/main/help/help.component.html +++ b/src/app/main/help/help.component.html @@ -1,8 +1,14 @@
+
+
+

This is a development version of DSP (release {{dsp.release}}) running in the environment {{dsp.environment}}

+
+
+

Need help?

-

Read the user guide: Explore by topic

+

Read the user guide: Explore by topic

@@ -10,10 +16,13 @@

Read the user guide: Explore by topic

-

Explore our software products

-

The web application and the tools for data storage and long-term access are developed - by the DaSCH team in Switzerland.

- +

Explore our software products

+

The DaSCH Service Platform (DSP) is our main product within release {{dsp.release}} + → here you will get the latest news about this main version launch +

+ If you are interested in more details about the individual applications of DSP, + take a look at the following software products — all developed by the DaSCH team in Switzerland. +

@@ -21,7 +30,7 @@

Explore our software products

-

Get more support or help to improve

+

Get more support or help to improve

diff --git a/src/app/main/help/help.component.scss b/src/app/main/help/help.component.scss index 9af4e67c5d..8d0b4d6f1e 100644 --- a/src/app/main/help/help.component.scss +++ b/src/app/main/help/help.component.scss @@ -8,6 +8,10 @@ section { text-align: center; padding: 24px 0; + &.info { + min-height: auto; + } + .content { img.logo { max-width: 400px; diff --git a/src/app/main/help/help.component.spec.ts b/src/app/main/help/help.component.spec.ts index 0ed1dfd6db..b4588383fa 100644 --- a/src/app/main/help/help.component.spec.ts +++ b/src/app/main/help/help.component.spec.ts @@ -19,6 +19,12 @@ describe('HelpComponent', () => { let component: HelpComponent; let fixture: ComponentFixture; + const appInitSpy = { + dspConfig: { + release: '2022.01.01' + } + }; + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ declarations: [ @@ -45,6 +51,10 @@ describe('HelpComponent', () => { { provide: DspApiConnectionToken, useValue: new KnoraApiConnection(TestConfig.ApiConfig) + }, + { + provide: AppInitService, + useValue: appInitSpy } ] }) diff --git a/src/app/main/help/help.component.ts b/src/app/main/help/help.component.ts index d93778c020..5f0e6fa970 100644 --- a/src/app/main/help/help.component.ts +++ b/src/app/main/help/help.component.ts @@ -1,11 +1,13 @@ import { Component, Inject, OnInit } from '@angular/core'; import { ApiResponseData, ApiResponseError, HealthResponse, KnoraApiConnection, VersionResponse } from '@dasch-swiss/dsp-js'; +import { AppInitService } from 'src/app/app-init.service'; import { DspApiConnectionToken } from '../declarations/dsp-api-tokens'; +import { DspConfig } from '../declarations/dsp-config'; import { ErrorHandlerService } from '../error/error-handler.service'; import { GridItem } from '../grid/grid.component'; declare let require: any; -const { version: appVersion, name: appName } = require('../../../../package.json'); +const { version: appVersion } = require('../../../../package.json'); @Component({ selector: 'app-help', @@ -16,9 +18,12 @@ export class HelpComponent implements OnInit { loading = true; + dsp: DspConfig; + releaseNotesUrl: string; + appVersion: string = appVersion; apiStatus: HealthResponse; - dspVersion: VersionResponse; + apiVersion: VersionResponse; docs: GridItem[] = [ { @@ -74,7 +79,7 @@ export class HelpComponent implements OnInit { }, { title: 'DaSCH Infrastructure', - text: 'Wondering what the Data and Service Center for the Humanities DaSCH exactly is? Get more information on our Website:', + text: 'Wondering what the Swiss National Data and Service Center for the Humanities DaSCH exactly is? Get more information on our Website:', url: 'https://dasch.swiss', urlText: 'dasch.swiss' }, @@ -88,26 +93,34 @@ export class HelpComponent implements OnInit { constructor( @Inject(DspApiConnectionToken) private _dspApiConnection: KnoraApiConnection, + private _appInitService: AppInitService, private _errorHandler: ErrorHandlerService) { } ngOnInit() { + this.dsp = this._appInitService.dspConfig; + + // quick solution; todo: has to be done in a better way + // to go directly to the page e.g. https://dasch.atlassian.net/wiki/spaces/changelog/pages/25067546/Releasenews+2022.01.02 + // or https://dasch.atlassian.net/wiki/spaces/changelog/pages/21266446/Releasenews+2022.01.01 + this.releaseNotesUrl = 'https://dasch.atlassian.net/wiki/search?text=' + this.dsp.release; + this._dspApiConnection.system.versionEndpoint.getVersion().subscribe( (response: ApiResponseData) => { - this.dspVersion = response.body; + this.apiVersion = response.body; // set dsp-app version this.tools[0].title += ' v' + this.appVersion; this.tools[0].url += this.appVersion; // set dsp-api version - this.tools[1].title += this.dspVersion.webapi; - this.tools[1].url += this.dspVersion.webapi; + this.tools[1].title += this.apiVersion.webapi; + this.tools[1].url += this.apiVersion.webapi; // set dsp-sipi version - this.tools[2].title += ' v' + this.dspVersion.sipi; - this.tools[2].url += this.dspVersion.sipi; + this.tools[2].title += ' v' + this.apiVersion.sipi; + this.tools[2].url += this.apiVersion.sipi; }, (error: ApiResponseError) => { this._errorHandler.showMessage(error); diff --git a/src/app/main/main.component.html b/src/app/main/main.component.html index c1e6aa57e6..2803c9da6b 100644 --- a/src/app/main/main.component.html +++ b/src/app/main/main.component.html @@ -6,7 +6,7 @@

bring everything together and simplify your research

-

This is the generic web application of the Data and Service Center for the +

This is the generic web application of the Swiss National Data and Service Center for the Humanities DaSCH. It's the user interface research layer of DSP-API – a software framework for storing, sharing, and working with primary resources and all kind of data in your research project in @@ -96,14 +96,14 @@

annotate, transcribe, connect and share

Who's behind all that?

- Since 2017, the Data and Service Center for the Humanities (DaSCH) has been a member of the Swiss + Since 2017, the Swiss National Data and Service Center for the Humanities (DaSCH) has been a member of the Swiss Academy of Humanities and Social Sciences. The main task of the institution is to operate a platform for humanities research data that ensures access to this data.

+ alt="Swiss National Data and Service Center for the Humanities">