forked from opendatahub-io/odh-dashboard
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request opendatahub-io#2811 from jpuzz0/RHOAIENG-2989-arti…
…fact-run-node-artifact-details [RHOAIENG-2989] artifact node drawer details section
- Loading branch information
Showing
11 changed files
with
318 additions
and
49 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
frontend/src/concepts/pipelines/apiHooks/mlmd/useArtifactsFromMlmdContext.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import React from 'react'; | ||
import { MlmdContext } from '~/concepts/pipelines/apiHooks/mlmd/types'; | ||
import { usePipelinesAPI } from '~/concepts/pipelines/context'; | ||
import { Artifact } from '~/third_party/mlmd'; | ||
import { GetArtifactsByContextRequest } from '~/third_party/mlmd/generated/ml_metadata/proto/metadata_store_service_pb'; | ||
import useFetchState, { | ||
FetchState, | ||
FetchStateCallbackPromise, | ||
NotReadyError, | ||
} from '~/utilities/useFetchState'; | ||
|
||
export const useArtifactsFromMlmdContext = ( | ||
context: MlmdContext | null, | ||
refreshRate?: number, | ||
): FetchState<Artifact[]> => { | ||
const { metadataStoreServiceClient } = usePipelinesAPI(); | ||
|
||
const getArtifactsList = React.useCallback<FetchStateCallbackPromise<Artifact[]>>(async () => { | ||
if (!context) { | ||
return Promise.reject(new NotReadyError('No context')); | ||
} | ||
|
||
const request = new GetArtifactsByContextRequest(); | ||
request.setContextId(context.getId()); | ||
const res = await metadataStoreServiceClient.getArtifactsByContext(request); | ||
return res.getArtifactsList(); | ||
}, [metadataStoreServiceClient, context]); | ||
|
||
return useFetchState(getArtifactsList, [], { | ||
refreshRate, | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 88 additions & 0 deletions
88
...concepts/pipelines/content/pipelinesDetails/pipelineRun/artifacts/ArtifactNodeDetails.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
import React from 'react'; | ||
import { Link } from 'react-router-dom'; | ||
|
||
import { | ||
Title, | ||
Flex, | ||
FlexItem, | ||
Stack, | ||
DescriptionList, | ||
DescriptionListGroup, | ||
DescriptionListTerm, | ||
DescriptionListDescription, | ||
} from '@patternfly/react-core'; | ||
|
||
import { Artifact } from '~/third_party/mlmd'; | ||
import { artifactsDetailsRoute } from '~/routes'; | ||
import { usePipelinesAPI } from '~/concepts/pipelines/context'; | ||
import { getArtifactName } from '~/pages/pipelines/global/experiments/artifacts/utils'; | ||
import PipelinesTableRowTime from '~/concepts/pipelines/content/tables/PipelinesTableRowTime'; | ||
import PipelineRunDrawerRightContent from '~/concepts/pipelines/content/pipelinesDetails/pipelineRun/PipelineRunDrawerRightContent'; | ||
|
||
type ArtifactNodeDetailsProps = Pick< | ||
React.ComponentProps<typeof PipelineRunDrawerRightContent>, | ||
'upstreamTaskName' | ||
> & { | ||
artifact: Artifact.AsObject; | ||
}; | ||
|
||
export const ArtifactNodeDetails: React.FC<ArtifactNodeDetailsProps> = ({ | ||
artifact, | ||
upstreamTaskName, | ||
}) => { | ||
const { namespace } = usePipelinesAPI(); | ||
const artifactName = getArtifactName(artifact); | ||
|
||
return ( | ||
<Flex | ||
spaceItems={{ default: 'spaceItems2xl' }} | ||
direction={{ default: 'column' }} | ||
className="pf-v5-u-pt-lg pf-v5-u-pb-lg" | ||
> | ||
<FlexItem> | ||
<Stack hasGutter> | ||
<Title headingLevel="h3">Artifact details</Title> | ||
<DescriptionList | ||
isHorizontal | ||
horizontalTermWidthModifier={{ default: '15ch' }} | ||
data-testid="artifact-details-description-list" | ||
> | ||
<DescriptionListGroup> | ||
<DescriptionListTerm>Upstream task</DescriptionListTerm> | ||
<DescriptionListDescription>{upstreamTaskName}</DescriptionListDescription> | ||
|
||
<DescriptionListTerm>Artifact name</DescriptionListTerm> | ||
<DescriptionListDescription> | ||
<Link to={artifactsDetailsRoute(namespace, artifact.id)}>{artifactName}</Link> | ||
</DescriptionListDescription> | ||
|
||
<DescriptionListTerm>Artifact type</DescriptionListTerm> | ||
<DescriptionListDescription>{artifact.type}</DescriptionListDescription> | ||
|
||
<DescriptionListTerm>Created at</DescriptionListTerm> | ||
<DescriptionListDescription> | ||
<PipelinesTableRowTime date={new Date(artifact.createTimeSinceEpoch)} /> | ||
</DescriptionListDescription> | ||
</DescriptionListGroup> | ||
</DescriptionList> | ||
</Stack> | ||
</FlexItem> | ||
|
||
<FlexItem> | ||
<Stack hasGutter> | ||
<Title headingLevel="h3">Artifact URI</Title> | ||
<DescriptionList | ||
isHorizontal | ||
horizontalTermWidthModifier={{ default: '15ch' }} | ||
data-testid="artifact-uri-description-list" | ||
> | ||
<DescriptionListGroup> | ||
<DescriptionListTerm>{artifactName}</DescriptionListTerm> | ||
<DescriptionListDescription>{artifact.uri}</DescriptionListDescription> | ||
</DescriptionListGroup> | ||
</DescriptionList> | ||
</Stack> | ||
</FlexItem> | ||
</Flex> | ||
); | ||
}; |
Oops, something went wrong.