diff --git a/projects/common/app.module.ts b/projects/common/app.module.ts index 42b2cdbf248430cf79002938070007bdcf73458e..13a54d153ea13421e0e436278ee051c4c90f9e30 100644 --- a/projects/common/app.module.ts +++ b/projects/common/app.module.ts @@ -20,6 +20,7 @@ import { MatSnackBarModule } from '@angular/material/snack-bar'; import { MatTooltipModule } from '@angular/material/tooltip'; import { TranslateModule } from '@ngx-translate/core'; +import { MatDialogModule } from '@angular/material/dialog'; import { TextComponent } from './element-components/text.component'; import { ButtonComponent } from './element-components/button.component'; import { TextFieldComponent } from './element-components/text-field.component'; @@ -45,6 +46,7 @@ import { NumberFieldComponent } from './element-components/number-field.componen FormsModule, MatFormFieldModule, MatInputModule, + MatDialogModule, TranslateModule ], declarations: [ @@ -91,6 +93,7 @@ import { NumberFieldComponent } from './element-components/number-field.componen CorrectionComponent, MatSnackBarModule, MatTooltipModule, + MatDialogModule, TranslateModule ] }) diff --git a/projects/common/assets/i18n/de.json b/projects/common/assets/i18n/de.json index c5dd2dcc30002e81f39a74e752d573d1aa66cfca..5b5eee08261da928c21658612418e78570465906 100644 --- a/projects/common/assets/i18n/de.json +++ b/projects/common/assets/i18n/de.json @@ -1,3 +1,4 @@ { - "pageIndication": "Seite {{index}}" + "pageIndication": "Seite {{index}}", + "close": "Schließen" } diff --git a/projects/editor/src/app/app.module.ts b/projects/editor/src/app/app.module.ts index 1ec1c595af06f6f3df5efeb861b446dac5a21c68..23f6ecd352c8c23e600541047d0fe8f05484c19d 100644 --- a/projects/editor/src/app/app.module.ts +++ b/projects/editor/src/app/app.module.ts @@ -5,7 +5,6 @@ import { CommonModule } from '@angular/common'; import { createCustomElement } from '@angular/elements'; import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; -import { MatDialogModule } from '@angular/material/dialog'; import { MatButtonToggleModule } from '@angular/material/button-toggle'; import { AppComponent } from './app.component'; @@ -49,7 +48,6 @@ import { ElementPropertiesComponent } from './components/unit-view/page-view/pro BrowserAnimationsModule, CommonModule, SharedModule, - MatDialogModule, MatButtonToggleModule, TranslateModule.forRoot({ loader: { diff --git a/projects/player/src/app/app.component.ts b/projects/player/src/app/app.component.ts index 5e903a66d890001c3d38501e4b1fef5858f23ca3..6be1617b55df77e6bdacbd0fdb70cb5891600b7d 100644 --- a/projects/player/src/app/app.component.ts +++ b/projects/player/src/app/app.component.ts @@ -1,6 +1,7 @@ import { Component, OnInit } from '@angular/core'; import { FormGroup } from '@angular/forms'; import { TranslateService } from '@ngx-translate/core'; +import { MatDialog } from '@angular/material/dialog'; import { Unit, UnitPage, UnitPageSection, UnitUIElement } from '../../../common/unit'; @@ -10,6 +11,7 @@ import { NativeEventService } from './services/native-event.service'; import { MetaDataService } from './services/meta-data.service'; import { PlayerConfig, UnitState, VopStartCommand } from './models/verona'; import { FormPage } from '../../../common/form'; +import { AlertDialogComponent } from './components/alert-dialog/alert-dialog.component'; @Component({ selector: 'player-aspect', @@ -26,7 +28,8 @@ export class AppComponent implements OnInit { private veronaSubscriptionService: VeronaSubscriptionService, private veronaPostService: VeronaPostService, private metaDataService: MetaDataService, - private nativeEventService: NativeEventService) { + private nativeEventService: NativeEventService, + private dialog: MatDialog) { } ngOnInit(): void { @@ -53,7 +56,13 @@ export class AppComponent implements OnInit { this.pages = this.addStoredValues(pages, storedPages); } else { // eslint-disable-next-line no-console - console.warn('player: wrong unitStateDataType'); + this.dialog.open(AlertDialogComponent, { + data: { + title: this.translateService.instant('dialogTitle.wrongUnitStateDataType'), + content: this.translateService.instant('dialogContent.wrongUnitStateDataType', + { version: this.metaDataService.playerMetadata.supportedUnitStateDataTypes }) + } + }); this.pages = pages; } } else { @@ -70,8 +79,13 @@ export class AppComponent implements OnInit { this.playerConfig = message.playerConfig || {}; this.initUnitPages(unitDefinition.pages, message.unitState); } else { - // eslint-disable-next-line no-console - console.warn('player: wrong unitDefinitionType'); + this.dialog.open(AlertDialogComponent, { + data: { + title: this.translateService.instant('dialogTitle.wrongUnitDefinitionType'), + content: this.translateService.instant('dialogContent.wrongUnitDefinitionType', + { version: this.metaDataService.playerMetadata.supportedUnitDefinitionTypes }) + } + }); } } diff --git a/projects/player/src/app/app.module.ts b/projects/player/src/app/app.module.ts index c09ff7e2f45986ce53af3e0d35c9cfeb900184e6..37884b64f4142a7468772339b008783c5805c6a1 100644 --- a/projects/player/src/app/app.module.ts +++ b/projects/player/src/app/app.module.ts @@ -16,6 +16,7 @@ import { PlayerTranslateLoader } from './classes/player-translate-loader'; import { LayoutComponent } from './components/layout/layout.component'; import { HideFirstChildDirective } from './directives/hide-first-child.directive'; import { ScrollIndexDirective } from './directives/scroll-index.directive'; +import { AlertDialogComponent } from './components/alert-dialog/alert-dialog.component'; @NgModule({ declarations: [ @@ -27,6 +28,7 @@ import { ScrollIndexDirective } from './directives/scroll-index.directive'; FormComponent, PlayerStateComponent, LayoutComponent, + AlertDialogComponent, HideFirstChildDirective, ScrollIndexDirective ], diff --git a/projects/player/src/app/components/alert-dialog/alert-dialog.component.css b/projects/player/src/app/components/alert-dialog/alert-dialog.component.css new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/projects/player/src/app/components/alert-dialog/alert-dialog.component.html b/projects/player/src/app/components/alert-dialog/alert-dialog.component.html new file mode 100644 index 0000000000000000000000000000000000000000..a40f393687e62d5a48666922a019e290e86e0e32 --- /dev/null +++ b/projects/player/src/app/components/alert-dialog/alert-dialog.component.html @@ -0,0 +1,5 @@ +<h2 mat-dialog-title>{{data.title}}</h2> +<mat-dialog-content>{{data.content}}</mat-dialog-content> +<mat-dialog-actions> + <button mat-button mat-dialog-close>{{'close' | translate}}</button> +</mat-dialog-actions> diff --git a/projects/player/src/app/components/alert-dialog/alert-dialog.component.ts b/projects/player/src/app/components/alert-dialog/alert-dialog.component.ts new file mode 100644 index 0000000000000000000000000000000000000000..8c8f5a299eb5bbc54965efb65b754a49382ee529 --- /dev/null +++ b/projects/player/src/app/components/alert-dialog/alert-dialog.component.ts @@ -0,0 +1,11 @@ +import { Component, Inject } from '@angular/core'; +import { MAT_DIALOG_DATA } from '@angular/material/dialog'; + +@Component({ + selector: 'app-alert-dialog', + templateUrl: './alert-dialog.component.html', + styleUrls: ['./alert-dialog.component.css'] +}) +export class AlertDialogComponent { + constructor(@Inject(MAT_DIALOG_DATA) public data: { title: string, content: string }) { } +} diff --git a/projects/player/src/assets/i18n/de.json b/projects/player/src/assets/i18n/de.json index 12e695e3ce1859dfe4388d794212636c539c312e..8ab32af029f3d35d70b75e5e8ae6bdc44bdadb70 100644 --- a/projects/player/src/assets/i18n/de.json +++ b/projects/player/src/assets/i18n/de.json @@ -10,5 +10,13 @@ "InputTooLong": "Eingabe zu lang", "ValueTooSmall": "Wert zu klein", "ValueTooBig": "Wert zu groß" + }, + "dialogTitle": { + "wrongUnitDefinitionType": "Falscher Unit-Definition-Type", + "wrongUnitStateDataType": "Falscher Unit-State-Data-Type" + }, + "dialogContent": { + "wrongUnitDefinitionType": "Der Player benötigt einen Unit-Definition-Type in der Version {{version}}.", + "wrongUnitStateDataType": "Der Player benötigt einen Unit-State-Data-Type in der Version {{version}}." } }