Sha256: 945bc04a3ac809cc81f240792c7eae3853d09dae91e83baba25edcb8411d9524
Contents?: true
Size: 1.17 KB
Versions: 80
Compression:
Stored size: 1.17 KB
Contents
/* eslint-disable camelcase */ import React from 'react'; import { orderBy } from 'lodash'; import Resolutions from './Resolutions'; export const modifyRows = (remediations, setResolutions, setHostsIds) => { if (remediations.length === 0) return []; const resolutionToSubmit = []; const hostsIdsToSubmit = new Set(); const modifiedRemediations = orderBy( remediations.asMutable(), [r => r.resolutions?.length || 0], ['desc'] ).map(({ id, host_id, hostname, title, resolutions, reboot }) => { hostsIdsToSubmit.add(host_id); const selectedResolution = resolutions[0]?.id; resolutionToSubmit.push({ hit_id: id, resolution_id: selectedResolution /** defaults to the first resolution if many */, }); return { cells: [ hostname, title, <div> <Resolutions hit_id={id} resolutions={resolutions} setResolutions={setResolutions} selectedResolution={selectedResolution} /> </div>, reboot, ], id, }; }); setResolutions(resolutionToSubmit); setHostsIds(Array.from(hostsIdsToSubmit)); return modifiedRemediations; };
Version data entries
80 entries across 80 versions & 1 rubygems