]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: generic redirect link for a table item 66049/head
authorNizamudeen A <nia@redhat.com>
Fri, 24 Oct 2025 08:08:57 +0000 (13:38 +0530)
committerNizamudeen A <nia@redhat.com>
Thu, 30 Oct 2025 06:21:01 +0000 (11:51 +0530)
Fixes: https://tracker.ceph.com/issues/73638
Signed-off-by: Nizamudeen A <nia@redhat.com>
src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.html
src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/enum/cell-template.enum.ts

index 044f586aa754cb29f1b538b1f3f5a1607fd595d7..f42605af582f49483e5154c69c764b75d7412a3b 100644 (file)
   </div>
   }
 </ng-template>
+
+<ng-template #redirectTpl
+             let-value="data.value"
+             let-column="data.column">
+  <a [routerLink]="column.customTemplateConfig?.redirectLink">{{value}}</a>
+</ng-template>
index dd811aad36ee094dbd5f531b8646fb7101526101..09eca532a7f0e73c14c12a3204d40e905d3074d2 100644 (file)
@@ -90,6 +90,8 @@ export class TableComponent implements AfterViewInit, OnInit, OnChanges, OnDestr
   tableActionTpl: TemplateRef<any>;
   @ViewChild('editingTpl', { static: true })
   editingTpl: TemplateRef<any>;
+  @ViewChild('redirectTpl', { static: true })
+  redirectTpl: TemplateRef<any>;
 
   @ContentChild(TableDetailDirective) rowDetail!: TableDetailDirective;
   @ContentChild(TableActionsComponent) tableActions!: TableActionsComponent;
@@ -862,6 +864,7 @@ export class TableComponent implements AfterViewInit, OnInit, OnChanges, OnDestr
     this.cellTemplates.tooltip = this.tooltipTpl;
     this.cellTemplates.copy = this.copyTpl;
     this.cellTemplates.editing = this.editingTpl;
+    this.cellTemplates.redirect = this.redirectTpl;
   }
 
   useCustomClass(value: any): string {
index 15a409cccdd6b292439f09ea2d9c23169efdfd56..96168dea3a6970ba41e701aae1eae6f7f11a489e 100644 (file)
@@ -99,5 +99,18 @@ export enum CellTemplate {
   Also need to pass forceIdentifer=true and also a unique identifier prop like
   identifier="uid" to the table in some cases to avoid issues.
   */
-  editing = 'editing'
+  editing = 'editing',
+  /*
+  This template let's you provide a redirect url and let you redirect from when you click
+  on the cell item. The redirect link can be provided in the customTemplateConfig
+  // {
+  //    ...
+  //    cellTransformation: CellTemplate.redirect,
+  //    customTemplateConfig: {
+  //          redirectLink: ['dashboard', 'overview'],
+  //    }
+  //    ...
+  // }
+  */
+  redirect = 'redirect'
 }