Skip to content

Commit 5bc623a

Browse files
committed
Add clusterName to automatic backup list
Signed-off-by: Mathias Petermann <[email protected]>
1 parent 7d87bdf commit 5bc623a

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

modules/web/src/app/backup/list/automatic-backup/component.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import {
2222
AddAutomaticBackupDialogConfig,
2323
} from '@app/backup/list/automatic-backup/add-dialog/component';
2424
import {BackupService} from '@core/services/backup';
25+
import {ClusterService} from '@core/services/cluster';
2526
import {NotificationService} from '@core/services/notification';
2627
import {ProjectService} from '@core/services/project';
2728
import {UserService} from '@core/services/user';
@@ -49,6 +50,7 @@ export class AutomaticBackupListComponent implements OnInit, OnDestroy {
4950
private _currentGroupConfig: GroupConfig;
5051
private _selectedProject = {} as Project;
5152
private _backups = [];
53+
private _clusters = [];
5254
dataSource = new MatTableDataSource<EtcdBackupConfig>();
5355
isInitialized = true;
5456

@@ -57,7 +59,7 @@ export class AutomaticBackupListComponent implements OnInit, OnDestroy {
5759
}
5860

5961
get columns(): string[] {
60-
return ['status', 'name', 'cluster', 'destination', 'schedule', 'keep', 'created', 'actions'];
62+
return ['status', 'name', 'clusterName', 'cluster', 'destination', 'schedule', 'keep', 'created', 'actions'];
6163
}
6264

6365
get isEmpty(): boolean {
@@ -82,6 +84,7 @@ export class AutomaticBackupListComponent implements OnInit, OnDestroy {
8284

8385
constructor(
8486
private readonly _backupService: BackupService,
87+
private readonly _clusterService: ClusterService,
8588
private readonly _projectService: ProjectService,
8689
private readonly _userService: UserService,
8790
private readonly _matDialog: MatDialog,
@@ -116,6 +119,13 @@ export class AutomaticBackupListComponent implements OnInit, OnDestroy {
116119
this._backups = backups;
117120
this.dataSource.data = this._backups;
118121
});
122+
123+
this._projectService.selectedProject
124+
.pipe(switchMap(project => this._clusterService.clusters(project.id, false)))
125+
.pipe(takeUntil(this._unsubscribe))
126+
.subscribe(clusters => {
127+
this._clusters = clusters;
128+
});
119129
}
120130

121131
ngOnDestroy(): void {
@@ -136,6 +146,15 @@ export class AutomaticBackupListComponent implements OnInit, OnDestroy {
136146
return getBackupHealthStatus(backup, condition);
137147
}
138148

149+
getClusterName(backup: EtcdBackupConfig): string {
150+
for (const cluster of this._clusters) {
151+
if (cluster.id === backup.spec.clusterId) {
152+
return cluster.name;
153+
}
154+
}
155+
return 'N/A';
156+
}
157+
139158
delete(backup: EtcdBackupConfig): void {
140159
const config: MatDialogConfig = {
141160
data: {

modules/web/src/app/backup/list/automatic-backup/template.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,17 @@
6161
</td>
6262
</ng-container>
6363

64+
<ng-container matColumnDef="clusterName">
65+
<th mat-header-cell
66+
*matHeaderCellDef
67+
class="km-header-cell p-15">Cluster Name
68+
</th>
69+
<td mat-cell
70+
*matCellDef="let element">
71+
<span>{{getClusterName(element)}}</span>
72+
</td>
73+
</ng-container>
74+
6475
<ng-container matColumnDef="cluster">
6576
<th mat-header-cell
6677
*matHeaderCellDef

0 commit comments

Comments
 (0)