Skip to content

Commit cc839b4

Browse files
committed
refactor(observability): use component syntax
resolve: #MAOBS-103 Signed-off-by: yjaaouane <[email protected]>
1 parent f9e5bb6 commit cc839b4

File tree

1 file changed

+11
-19
lines changed

1 file changed

+11
-19
lines changed

packages/manager/apps/observability/src/components/listing/tenants/TenantsListDatagrid.component.tsx

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,8 @@ export default function TenantsListDatagrid({
6767
isSortable: true,
6868
isFilterable: true,
6969
enableHiding: false,
70-
cell: (mappedTenant: MappedTenant) => {
71-
const { id: tenantId, name } = mappedTenant;
72-
return DatagridCellLink({
73-
id: tenantId,
74-
label: name,
75-
path: tenantId,
76-
});
77-
},
70+
cell: ({ id, name }: MappedTenant) =>
71+
<DatagridCellLink id={id} label={name} path={id} />,
7872
label: t(`${NAMESPACES.DASHBOARD}:name`),
7973
type: FilterTypeCategories.String,
8074
},
@@ -84,8 +78,8 @@ export default function TenantsListDatagrid({
8478
isSortable: true,
8579
isFilterable: true,
8680
enableHiding: true,
87-
cell: (mappedTenant: MappedTenant) =>
88-
DatagridCellEnpoint({ infrastructure: mappedTenant.infrastructure }),
81+
cell: ({ infrastructure }: MappedTenant) =>
82+
<DatagridCellEnpoint infrastructure={infrastructure} />,
8983
label: t('tenants:listing.endpoint_cell'),
9084
type: FilterTypeCategories.String,
9185
},
@@ -96,9 +90,8 @@ export default function TenantsListDatagrid({
9690
isFilterable: true,
9791
enableHiding: true,
9892
label: t('tenants:listing.retention_cell'),
99-
cell: (mappedTenant: MappedTenant) => (
100-
<DataGridTextCell>{mappedTenant.retention}</DataGridTextCell>
101-
),
93+
cell: ({ retention }: MappedTenant) =>
94+
<DataGridTextCell>{retention}</DataGridTextCell>,
10295
type: FilterTypeCategories.String,
10396
},
10497
{
@@ -108,9 +101,8 @@ export default function TenantsListDatagrid({
108101
isFilterable: true,
109102
enableHiding: true,
110103
label: t('tenants:listing.active_metrics_cell'),
111-
cell: (mappedTenant: MappedTenant) => (
112-
<DataGridTextCell>{mappedTenant.numberOfSeries}</DataGridTextCell>
113-
),
104+
cell: ({ numberOfSeries }: MappedTenant) =>
105+
<DataGridTextCell>{numberOfSeries}</DataGridTextCell>,
114106
type: FilterTypeCategories.Numeric,
115107
},
116108
{
@@ -121,8 +113,8 @@ export default function TenantsListDatagrid({
121113
enableHiding: true,
122114
type: FilterTypeCategories.String,
123115
label: t('tenants:listing.tags_cell'),
124-
cell: (mappedTenant: MappedTenant) =>
125-
DatagridTenantCellTags({ tags: mappedTenant.tagsArray }),
116+
cell: ({ tagsArray: tags }: MappedTenant) =>
117+
<DatagridTenantCellTags tags={tags} />,
126118
},
127119
{
128120
id: 'actions',
@@ -147,7 +139,7 @@ export default function TenantsListDatagrid({
147139
}),
148140
);
149141
}
150-
}, [isError, error]);
142+
}, [addError, error, isError, t]);
151143

152144
const { filters, addFilter, removeFilter } = useColumnFilters();
153145

0 commit comments

Comments
 (0)