Skip to content

Commit

Permalink
Added info popup for reviews
Browse files Browse the repository at this point in the history
Signed-off-by: Omkar Phansopkar <omkarphansopkar@gmail.com>
  • Loading branch information
OmkarPh committed Nov 10, 2023
1 parent 5c24602 commit b85d986
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 20 deletions.
5 changes: 4 additions & 1 deletion src/components/LicenseEntity/LicenseMatchesTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ const LicenseMatchesTable = (props: LicenseMatchProps) => {
<MatchedTextProvider>
<div>
{matchesInfo.matches.map((match) => (
<div className="matches-table-container">
<div
className="matches-table-container"
key={match.license_expression}
>
<Table size="sm" bordered>
<tbody>
<tr>
Expand Down
4 changes: 4 additions & 0 deletions src/components/LicenseEntity/licenseEntity.css
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
margin: 0;
}

.matches-table-container table tr td {
padding: 7px;
}

.matches-table-container table tr td:first-child {
font-weight: 500;
width: 190px;
Expand Down
9 changes: 6 additions & 3 deletions src/pages/DependencyInfoDash/dependencyInfoDash.css
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
height: auto;
}


.scope-summary-table .ag-center-cols-viewport .ag-center-cols-container,
.scope-summary-table .ag-body-viewport,
.scope-summary-table .ag-body {
height: auto;
Expand All @@ -35,6 +37,7 @@
flex: none;
}

.scope-summary-table .ag-center-cols-viewport {
height: auto;
}
.scope-summary-table .ag-center-cols-viewport .ag-center-cols-container {
overflow-y: auto;
overflow-x: hidden;
}
11 changes: 11 additions & 0 deletions src/pages/Licenses/Licenses.css
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,17 @@
padding: 1px;
padding-left: 7px;
font-weight: 700;
display: flex;
justify-content: space-between;
}

.licenses-navigator-pane-title .info-icon {
display: flex;
cursor: pointer;
flex-direction: row-reverse;
width: fit-content;
margin-right: 20px;
margin-top: 2px;
}

.license-item {
Expand Down
39 changes: 27 additions & 12 deletions src/pages/Licenses/Licenses.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
import { Allotment } from "allotment";
import React, { useEffect, useState } from "react";
import { Allotment } from "allotment";
import {
Badge,
Form,
InputGroup,
ListGroup,
ListGroupItem,
OverlayTrigger,
Tooltip,
} from "react-bootstrap";
import Select from "react-select";
import { toast } from "react-toastify";
import { ThreeDots } from "react-loader-spinner";
import { useSearchParams } from "react-router-dom";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faExclamation } from "@fortawesome/free-solid-svg-icons";
import { faExclamation, faInfoCircle } from "@fortawesome/free-solid-svg-icons";

import LicenseEntity from "../../components/LicenseEntity/LicenseEntity";
import NoDataFallback from "../../components/NoDataSection";
Expand Down Expand Up @@ -224,9 +226,9 @@ const LicenseDetections = () => {
license: LicenseDetectionDetails | LicenseClueDetails
) => {
if (reviewFilter === REVIEW_STATUS_OPTIONS.ALL) return true;
if (reviewFilter === REVIEW_STATUS_OPTIONS.VETTED)
if (reviewFilter === REVIEW_STATUS_OPTIONS.REVIEWED)
return reviewedLicenses.has(license.identifier);
if (reviewFilter === REVIEW_STATUS_OPTIONS.UNVETTED)
if (reviewFilter === REVIEW_STATUS_OPTIONS.UNREVIEWED)
return !reviewedLicenses.has(license.identifier);
return true;
};
Expand Down Expand Up @@ -297,9 +299,26 @@ const LicenseDetections = () => {
className="licenses-navigator-pane pb-2"
>
<div className="licenses-navigator-pane-title">
{licenseDetections.length > 0
? "License Detections"
: "No license detections"}
<span>
{licenseDetections.length > 0
? "License Detections"
: "No license detections"}
</span>
<OverlayTrigger
placement="left"
trigger="click"
overlay={
<Tooltip>
Tick the checkboxes below to mark licenses as reviewed
</Tooltip>
}
>
<FontAwesomeIcon
icon={faInfoCircle}
width={200}
className="info-icon"
/>
</OverlayTrigger>
</div>
<ListGroup
hidden={licenseDetections.length === 0}
Expand Down Expand Up @@ -437,11 +456,7 @@ const LicenseDetections = () => {
</Allotment.Pane>
</Allotment>
</Allotment.Pane>
<Allotment.Pane
snap
minSize={500}
className="license-entity-pane overflow-scroll"
>
<Allotment.Pane snap minSize={500} className="license-entity-pane">
<LicenseEntity
activeLicenseEntity={activeLicense}
activeLicenseTodo={todos.get(activeLicense?.license.identifier)}
Expand Down
7 changes: 6 additions & 1 deletion src/pages/Licenses/licenseDefinitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,16 @@ export type ActiveLicenseEntity =
license: LicenseClueDetails;
};

export enum ReviewOptionKeys {
ALL = "ALL",
REVIEWED = "REVIEWED",
UNREVIEWED = "UNREVIEWED",
}
export interface ReviewOption {
value: string;
label: string;
}
export const REVIEW_STATUS_OPTIONS: Record<string, ReviewOption> = {
export const REVIEW_STATUS_OPTIONS: Record<ReviewOptionKeys, ReviewOption> = {
ALL: { value: "ALL", label: "All" },
REVIEWED: { value: "REVIEWED", label: "Reviewed" },
UNREVIEWED: { value: "UNREVIEWED", label: "Unreviewed" },
Expand Down
8 changes: 5 additions & 3 deletions src/styles/entityCommonStyles.css
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
height: auto;
}

.entity-table .ag-center-cols-viewport .ag-center-cols-container,
.entity-table .ag-body-viewport,
.entity-table .ag-body {
height: auto;
Expand All @@ -50,6 +51,7 @@
flex: none;
}

.entity-table .ag-center-cols-viewport {
height: auto;
}
.entity-table .ag-center-cols-viewport .ag-center-cols-container {
overflow-y: auto;
overflow-x: hidden;
}

0 comments on commit b85d986

Please sign in to comment.