Skip to content

Commit

Permalink
Notebook Spawner reachable when disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
pnaik1 committed Jul 13, 2023
1 parent 58d77f1 commit ddbe1fa
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 19 deletions.
23 changes: 17 additions & 6 deletions frontend/src/pages/projects/screens/projects/EmptyProjects.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -19,7 +20,7 @@ type EmptyProjectsProps = {

const EmptyProjects: React.FC<EmptyProjectsProps> = ({ allowCreate }) => {
const navigate = useNavigate();

const { dashboardConfig } = useAppContext();
return (
<EmptyState>
<EmptyStateIcon icon={CubesIcon} />
Expand All @@ -28,17 +29,27 @@ const EmptyProjects: React.FC<EmptyProjectsProps> = ({ allowCreate }) => {
</Title>
<EmptyStateBody>
{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.'
: '.'
}`}
</EmptyStateBody>
{allowCreate ? (
<>
<NewProjectButton
onProjectCreated={(projectName) => navigate(`/projects/${projectName}`)}
/>
<EmptyStateSecondaryActions>
<LaunchJupyterButton variant={ButtonVariant.link} />
</EmptyStateSecondaryActions>
{dashboardConfig.spec.notebookController?.enabled && (
<EmptyStateSecondaryActions>
<LaunchJupyterButton variant={ButtonVariant.link} />
</EmptyStateSecondaryActions>
)}
</>
) : (
<LaunchJupyterButton variant={ButtonVariant.primary} />
Expand Down
24 changes: 11 additions & 13 deletions frontend/src/pages/projects/screens/projects/ProjectListView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -19,6 +20,7 @@ type ProjectListViewProps = {
};

const ProjectListView: React.FC<ProjectListViewProps> = ({ allowCreate }) => {
const { dashboardConfig } = useAppContext();
const { projects: unfilteredProjects } = React.useContext(ProjectsContext);
const navigate = useNavigate();
const [searchType, setSearchType] = React.useState<SearchType>(SearchType.NAME);
Expand Down Expand Up @@ -87,20 +89,16 @@ const ProjectListView: React.FC<ProjectListViewProps> = ({ allowCreate }) => {
}}
/>
</ToolbarItem>
{allowCreate ? (
<>
<ToolbarItem>
<NewProjectButton
onProjectCreated={(projectName) => navigate(`/projects/${projectName}`)}
/>
</ToolbarItem>
<ToolbarItem>
<LaunchJupyterButton variant={ButtonVariant.link} />
</ToolbarItem>
</>
) : (
{allowCreate && (
<ToolbarItem>
<LaunchJupyterButton variant={ButtonVariant.primary} />
<NewProjectButton
onProjectCreated={(projectName) => navigate(`/projects/${projectName}`)}
/>
</ToolbarItem>
)}
{dashboardConfig.spec.notebookController?.enabled && (
<ToolbarItem>
<LaunchJupyterButton variant={ButtonVariant.link} />
</ToolbarItem>
)}
</React.Fragment>
Expand Down

0 comments on commit ddbe1fa

Please sign in to comment.