Edit Name of ModelComponent in Overview (Gamesystems did not apply updated name bcs of Datasource outdated)
All checks were successful
E2E Testing / test (push) Successful in 1m25s

This commit is contained in:
Sebastian Böckelmann 2024-02-09 20:46:00 +01:00
parent d40f6061b1
commit b09e9351e0
6 changed files with 20 additions and 4 deletions

View File

@ -27,7 +27,7 @@
</mat-drawer>
<div class="example-sidenav-content">
<app-editor #editor></app-editor>
<app-editor #editor (onModelNameUpdate)="onModelNameUpdate()"></app-editor>
</div>
</mat-drawer-container>

View File

@ -116,6 +116,11 @@ export class AppComponent implements OnInit{
} else {
console.log("[WARN] [App.Component] Editor is undefined")
}
}
onModelNameUpdate() {
if(this.openContent == ModelComponentType.GAMESYTEM) {
this.gamesystemOverview!.onUpdateModelName();
}
}
}

View File

@ -5,7 +5,7 @@
<span [ngClass]="modelComponent.unsaved? 'unsaved':'saved'">{{modelComponent.componentName}}</span>
<button class="content-label close-btn" mat-icon-button (click)="closeGameModelComponent(modelComponent)"><mat-icon>close</mat-icon></button>
</ng-template>
<app-model-component-editor [modelComponent]="modelComponent"></app-model-component-editor>
<app-model-component-editor [modelComponent]="modelComponent" (onModelNameUpdated)="onModelNameUpdate()"></app-model-component-editor>
<app-script-account-editor *ngIf="modelComponent.type === ModelComponentType.SCRIPTACCOUNT"
[scriptAccount]="convertModelComponentToScriptAccount(modelComponent)"></app-script-account-editor>

View File

@ -1,4 +1,4 @@
import {Component, Input} from '@angular/core';
import {Component, EventEmitter, Input, Output} from '@angular/core';
import {GameModel} from "../game-model/GameModel";
import {ModelComponent} from "../game-model/ModelComponent";
import {ModelComponentType} from "../game-model/ModelComponentType";
@ -11,6 +11,7 @@ import {ScriptAccount} from "../game-model/scriptAccounts/ScriptAccount";
})
export class EditorComponent {
gameModelComponents: ModelComponent[] = [];
@Output("onModelNameUpdate") onModelNameUpdateEmitter = new EventEmitter<boolean>();
openGameModelComponent(gameModelComponent: ModelComponent) {
if(!this.gameModelComponents.includes(gameModelComponent)) {
@ -29,4 +30,8 @@ export class EditorComponent {
}
protected readonly ModelComponentType = ModelComponentType;
onModelNameUpdate() {
this.onModelNameUpdateEmitter.emit(true);
}
}

View File

@ -1,4 +1,4 @@
import {Component, Input, OnInit} from '@angular/core';
import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
import {ModelComponent} from "../../game-model/ModelComponent";
import {FormControl, Validators} from "@angular/forms";
@ -9,6 +9,7 @@ import {FormControl, Validators} from "@angular/forms";
})
export class ModelComponentEditorComponent implements OnInit{
@Input('modelComponent') modelComponent: ModelComponent | undefined
@Output("onModelNameUpdated") onModelNameUpdateEmitter = new EventEmitter<boolean>();
nameCtrl: FormControl = new FormControl('', [Validators.required]);
descriptionCtrl: FormControl = new FormControl('' );
@ -21,6 +22,7 @@ export class ModelComponentEditorComponent implements OnInit{
onUpdateName() {
this.modelComponent!.componentName = this.nameCtrl.value;
this.modelComponent!.onModifyContent();
this.onModelNameUpdateEmitter.emit(true);
}
onUpdateDescription() {

View File

@ -91,4 +91,8 @@ export class GamescriptOverviewComponent implements OnInit {
this.openGamesystemEmitter.emit(gamesystem);
}
}
onUpdateModelName() {
this.dataSource.data = this.gameModel!.gamesystems;
}
}