From ebd8aa9e0ec6e6ec8f96fa1fe98f7d9ac0177703 Mon Sep 17 00:00:00 2001 From: pnaik1 Date: Wed, 12 Jul 2023 12:36:56 +0530 Subject: [PATCH] Notebook Spawner reachable when disabled --- .../screens/projects/EmptyProjects.tsx | 23 +++++++++++++----- .../screens/projects/ProjectListView.tsx | 24 +++++++++---------- 2 files changed, 28 insertions(+), 19 deletions(-) diff --git a/frontend/src/pages/projects/screens/projects/EmptyProjects.tsx b/frontend/src/pages/projects/screens/projects/EmptyProjects.tsx index bc2649524b..5ded2bc5a8 100644 --- a/frontend/src/pages/projects/screens/projects/EmptyProjects.tsx +++ b/frontend/src/pages/projects/screens/projects/EmptyProjects.tsx @@ -10,6 +10,7 @@ import { import { CubesIcon } from '@patternfly/react-icons'; import { useNavigate } from 'react-router-dom'; import { ODH_PRODUCT_NAME } from '~/utilities/const'; +import { useAppContext } from '~/app/AppContext'; import LaunchJupyterButton from '~/pages/projects/screens/projects/LaunchJupyterButton'; import NewProjectButton from './NewProjectButton'; @@ -19,7 +20,7 @@ type EmptyProjectsProps = { const EmptyProjects: React.FC = ({ allowCreate }) => { const navigate = useNavigate(); - + const { dashboardConfig } = useAppContext(); return ( @@ -28,17 +29,27 @@ const EmptyProjects: React.FC = ({ allowCreate }) => { {allowCreate - ? 'To get started, create a data science project or launch a notebook with Jupyter.' - : `To get started, ask your ${ODH_PRODUCT_NAME} admin for a data science project or launch a notebook with Jupyter.`} + ? `To get started, create a data science project${ + dashboardConfig.spec.notebookController?.enabled + ? ' or launch a notebook with Jupyter' + : '' + }.` + : `To get started, ask your ${ODH_PRODUCT_NAME} admin for a data science project${ + dashboardConfig.spec.notebookController?.enabled + ? ' or launch a notebook with Jupyter' + : '' + }.`} {allowCreate ? ( <> navigate(`/projects/${projectName}`)} /> - - - + {dashboardConfig.spec.notebookController?.enabled && ( + + + + )} ) : ( diff --git a/frontend/src/pages/projects/screens/projects/ProjectListView.tsx b/frontend/src/pages/projects/screens/projects/ProjectListView.tsx index 668536a446..dcb6eb1cf1 100644 --- a/frontend/src/pages/projects/screens/projects/ProjectListView.tsx +++ b/frontend/src/pages/projects/screens/projects/ProjectListView.tsx @@ -6,6 +6,7 @@ import useTableColumnSort from '~/components/table/useTableColumnSort'; import SearchField, { SearchType } from '~/pages/projects/components/SearchField'; import { ProjectKind } from '~/k8sTypes'; import { getProjectDisplayName, getProjectOwner } from '~/pages/projects/utils'; +import { useAppContext } from '~/app/AppContext'; import LaunchJupyterButton from '~/pages/projects/screens/projects/LaunchJupyterButton'; import { ProjectsContext } from '~/concepts/projects/ProjectsContext'; import NewProjectButton from './NewProjectButton'; @@ -19,6 +20,7 @@ type ProjectListViewProps = { }; const ProjectListView: React.FC = ({ allowCreate }) => { + const { dashboardConfig } = useAppContext(); const { projects: unfilteredProjects } = React.useContext(ProjectsContext); const navigate = useNavigate(); const [searchType, setSearchType] = React.useState(SearchType.NAME); @@ -87,20 +89,16 @@ const ProjectListView: React.FC = ({ allowCreate }) => { }} /> - {allowCreate ? ( - <> - - navigate(`/projects/${projectName}`)} - /> - - - - - - ) : ( + {allowCreate && ( - + navigate(`/projects/${projectName}`)} + /> + + )} + {dashboardConfig.spec.notebookController?.enabled && ( + + )}