Skip to content

Commit

Permalink
Refactor process column mapping to use mapColumns for consistency a…
Browse files Browse the repository at this point in the history
…cross OS implementations and enhance code clarity
  • Loading branch information
guidomodarelli committed Oct 23, 2024
1 parent ab5d6bc commit 55dabf6
Showing 1 changed file with 4 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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%' },
Expand All @@ -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%' },
Expand All @@ -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,
Expand Down

0 comments on commit 55dabf6

Please sign in to comment.