From 55dabf64a2746088f5078476d5c5d83ca80c6ffd Mon Sep 17 00:00:00 2001 From: Guido Modarelli Date: Wed, 23 Oct 2024 16:24:45 -0300 Subject: [PATCH] Refactor process column mapping to use `mapColumns` for consistency across OS implementations and enhance code clarity --- .../agents/syscollector/columns/process-columns.ts | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/plugins/main/public/components/agents/syscollector/columns/process-columns.ts b/plugins/main/public/components/agents/syscollector/columns/process-columns.ts index 8202e9a65d..8cef9f3a39 100644 --- a/plugins/main/public/components/agents/syscollector/columns/process-columns.ts +++ b/plugins/main/public/components/agents/syscollector/columns/process-columns.ts @@ -1,12 +1,6 @@ import { KeyEquivalence } from '../../../../../common/csv-key-equivalence'; -const mapFieldName = ({ - field, - ...rest -}: { - field: string; - name?: string; -}) => ({ +const mapColumns = ({ field, ...rest }: { field: string; name?: string }) => ({ ...rest, field, name: rest.name || KeyEquivalence[field] || field, @@ -20,7 +14,7 @@ const windowsColumns = [ { field: 'priority', searchable: true, sortable: true }, { field: 'nlwp', searchable: true, sortable: true }, { field: 'cmd', searchable: true, sortable: true, width: '30%' }, -].map(mapFieldName); +].map(mapColumns); const linuxColumns = [ { field: 'name', searchable: true, sortable: true, width: '10%' }, @@ -35,7 +29,7 @@ const linuxColumns = [ { field: 'session', searchable: true, sortable: true }, { field: 'nice', searchable: true, sortable: true }, { field: 'state', searchable: true, sortable: true, width: '15%' }, -].map(mapFieldName); +].map(mapColumns); const macColumns = [ { field: 'name', searchable: true, sortable: true, width: '10%' }, @@ -44,7 +38,7 @@ const macColumns = [ { field: 'ppid', searchable: true, sortable: true }, { field: 'vm_size', searchable: true, sortable: true }, { field: 'nice', searchable: true, sortable: true }, -].map(mapFieldName); +].map(mapColumns); export const processColumns = { windows: windowsColumns,