From: Nizamudeen A Date: Fri, 24 Oct 2025 08:08:57 +0000 (+0530) Subject: mgr/dashboard: generic redirect link for a table item X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=fb409aab5a8abb71a7dbdf0c6b19a6e1f257b094;p=ceph.git mgr/dashboard: generic redirect link for a table item Fixes: https://tracker.ceph.com/issues/73638 Signed-off-by: Nizamudeen A --- diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.html b/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.html index 044f586aa75..f42605af582 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.html @@ -477,3 +477,9 @@ } + + + {{value}} + diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.ts index dd811aad36e..09eca532a7f 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.ts @@ -90,6 +90,8 @@ export class TableComponent implements AfterViewInit, OnInit, OnChanges, OnDestr tableActionTpl: TemplateRef; @ViewChild('editingTpl', { static: true }) editingTpl: TemplateRef; + @ViewChild('redirectTpl', { static: true }) + redirectTpl: TemplateRef; @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 { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/enum/cell-template.enum.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/enum/cell-template.enum.ts index 15a409cccdd..96168dea3a6 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/enum/cell-template.enum.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/enum/cell-template.enum.ts @@ -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' }