Skip to content

Commit

Permalink
fix(OpenScanHub): Rename URLs & TS compliance
Browse files Browse the repository at this point in the history
There were some stuff missing regarding styling of the API and what went
on within components. In particular a lot of additions that were not
changed after copying from another component.

As for the API interfaces they were missing the submitted_time which
showed errors within the components themselves.

Also URLs and titles have been renamed to indicate OpenScanHub more
explicitly as we do not have to use abbreviations.
  • Loading branch information
Venefilyn committed Nov 11, 2024
1 parent 92a5e97 commit adff891
Show file tree
Hide file tree
Showing 7 changed files with 97 additions and 91 deletions.
20 changes: 11 additions & 9 deletions frontend/src/apiDefinitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -392,26 +392,27 @@ export interface PipelineRun {

// /api/osh-scans
export interface OSHScanGroup {
packit_id: number;
anitya_package: string | null;
anitya_project_id: number | null;
anitya_project_name: string | null;
anitya_version: string | null;
branch_name: string | null;
commit_sha: string;
copr_build_target_id: number;
issues_added_url: string;
issues_fixed_url: string;
non_git_upstream: boolean;
packit_id: number;
pr_id: number | null;
project_url: string;
release: string | null;
repo_name: string;
repo_namespace: string;
copr_build_target_id: number;
scan_results_url: string;
status: string;
submitted_time: number | null;
task_id: number;
url: string;
issues_added_url: string;
issues_fixed_url: string;
scan_results_url: string;
}

// /api/osh-scans/$id
Expand All @@ -422,17 +423,18 @@ export interface OSHScan {
anitya_version: string | null;
branch_name: string | null;
commit_sha: string;
copr_build_target_id: number;
issues_added_url: string;
issues_fixed_url: string;
non_git_upstream: boolean;
pr_id: number | null;
project_url: string;
release: string | null;
repo_name: string;
repo_namespace: string;
copr_build_target_id: number;
scan_results_url: string;
status: string;
submitted_time: number | null;
task_id: number;
url: string;
issues_added_url: string;
issues_fixed_url: string;
scan_results_url: string;
}
4 changes: 2 additions & 2 deletions frontend/src/components/jobs/Jobs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ const Jobs = () => {
<NavItem isActive={!!matchRoute(jobTypeObject("bodhi"))}>
<Link {...jobTypeObject("bodhi")}>Bodhi Updates</Link>
</NavItem>
<NavItem isActive={!!matchRoute(jobTypeObject("osh-scans"))}>
<Link {...jobTypeObject("osh-scans")}>OpenScanHub Scans</Link>
<NavItem isActive={!!matchRoute(jobTypeObject("openscanhub"))}>
<Link {...jobTypeObject("openscanhub")}>OpenScanHub</Link>
</NavItem>
</NavList>
</Nav>
Expand Down
60 changes: 32 additions & 28 deletions frontend/src/components/osh/OSHScan.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@ import {
DescriptionListDescription,
DescriptionListGroup,
DescriptionListTerm,
List,
ListItem,
PageSection,
Title,
} from "@patternfly/react-core";
import { useQuery } from "@tanstack/react-query";
import { oshScanQueryOptions } from "../../queries/osh/oshScanQuery";
import { Route as OSHScanRoute } from "../../routes/jobs_/osh-scans.$id";
import { Route as OSHScanRoute } from "../../routes/jobs_/openscanhub.$id";
import { ErrorConnection } from "../errors/ErrorConnection";
import { LabelLink } from "../shared/LabelLink";
import { Preloader } from "../shared/Preloader";
Expand Down Expand Up @@ -91,33 +93,35 @@ export const OSHScan = () => {
<>
<DescriptionListTerm>Result files</DescriptionListTerm>
<DescriptionListDescription>
<div>
<a
href={data.issues_added_url}
rel="noreferrer"
target="_blank"
>
Added issues
</a>
</div>
<div>
<a
href={data.issues_fixed_url}
rel="noreferrer"
target="_blank"
>
Fixed issues
</a>
</div>
<div>
<a
href={data.scan_results_url}
rel="noreferrer"
target="_blank"
>
All results
</a>
</div>
<List>
<ListItem>
<a
href={data.issues_added_url}
rel="noreferrer"
target="_blank"
>
Added issues
</a>
</ListItem>
<ListItem>
<a
href={data.issues_fixed_url}
rel="noreferrer"
target="_blank"
>
Fixed issues
</a>
</ListItem>
<ListItem>
<a
href={data.scan_results_url}
rel="noreferrer"
target="_blank"
>
All results
</a>
</ListItem>
</List>
</DescriptionListDescription>
</>
) : (
Expand Down
18 changes: 9 additions & 9 deletions frontend/src/components/osh/OSHScansTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
TriggerSuffix,
} from "../../components/trigger/TriggerLink";
import { oshScansQueryOptions } from "../../queries/osh/oshScansQuery";
import { ForgeIcon, ForgeIconByForge } from "../icons/ForgeIcon";
import { ForgeIcon } from "../icons/ForgeIcon";
import { LoadMore } from "../shared/LoadMore";
import { StatusLabel } from "../statusLabels/StatusLabel";

Expand All @@ -31,9 +31,9 @@ const OSHScansTable = () => {
const columnNames = {
forge: "Forge",
trigger: "Trigger",
scan: "OpenScanHub task",
branch: "Scan details",
scanDetails: "Scan details",
timeProcessed: "Time Processed",
scan: "OpenScanHub task",
};

const {
Expand All @@ -55,8 +55,8 @@ const OSHScansTable = () => {
<Th key={columnNames.trigger} width={35}>
{columnNames.trigger}
</Th>,
<Th key={columnNames.branch} width={20}>
{columnNames.branch}
<Th key={columnNames.scanDetails} width={20}>
{columnNames.scanDetails}
</Th>,
<Th key={columnNames.timeProcessed} width={20}>
{columnNames.timeProcessed}
Expand All @@ -75,7 +75,7 @@ const OSHScansTable = () => {
return (
<SkeletonTable
variant={TableVariant.compact}
rows={10}
rowsCount={10}
columns={TableHeads}
/>
);
Expand All @@ -100,17 +100,17 @@ const OSHScansTable = () => {
</TriggerLink>
</strong>
</Td>
<Td dataLabel={columnNames.branch}>
<Td dataLabel={columnNames.scanDetails}>
<StatusLabel
target={"rawhide"}
status={scan.status}
link={`/jobs/osh-scans/${scan.packit_id}`}
link={`/jobs/openscanhub/${scan.packit_id}`}
/>
</Td>
<Td dataLabel={columnNames.timeProcessed}>
<Timestamp stamp={scan.submitted_time} />
</Td>
<Td dataLabel={columnNames.bodhiUpdate}>
<Td dataLabel={columnNames.scan}>
<strong>
<a href={scan.url ?? ""} target="_blank" rel="noreferrer">
{scan.task_id}
Expand Down
Loading

0 comments on commit adff891

Please sign in to comment.