From 7f8460ae99d065c1818d560279a8f3085167b10f Mon Sep 17 00:00:00 2001 From: Nizamudeen A Date: Tue, 25 Nov 2025 17:01:31 +0530 Subject: [PATCH] mgr/dashboard: support custom prop for table item redirection use an extra customTemplateConfig called `customRowProperty` where you can provide the key of the property you wish to route, instead of relying on the cell's prop itself Fixes: https://tracker.ceph.com/issues/73989 Signed-off-by: Nizamudeen A --- .../app/shared/datatable/table/table.component.html | 7 +++++++ .../src/app/shared/enum/cell-template.enum.ts | 12 ++++++++++++ 2 files changed, 19 insertions(+) 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 3817c24967e..82f844de5b3 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 @@ -481,6 +481,13 @@ +@if (column.customTemplateConfig?.customRowProperty && row[column.customTemplateConfig?.customRowProperty]) { + {{value}} +} @else if (column.customTemplateConfig?.redirectLink) { {{value}} +} @else { + {{ value }} +} 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 622aa1fdd90..50971bb9311 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 @@ -113,6 +113,18 @@ export enum CellTemplate { // } // you can also use '::prop' in the redirectLink array to replace it with the cell value. // e.g ['dashboard', '::prop', 'details'] + // + // if you want to use some other property of the row for redirection instead of the cell value, + // you can use the 'customRowProperty' property in the customTemplateConfig to specify + // the property name. + // { + // ... + // cellTransformation: CellTemplate.redirect, + // customTemplateConfig: { + // customRowProperty: 'otherPropertyName'} + // } + // ... + // } */ redirect = 'redirect' } -- 2.47.3