Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | import { Component, OnDestroy, OnInit, ViewChild } from '@angular/core'; import { SelectionModel } from '@angular/cdk/collections'; import { MatDialog } from '@angular/material/dialog'; import { MatSnackBar } from '@angular/material/snack-bar'; import { MatSort } from '@angular/material/sort'; import { MatTableDataSource } from '@angular/material/table'; import { Subscription } from 'rxjs'; import { ConfirmDialogComponent, ConfirmDialogData } from '../../shared/shared.module'; import { BackendService } from '../backend.service'; import { WorkspaceDataService } from '../workspacedata.service'; import { ReportType, SysCheckStatistics } from '../workspace.interfaces'; @Component({ templateUrl: './syscheck.component.html', styleUrls: ['./syscheck.component.css'] }) export class SyscheckComponent implements OnInit, OnDestroy { displayedColumns: string[] = ['selectCheckbox', 'syscheckLabel', 'number', 'details-os', 'details-browser']; resultDataSource: MatTableDataSource<SysCheckStatistics> = new MatTableDataSource<SysCheckStatistics>([]); tableSelectionCheckbox = new SelectionModel<SysCheckStatistics>(true, []); @ViewChild(MatSort, { static: true }) sort!: MatSort; private wsIdSubscription: Subscription | null = null; constructor( private bs: BackendService, private deleteConfirmDialog: MatDialog, public wds: WorkspaceDataService, public snackBar: MatSnackBar ) { } ngOnInit(): void { setTimeout(() => { this.wsIdSubscription = this.wds.workspaceId$ .subscribe(() => { this.updateTable(); }); }); } ngOnDestroy(): void { Iif (this.wsIdSubscription) { this.wsIdSubscription.unsubscribe(); this.wsIdSubscription = null; } } updateTable(): void { this.tableSelectionCheckbox.clear(); this.resultDataSource = new MatTableDataSource<SysCheckStatistics>([]); this.bs.getSysCheckReportsOverview(this.wds.workspaceId) .subscribe((resultData: SysCheckStatistics[]) => { this.resultDataSource = new MatTableDataSource<SysCheckStatistics>(resultData); this.resultDataSource.sort = this.sort; }); } isAllSelected(): boolean { const numSelected = this.tableSelectionCheckbox.selected.length; const numRows = this.resultDataSource.data.length; return numSelected === numRows; } masterToggle(): void { this.isAllSelected() ? this.tableSelectionCheckbox.clear() : this.resultDataSource.data.forEach(row => this.tableSelectionCheckbox.select(row)); } downloadReportsCSV(): void { Iif (this.tableSelectionCheckbox.selected.length > 0) { const dataIds: string[] = []; this.tableSelectionCheckbox.selected.forEach(element => { dataIds.push(element.id); }); this.wds.downloadReport(dataIds, ReportType.SYSTEM_CHECK, 'iqb-testcenter-syscheckreports.csv'); this.tableSelectionCheckbox.clear(); } } deleteReports(): void { Iif (this.tableSelectionCheckbox.selected.length > 0) { const selectedReports: string[] = []; this.tableSelectionCheckbox.selected.forEach(element => { selectedReports.push(element.id); }); let prompt = 'Es werden alle Berichte für diese'; if (selectedReports.length > 1) { prompt = `${prompt} ${selectedReports.length} System-Checks `; } else { prompt = `${prompt}n System-Check "${selectedReports[0]}" `; } const dialogRef = this.deleteConfirmDialog.open(ConfirmDialogComponent, { width: '400px', data: <ConfirmDialogData>{ title: 'Löschen von Berichten', content: `${prompt}gelöscht. Fortsetzen?`, confirmbuttonlabel: 'Berichtsdaten löschen', showcancel: true } }); dialogRef.afterClosed() .subscribe(result => { Iif (result === false) { return; } this.bs.deleteSysCheckReports(this.wds.workspaceId, selectedReports) .subscribe(fileDeletionReport => { const message = []; Iif (fileDeletionReport.deleted.length > 0) { message.push(`${fileDeletionReport.deleted.length} Berichte erfolgreich gelöscht.`); } Iif (fileDeletionReport.not_allowed.length > 0) { message.push(`${fileDeletionReport.not_allowed.length} Berichte konnten nicht gelöscht werden.`); } this.snackBar.open(message.join('<br>'), message.length > 1 ? 'Achtung' : '', { duration: 1000 }); this.updateTable(); }); }); } } } |