global key detect

This commit is contained in:
Mateusz Gruszczyński
2026-04-13 09:20:03 +02:00
parent fe1e731e44
commit 93a03b84c0
5 changed files with 34 additions and 7 deletions

View File

@@ -39,7 +39,7 @@
<td>
<div class="inline-tags">
<p-tag [value]="routerItem.ssh_password ? ('routers.passwordMode' | translate) : ('routers.noPassword' | translate)" [severity]="routerItem.ssh_password ? 'warning' : 'secondary'"></p-tag>
<p-tag [value]="routerItem.ssh_key ? ('routers.keyMode' | translate) : ('routers.noKey' | translate)" [severity]="routerItem.ssh_key ? 'success' : 'secondary'"></p-tag>
<p-tag [value]="hasEffectiveSshKey(routerItem) ? ((usesGlobalSshKey(routerItem) ? 'routers.globalKeyMode' : 'routers.keyMode') | translate) : ('routers.noKey' | translate)" [severity]="hasEffectiveSshKey(routerItem) ? 'success' : 'secondary'"></p-tag>
</div>
</td>
<td>

View File

@@ -23,6 +23,8 @@ interface RouterItem {
ssh_user: string;
ssh_password?: string;
ssh_key?: string;
uses_global_ssh_key?: boolean;
has_effective_ssh_key?: boolean;
}
@Component({
@@ -58,7 +60,15 @@ export class RoutersPageComponent implements OnInit {
}
get keyCount(): number {
return this.routers.filter((item) => !!item.ssh_key).length;
return this.routers.filter((item) => this.hasEffectiveSshKey(item)).length;
}
hasEffectiveSshKey(item: RouterItem): boolean {
return !!item.has_effective_ssh_key;
}
usesGlobalSshKey(item: RouterItem): boolean {
return !!item.uses_global_ssh_key;
}