import React, { useState, useEffect } from 'react'; import superagent from 'superagent'; import { Segment, Form, Button, Icon, Pagination } from 'semantic-ui-react'; import * as ApiUtils from '../CloudApi/ApiUtils.js'; import AnalyticsWrapper from './AnalyticsWrapper.jsx'; const FabricatorAnalytics = (props) => { const [report, setReport] = useState(null); const [loading, setLoading] = useState(false); const runReport = async (url) => { setLoading(true); try { const res = await superagent.get(url).accept('json'); setReport(res.body); } catch (e) { console.log(e); } setLoading(false); } const runJobsReport = async () => { return runReport(`/api/admin/fabricator/jobs/report`); } const runOrdersReport = async () => { return runReport(`/api/admin/shop/orders/report`); } const runIPDReport = async () => { return runReport(`/api/admin/shop/orders/data`); } const runInventoryReport = async () => { return runReport(`/api/admin/inventory/report`); } return ( {report && (
                    {JSON.stringify(report, null, 2)}
                
)}
); } export default FabricatorAnalytics;