diff --git a/frontend/src/apiDefinitions.ts b/frontend/src/apiDefinitions.ts index 9a7242b..5062178 100644 --- a/frontend/src/apiDefinitions.ts +++ b/frontend/src/apiDefinitions.ts @@ -102,10 +102,10 @@ export interface CoprBuildPackage { // /api/copr-builds/$id export interface CoprBuild { - antiya_package: unknown | null; - anitya_project_id: unknown | null; - anitya_project_name: unknown | null; - anitya_project_version: unknown | null; + anitya_package: string | null; + anitya_project_id: number | null; + anitya_project_name: string | null; + anitya_version: string | null; branch_name: string | null; build_finished_time: number; build_id: string; @@ -152,10 +152,10 @@ export interface KojiBuildGroup { // /api/koji-builds/$id export interface KojiBuild { - antiya_package: unknown | null; - anitya_project_id: unknown | null; - anitya_project_name: unknown | null; - anitya_project_version: unknown | null; + anitya_package: string | null; + anitya_project_id: number | null; + anitya_project_name: string | null; + anitya_version: string | null; branch_name: string | null; build_finished_time: number; build_logs_urls: [string: string]; @@ -197,10 +197,10 @@ export interface SRPMBuildGroup { // /api/srpm-builds/$id export interface SRPMBuild { - antiya_package: unknown | null; - anitya_project_id: unknown | null; - anitya_project_name: unknown | null; - anitya_project_version: unknown | null; + anitya_package: string | null; + anitya_project_id: number | null; + anitya_project_name: string | null; + anitya_version: string | null; branch_name: string | null; build_finished_time: number; build_start_time: number; @@ -242,10 +242,10 @@ export interface BodhiUpdateGroup { // /api/bodhi-updates/$id export interface BodhiUpdate { alias: string | null; - antiya_package: unknown | null; - anitya_project_id: unknown | null; - anitya_project_name: unknown | null; - anitya_project_version: unknown | null; + anitya_package: string | null; + anitya_project_id: number | null; + anitya_project_name: string | null; + anitya_version: string | null; branch: string; branch_name: string | null; issue_id: number | null; @@ -280,10 +280,10 @@ export interface TestingFarmRunGroup { // /api/testing-farm/$id export interface TestingFarmRun { - antiya_package: unknown | null; - anitya_project_id: unknown | null; - anitya_project_name: unknown | null; - anitya_project_version: unknown | null; + anitya_package: string | null; + anitya_project_id: number | null; + anitya_project_name: string | null; + anitya_version: string | null; branch_name: string | null; chroot: string; commit_sha: string; @@ -305,10 +305,10 @@ export interface TestingFarmRun { // /api/propose-downstream // /api/pull-from-upstream export interface SyncReleaseJobGroup { - antiya_package: unknown | null; - anitya_project_id: unknown | null; - anitya_project_name: unknown | null; - anitya_project_version: unknown | null; + anitya_package: string | null; + anitya_project_id: number | null; + anitya_project_name: string | null; + anitya_version: string | null; issue_id: number | null; non_git_upstream: boolean; packit_id: number; @@ -326,10 +326,10 @@ export interface SyncReleaseJobGroup { // /api/propose-downstream/$id // /api/pull-from-upstream/$id export interface SyncReleaseJob { - antiya_package: unknown | null; - anitya_project_id: unknown | null; - anitya_project_name: unknown | null; - anitya_project_version: unknown | null; + anitya_package: string | null; + anitya_project_id: number | null; + anitya_project_name: string | null; + anitya_version: string | null; branch: string; branch_name: string | null; downstream_pr_id: number | null; @@ -372,10 +372,10 @@ export interface PipelineRun { time_submitted: number; trigger: | { - antiya_package: unknown | null; - anitya_project_id: unknown | null; - anitya_project_name: unknown | null; - anitya_project_version: unknown | null; + anitya_package: string | null; + anitya_project_id: number | null; + anitya_project_name: string | null; + anitya_version: string | null; branch_name: string | null; issue_id: number | null; non_git_upstream: boolean; diff --git a/frontend/src/components/icons/ForgeIcon.tsx b/frontend/src/components/icons/ForgeIcon.tsx index cceccfa..4bd3f82 100644 --- a/frontend/src/components/icons/ForgeIcon.tsx +++ b/frontend/src/components/icons/ForgeIcon.tsx @@ -6,7 +6,12 @@ import React from "react"; import { Tooltip } from "@patternfly/react-core"; import { getHostName } from "../../components/forgeUrls"; -import { GithubIcon, GitlabIcon, GitIcon } from "@patternfly/react-icons"; +import { + GithubIcon, + GitlabIcon, + GitIcon, + PackageIcon, +} from "@patternfly/react-icons"; export interface ForgeIconProps { url: string; @@ -26,6 +31,9 @@ export const ForgeIconByForge: React.FC<{ forge?: string }> = ({ forge }) => { case "gitlab.com": forgeIcon = ; break; + case "release-monitoring.org": + forgeIcon = ; + break; default: // patternfly doesn't have an icon for pagure forgeIcon = ; diff --git a/frontend/src/components/trigger/TriggerLink.tsx b/frontend/src/components/trigger/TriggerLink.tsx index a5d8cf0..ca81025 100644 --- a/frontend/src/components/trigger/TriggerLink.tsx +++ b/frontend/src/components/trigger/TriggerLink.tsx @@ -16,22 +16,28 @@ interface TriggerLinkProps { issue_id?: number | null; branch_name?: string | null; release?: string | null; + anitya_project_name?: string | null; + anitya_version?: string | null; + anitya_package?: string | null; }; children?: React.ReactNode; } const TriggerLink: React.FC = ({ trigger, children }) => { let link = ""; - const gitRepo = trigger.project_url ? trigger.project_url : ""; + const projectUrl = trigger.project_url ? trigger.project_url : ""; if (trigger.pr_id) { - link = getPRLink(gitRepo, trigger.pr_id); + link = getPRLink(projectUrl, trigger.pr_id); } else if (trigger.issue_id) { - link = getIssueLink(gitRepo, trigger.issue_id); + link = getIssueLink(projectUrl, trigger.issue_id); } else if (trigger.branch_name) { - link = getBranchLink(gitRepo, trigger.branch_name); + link = getBranchLink(projectUrl, trigger.branch_name); } else if (trigger.release) { - link = getReleaseLink(gitRepo, trigger.release); + link = getReleaseLink(projectUrl, trigger.release); + } else if (trigger.anitya_version) { + // there is no link to the particular version, just the whole project + link = projectUrl; } if (link) { @@ -44,22 +50,45 @@ const TriggerLink: React.FC = ({ trigger, children }) => { return children; }; -interface TriggerSuffixProps { - trigger: { - branch_name?: string | null; - issue_id?: number | null; - pr_id?: number | null; - release?: string | null; - repo_name: string; - repo_namespace: string; - }; +interface TriggerSuffixInterface { + branch_name?: string | null; + issue_id?: number | null; + pr_id?: number | null; + release?: string | null; +} + +interface TriggerSuffixGitRepo extends TriggerSuffixInterface { + repo_name: string; + repo_namespace: string; + anitya_project_name?: string | null; + anitya_version?: string | null; + anitya_package?: string | null; +} + +interface TriggerSuffixAnityaProject extends TriggerSuffixInterface { + anitya_project_name: string; + anitya_version: string; + anitya_package: string; + repo_name?: string | null; + repo_namespace?: string | null; } +type TriggerSuffixProps = { + trigger: TriggerSuffixGitRepo | TriggerSuffixAnityaProject; +}; + const TriggerSuffix: React.FC = ({ trigger }) => { - // set suffix to be either PR ID or Branch Name depending on trigger let jobSuffix = ""; - if (trigger.pr_id) { + if (isAnityaTrigger(trigger)) { + jobSuffix = `#version:${trigger.anitya_version}`; + return ( + <> + {trigger.anitya_project_name} + {jobSuffix} + + ); + } else if (trigger.pr_id) { jobSuffix = `#${trigger.pr_id}`; } else if (trigger.issue_id) { jobSuffix = `#${trigger.issue_id}`; @@ -77,4 +106,12 @@ const TriggerSuffix: React.FC = ({ trigger }) => { ); }; +function isAnityaTrigger( + trigger: TriggerSuffixProps["trigger"], +): trigger is TriggerSuffixAnityaProject { + return ( + typeof trigger.anitya_version === "string" && + trigger.anitya_version.length > 0 + ); +} export { TriggerLink, TriggerSuffix };