2021-05-13 20:27:42 +02:00
|
|
|
import React from 'react';
|
2024-11-20 22:22:16 +01:00
|
|
|
import {format} from '../../services/time/timeService';
|
|
|
|
|
import {Banner, Card, Descriptions, Divider} from '@douyinfe/semi-ui';
|
|
|
|
|
import {IconBolt} from '@douyinfe/semi-icons';
|
2023-03-20 08:52:13 +01:00
|
|
|
|
2024-11-20 22:22:16 +01:00
|
|
|
export default function ProcessingTimes({processingTimes = {}}) {
|
|
|
|
|
const {Meta} = Card;
|
|
|
|
|
if (Object.keys(processingTimes).length === 0) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
if (processingTimes.error != null) {
|
|
|
|
|
return <Banner
|
|
|
|
|
fullMode={false}
|
|
|
|
|
type="danger"
|
|
|
|
|
closeIcon={null}
|
2023-03-20 08:52:13 +01:00
|
|
|
title={
|
2024-11-20 22:22:16 +01:00
|
|
|
<div style={{fontWeight: 600, fontSize: '14px', lineHeight: '20px'}}>
|
|
|
|
|
Scraping Ant Error
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
style={{marginBottom: '1rem'}}
|
|
|
|
|
description={
|
|
|
|
|
<div>
|
|
|
|
|
{processingTimes.error}
|
|
|
|
|
</div>
|
2023-03-20 08:52:13 +01:00
|
|
|
}
|
2024-11-20 22:22:16 +01:00
|
|
|
/>;
|
|
|
|
|
}
|
|
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
|
<Descriptions
|
|
|
|
|
row
|
|
|
|
|
size="small"
|
|
|
|
|
style={{
|
|
|
|
|
backgroundColor: '#35363c',
|
|
|
|
|
borderRadius: '4px',
|
|
|
|
|
padding: '10px',
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<Descriptions.Item itemKey="Processing Interval">{processingTimes.interval} min</Descriptions.Item>
|
|
|
|
|
{processingTimes.lastRun && (
|
|
|
|
|
<>
|
|
|
|
|
<Descriptions.Item itemKey="Last run">{format(processingTimes.lastRun)}</Descriptions.Item>
|
|
|
|
|
<Descriptions.Item itemKey="Next run">
|
|
|
|
|
{format(processingTimes.lastRun + processingTimes.interval * 60000)}
|
|
|
|
|
</Descriptions.Item>
|
|
|
|
|
</>
|
|
|
|
|
)}
|
|
|
|
|
</Descriptions>
|
|
|
|
|
|
|
|
|
|
{(processingTimes.scrapingAntData != null && Object.keys(processingTimes.scrapingAntData).length > 0) &&(
|
|
|
|
|
<>
|
|
|
|
|
<Divider margin="1rem"/>
|
|
|
|
|
<Card
|
|
|
|
|
style={{backgroundColor: '#35363c'}}
|
|
|
|
|
title={
|
|
|
|
|
<Meta
|
|
|
|
|
title="Remaining ScrapingAnt calls"
|
|
|
|
|
description="Information about your Scraping Ant Plan"
|
|
|
|
|
avatar={<IconBolt/>}
|
|
|
|
|
/>
|
|
|
|
|
}
|
|
|
|
|
>
|
|
|
|
|
<p>Plan: {processingTimes.scrapingAntData.plan_name}</p>
|
|
|
|
|
<p>
|
|
|
|
|
Duration: {format(new Date(processingTimes.scrapingAntData.start_date))} -{' '}
|
|
|
|
|
{format(new Date(processingTimes.scrapingAntData.end_date))}
|
|
|
|
|
<br/>
|
|
|
|
|
Credits: {processingTimes.scrapingAntData.remained_credits}/
|
|
|
|
|
{processingTimes.scrapingAntData.plan_total_credits}
|
|
|
|
|
</p>
|
|
|
|
|
If you want to scrape Immoscout or Immonet more often, you have to purchase a premium account
|
|
|
|
|
of{' '}
|
|
|
|
|
<a href="https://scrapingant.com/" target="_blank" rel="noreferrer">
|
|
|
|
|
ScrapingAnt
|
|
|
|
|
</a>
|
|
|
|
|
. You can use the code <b>FREDY10</b> to get 10% off. (No affiliation, we are <b>not</b> getting
|
|
|
|
|
paid by ScrapingAnt.)
|
|
|
|
|
</Card>
|
|
|
|
|
</>
|
|
|
|
|
)}
|
2023-03-20 08:52:13 +01:00
|
|
|
</>
|
2024-11-20 22:22:16 +01:00
|
|
|
);
|
2021-05-13 20:27:42 +02:00
|
|
|
}
|
2023-03-20 08:52:13 +01:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
*/
|