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 | 1x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 8x 8x 8x 9x 9x 9x 9x 8x 7x 7x 2x 9x 1x 4x 1x | import { Component, OnInit } from '@angular/core';
import { CommonModule } from '@angular/common';
import { ActivatedRoute, RouterLink } from '@angular/router';
import { MetadataService } from '../../../core/services/metadata/metadata.service';
import { DisotService } from '../../../core/services/disot.service';
import { MetadataContent, AuthorRole } from '../../../core/domain/interfaces/metadata-entry';
import { DisotEntry } from '../../../core/domain/interfaces/disot.interface';
@Component({
selector: 'app-metadata-view',
standalone: true,
imports: [CommonModule, RouterLink],
templateUrl: './metadata-view.component.html'
})
export class MetadataViewComponent implements OnInit {
entry: DisotEntry | null = null;
metadata: MetadataContent | null = null;
versionHistory: DisotEntry[] = [];
isVerified = false;
loading = true;
error = '';
private entryId = '';
constructor(
private route: ActivatedRoute,
private metadataService: MetadataService,
private disotService: DisotService
) {}
ngOnInit() {
this.route.params.subscribe(params => {
this.entryId = params['id'];
this.loadMetadata();
});
}
private async loadMetadata() {
this.loading = true;
this.error = '';
try {
// Load the entry
this.entry = await this.disotService.getEntry(this.entryId);
// Get metadata content
this.metadata = await this.metadataService.getMetadataContent(this.entryId);
// Verify signature
this.isVerified = await this.disotService.verifyEntry(this.entry);
// Load version history
this.versionHistory = await this.metadataService.getVersionHistory(this.entryId);
} catch (error: any) {
this.error = error.message || 'Failed to load metadata';
} finally {
this.loading = false;
}
}
formatTimestamp(date: Date): string {
return date.toLocaleString();
}
getRoleDisplayName(role: AuthorRole): string {
return role.charAt(0).toUpperCase() + role.slice(1);
}
async refresh() {
await this.loadMetadata();
}
} |