Delete States (only top-level simple-gamesystems)
	
		
			
	
		
	
	
		
	
		
			Some checks failed
		
		
	
	
		
			
				
	
				E2E Testing / test (push) Failing after 1m28s
				
			
		
		
	
	
				
					
				
			
		
			Some checks failed
		
		
	
	E2E Testing / test (push) Failing after 1m28s
				
			This commit is contained in:
		
							parent
							
								
									e7809df01f
								
							
						
					
					
						commit
						19cfe82905
					
				@ -1 +1 @@
 | 
				
			|||||||
<app-simple-state-editor [states]="simpleGamesystem!.states"></app-simple-state-editor>
 | 
					<app-simple-state-editor [states]="simpleGamesystem!.states" [gamesystem]="simpleGamesystem"></app-simple-state-editor>
 | 
				
			||||||
 | 
				
			|||||||
@ -48,7 +48,7 @@
 | 
				
			|||||||
  <ng-container matColumnDef="delete">
 | 
					  <ng-container matColumnDef="delete">
 | 
				
			||||||
    <th mat-header-cell *matHeaderCellDef></th>
 | 
					    <th mat-header-cell *matHeaderCellDef></th>
 | 
				
			||||||
    <td mat-cell *matCellDef="let state">
 | 
					    <td mat-cell *matCellDef="let state">
 | 
				
			||||||
      <button mat-icon-button color="warn"><mat-icon>delete</mat-icon></button>
 | 
					      <button mat-icon-button color="warn" (click)="deleteState(state)"><mat-icon>delete</mat-icon></button>
 | 
				
			||||||
    </td>
 | 
					    </td>
 | 
				
			||||||
  </ng-container>
 | 
					  </ng-container>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -3,6 +3,7 @@ import {SimpleState} from "../../../../game-model/gamesystems/SimpleState";
 | 
				
			|||||||
import {MatTableDataSource} from "@angular/material/table";
 | 
					import {MatTableDataSource} from "@angular/material/table";
 | 
				
			||||||
import {animate, state, style, transition, trigger} from "@angular/animations";
 | 
					import {animate, state, style, transition, trigger} from "@angular/animations";
 | 
				
			||||||
import {MatSnackBar} from "@angular/material/snack-bar";
 | 
					import {MatSnackBar} from "@angular/material/snack-bar";
 | 
				
			||||||
 | 
					import {SimpleGamesystem} from "../../../../game-model/gamesystems/SimpleGamesystem";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@Component({
 | 
					@Component({
 | 
				
			||||||
  selector: 'app-simple-state-editor',
 | 
					  selector: 'app-simple-state-editor',
 | 
				
			||||||
@ -19,6 +20,7 @@ import {MatSnackBar} from "@angular/material/snack-bar";
 | 
				
			|||||||
export class SimpleStateEditorComponent implements OnInit{
 | 
					export class SimpleStateEditorComponent implements OnInit{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  @Input() states: SimpleState[] = [];
 | 
					  @Input() states: SimpleState[] = [];
 | 
				
			||||||
 | 
					  @Input() gamesystem: SimpleGamesystem | undefined
 | 
				
			||||||
  dataSource = new MatTableDataSource();
 | 
					  dataSource = new MatTableDataSource();
 | 
				
			||||||
  displayedColumns = ["name", "initial", "edit", "delete"];
 | 
					  displayedColumns = ["name", "initial", "edit", "delete"];
 | 
				
			||||||
  columnsToDisplayWithExpand = [...this.displayedColumns, 'expand'];
 | 
					  columnsToDisplayWithExpand = [...this.displayedColumns, 'expand'];
 | 
				
			||||||
@ -57,4 +59,13 @@ export class SimpleStateEditorComponent implements OnInit{
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
    return false;
 | 
					    return false;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  deleteState(state: SimpleState) {
 | 
				
			||||||
 | 
					    if(this.gamesystem == undefined || this.gamesystem.parentGamesystem == undefined) {
 | 
				
			||||||
 | 
					      this.gamesystem?.removeState(state);
 | 
				
			||||||
 | 
					      this.dataSource.data = this.gamesystem!.states
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user