Files
jambotron/jambotron-ui/src/app/modules/admin-module/components/json-dump.component/json-dump.component.html
T
liosha84 a05e9a31fc remake init data
json dump

Small bug fix
2025-08-18 12:26:34 +03:00

89 lines
3.4 KiB
HTML

<div class="json-dump-container" *ngIf="!loading; else loadingTpl">
<h2>JSON Dump Management</h2>
<!-- Entity-specific Export/Import -->
<!-- <div class="entity-actions" *ngFor="let entity of entityTypes">
<h3>{{ entity | titlecase }}</h3>
<button mat-raised-button color="primary" (click)="exportEntity(entity)">
<mat-icon>download</mat-icon> Export {{ entity }}
</button>
<label mat-raised-button color="accent">
<mat-icon>upload</mat-icon> Import {{ entity }}
<input type="file" hidden accept=".json" (change)="onFileSelected($event, entity)">
</label>
<button mat-icon-button (click)="restore(entity)" matTooltip="Restore from latest file">
<mat-icon>restore_from_trash</mat-icon>
</button>
<label mat-i color="accent">
<mat-icon>upload</mat-icon> Import {{ entity }}
<input type="file" hidden accept=".json" (change)="onFileSelected($event, entity)">
</label>
</div>-->
<mat-toolbar>
@for (entity of entityTypes; track entity) {
<mat-toolbar-row>
<mat-label>{{ entity | titlecase }}</mat-label>
<button mat-icon-button (click)="exportEntity(entity)" matTooltip="Export {{ entity }}">
<mat-icon>download</mat-icon>
</button>
<button mat-icon-button (click)="fileInput.click()" matTooltip=" Import {{ entity }}">
<mat-icon>restore_from_trash</mat-icon>
</button>
<button mat-icon-button (click)="restore(entity)" matTooltip="Restore from latest file">
<mat-icon>upload</mat-icon>
</button>
<input
type="file"
#fileInput
accept=".json"
(change)="onFileSelected($event, entity)"
hidden
/>
</mat-toolbar-row>
}
</mat-toolbar>
<!-- Files Table -->
<h3>Available JSON Files</h3>
<mat-table [dataSource]="files">
<ng-container matColumnDef="fileName">
<mat-header-cell *matHeaderCellDef> File Name </mat-header-cell>
<mat-cell *matCellDef="let file">{{ file.fileName }}</mat-cell>
</ng-container>
<ng-container matColumnDef="size">
<mat-header-cell *matHeaderCellDef> Size </mat-header-cell>
<mat-cell *matCellDef="let file">{{ jsonDumpService.formatFileSize(file.size) }}</mat-cell>
</ng-container>
<ng-container matColumnDef="lastModified">
<mat-header-cell *matHeaderCellDef> Last Modified </mat-header-cell>
<mat-cell *matCellDef="let file">{{ jsonDumpService.formatDate(file.lastModified) }}</mat-cell>
</ng-container>
<ng-container matColumnDef="actions">
<mat-header-cell *matHeaderCellDef> Actions </mat-header-cell>
<mat-cell *matCellDef="let file">
<button mat-icon-button (click)="downloadFile(file.fileName)" matTooltip="Download">
<mat-icon>download</mat-icon>
</button>
<button mat-icon-button color="warn" (click)="deleteFile(file.fileName)" matTooltip="Delete">
<mat-icon>delete</mat-icon>
</button>
</mat-cell>
</ng-container>
<mat-header-row *matHeaderRowDef="['fileName', 'size', 'lastModified', 'actions']"></mat-header-row>
<mat-row *matRowDef="let row; columns: ['fileName', 'size', 'lastModified', 'actions']"></mat-row>
</mat-table>
<!-- Archives -->
<h3>Archives</h3>
<mat-list>
<mat-list-item *ngFor="let archive of archives">{{ archive }}</mat-list-item>
</mat-list>
</div>
<ng-template #loadingTpl>
<mat-spinner></mat-spinner>
</ng-template>