Skip to content
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
1 change: 1 addition & 0 deletions changelog/+link-artifact-validator-to-definition.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added a link in the Proposed Change "Checks" tab from each Artifact Validator to the originating `CoreArtifactDefinition`, so users can navigate directly to the definition that produced the check.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ const GET_VALIDATORS = graphql(`
}
}
}
... on CoreArtifactValidator {
definition {
node {
id
display_label
__typename
}
}
}
__typename
}
}
Expand Down
30 changes: 30 additions & 0 deletions frontend/app/src/entities/diff/ui/checks/validator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,16 @@ import Accordion from "@/shared/components/display/accordion";
import { DateDisplay } from "@/shared/components/display/date-display";
import { DurationDisplay } from "@/shared/components/display/duration-display";
import { List } from "@/shared/components/table/list";
import { Link } from "@/shared/components/ui/link";
import { Popover, PopoverContent, PopoverTrigger } from "@/shared/components/ui/popover";
import { Tooltip } from "@/shared/components/ui/tooltip";

import { getObjectDetailsUrl } from "@/entities/nodes/utils";

import { ValidatorDetails } from "./validator-details";

const ARTIFACT_VALIDATOR_KIND = "CoreArtifactValidator";

type tValidatorProps = {
validator: any;
};
Expand Down Expand Up @@ -66,6 +71,9 @@ const getValidatorState = (state?: string, conclusion?: string) => {
export const Validator = ({ validator }: tValidatorProps) => {
const { id, display_label, started_at, completed_at, conclusion, state } = validator;

const artifactDefinition =
validator.__typename === ARTIFACT_VALIDATOR_KIND ? validator.definition?.node : null;

const columns = [
{
name: "id",
Expand All @@ -91,6 +99,7 @@ export const Validator = ({ validator }: tValidatorProps) => {
name: "state",
label: "State",
},
...(artifactDefinition ? [{ name: "definition", label: "Definition" }] : []),
];

const row = {
Expand All @@ -101,6 +110,15 @@ export const Validator = ({ validator }: tValidatorProps) => {
completed_at: <DateDisplay date={completed_at.value} />,
conclusion: conclusion.value,
state: state.value,
...(artifactDefinition
? {
definition: (
<Link to={getObjectDetailsUrl("CoreArtifactDefinition", artifactDefinition.id)}>
{artifactDefinition.display_label}
</Link>
),
}
: {}),
},
};

Expand All @@ -111,6 +129,18 @@ export const Validator = ({ validator }: tValidatorProps) => {
<span className="font-normal">-</span>
<DurationDisplay date={started_at.value} endDate={completed_at.value} />

{artifactDefinition && (
<Tooltip content={`Open Artifact Definition: ${artifactDefinition.display_label}`} enabled>
<Link
to={getObjectDetailsUrl("CoreArtifactDefinition", artifactDefinition.id)}
onClick={(e) => e.stopPropagation()}
className="text-gray-500 hover:text-gray-700"
>
<Icon icon="mdi:open-in-new" />
</Link>
</Tooltip>
)}

<div className="flex grow justify-end">
<Popover>
<PopoverTrigger onClick={(e) => e.stopPropagation()} asChild>
Expand Down
Loading
Loading