Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ui): Clearing status UI Implemented #263

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added src/assets/images/do-not-use.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/identified.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/no-license.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/not-cleared.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/to-be-discussed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 31 additions & 1 deletion src/pages/BrowseUploads/LicenseBrowser/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ import { getUploadSummary, getUploadLicense } from "services/upload";
// Helper function for error handling
import { handleError } from "shared/helper";

// Clearing status Assests
import DoNotUse from "../../../assets/images/do-not-use.png";
import Identified from "../../../assets/images/identified.png";
import NoLicense from "../../../assets/images/no-license.png";
import NotCleared from "../../../assets/images/not-cleared.png";
import ToBeDiscussed from "../../../assets/images/to-be-discussed.png";

const LicenseBrowser = () => {
// Setting the upload Id
const [uploadId, setuploadId] = useState();
Expand Down Expand Up @@ -86,6 +93,17 @@ const LicenseBrowser = () => {
}
}, [uploadId]);

function getClearingImage(status, scanner) {
if (scanner[0] === "No_license_found") return NoLicense;
if (status === "DO_NOT_USE") return DoNotUse;
if (status === "IRRELEVANT") return Identified;
if (status === "IDENTIFIED") return Identified;
if (status === "NON_FUNCTIONAL") return DoNotUse;
if (status === "not_found") return NotCleared;
if (status === "TO_BE_DISCUSSED") return ToBeDiscussed;
return NoLicense;
}

return (
<>
<Title title="License Browser" />
Expand Down Expand Up @@ -149,7 +167,19 @@ const LicenseBrowser = () => {
})
: null}
</td>
<td>-</td>
<td>
{data.clearing_status !== null &&
filteredScanner !== null ? (
<img
src={getClearingImage(
data.clearing_status,
filteredScanner
)}
alt="clearing-img"
className="rounded mx-auto d-block"
/>
) : null}
</td>
<td>-</td>
<td>-</td>
</tr>
Expand Down