+
+
-
-
-
-
+
+
+
+
+
+
+
+
© 2024 Fraunhofer IOSB-INA - AASPortal (v{{version()}})
+ @if (count() > 0) {
+
{{summary()}}
+ }
+
-
\ No newline at end of file
diff --git a/projects/aas-portal/src/app/main/main.component.scss b/projects/aas-portal/src/app/main/main.component.scss
index c57d4b61..70c5b93d 100644
--- a/projects/aas-portal/src/app/main/main.component.scss
+++ b/projects/aas-portal/src/app/main/main.component.scss
@@ -1,7 +1,44 @@
-/******************************************************************************
- *
- * Copyright (c) 2019-2022 Fraunhofer IOSB-INA Lemgo,
- * eine rechtlich nicht selbstaendige Einrichtung der Fraunhofer-Gesellschaft
- * zur Foerderung der angewandten Forschung e.V.
- *
- *****************************************************************************/
+/******************************************************************************
+ *
+ * Copyright (c) 2019-2024 Fraunhofer IOSB-INA Lemgo,
+ * eine rechtlich nicht selbstaendige Einrichtung der Fraunhofer-Gesellschaft
+ * zur Foerderung der angewandten Forschung e.V.
+ *
+ *****************************************************************************/
+
+ .fhg-main-page {
+ display: grid;
+ position: absolute !important;
+ top: 0;
+ bottom: 0;
+ left: 0;
+ right: 0;
+ grid-template-columns: auto;
+ grid-template-rows: auto min-content 1fr min-content;
+ grid-template-areas: "navbar" "toolbar" "content" "statusbar";
+ }
+
+.fhg-main-navbar {
+ grid-area: navbar;
+ overflow: visible;
+}
+
+.fhg-main-toolbar {
+ grid-area: toolbar;
+ overflow: visible;
+ height: 100%;
+}
+
+.fhg-main-content {
+ grid-area: content;
+ overflow: hidden;
+}
+
+.fhg-main-statusbar {
+ grid-area: statusbar;
+ overflow: hidden;
+}
+
+.fhg-pointer {
+ cursor: pointer;
+}
diff --git a/projects/aas-portal/src/app/main/main.component.ts b/projects/aas-portal/src/app/main/main.component.ts
index a21edb0a..851a30e4 100644
--- a/projects/aas-portal/src/app/main/main.component.ts
+++ b/projects/aas-portal/src/app/main/main.component.ts
@@ -1,24 +1,29 @@
/******************************************************************************
*
- * Copyright (c) 2019-2023 Fraunhofer IOSB-INA Lemgo,
+ * Copyright (c) 2019-2024 Fraunhofer IOSB-INA Lemgo,
* eine rechtlich nicht selbstaendige Einrichtung der Fraunhofer-Gesellschaft
* zur Foerderung der angewandten Forschung e.V.
*
*****************************************************************************/
-import { Component, OnDestroy, OnInit, TemplateRef, ViewChild, ViewContainerRef } from '@angular/core';
-import { Router } from '@angular/router';
-import { Observable, Subscription, first, map } from 'rxjs';
-import { ClipboardService, WindowService, AASQuery } from 'projects/aas-lib/src/public-api';
-import { ProjectService } from '../project/project.service';
+import { ChangeDetectionStrategy, Component, OnInit, TemplateRef, ViewChild, signal } from '@angular/core';
+import { ActivatedRoute, Router, RouterLink, RouterOutlet } from '@angular/router';
+import { NgbNavModule } from '@ng-bootstrap/ng-bootstrap';
+import { first } from 'rxjs';
+import { noop } from 'aas-core';
+import { AuthComponent, IndexChangeService, LocalizeComponent, NotifyComponent, WindowService } from 'aas-lib';
+import { TranslateModule } from '@ngx-translate/core';
+import { AsyncPipe, NgTemplateOutlet } from '@angular/common';
import { ToolbarService } from '../toolbar.service';
+import { MainApiService } from './main-api.service';
+import { environment } from '../../environments/environment';
-export enum LinkId {
+export const enum LinkId {
START = 0,
AAS = 1,
VIEW = 2,
DASHBOARD = 3,
- ABOUT = 4
+ ABOUT = 4,
}
export interface LinkDescriptor {
@@ -30,72 +35,97 @@ export interface LinkDescriptor {
@Component({
selector: 'fhg-main',
templateUrl: './main.component.html',
- styleUrls: ['./main.component.scss']
+ styleUrls: ['./main.component.scss'],
+ standalone: true,
+ imports: [
+ RouterOutlet,
+ RouterLink,
+ AsyncPipe,
+ NgbNavModule,
+ NgTemplateOutlet,
+ TranslateModule,
+ NotifyComponent,
+ LocalizeComponent,
+ AuthComponent,
+ ],
+ changeDetection: ChangeDetectionStrategy.OnPush,
})
-export class MainComponent implements OnInit, OnDestroy {
- private readonly subscription = new Subscription();
- private readonly _links: LinkDescriptor[] = [
+export class MainComponent implements OnInit {
+ public constructor(
+ public readonly route: ActivatedRoute,
+ private readonly router: Router,
+ private readonly window: WindowService,
+ private readonly api: MainApiService,
+ private readonly toolbar: ToolbarService,
+ private readonly indexChange: IndexChangeService,
+ ) {}
+
+ @ViewChild('emptyToolbar', { read: TemplateRef })
+ public emptyToolbar!: TemplateRef
;
+
+ public readonly toolbarTemplate = this.toolbar.toolbarTemplate;
+
+ public readonly links = signal([
{
- id: LinkId.START, name: "CAPTION_START", url: "/start"
+ id: LinkId.START,
+ name: 'CAPTION_START',
+ url: '/start',
},
{
- id: LinkId.AAS, name: "CAPTION_AAS", url: '/aas'
+ id: LinkId.AAS,
+ name: 'CAPTION_AAS',
+ url: '/aas',
},
{
- id: LinkId.VIEW, name: "CAPTION_VIEW", url: '/view'
+ id: LinkId.VIEW,
+ name: 'CAPTION_VIEW',
+ url: '/view',
},
{
- id: LinkId.DASHBOARD, name: "CAPTION_DASHBOARD", url: '/dashboard'
+ id: LinkId.DASHBOARD,
+ name: 'CAPTION_DASHBOARD',
+ url: '/dashboard',
},
{
- id: LinkId.ABOUT, name: "CAPTION_ABOUT", url: "/about"
- }
- ];
-
- constructor(
- private readonly router: Router,
- private readonly window: WindowService,
- private readonly project: ProjectService,
- private readonly clipboard: ClipboardService,
- private readonly viewContainer: ViewContainerRef,
- private readonly toolbar: ToolbarService) {
-
- this.toolbarTemplate = this.toolbar.toolbarTemplate.pipe(map(value => this.nextToolbar(value)))
- }
-
- @ViewChild('emptyToolbar', { read: TemplateRef })
- public emptyToolbar!: TemplateRef;
+ id: LinkId.ABOUT,
+ name: 'CAPTION_ABOUT',
+ url: '/about',
+ },
+ ]).asReadonly();
- public toolbarTemplate: Observable | null>;
+ public readonly version = signal(environment.version).asReadonly();
- public activeId = LinkId.START;
+ public readonly count = this.indexChange.count;
- public get links(): LinkDescriptor[] {
- return this._links;
- }
+ public readonly summary = this.indexChange.summary;
public ngOnInit(): void {
const params = this.window.getQueryParams();
const id = params.get('id');
if (id) {
- this.project.findDocument(id).pipe(first()).subscribe(document => {
- if (document) {
- this.clipboard.set('AASQuery', { id: document.id } as AASQuery);
- this.router.navigateByUrl('/aas?format=AASQuery', { skipLocationChange: true });
- } else {
- this.router.navigateByUrl('/start', { skipLocationChange: true });
- }
- });
+ this.api
+ .getDocument(id)
+ .pipe(first())
+ .subscribe(document => {
+ if (document) {
+ this.router.navigate(['/aas'], {
+ skipLocationChange: true,
+ queryParams: { id: document.id, endpoint: document.endpoint },
+ });
+ } else {
+ this.router.navigate(['/start'], { skipLocationChange: true });
+ }
+ });
} else {
- this.router.navigateByUrl('/start', { skipLocationChange: true });
+ this.router.navigate(['/start'], { skipLocationChange: true });
}
}
- public ngOnDestroy(): void {
- this.subscription.unsubscribe();
+ public clear(): void {
+ this.indexChange.clear();
}
- private nextToolbar(value: TemplateRef | null): TemplateRef {
- return value ?? this.emptyToolbar;
+ public onKeyDown($event: KeyboardEvent): void {
+ noop($event);
}
-}
\ No newline at end of file
+}
diff --git a/projects/aas-portal/src/app/project/project-api.service.ts b/projects/aas-portal/src/app/project/project-api.service.ts
deleted file mode 100644
index 4818f79f..00000000
--- a/projects/aas-portal/src/app/project/project-api.service.ts
+++ /dev/null
@@ -1,97 +0,0 @@
-/******************************************************************************
- *
- * Copyright (c) 2019-2023 Fraunhofer IOSB-INA Lemgo,
- * eine rechtlich nicht selbstaendige Einrichtung der Fraunhofer-Gesellschaft
- * zur Foerderung der angewandten Forschung e.V.
- *
- *****************************************************************************/
-
-import { Injectable } from '@angular/core';
-import { HttpClient, } from '@angular/common/http';
-import { AASDocument, AASWorkspace, aas } from 'common';
-import { Observable } from 'rxjs';
-import { encodeBase64Url } from 'projects/aas-lib/src/public-api';
-
-/** The client side AAS provider service. */
-@Injectable({
- providedIn: 'root'
-})
-export class ProjectAPIService {
- constructor(
- private readonly http: HttpClient,
- ) {}
-
- /**
- * Returns the basic data of all available AAS containers.
- * @returns An array of `AASContainer`.
- */
- public getWorkspaces(): Observable {
- return this.http.get('/api/v1/workspaces');
- }
-
- /**
- * Returns all documents contained in the container with the specified URL.
- * @param url The container URL.
- * @returns The documents of the specified container.
- */
- public getDocuments(url: string): Observable {
- return this.http.get(`/api/v1/containers/${encodeBase64Url(url)}/documents`);
- }
-
- /**
- * Gets the referenced AAS document.
- * @param id The identification or name of the document.
- * @param url The URL of the container.
- * @returns The AAS document.
- */
- public getDocument(id: string, url?: string): Observable {
- return this.http.get(
- url ? `/api/v1/containers/${encodeBase64Url(url)}/documents/${encodeBase64Url(id)}`
- : `/api/v1/documents/${encodeBase64Url(id)}`);
- }
-
- /**
- * Loads the element structure of the specified document.
- * @param id The identification of the AAS document.
- * @param url The URL of the container.
- * @returns The root of the element structure.
- */
- public getContent(id: string, url: string): Observable {
- return this.http.get(
- `/api/v1/containers/${encodeBase64Url(url)}/documents/${encodeBase64Url(id)}/content`);
- }
-
- /**
- * Adds a new endpoint to the AASServer configuration.
- * @param endpoint The registry.
- */
- public addEndpoint(name: string, url: string): Observable {
- return this.http.post(`/api/v1/endpoints/${name}`, { url });
- }
-
- /**
- * Removes the specified endpoint from the AASServer configuration.
- * @param name The name of the endpoint.
- */
- public removeEndpoint(name: string): Observable {
- return this.http.delete(`/api/v1/endpoints/${name}`);
- }
-
- /**
- * Restores the default workspace/container configuration.
- */
- public reset(): Observable