diff --git a/webview/src/setup/components/App.test.tsx b/webview/src/setup/components/App.test.tsx index 177420200c..3784e95214 100644 --- a/webview/src/setup/components/App.test.tsx +++ b/webview/src/setup/components/App.test.tsx @@ -22,6 +22,7 @@ const renderApp = ({ isPythonExtensionInstalled, isStudioConnected, needsGitInitialized, + needsGitCommit, projectInitialized, pythonBinPath, sectionCollapsed, @@ -38,6 +39,7 @@ const renderApp = ({ hasData, isPythonExtensionInstalled, isStudioConnected, + needsGitCommit, needsGitInitialized, projectInitialized, pythonBinPath, @@ -489,6 +491,24 @@ describe('App', () => { ).not.toBeInTheDocument() }) + it('should show a screen saying there needs to be a git commit if the project is initialized, dvc is installed, but has not git commit', () => { + renderApp({ + canGitInitialize: false, + cliCompatible: true, + hasData: false, + isPythonExtensionInstalled: false, + isStudioConnected: false, + needsGitCommit: true, + needsGitInitialized: false, + projectInitialized: true, + pythonBinPath: undefined, + sectionCollapsed: undefined, + shareLiveToStudio: false + }) + + expect(screen.getByText('No Git commits detected')).toBeInTheDocument() + }) + it('should show a loading screen if the project is loading in data', () => { renderApp({ canGitInitialize: false, diff --git a/webview/src/setup/components/App.tsx b/webview/src/setup/components/App.tsx index f8ae7c6ee8..460b7bf079 100644 --- a/webview/src/setup/components/App.tsx +++ b/webview/src/setup/components/App.tsx @@ -95,7 +95,6 @@ export const App: React.FC = () => { cliCompatible={cliCompatible} isPythonExtensionInstalled={isPythonExtensionInstalled} needsGitInitialized={needsGitInitialized} - needsGitCommit={needsGitCommit} projectInitialized={projectInitialized} pythonBinPath={pythonBinPath} isExperimentsAvailable={hasData} @@ -109,7 +108,8 @@ export const App: React.FC = () => { setSectionCollapsed={setSectionCollapsed} > diff --git a/webview/src/setup/components/Dvc.tsx b/webview/src/setup/components/Dvc.tsx index 1fdf903b51..0b02b9a8d4 100644 --- a/webview/src/setup/components/Dvc.tsx +++ b/webview/src/setup/components/Dvc.tsx @@ -10,10 +10,9 @@ import { installDvc, selectPythonInterpreter, setupWorkspace, - showExperiments, - showScmPanel + showExperiments } from './messages' -import { NeedsGitCommit } from './NeedsGitCommit' + import { EmptyState } from '../../shared/components/emptyState/EmptyState' import { Beaker } from '../../shared/components/icons' import { IconButton } from '../../shared/components/button/IconButton' @@ -23,7 +22,6 @@ export type DvcProps = { cliCompatible: boolean | undefined isPythonExtensionInstalled: boolean needsGitInitialized: boolean | undefined - needsGitCommit: boolean projectInitialized: boolean pythonBinPath: string | undefined isExperimentsAvailable: boolean | undefined @@ -35,7 +33,6 @@ export const Dvc: React.FC = ({ cliCompatible, isPythonExtensionInstalled, needsGitInitialized, - needsGitCommit, projectInitialized, pythonBinPath, setSectionCollapsed, @@ -68,10 +65,6 @@ export const Dvc: React.FC = ({ ) } - if (needsGitCommit) { - return - } - return (

Setup Complete

diff --git a/webview/src/setup/components/Experiments.tsx b/webview/src/setup/components/Experiments.tsx index 5a2c805b65..92d62d0397 100644 --- a/webview/src/setup/components/Experiments.tsx +++ b/webview/src/setup/components/Experiments.tsx @@ -1,7 +1,8 @@ import React from 'react' import { SectionCollapsed } from 'dvc/src/setup/webview/contract' -import { showExperiments } from './messages' +import { showExperiments, showScmPanel } from './messages' import { NoData } from './NoData' +import { NeedsGitCommit } from './NeedsGitCommit' import { EmptyState } from '../../shared/components/emptyState/EmptyState' import { IconButton } from '../../shared/components/button/IconButton' import { Beaker } from '../../shared/components/icons' @@ -11,12 +12,14 @@ export type ExperimentsProps = { isDvcSetup: boolean hasData: boolean | undefined setSectionCollapsed: (sectionCollapsed: SectionCollapsed) => void + needsGitCommit: boolean } export const Experiments: React.FC = ({ isDvcSetup, hasData, - setSectionCollapsed + setSectionCollapsed, + needsGitCommit }) => { if (!isDvcSetup) { return ( @@ -37,6 +40,10 @@ export const Experiments: React.FC = ({ ) } + if (needsGitCommit) { + return + } + if (hasData === undefined) { return Loading Project... }