import { Component, Input } from '@angular/core'; import { RouterLink } from '@angular/router'; import { CardComponent, CardHeaderComponent, CardTitleComponent, CardDescriptionComponent, CardContentComponent, } from '../../ui/card/card.component'; interface ICertificateHealth { valid: number; expiringSoon: number; expired: number; expiringDomains: Array<{ domain: string; daysRemaining: number }>; } @Component({ selector: 'app-certificates-card', standalone: true, host: { class: 'block h-full' }, imports: [ RouterLink, CardComponent, CardHeaderComponent, CardTitleComponent, CardDescriptionComponent, CardContentComponent, ], template: ` Certificates SSL/TLS certificate status
@if (health.valid > 0) {
{{ health.valid }} valid
} @if (health.expiringSoon > 0) {
{{ health.expiringSoon }} expiring soon
} @if (health.expired > 0) {
{{ health.expired }} expired
} @if (health.valid === 0 && health.expiringSoon === 0 && health.expired === 0) {
No certificates
}
@if (health.expiringDomains.length > 0) {
@for (item of health.expiringDomains; track item.domain) { {{ item.domain }} {{ item.daysRemaining }}d }
}
`, }) export class CertificatesCardComponent { @Input() health: ICertificateHealth = { valid: 0, expiringSoon: 0, expired: 0, expiringDomains: [], }; }