Skip to content

Commit

Permalink
[improve] support kanban tablename i18n (#2749)
Browse files Browse the repository at this point in the history
Signed-off-by: aias00 <[email protected]>
Co-authored-by: Zhang Yuxuan <[email protected]>
  • Loading branch information
Aias00 and zuobiao-zhou authored Sep 24, 2024
1 parent f2eb663 commit 5dabc7b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
6 changes: 2 additions & 4 deletions web-app/src/app/routes/bulletin/bulletin.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,12 @@
<th nzAlign="center" nzWidth="7%" [rowSpan]="2">App</th>
<th nzAlign="center" nzWidth="7%" [rowSpan]="2">Host</th>
<ng-container *ngFor="let metric of metrics">
<th nzAlign="center" [colSpan]="getKeys(metric).length">
{{ metric }}
</th>
<th nzAlign="center" [colSpan]="getKeys(metric).length"> {{ getMetricName(tab.app, metric) }} </th>
</ng-container>
</tr>
<tr>
<ng-container *ngFor="let metric of metrics">
<ng-container *ngFor="let field of getKeys(metric)">
<ng-container *ngFor="let field of getKeyNames(tab.app, metric)">
<th nzAlign="center" [colSpan]="1">
{{ field }}
</th>
Expand Down
20 changes: 20 additions & 0 deletions web-app/src/app/routes/bulletin/bulletin.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,10 @@ export class BulletinComponent implements OnInit, OnDestroy {
);
}

getMetricName(appName: string, metricName: string): string {
return this.i18nSvc.fanyi(`monitor.app.${appName}.metrics.${metricName}`);
}

getKeys(metricName: string): string[] {
const result = new Set<string>();
this.metricsData.forEach((item: any) => {
Expand All @@ -485,6 +489,22 @@ export class BulletinComponent implements OnInit, OnDestroy {
return Array.from(result);
}

getKeyNames(appName: string, metricName: string): string[] {
const result = new Set<string>();
this.metricsData.forEach((item: any) => {
item.metrics.forEach((metric: any) => {
if (metric.name === metricName) {
metric.fields.forEach((fieldGroup: any) => {
fieldGroup.forEach((field: any) => {
result.add(this.i18nSvc.fanyi(`monitor.app.${appName}.metrics.${metricName}.metric.${field.key}`));
});
});
}
});
});
return Array.from(result);
}

onTablePageChange(params: NzTableQueryParams): void {
const { pageSize, pageIndex } = params;

Expand Down

0 comments on commit 5dabc7b

Please sign in to comment.