-
Notifications
You must be signed in to change notification settings - Fork 167
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[RHOAIENG-2986] Artifacts - Initial Infrastructure
- Loading branch information
Showing
11 changed files
with
178 additions
and
22 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import React from 'react'; | ||
import { Navigate, Route } from 'react-router-dom'; | ||
|
||
import ProjectsRoutes from '~/concepts/projects/ProjectsRoutes'; | ||
import GlobalPipelineCoreLoader from '~/pages/pipelines/global/GlobalPipelineCoreLoader'; | ||
import { artifactsBaseRoute } from '~/routes'; | ||
import { GlobalArtifactsPage } from './global/experiments/artifacts'; | ||
|
||
const GlobalArtifactsRoutes: React.FC = () => ( | ||
<ProjectsRoutes> | ||
<Route | ||
path="/:namespace?/*" | ||
element={<GlobalPipelineCoreLoader getInvalidRedirectPath={artifactsBaseRoute} />} | ||
> | ||
<Route index element={<GlobalArtifactsPage />} /> | ||
<Route path="*" element={<Navigate to="." />} /> | ||
</Route> | ||
</ProjectsRoutes> | ||
); | ||
|
||
export default GlobalArtifactsRoutes; |
59 changes: 59 additions & 0 deletions
59
frontend/src/pages/pipelines/global/experiments/artifacts/ArtifactsListTable.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,59 @@ | ||
import React from 'react'; | ||
|
||
import { | ||
Bullseye, | ||
EmptyState, | ||
EmptyStateBody, | ||
EmptyStateHeader, | ||
EmptyStateIcon, | ||
EmptyStateVariant, | ||
Spinner, | ||
} from '@patternfly/react-core'; | ||
import { ExclamationCircleIcon, PlusCircleIcon } from '@patternfly/react-icons'; | ||
|
||
import { useGetArtifactsList } from './useGetArtifactsList'; | ||
|
||
export const ArtifactsListTable: React.FC = () => { | ||
const [artifacts, isArtifactsLoaded, artifactsError] = useGetArtifactsList(); | ||
|
||
if (artifactsError) { | ||
return ( | ||
<Bullseye> | ||
<EmptyState variant={EmptyStateVariant.lg}> | ||
<EmptyStateHeader | ||
titleText="There was an issue loading artifacts" | ||
icon={<EmptyStateIcon icon={ExclamationCircleIcon} />} | ||
headingLevel="h2" | ||
/> | ||
<EmptyStateBody>{artifactsError.message}</EmptyStateBody> | ||
</EmptyState> | ||
</Bullseye> | ||
); | ||
} | ||
|
||
if (!isArtifactsLoaded) { | ||
return ( | ||
<Bullseye> | ||
<Spinner /> | ||
</Bullseye> | ||
); | ||
} | ||
|
||
if (!artifacts?.length) { | ||
return ( | ||
<EmptyState data-testid="artifacts-list-empty-state" variant={EmptyStateVariant.lg}> | ||
<EmptyStateHeader | ||
titleText="No artifacts" | ||
icon={<EmptyStateIcon icon={PlusCircleIcon} />} | ||
headingLevel="h4" | ||
/> | ||
<EmptyStateBody> | ||
No artifacts have been generated from experiments within this project. Select a different | ||
project, or execute an experiment from the <b>Experiments and runs</b> page. | ||
</EmptyStateBody> | ||
</EmptyState> | ||
); | ||
} | ||
|
||
return <></>; | ||
}; |
29 changes: 29 additions & 0 deletions
29
frontend/src/pages/pipelines/global/experiments/artifacts/GlobalArtifactsPage.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,29 @@ | ||
import React from 'react'; | ||
|
||
import { usePipelinesAPI } from '~/concepts/pipelines/context'; | ||
import PipelineServerActions from '~/concepts/pipelines/content/PipelineServerActions'; | ||
import PipelineCoreApplicationPage from '~/pages/pipelines/global/PipelineCoreApplicationPage'; | ||
import EnsureAPIAvailability from '~/concepts/pipelines/EnsureAPIAvailability'; | ||
import EnsureCompatiblePipelineServer from '~/concepts/pipelines/EnsureCompatiblePipelineServer'; | ||
import { artifactsBaseRoute } from '~/routes'; | ||
import { ArtifactsListTable } from './ArtifactsListTable'; | ||
|
||
export const GlobalArtifactsPage: React.FC = () => { | ||
const pipelinesAPI = usePipelinesAPI(); | ||
|
||
return ( | ||
<PipelineCoreApplicationPage | ||
title="Artifacts" | ||
description="View your artifacts and their metadata." | ||
headerAction={<PipelineServerActions isDisabled={!pipelinesAPI.pipelinesServer.installed} />} | ||
getRedirectPath={artifactsBaseRoute} | ||
overrideChildPadding | ||
> | ||
<EnsureAPIAvailability> | ||
<EnsureCompatiblePipelineServer> | ||
<ArtifactsListTable /> | ||
</EnsureCompatiblePipelineServer> | ||
</EnsureAPIAvailability> | ||
</PipelineCoreApplicationPage> | ||
); | ||
}; |
1 change: 1 addition & 0 deletions
1
frontend/src/pages/pipelines/global/experiments/artifacts/index.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 @@ | ||
export { GlobalArtifactsPage } from './GlobalArtifactsPage'; |
20 changes: 20 additions & 0 deletions
20
frontend/src/pages/pipelines/global/experiments/artifacts/useGetArtifactsList.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,20 @@ | ||
import React from 'react'; | ||
|
||
import { usePipelinesAPI } from '~/concepts/pipelines/context'; | ||
import { Artifact, GetArtifactsRequest } from '~/third_party/mlmd'; | ||
import useFetchState, { FetchState } from '~/utilities/useFetchState'; | ||
|
||
export const useGetArtifactsList = ( | ||
refreshRate?: number, | ||
): FetchState<Artifact.AsObject[] | null> => { | ||
const { metadataStoreServiceClient } = usePipelinesAPI(); | ||
|
||
const fetchArtifactsList = React.useCallback(async () => { | ||
const response = await metadataStoreServiceClient.getArtifacts(new GetArtifactsRequest()); | ||
return response.toObject().artifactsList; | ||
}, [metadataStoreServiceClient]); | ||
|
||
return useFetchState(fetchArtifactsList, null, { | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export const artifactsRootPath = '/artifacts'; | ||
export const globArtifactsAll = `${artifactsRootPath}/*`; | ||
|
||
export const artifactsBaseRoute = (namespace: string | undefined): string => | ||
!namespace ? artifactsRootPath : `${artifactsRootPath}/${namespace}`; |
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
export * from './global'; | ||
export * from './project'; | ||
export * from './experiments'; | ||
export * from './artifacts'; | ||
export * from './runs'; |
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