Skip to content

Commit

Permalink
Pipeline system.ClassificationMetrics artifacts provide a uri but hav…
Browse files Browse the repository at this point in the history
…e no source in storage
  • Loading branch information
dpanshug committed Jun 21, 2024
1 parent a8d2118 commit 97d5e3c
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,19 @@ import { usePipelinesAPI } from '~/concepts/pipelines/context';
import { useIsAreaAvailable, SupportedArea } from '~/concepts/areas';
import { MAX_STORAGE_OBJECT_SIZE, fetchStorageObjectSize } from '~/services/storageService';
import { bytesAsRoundedGiB } from '~/utilities/number';
import { ArtifactType } from '~/concepts/pipelines/kfTypes';
import { extractS3UriComponents, getArtifactUrlFromUri } from './utils';

interface ArtifactUriLinkProps {
uri: string;
type: string;
}

export const ArtifactUriLink: React.FC<ArtifactUriLinkProps> = ({ uri }) => {
export const ArtifactUriLink: React.FC<ArtifactUriLinkProps> = ({ uri, type }) => {
const { namespace } = usePipelinesAPI();
const isS3EndpointAvailable = useIsAreaAvailable(SupportedArea.S3_ENDPOINT).status;
const [size, setSize] = React.useState<number | null>(null);
const isClassificationMetrics = type === ArtifactType.CLASSIFICATION_METRICS;

const url = React.useMemo(() => {
if (!uri || !isS3EndpointAvailable) {
Expand All @@ -41,7 +44,7 @@ export const ArtifactUriLink: React.FC<ArtifactUriLinkProps> = ({ uri }) => {
return getArtifactUrlFromUri(uri, namespace);
}, [isS3EndpointAvailable, namespace, uri]);

if (!url) {
if (!url || isClassificationMetrics) {
return uri;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export const ArtifactNodeDetails: React.FC<ArtifactNodeDetailsProps> = ({
<DescriptionListGroup>
<DescriptionListTerm>{artifactName}</DescriptionListTerm>
<DescriptionListDescription>
<ArtifactUriLink uri={artifact.getUri()} />
<ArtifactUriLink uri={artifact.getUri()} type={artifact.getType()} />
</DescriptionListDescription>
</DescriptionListGroup>
</DescriptionList>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const TaskDetailsInputOutput: React.FC<TaskDetailsInputOutputProps> = ({
if (artifact) {
return {
label: artifactInputOutput.label,
value: <ArtifactUriLink uri={artifact.getUri()} />,
value: <ArtifactUriLink uri={artifact.getUri()} type={artifact.getType()} />,
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const ArtifactOverviewDetails: React.FC<ArtifactOverviewDetailsProps> = (
<>
<DescriptionListTerm>URI</DescriptionListTerm>
<DescriptionListDescription>
<ArtifactUriLink uri={artifact.uri} />
<ArtifactUriLink uri={artifact.uri} type={artifact.type} />
</DescriptionListDescription>
</>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export const ArtifactsTable: React.FC<ArtifactsTableProps> = ({
<Td>{artifact.id}</Td>
<Td>{artifact.type}</Td>
<Td>
<ArtifactUriLink uri={artifact.uri} />
<ArtifactUriLink uri={artifact.uri} type={artifact.type} />
</Td>
<Td>
<PipelinesTableRowTime date={new Date(artifact.createTimeSinceEpoch)} />
Expand Down

0 comments on commit 97d5e3c

Please sign in to comment.