import React, { Fragment } from 'react';
import { Table, Button } from 'semantic-ui-react';
import Switch from 'react-switch';
const emptyTable = () => {
return (
No Data
);
};
const content = (jobs, onJobRemoval, onJobStatusChanged, onJobEdit, onJobInsight) => {
return (
{Object.keys(jobs).map((jobKey) => {
const job = jobs[jobKey];
return (
onJobStatusChanged(job.id, checked)} checked={job.enabled} />
{job.name}
{job.numberOfFoundListings || 0}
{job.provider.length || 0}
{job.notificationAdapter.length || 0}
);
})}
);
};
export default function JobTable({ jobs = {}, onJobRemoval, onJobStatusChanged, onJobEdit, onJobInsight } = {}) {
return (
Job Name
Number of findings
Active provider
Active notification adapter
{Object.keys(jobs).length === 0
? emptyTable()
: content(jobs, onJobRemoval, onJobStatusChanged, onJobEdit, onJobInsight)}
);
}