-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(workbench-client): enable microfrontend to display a splash unti…
…l loaded Loading and bootstrapping a microfrontend can take some time, at worst, only displaying content once initialized. To indicate the loading of a microfrontend, set the `showSplash` flag to `true` on the view or popup capability. ```ts { type: 'view', qualifier: { component: 'microfrontend', }, properties: { path: 'path/to/microfrontend', showSplash: true, }, } ``` The splash is displayed until the embedded microfrontend signals readiness. ```ts inject(WorkbenchView).signalReady(); ```
- Loading branch information
1 parent
ed63b22
commit 7a79065
Showing
55 changed files
with
1,273 additions
and
1,836 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
apps/workbench-client-testing-app/src/app/messaging-page/messaging-page.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<sci-tabbar class="e2e-messaging"> | ||
<ng-template sciTab label="Publish Message" cssClass="e2e-publish-message"> | ||
<app-publish-message-page/> | ||
</ng-template> | ||
</sci-tabbar> |
4 changes: 4 additions & 0 deletions
4
apps/workbench-client-testing-app/src/app/messaging-page/messaging-page.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
:host { | ||
display: grid; | ||
padding: 1em; | ||
} |
32 changes: 32 additions & 0 deletions
32
apps/workbench-client-testing-app/src/app/messaging-page/messaging-page.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Copyright (c) 2018-2023 Swiss Federal Railways | ||
* | ||
* This program and the accompanying materials are made | ||
* available under the terms of the Eclipse Public License 2.0 | ||
* which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*/ | ||
|
||
import {Component} from '@angular/core'; | ||
import {SciTabbarComponent, SciTabDirective} from '@scion/components.internal/tabbar'; | ||
import PublishMesagePageComponent from './publish-message-page/publish-message-page.component'; | ||
import {WorkbenchView} from '@scion/workbench-client'; | ||
|
||
@Component({ | ||
selector: 'app-messaging-page', | ||
templateUrl: './messaging-page.component.html', | ||
styleUrls: ['./messaging-page.component.scss'], | ||
standalone: true, | ||
imports: [ | ||
SciTabDirective, | ||
SciTabbarComponent, | ||
PublishMesagePageComponent, | ||
], | ||
}) | ||
export default class MessagingPageComponent { | ||
|
||
constructor(view: WorkbenchView) { | ||
view.signalReady(); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
...sting-app/src/app/messaging-page/publish-message-page/publish-message-page.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<form [formGroup]="form" autocomplete="off"> | ||
<section> | ||
<sci-form-field label="Topic"> | ||
<input [formControl]="form.controls.topic" class="e2e-topic"> | ||
</sci-form-field> | ||
</section> | ||
|
||
<button (click)="onPublish()" [disabled]="form.invalid" class="e2e-publish" sci-primary> | ||
Publish | ||
</button> | ||
|
||
<output class="publish-success e2e-publish-success" *ngIf="publishError === false"> | ||
Success | ||
</output> | ||
|
||
<output class="publish-error e2e-publish-error" *ngIf="publishError"> | ||
{{publishError}} | ||
</output> | ||
</form> |
37 changes: 37 additions & 0 deletions
37
...sting-app/src/app/messaging-page/publish-message-page/publish-message-page.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
:host { | ||
display: flex; | ||
flex-direction: column; | ||
gap: 1em; | ||
|
||
> form { | ||
flex: none; | ||
display: flex; | ||
flex-direction: column; | ||
gap: 1em; | ||
|
||
> section { | ||
flex: none; | ||
display: flex; | ||
flex-direction: column; | ||
gap: .5em; | ||
border: 1px solid var(--sci-color-border); | ||
border-radius: var(--sci-corner); | ||
padding: 1em; | ||
} | ||
|
||
> output.publish-success { | ||
flex: none; | ||
display: none; | ||
} | ||
|
||
> output.publish-error { | ||
flex: none; | ||
border: 1px solid var(--sci-color-negative); | ||
background-color: var(--sci-color-background-negative); | ||
color: var(--sci-color-negative); | ||
border-radius: var(--sci-corner); | ||
padding: 1em; | ||
font-family: monospace; | ||
} | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
...testing-app/src/app/messaging-page/publish-message-page/publish-message-page.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Copyright (c) 2018-2023 Swiss Federal Railways | ||
* | ||
* This program and the accompanying materials are made | ||
* available under the terms of the Eclipse Public License 2.0 | ||
* which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*/ | ||
|
||
import {Component} from '@angular/core'; | ||
import {NonNullableFormBuilder, ReactiveFormsModule, Validators} from '@angular/forms'; | ||
import {SciFormFieldComponent} from '@scion/components.internal/form-field'; | ||
import {MessageClient} from '@scion/microfrontend-platform'; | ||
import {stringifyError} from '../../common/stringify-error.util'; | ||
import {NgIf} from '@angular/common'; | ||
|
||
@Component({ | ||
selector: 'app-publish-message-page', | ||
templateUrl: './publish-message-page.component.html', | ||
styleUrls: ['./publish-message-page.component.scss'], | ||
standalone: true, | ||
imports: [ | ||
ReactiveFormsModule, | ||
SciFormFieldComponent, | ||
NgIf, | ||
], | ||
}) | ||
export default class PublishMesagePageComponent { | ||
|
||
public publishError: string | false | undefined; | ||
|
||
public form = this._formBuilder.group({ | ||
topic: this._formBuilder.control('', Validators.required), | ||
}); | ||
|
||
constructor(private _formBuilder: NonNullableFormBuilder, private _messageClient: MessageClient) { | ||
} | ||
|
||
public onPublish(): void { | ||
this.publishError = undefined; | ||
this._messageClient | ||
.publish(this.form.controls.topic.value) | ||
.then(() => { | ||
this.publishError = false; | ||
this.form.reset(); | ||
}) | ||
.catch(error => this.publishError = stringifyError(error)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.