Skip to content

Commit eca39db

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

File tree

1 file changed

+8
-18
lines changed

1 file changed

+8
-18
lines changed

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

Lines changed: 8 additions & 18 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: tenantId, name }: MappedTenant) =>
71+
DatagridCellLink({ id: tenantId, label: name, path: tenantId }),
7872
label: t(`${NAMESPACES.DASHBOARD}:name`),
7973
type: FilterTypeCategories.String,
8074
},
@@ -84,8 +78,7 @@ 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) => DatagridCellEnpoint({ infrastructure }),
8982
label: t('tenants:listing.endpoint_cell'),
9083
type: FilterTypeCategories.String,
9184
},
@@ -96,9 +89,7 @@ export default function TenantsListDatagrid({
9689
isFilterable: true,
9790
enableHiding: true,
9891
label: t('tenants:listing.retention_cell'),
99-
cell: (mappedTenant: MappedTenant) => (
100-
<DataGridTextCell>{mappedTenant.retention}</DataGridTextCell>
101-
),
92+
cell: ({ retention }: MappedTenant) => <DataGridTextCell>{retention}</DataGridTextCell>,
10293
type: FilterTypeCategories.String,
10394
},
10495
{
@@ -108,8 +99,8 @@ export default function TenantsListDatagrid({
10899
isFilterable: true,
109100
enableHiding: true,
110101
label: t('tenants:listing.active_metrics_cell'),
111-
cell: (mappedTenant: MappedTenant) => (
112-
<DataGridTextCell>{mappedTenant.numberOfSeries}</DataGridTextCell>
102+
cell: ({ numberOfSeries }: MappedTenant) => (
103+
<DataGridTextCell>{numberOfSeries}</DataGridTextCell>
113104
),
114105
type: FilterTypeCategories.Numeric,
115106
},
@@ -121,8 +112,7 @@ export default function TenantsListDatagrid({
121112
enableHiding: true,
122113
type: FilterTypeCategories.String,
123114
label: t('tenants:listing.tags_cell'),
124-
cell: (mappedTenant: MappedTenant) =>
125-
DatagridTenantCellTags({ tags: mappedTenant.tagsArray }),
115+
cell: ({ tagsArray: tags }: MappedTenant) => DatagridTenantCellTags({ tags }),
126116
},
127117
{
128118
id: 'actions',
@@ -147,7 +137,7 @@ export default function TenantsListDatagrid({
147137
}),
148138
);
149139
}
150-
}, [isError, error]);
140+
}, [addError, error, isError, t]);
151141

152142
const { filters, addFilter, removeFilter } = useColumnFilters();
153143

0 commit comments

Comments
 (0)