Skip to content

Commit

Permalink
view name change
Browse files Browse the repository at this point in the history
  • Loading branch information
aluneed authored and xutianyi1999 committed Jun 12, 2023
1 parent 0498ba3 commit 1cef531
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 14 deletions.
28 changes: 14 additions & 14 deletions fubuki-webui/src/app/info-item/info-item.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
The actual rendered columns are set as a property on the row definition" -->

<ng-container matColumnDef={{groupColumnName}} *ngFor="let groupColumnName of basicGroupColumns">
<th mat-header-cell *matHeaderCellDef> {{groupColumnName}} </th>
<th mat-header-cell *matHeaderCellDef> {{toViewName(groupColumnName) | uppercase}} </th>
<td mat-cell *matCellDef="let groupInfo"> {{groupInfo[groupColumnName]}} </td>
</ng-container>

<ng-container matColumnDef="mode">
<th mat-header-cell *matHeaderCellDef>mode</th>
<th mat-header-cell *matHeaderCellDef>MODE</th>
<td mat-cell *matCellDef="let groupInfo">
<mat-chip-listbox aria-label="modes">
<mat-chip *ngFor="let modeName of getActiveModes(groupInfo.mode)"
Expand All @@ -30,7 +30,7 @@
</ng-container>

<ng-container matColumnDef="server_udp_status">
<th mat-header-cell *matHeaderCellDef>server_udp_status</th>
<th mat-header-cell *matHeaderCellDef>SERVER_UDP_STATUS</th>
<td mat-cell *matCellDef="let groupInfo">

<mat-chip-listbox aria-label="server_udp_status">
Expand All @@ -51,14 +51,14 @@
<ng-component *ngFor="let hcColumnName of groupHcColumns">
<ng-container matColumnDef="server_{{hcColumnName}}_latency">

<th mat-header-cell *matHeaderCellDef> server_{{hcColumnName}}_latency </th>
<th mat-header-cell *matHeaderCellDef> SERVER_{{hcColumnName | uppercase}}_LATENCY </th>
<td mat-cell *matCellDef="let groupInfo">
{{toLatency(groupInfo["server_" + hcColumnName + "_hc"].elapsed) | number}}ms
</td>
</ng-container>

<ng-container matColumnDef="server_{{hcColumnName}}_loss_rate">
<th mat-header-cell *matHeaderCellDef> server_{{hcColumnName}}_loss_rate </th>
<th mat-header-cell *matHeaderCellDef> SERVER_{{hcColumnName | uppercase}}_LOSS_RATE </th>
<td mat-cell *matCellDef="let groupInfo">
<mat-chip-listbox aria-label="loss_rate">
<mat-chip
Expand Down Expand Up @@ -91,12 +91,12 @@
</ng-container>

<ng-container matColumnDef={{nodeColumnName}} *ngFor="let nodeColumnName of basicNodeColumns">
<th mat-header-cell *matHeaderCellDef> {{nodeColumnName}} </th>
<th mat-header-cell *matHeaderCellDef> {{toViewName(nodeColumnName) | uppercase}} </th>
<td mat-cell *matCellDef="let nodeInfo"> {{nodeInfo.node[nodeColumnName]}} </td>
</ng-container>

<ng-container matColumnDef="mode">
<th mat-header-cell *matHeaderCellDef>mode</th>
<th mat-header-cell *matHeaderCellDef>MODE</th>
<td mat-cell *matCellDef="let nodeInfo">

<mat-chip-listbox aria-label="modes">
Expand All @@ -114,7 +114,7 @@
</ng-container>

<ng-container matColumnDef="allowed_ips">
<th mat-header-cell *matHeaderCellDef>allowed_ips</th>
<th mat-header-cell *matHeaderCellDef>ALLOWED_IPS</th>
<td mat-cell *matCellDef="let nodeInfo">
<mat-chip-listbox aria-label="allowed_ips">
<mat-chip
Expand All @@ -129,14 +129,14 @@
</ng-container>

<ng-container matColumnDef="register_time">
<th mat-header-cell *matHeaderCellDef>register_time</th>
<th mat-header-cell *matHeaderCellDef>REGISTER_TIME</th>
<td mat-cell *matCellDef="let nodeInfo">
{{secondsToDate(nodeInfo.node.register_time) | date: "yyyy-MM-dd HH:mm:ss"}}
</td>
</ng-container>

<ng-container matColumnDef="udp_status">
<th mat-header-cell *matHeaderCellDef>udp_status</th>
<th mat-header-cell *matHeaderCellDef>UDP_STATUS</th>
<td mat-cell *matCellDef="let nodeInfo">

<mat-chip-listbox aria-label="udp_status">
Expand All @@ -155,14 +155,14 @@


<ng-container matColumnDef="latency">
<th mat-header-cell *matHeaderCellDef>latency</th>
<th mat-header-cell *matHeaderCellDef>LATENCY</th>
<td mat-cell *matCellDef="let nodeInfo">
{{toLatency(nodeInfo.hc.elapsed) | number}}ms
</td>
</ng-container>

<ng-container matColumnDef="loss_rate">
<th mat-header-cell *matHeaderCellDef>loss_rate</th>
<th mat-header-cell *matHeaderCellDef>LOSS_RATE</th>
<td mat-cell *matCellDef="let nodeInfo">

<mat-chip-listbox aria-label="loss_rate">
Expand All @@ -181,14 +181,14 @@
<ng-component *ngFor="let hcColumnName of nodeHcColumns">
<ng-container matColumnDef="{{hcColumnName}}_latency">

<th mat-header-cell *matHeaderCellDef> {{hcColumnName}}_latency </th>
<th mat-header-cell *matHeaderCellDef> {{hcColumnName | uppercase}}_LATENCY </th>
<td mat-cell *matCellDef="let groupInfo">
{{toLatency(groupInfo[hcColumnName + '_heartbeat_cache'].elapsed) | number}}ms
</td>
</ng-container>

<ng-container matColumnDef="{{hcColumnName}}_loss_rate">
<th mat-header-cell *matHeaderCellDef> {{hcColumnName}}_loss_rate </th>
<th mat-header-cell *matHeaderCellDef> {{hcColumnName | uppercase}}_LOSS_RATE </th>
<td mat-cell *matCellDef="let groupInfo">
<mat-chip-listbox aria-label="loss_rate">
<mat-chip
Expand Down
22 changes: 22 additions & 0 deletions fubuki-webui/src/app/info-item/info-item.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { NodeStatus } from '../fubuki/types/NodeStatus';
import { Clipboard } from '@angular/cdk/clipboard';
import { HeartbeatCache } from '../fubuki/types/HeartbeatCache';
import { UdpStatus } from '../fubuki/types/UdpStatus';
import { filter } from 'rxjs';

@Component({
selector: 'app-info-item',
Expand Down Expand Up @@ -77,6 +78,27 @@ export class InfoItemComponent {
nodeHcColumns!: string[];
timer!: any;

viewNameMap: Map<string, string> = new Map(
[
["listen_addr", "listen_address"],
["virtual_addr", "ip"],
["lan_udp_addr", "lan_address"],
["wan_udp_addr", "wan_address"],
["mode", "protocol_mode"],

["addr", "ip"],
["server_addr", "server_address"]
]
)

toViewName(fieldName: string): string {
if(this.viewNameMap.has(fieldName)) {
return this.viewNameMap.get(fieldName)!;
} else {
return fieldName;
}
}

path: string = "";
serverType!: string;

Expand Down

0 comments on commit 1cef531

Please sign in to comment.