-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(UI): added show jobs page to view the history of all the jobs fo…
…r a given upload refactor(ui): added main license and status stats on the browse table for each upload Signed-off-by: Krishna Mahato <[email protected]>
- Loading branch information
1 parent
615a373
commit 366c33e
Showing
8 changed files
with
204 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
/* | ||
Copyright (C) 2022 Krishna Mahato ([email protected]) | ||
SPDX-License-Identifier: GPL-2.0 | ||
This program is free software; you can redistribute it and/or | ||
modify it under the terms of the GNU General Public License | ||
version 2 as published by the Free Software Foundation. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License along | ||
with this program; if not, write to the Free Software Foundation, Inc., | ||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
*/ | ||
|
||
import React, { useEffect, useState } from "react"; | ||
|
||
// Title | ||
import Title from "components/Title"; | ||
|
||
// Required functions for API and Error handling | ||
import { initialMessage } from "constants/constants"; | ||
import { Alert } from "components/Widgets"; | ||
import { useParams } from "react-router-dom"; | ||
import { getUploadHistory } from "services/jobs"; | ||
import { apiUrl } from "constants/endpoints"; | ||
|
||
const ShowJobs = () => { | ||
const [message, setMessage] = useState(initialMessage); | ||
const [showMessage, setShowMessage] = useState(false); | ||
const [allJobsHistoryList, setAllJobsHistoryList] = useState([]); | ||
const params = useParams(); | ||
|
||
useEffect(async () => { | ||
if (params.uploadId) { | ||
try { | ||
const allJobsHistory = await getUploadHistory(params.uploadId); | ||
setAllJobsHistoryList(allJobsHistory); | ||
} catch (error) { | ||
setMessage(error.message); | ||
setShowMessage(true); | ||
} | ||
} | ||
}, [params]); | ||
|
||
return ( | ||
<> | ||
<Title title="Show Jobs" /> | ||
<div className="main-container my-3 text-center"> | ||
{showMessage && ( | ||
<Alert | ||
type={message.type} | ||
setShow={setShowMessage} | ||
message={message.text} | ||
/> | ||
)} | ||
<div> | ||
<div> | ||
{allJobsHistoryList?.map((job) => { | ||
return ( | ||
<table | ||
key={job.jobId} | ||
className="table table-striped text-primary-color font-size-medium table-responsive-sm table-bordered" | ||
> | ||
<thead> | ||
<tr className="font-bold"> | ||
<th>Job/Dependency</th> | ||
<th>Status</th> | ||
<th colSpan={3}>{job.jobName}</th> | ||
<th>Average items/sec</th> | ||
<th>ETA</th> | ||
<th>Download</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{job?.jobQueue?.map((jobQues) => { | ||
return ( | ||
<tr key={jobQues.jq_pk}> | ||
<td> | ||
{jobQues?.jq_pk} | ||
{jobQues?.depends[0] && ` / ${jobQues?.depends[0]}`} | ||
</td> | ||
<td>{jobQues?.jq_endtext}</td> | ||
<td>{jobQues?.jq_type}</td> | ||
<td> | ||
{jobQues?.jq_starttime} - {jobQues?.jq_endtime} | ||
</td> | ||
<td>{jobQues?.jq_itemsprocessed} items</td> | ||
<td>{jobQues?.itemsPerSec} items/sec</td> | ||
<td>Scanned</td> | ||
<td> | ||
<a | ||
target="_blank" | ||
rel="noreferrer" | ||
href={`${apiUrl.slice( | ||
0, | ||
-7 | ||
)}/?mod=download&report=${job.jobId}`} | ||
> | ||
{jobQues?.download} | ||
</a> | ||
</td> | ||
</tr> | ||
); | ||
})} | ||
</tbody> | ||
</table> | ||
); | ||
})} | ||
</div> | ||
</div> | ||
</div> | ||
</> | ||
); | ||
}; | ||
|
||
export default ShowJobs; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters