diff --git a/backend/capellacollab/config/config_schema.yaml b/backend/capellacollab/config/config_schema.yaml
index c183dab167..abf219e1a7 100644
--- a/backend/capellacollab/config/config_schema.yaml
+++ b/backend/capellacollab/config/config_schema.yaml
@@ -111,9 +111,22 @@ properties:
host:
type: string
port:
- potypert: string
+ type: string
scheme:
type: string
+ metadata:
+ type: object
+ properties:
+ privacyPolicyURL:
+ type: string
+ imprintURL:
+ type: string
+ provider:
+ type: string
+ authenticationProvider:
+ type: string
+ environment:
+ type: string
extensions:
type: object
additionalProperties: false
diff --git a/backend/capellacollab/core/metadata.py b/backend/capellacollab/core/metadata.py
index b3c62a01ba..60dc808ca7 100644
--- a/backend/capellacollab/core/metadata.py
+++ b/backend/capellacollab/core/metadata.py
@@ -5,15 +5,22 @@
import pydantic
import capellacollab
+from capellacollab.config import config
class Metadata(pydantic.BaseModel):
model_config = pydantic.ConfigDict(from_attributes=True)
version: str
+ privacy_policy_url: str | None
+ imprint_url: str | None
+ provider: str | None
+ authentication_provider: str | None
+ environment: str | None
router = fastapi.APIRouter()
+cfg: dict[str, str | None] = config["general"].get("metadata", {})
@router.get(
@@ -21,4 +28,11 @@ class Metadata(pydantic.BaseModel):
response_model=Metadata,
)
def get_metadata():
- return Metadata(version=capellacollab.__version__)
+ return Metadata(
+ version=capellacollab.__version__,
+ privacy_policy_url=cfg.get("privacyPolicyURL"),
+ imprint_url=cfg.get("imprintURL"),
+ provider=cfg.get("provider"),
+ authentication_provider=cfg.get("authenticationProvider"),
+ environment=cfg.get("environment"),
+ )
diff --git a/backend/config/config_template.yaml b/backend/config/config_template.yaml
index c442c53771..54a90f1a8b 100644
--- a/backend/config/config_template.yaml
+++ b/backend/config/config_template.yaml
@@ -36,6 +36,13 @@ general:
port: 4200
scheme: http
+ metadata:
+ privacyPolicyURL: https://example.com/privacy
+ imprintURL: https://example.com/imprint
+ provider: Systems Engineering Toolchain team
+ authenticationProvider: OAuth2
+ environment: development
+
extensions:
guacamole:
baseURI: http://localhost:8080/guacamole
diff --git a/frontend/src/app/general/auth/auth/auth.component.html b/frontend/src/app/general/auth/auth/auth.component.html
index 55a987950b..274ef36339 100644
--- a/frontend/src/app/general/auth/auth/auth.component.html
+++ b/frontend/src/app/general/auth/auth/auth.component.html
@@ -25,7 +25,8 @@
Capella Collaboration Manager
diff --git a/frontend/src/app/general/auth/auth/auth.component.ts b/frontend/src/app/general/auth/auth/auth.component.ts
index 38477b7a8b..d07efccaf9 100644
--- a/frontend/src/app/general/auth/auth/auth.component.ts
+++ b/frontend/src/app/general/auth/auth/auth.component.ts
@@ -5,9 +5,9 @@
import { Component, Input, OnInit } from '@angular/core';
import { ActivatedRoute, ParamMap } from '@angular/router';
+import { MetadataService } from 'src/app/general/metadata/version/version.service';
import { PageLayoutService } from 'src/app/page-layout/page-layout.service';
import { AuthService } from 'src/app/services/auth/auth.service';
-import { environment } from 'src/environments/environment';
@Component({
selector: 'app-auth',
@@ -22,12 +22,12 @@ export class AuthComponent implements OnInit {
}
}
- authProvider = environment.authentication;
public params = {} as ParamMap;
constructor(
private authService: AuthService,
private pageLayoutService: PageLayoutService,
+ public metadataService: MetadataService,
private route: ActivatedRoute
) {
this.pageLayoutService.disableAll();
diff --git a/frontend/src/app/general/footer/footer.component.html b/frontend/src/app/general/footer/footer.component.html
index 63272d51d4..d2d03c422b 100644
--- a/frontend/src/app/general/footer/footer.component.html
+++ b/frontend/src/app/general/footer/footer.component.html
@@ -6,5 +6,9 @@
diff --git a/frontend/src/app/general/footer/footer.component.ts b/frontend/src/app/general/footer/footer.component.ts
index 36d6ffad83..9e6049921e 100644
--- a/frontend/src/app/general/footer/footer.component.ts
+++ b/frontend/src/app/general/footer/footer.component.ts
@@ -5,7 +5,7 @@
import { Component } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
-import { environment } from 'src/environments/environment';
+import { MetadataService } from 'src/app/general/metadata/version/version.service';
@Component({
selector: 'app-footer',
@@ -13,7 +13,8 @@ import { environment } from 'src/environments/environment';
styleUrls: ['./footer.component.css'],
})
export class FooterComponent {
- constructor(public dialog: MatDialog) {}
-
- provider = environment.provider;
+ constructor(
+ public dialog: MatDialog,
+ public metadataService: MetadataService
+ ) {}
}
diff --git a/frontend/src/app/general/footer/legal/legal.component.html b/frontend/src/app/general/footer/legal/legal.component.html
index e61028a8b8..bf7265ad1f 100644
--- a/frontend/src/app/general/footer/legal/legal.component.html
+++ b/frontend/src/app/general/footer/legal/legal.component.html
@@ -4,6 +4,17 @@
-->
diff --git a/frontend/src/app/general/footer/legal/legal.component.ts b/frontend/src/app/general/footer/legal/legal.component.ts
index 047dae635e..a0c4675357 100644
--- a/frontend/src/app/general/footer/legal/legal.component.ts
+++ b/frontend/src/app/general/footer/legal/legal.component.ts
@@ -4,7 +4,7 @@
*/
import { Component } from '@angular/core';
-import { environment } from 'src/environments/environment';
+import { MetadataService } from 'src/app/general/metadata/version/version.service';
@Component({
selector: 'app-legal',
@@ -12,6 +12,5 @@ import { environment } from 'src/environments/environment';
styleUrls: ['./legal.component.css'],
})
export class LegalComponent {
- imprint = environment.imprint;
- privacy = environment.privacy;
+ constructor(public metadataService: MetadataService) {}
}
diff --git a/frontend/src/app/general/metadata/version/version.component.html b/frontend/src/app/general/metadata/version/version.component.html
index c6183c6f16..d103fc79c5 100644
--- a/frontend/src/app/general/metadata/version/version.component.html
+++ b/frontend/src/app/general/metadata/version/version.component.html
@@ -7,21 +7,23 @@
- New version. What's new? ({{ versionService.oldVersion }}
+ New version. What's new? ({{ metadataService.oldVersion }}
arrow_right_alt{{ versionService.version.git.tag }})
+ >{{ metadataService.version.git.tag }})
- Environment: {{ env }}
- Frontend version: {{ versionService.version?.git?.version }}
- Backend version: {{ backend }}
+ Environment:
+ {{ (metadataService.backendMetadata | async)?.environment || "-" }}
+ Frontend version: {{ metadataService.version?.git?.version }}
+ Backend version:
+ {{ (metadataService.backendMetadata | async)?.version || "-" }}
diff --git a/frontend/src/app/general/metadata/version/version.component.ts b/frontend/src/app/general/metadata/version/version.component.ts
index 441aeb2306..6c59e732d3 100644
--- a/frontend/src/app/general/metadata/version/version.component.ts
+++ b/frontend/src/app/general/metadata/version/version.component.ts
@@ -3,31 +3,18 @@
* SPDX-License-Identifier: Apache-2.0
*/
-import { Component, OnInit } from '@angular/core';
+import { Component } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
-import { environment } from 'src/environments/environment';
-import { BackendMetadata, VersionService } from './version.service';
+import { MetadataService } from './version.service';
@Component({
selector: 'app-version',
templateUrl: './version.component.html',
styleUrls: ['./version.component.css'],
})
-export class VersionComponent implements OnInit {
- backend = '-';
- frontend = '-';
- env: string = environment.environment || 'not specified';
-
+export class VersionComponent {
constructor(
- public versionService: VersionService,
+ public metadataService: MetadataService,
public dialog: MatDialog
) {}
-
- ngOnInit(): void {
- this.versionService
- .loadBackendMetadata()
- .subscribe((metadata: BackendMetadata) => {
- this.backend = `v${metadata.version}`;
- });
- }
}
diff --git a/frontend/src/app/general/metadata/version/version.service.ts b/frontend/src/app/general/metadata/version/version.service.ts
index 2221664002..86e83d5317 100644
--- a/frontend/src/app/general/metadata/version/version.service.ts
+++ b/frontend/src/app/general/metadata/version/version.service.ts
@@ -6,7 +6,7 @@
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
-import { Observable } from 'rxjs';
+import { BehaviorSubject, Observable, tap } from 'rxjs';
import { compare } from 'semver';
import { LocalStorageService } from 'src/app/general/auth/local-storage/local-storage.service';
import { environment } from 'src/environments/environment';
@@ -14,19 +14,25 @@ import { environment } from 'src/environments/environment';
@Injectable({
providedIn: 'root',
})
-export class VersionService {
+export class MetadataService {
constructor(
private httpClient: HttpClient,
private localStorageService: LocalStorageService,
public dialog: MatDialog
) {
this.loadVersion();
+ this.loadBackendMetadata().subscribe();
}
public version: Version | undefined;
public oldVersion: string | undefined;
public changedVersion = false;
+ private _backendMetadata = new BehaviorSubject(
+ undefined
+ );
+ readonly backendMetadata = this._backendMetadata.asObservable();
+
loadVersion(): void {
if (!this.version) {
this.httpClient
@@ -39,9 +45,11 @@ export class VersionService {
}
loadBackendMetadata(): Observable {
- return this.httpClient.get(
- environment.backend_url + '/metadata'
- );
+ return this.httpClient
+ .get(environment.backend_url + '/metadata')
+ .pipe(
+ tap((metadata: BackendMetadata) => this._backendMetadata.next(metadata))
+ );
}
determinateChangedVersion() {
@@ -93,5 +101,9 @@ export interface Version {
export interface BackendMetadata {
version: string;
- tag: string;
+ privacy_policy_url: string;
+ imprint_url: string;
+ provider: string;
+ authentication_provider: string;
+ environment: string;
}
diff --git a/frontend/src/environments/environment.dev.ts b/frontend/src/environments/environment.dev.ts
index a2865cc1a5..cbb6364565 100644
--- a/frontend/src/environments/environment.dev.ts
+++ b/frontend/src/environments/environment.dev.ts
@@ -7,10 +7,5 @@ export const environment = {
production: false,
backend_url: 'http://localhost:8000/api/v1',
docsURL: 'http://localhost:8082',
- privacy: 'https://example.com/privacy',
- imprint: 'https://example.com/imprint',
- provider: 'PROVIDER',
- authentication: 'OAuth mock',
usernameAttribute: 'sub',
- environment: 'development',
};
diff --git a/frontend/src/environments/environment.ts b/frontend/src/environments/environment.ts
index 0968b39fce..d4eedaa00e 100644
--- a/frontend/src/environments/environment.ts
+++ b/frontend/src/environments/environment.ts
@@ -7,10 +7,5 @@ export const environment = {
production: true,
backend_url: '/api/v1',
docsURL: '/docs',
- privacy: 'https://example.com/privacy',
- imprint: 'https://example.com/imprint',
- provider: 'PROVIDER',
- authentication: 'OAuth mock',
usernameAttribute: 'sub',
- environment: 'production',
};
diff --git a/helm/config/backend.yaml b/helm/config/backend.yaml
index 9f4954a37f..3d03853724 100644
--- a/helm/config/backend.yaml
+++ b/helm/config/backend.yaml
@@ -30,6 +30,9 @@ general:
port: "{{ .Values.general.port }}"
scheme: "{{ .Values.general.scheme }}"
+ metadata:
+ {{- toYaml .Values.general.metadata | nindent 4 }}
+
extensions:
guacamole:
baseURI: "http://{{ .Release.Name }}-guacamole-guacamole:8080/guacamole"
diff --git a/helm/values.yaml b/helm/values.yaml
index 3a609a59bf..6fc0125a32 100644
--- a/helm/values.yaml
+++ b/helm/values.yaml
@@ -50,6 +50,13 @@ general:
port: 80
scheme: http
+ metadata:
+ privacyPolicyURL: https://example.com/privacy
+ imprintURL: https://example.com/imprint
+ provider: Systems Engineering Toolchain team
+ authenticationProvider: OAuth2
+ environment: development
+
sessions:
# Session timeout in minutes for unused and idle sessions
timeout: 90