global key detect
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user