diff --git a/src/app/debug/table/table-settings-modal/table-settings-modal.component.ts b/src/app/debug/table/table-settings-modal/table-settings-modal.component.ts
index 18982e09..2df3fcbc 100644
--- a/src/app/debug/table/table-settings-modal/table-settings-modal.component.ts
+++ b/src/app/debug/table/table-settings-modal/table-settings-modal.component.ts
@@ -3,20 +3,22 @@ import { ReactiveFormsModule, UntypedFormControl, UntypedFormGroup } from '@angu
import { NgbActiveModal, NgbModal } from '@ng-bootstrap/ng-bootstrap';
import { HttpService } from '../../../shared/services/http.service';
import { SettingsService } from '../../../shared/services/settings.service';
-import { catchError, Subscription, tap } from 'rxjs';
+import { catchError, Subscription } from 'rxjs';
import { ToastService } from '../../../shared/services/toast.service';
import { UploadParams } from 'src/app/shared/interfaces/upload-params';
import { ToastComponent } from '../../../shared/components/toast/toast.component';
import { ErrorHandling } from 'src/app/shared/classes/error-handling.service';
import { OptionsSettings } from '../../../shared/interfaces/options-settings';
import { Transformation } from '../../../shared/interfaces/transformation';
+import { VersionService } from '../../../shared/services/version.service';
+import { CopyTooltipDirective } from '../../../shared/directives/copy-tooltip.directive';
@Component({
selector: 'app-table-settings-modal',
templateUrl: './table-settings-modal.component.html',
styleUrls: ['./table-settings-modal.component.css'],
standalone: true,
- imports: [ReactiveFormsModule, ToastComponent],
+ imports: [ReactiveFormsModule, ToastComponent, CopyTooltipDirective],
})
export class TableSettingsModalComponent implements OnDestroy {
@ViewChild('modal') modal!: ElementRef;
@@ -38,6 +40,8 @@ export class TableSettingsModalComponent implements OnDestroy {
});
@Output() openLatestReportsEvent = new EventEmitter
();
saving: boolean = false;
+ backendVersion?: string;
+ frontendVersion?: string;
constructor(
private modalService: NgbModal,
@@ -45,7 +49,9 @@ export class TableSettingsModalComponent implements OnDestroy {
private settingsService: SettingsService,
private toastService: ToastService,
private errorHandler: ErrorHandling,
+ private versionService: VersionService,
) {
+ this.getApplicationVersions();
this.subscribeToSettingsServiceObservables();
}
@@ -53,6 +59,15 @@ export class TableSettingsModalComponent implements OnDestroy {
this.subscriptions.unsubscribe();
}
+ getApplicationVersions() {
+ this.versionService.getFrontendVersion().then((frontendVersion) => {
+ this.frontendVersion = frontendVersion;
+ });
+ this.versionService.getBackendVersion().then((backendVersion) => {
+ this.backendVersion = backendVersion;
+ });
+ }
+
subscribeToSettingsServiceObservables(): void {
const showMultipleSubscription: Subscription = this.settingsService.showMultipleAtATimeObservable.subscribe({
next: (value: boolean): void => {
diff --git a/src/app/shared/services/http.service.ts b/src/app/shared/services/http.service.ts
index 094afa82..aebaac22 100644
--- a/src/app/shared/services/http.service.ts
+++ b/src/app/shared/services/http.service.ts
@@ -212,4 +212,10 @@ export class HttpService {
headers: this.headers,
});
}
+
+ getBackendVersion(): Observable {
+ return this.http.get('api/testtool/version', {
+ responseType: 'text',
+ });
+ }
}
diff --git a/src/app/shared/services/node-link-strategy.service.spec.ts b/src/app/shared/services/node-link-strategy.service.spec.ts
deleted file mode 100644
index 59060975..00000000
--- a/src/app/shared/services/node-link-strategy.service.spec.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-import { TestBed } from '@angular/core/testing';
-
-import { ChangeNodeLinkStrategyService } from './node-link-strategy.service';
-
-describe('ChangeNodeLinkStrategyService', () => {
- let service: ChangeNodeLinkStrategyService;
-
- beforeEach(() => {
- TestBed.configureTestingModule({});
- service = TestBed.inject(ChangeNodeLinkStrategyService);
- });
-
- it('should be created', () => {
- expect(service).toBeTruthy();
- });
-});
diff --git a/src/app/shared/services/node-link-strategy.service.ts b/src/app/shared/services/node-link-strategy.service.ts
deleted file mode 100644
index 71fbefea..00000000
--- a/src/app/shared/services/node-link-strategy.service.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-import { Injectable } from '@angular/core';
-import { Subject } from 'rxjs';
-
-@Injectable({
- providedIn: 'root',
-})
-export class ChangeNodeLinkStrategyService {
- changeNodeLinkStrategy = new Subject();
- constructor() {}
-}
diff --git a/src/app/shared/services/version.service.spec.ts b/src/app/shared/services/version.service.spec.ts
new file mode 100644
index 00000000..c7bde985
--- /dev/null
+++ b/src/app/shared/services/version.service.spec.ts
@@ -0,0 +1,41 @@
+import { TestBed } from '@angular/core/testing';
+
+import { VersionService } from './version.service';
+import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
+import { HttpTestingController, provideHttpClientTesting } from '@angular/common/http/testing';
+
+describe('VersionService', () => {
+ let service: VersionService;
+
+ let httpTestingController: HttpTestingController;
+
+ beforeEach(() => {
+ TestBed.configureTestingModule({
+ providers: [provideHttpClient(withInterceptorsFromDi()), provideHttpClientTesting()],
+ });
+ service = TestBed.inject(VersionService);
+ httpTestingController = TestBed.inject(HttpTestingController);
+ });
+
+ it('should be created', () => {
+ expect(service).toBeTruthy();
+ });
+
+ it('should set version from package.json', async () => {
+ const frontendVersionPromise = service.getFrontendVersion();
+ const backendVersionPromise = service.getBackendVersion();
+ const mockPackageJson = { version: '1.0-TEST' };
+
+ const frontendVersionReq = httpTestingController.expectOne(service.packageJsonPath);
+
+ const backendVersionReg = httpTestingController.expectOne('api/testtool/version');
+ frontendVersionReq.flush(mockPackageJson);
+ backendVersionReg.flush('3.0-TEST');
+
+ const frontendVersion = await frontendVersionPromise;
+ const backendVersion = await backendVersionPromise;
+
+ expect(frontendVersion).toEqual('1.0-TEST');
+ expect(backendVersion).toEqual('3.0-TEST');
+ });
+});
diff --git a/src/app/shared/services/version.service.ts b/src/app/shared/services/version.service.ts
new file mode 100644
index 00000000..4bee2416
--- /dev/null
+++ b/src/app/shared/services/version.service.ts
@@ -0,0 +1,39 @@
+import { Injectable } from '@angular/core';
+import { HttpService } from './http.service';
+import { firstValueFrom } from 'rxjs';
+import { HttpClient } from '@angular/common/http';
+
+@Injectable({
+ providedIn: 'root',
+})
+export class VersionService {
+ packageJsonPath = 'assets/package.json';
+ frontendVersion?: string;
+ backendVersion?: string;
+
+ constructor(
+ private httpService: HttpService,
+ private httpClient: HttpClient,
+ ) {}
+
+ async getFrontendVersion() {
+ if (!this.frontendVersion) {
+ try {
+ const packageJson = await firstValueFrom(this.httpClient.get<{ version: string }>(this.packageJsonPath));
+ if (packageJson) {
+ this.frontendVersion = packageJson.version;
+ }
+ } catch (error) {
+ console.error('package.json could not be found in assets', error);
+ }
+ }
+ return this.frontendVersion!;
+ }
+
+ async getBackendVersion() {
+ if (!this.backendVersion) {
+ this.backendVersion = await firstValueFrom(this.httpService.getBackendVersion());
+ }
+ return this.backendVersion;
+ }
+}
diff --git a/src/styles.css b/src/styles.css
index 6f3e30da..fec9f707 100644
--- a/src/styles.css
+++ b/src/styles.css
@@ -145,3 +145,15 @@ html, body {
.red {
color: red;
}
+
+.gap-1 {
+ gap: 0.5rem;
+}
+
+.gap-2 {
+ gap: 0.75rem;
+}
+
+.cdk-overlay-container {
+ z-index: 1100 !important; /* Ensure it is higher than the modal's z-index */
+}