Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notebook Spawner reachable when disabled #1505

Merged
merged 1 commit into from
Jul 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading