diff --git a/projects/scion/workbench/src/lib/microfrontend-platform/microfrontend-view/microfrontend-view.component.html b/projects/scion/workbench/src/lib/microfrontend-platform/microfrontend-view/microfrontend-view.component.html index e0c16a0d6..43409f6f6 100644 --- a/projects/scion/workbench/src/lib/microfrontend-platform/microfrontend-view/microfrontend-view.component.html +++ b/projects/scion/workbench/src/lib/microfrontend-platform/microfrontend-view/microfrontend-view.component.html @@ -1,7 +1,9 @@ <wb-content-as-overlay [overlayHost]="iframeHost"> <sci-router-outlet #router_outlet [name]="viewId" - [ngClass]="microfrontendCssClasses" + [attr.data-capabilityid]="viewCapability && viewCapability.metadata!.id" + [attr.data-app]="viewCapability && viewCapability.metadata!.appSymbolicName" + [ngClass]="viewCssClasses" class="e2e-view" [keystrokes]="keystrokesToBubble$ | async"> </sci-router-outlet> </wb-content-as-overlay> diff --git a/projects/scion/workbench/src/lib/microfrontend-platform/microfrontend-view/microfrontend-view.component.ts b/projects/scion/workbench/src/lib/microfrontend-platform/microfrontend-view/microfrontend-view.component.ts index 4a59649f5..270cb29c3 100644 --- a/projects/scion/workbench/src/lib/microfrontend-platform/microfrontend-view/microfrontend-view.component.ts +++ b/projects/scion/workbench/src/lib/microfrontend-platform/microfrontend-view/microfrontend-view.component.ts @@ -46,7 +46,7 @@ export class MicrofrontendViewComponent implements OnInit, OnDestroy, WbBeforeDe 'keydown.escape', // allows closing notifications ]; - public microfrontendCssClasses!: string[]; + public viewCapability: WorkbenchViewCapability | undefined; public iframeHost: Promise<ViewContainerRef>; @ViewChild('router_outlet', {static: true}) @@ -126,6 +126,7 @@ export class MicrofrontendViewComponent implements OnInit, OnDestroy, WbBeforeDe // Check if navigating to a new microfrontend. if (!prevViewCapability || prevViewCapability.metadata!.id !== viewCapability.metadata!.id) { + this.viewCapability = viewCapability; this.setViewProperties(viewCapability, activatedRoute); this.installParamsUpdater(viewCapability); } @@ -209,7 +210,6 @@ export class MicrofrontendViewComponent implements OnInit, OnDestroy, WbBeforeDe .concat(Arrays.coerce(activatedRoute.data[WorkbenchRouteData.state]?.[WorkbenchNavigationalStates.cssClass])); this._view.closable = viewCapability.properties.closable ?? true; this._view.dirty = false; - this.microfrontendCssClasses = ['e2e-view', `e2e-${viewCapability.metadata!.appSymbolicName}`, ...this._view.cssClasses]; } /** @@ -226,6 +226,10 @@ export class MicrofrontendViewComponent implements OnInit, OnDestroy, WbBeforeDe return this._view.viewId; } + public get viewCssClasses(): string[] { + return this._view.cssClasses; + } + /** * Promise that resolves once params contain the given capability id. */