Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
dpanshug committed Sep 1, 2023
1 parent 8323422 commit 0e5efb9
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import ServingRuntimeList from '~/pages/modelServing/screens/projects/ServingRun
import { ProjectDetailsContext } from '~/pages/projects/ProjectDetailsContext';
import { featureFlagEnabled } from '~/utilities/utils';
import PipelinesSection from '~/pages/projects/screens/detail/pipelines/PipelinesSection';
import usePipelines from '~/concepts/pipelines/apiHooks/usePipelines';
import NotebooksList from './notebooks/NotebookList';
import { ProjectSectionID } from './types';
import StorageList from './storage/StorageList';
Expand All @@ -28,13 +27,10 @@ const ProjectDetailsComponents: React.FC = () => {
dataConnections: { data: connections, loaded: connectionsLoaded },
servingRuntimes: { data: modelServers, loaded: modelServersLoaded },
} = React.useContext(ProjectDetailsContext);

// Limit set to 1 for checking pipeline emptiness
const [pipelines, pipelinesLoaded] = usePipelines(1);

const modelServingEnabled = featureFlagEnabled(
dashboardConfig.spec.dashboardConfig.disableModelServing,
);
const [isPipelinesEmpty, setIsPipelinesEmpty] = React.useState(false);
const pipelinesEnabled =
featureFlagEnabled(dashboardConfig.spec.dashboardConfig.disablePipelines) &&
dashboardConfig.status.dependencyOperators.redhatOpenshiftPipelines.available;
Expand All @@ -60,8 +56,8 @@ const ProjectDetailsComponents: React.FC = () => {
? [
{
id: ProjectSectionID.PIPELINES,
component: <PipelinesSection />,
isEmpty: pipelinesLoaded && pipelines.length === 0,
component: <PipelinesSection setIsPipelinesEmpty={setIsPipelinesEmpty} />,
isEmpty: isPipelinesEmpty,
},
]
: []),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ import { usePipelinesAPI } from '~/concepts/pipelines/context';
import EmptyStateErrorMessage from '~/components/EmptyStateErrorMessage';
import { TABLE_CONTENT_LIMIT, LIMIT_MAX_ITEM_COUNT } from '~/concepts/pipelines/const';

const PipelinesList: React.FC = () => {
type PipelinesListProps = {
setIsPipelinesEmpty?: (value: boolean) => void;
};

const PipelinesList: React.FC<PipelinesListProps> = ({ setIsPipelinesEmpty }) => {
const { namespace } = usePipelinesAPI();
const [pipelines, loaded, loadError, refresh] = usePipelines(LIMIT_MAX_ITEM_COUNT);
const navigate = useNavigate();
Expand All @@ -29,6 +33,10 @@ const PipelinesList: React.FC = () => {
}

if (pipelines.length === 0) {
// Call setIsPipelinesEmpty only if it is provided
if (setIsPipelinesEmpty) {
setIsPipelinesEmpty(true);
}
return (
<EmptyDetailsList title="No pipelines" description="To get started, import a pipeline." />
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ import ImportPipelineButton from '~/concepts/pipelines/content/import/ImportPipe
import PipelinesList from '~/pages/projects/screens/detail/pipelines/PipelinesList';
import EnsureAPIAvailability from '~/concepts/pipelines/EnsureAPIAvailability';

const PipelinesSection: React.FC = () => {
type PipelinesSectionProps = {
setIsPipelinesEmpty?: (value: boolean) => void;
};

const PipelinesSection: React.FC<PipelinesSectionProps> = ({ setIsPipelinesEmpty }) => {
const {
pipelinesServer: { initializing, installed, timedOut },
} = usePipelinesAPI();
Expand All @@ -32,7 +36,7 @@ const PipelinesSection: React.FC = () => {
<PipelineServerTimedOut />
) : (
<EnsureAPIAvailability>
<PipelinesList />
<PipelinesList setIsPipelinesEmpty={setIsPipelinesEmpty} />
</EnsureAPIAvailability>
)}
</DetailsSection>
Expand Down

0 comments on commit 0e5efb9

Please sign in to comment.