-
Notifications
You must be signed in to change notification settings - Fork 29
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
Move Connect to Studio into Setup webview #3452
Conversation
@@ -69,12 +69,16 @@ export const SetupExperiments: React.FC<SetupExperimentsProps> = ({ | |||
} | |||
|
|||
if (hasData === undefined) { | |||
return <EmptyState>Loading Project...</EmptyState> | |||
return <EmptyState isFullScreen={false}>Loading Project...</EmptyState> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid too many return
statements within this function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we move this inside <NoData />
? This would probably solve that codeclimate issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did something about this in #3463.
} | ||
|
||
if (!hasData) { | ||
return <NoData /> | ||
} | ||
|
||
return <EmptyState>{"You're all setup"}</EmptyState> | ||
return ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid too many return
statements within this function.
@@ -26,7 +26,7 @@ export type SetupExperimentsProps = { | |||
pythonBinPath: string | undefined | |||
} | |||
|
|||
export const SetupExperiments: React.FC<SetupExperimentsProps> = ({ | |||
export const Experiments: React.FC<ExperimentsProps> = ({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function Experiments
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
} | ||
|
||
if (!hasData) { | ||
return <NoData /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid too many return
statements within this function.
return <CliIncompatible checkCompatibility={checkCompatibility} /> | ||
} | ||
|
||
if (cliCompatible === undefined) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar blocks of code found in 2 locations. Consider refactoring.
@@ -399,11 +399,6 @@ | |||
"command": "dvc.showCommands", | |||
"category": "DVC" | |||
}, | |||
{ | |||
"title": "Connect to Studio", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[F] I'll replace these in a follow-up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current behaviour is back UX but I will fix it in the next PR.
Screen.Recording.2023-03-14.at.12.29.42.pm.mov
The best idea at the moment seems to be to collapse all of the non-relevant sections.
@@ -108,11 +108,11 @@ export const getShareExperimentAsCommitCommand = | |||
} | |||
|
|||
export const getShareExperimentToStudioCommand = | |||
(internalCommands: InternalCommands, connect: Connect) => | |||
(internalCommands: InternalCommands, setup: Setup) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[F] All of the externals of Connect
have been moved directly onto Setup
to reduce the size of this change. Will work out a smarter split once the dust settles.
hasData: boolean | undefined | ||
}) { | ||
shareLiveToStudio | ||
}: SetupData) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to self: Consider using "Step" here instead of sending all of this data (consolidate logic).
@@ -633,5 +636,154 @@ suite('Setup Test Suite', () => { | |||
'should set dvc.cli.incompatible to false if the version is compatible' | |||
).to.be.calledWithExactly('setContext', 'dvc.cli.incompatible', false) | |||
}) | |||
|
|||
it('should handle a message from the webview to open Studio', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[F] These are the Connect
test suite tests copied across.
render(<App />) | ||
expect(mockPostMessage).toHaveBeenCalledWith({ | ||
type: MessageFromWebviewType.INITIALIZED | ||
describe('Experiments', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[F] Indentation change as per the new describe statement.
needsGitInitialized: undefined, | ||
projectInitialized: false, | ||
pythonBinPath: undefined | ||
describe('Studio not connected', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[F] Copy pasted from the old Connect App tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
] | ||
) | ||
) | ||
|
||
const setShareLiveToStudio = (shouldShareLive: boolean) => { | ||
setShareLiveToStudioValue(shouldShareLive) | ||
sendMessage({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be inside messages.ts
?
@@ -26,7 +26,7 @@ export type SetupExperimentsProps = { | |||
pythonBinPath: string | undefined | |||
} | |||
|
|||
export const SetupExperiments: React.FC<SetupExperimentsProps> = ({ | |||
export const Experiments: React.FC<ExperimentsProps> = ({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was wondering if a rename to Experiments
was a good idea. After looking the experiments table main component is exported as ExperimentsTable
(there is a <Experiments />
component, but it isn't exported). Just leaving this here in case anyone else was wondering. I'm fine with the renaming knowing these facts.
@@ -69,12 +69,16 @@ export const SetupExperiments: React.FC<SetupExperimentsProps> = ({ | |||
} | |||
|
|||
if (hasData === undefined) { | |||
return <EmptyState>Loading Project...</EmptyState> | |||
return <EmptyState isFullScreen={false}>Loading Project...</EmptyState> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we move this inside <NoData />
? This would probably solve that codeclimate issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work so far!
return <EmptyState>{"You're all setup"}</EmptyState> | ||
return ( | ||
<EmptyState isFullScreen={false}> | ||
<h1>{"You're all setup"}</h1> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this needs curly braces:
<h1>{"You're all setup"}</h1> | |
<h1>You're all setup</h1> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs to be some variant of You're all setup
without the braces which is why I opted for this. I changed this text in #3463 to Setup Complete
. We should agree on what the message should actually be.
{"Configure the extension's connection to "} | ||
<a href="https://studio.iterative.a">Studio</a>.<br /> | ||
Studio provides a collaboration platform for Machine Learning and is free | ||
for small teams and individual contributors. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spotted a couple minor things in the text:
- first line is wrapped in curly braces
- Should "Machine Learning" be capitalized?
- link to studio is missing an "i"
Configure the extension's connection to{' '}
<a href="https://studio.iterative.ai">Studio</a>.<br />
Studio provides a collaboration platform for machine learning and is free
for small teams and individual contributors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we care about the consistent use of {"'"}
vs '
then we need to add a linter rule.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only rule I have been able to find seems to be the opposite of what you're asking for: https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-literals.md
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only rule I have been able to find seems to be the opposite of what you're asking for: https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-literals.md
Can add https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-curly-brace-presence.md though
I've alway's just assumed we don't want extra curly braces that aren't needed in the JSX. Personally, I find it harder to read. No strong preference though!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we care about the consistent use of {"'"} vs
'
then we need to add a linter rule.I've always gotten error warnings when it comes to apostrophes in the text and I've just corrected them without thinking about it.
But, apparently, you're not seeing them? weird 🤔
Do you see those errors if there are braces wrapping the text?
Not sure why the section is not expanding @sroy3 how about:
This seems to work: Screen.Recording.2023-03-15.at.6.29.26.am.movScreen.Recording.2023-03-15.at.6.28.32.am.movWDYT? |
Not sure why the section is not expanding I think this is the best solution |
Code Climate has analyzed commit 375cdfe and detected 8 issues on this pull request. Here's the issue category breakdown:
The test coverage on the diff in this pull request is 91.2% (85% is the threshold). This pull request will bring the total coverage in the repository to 95.7% (0.1% change). View more on Code Climate. |
2/4
main
<- #3448 <- this <- #3462 <- #3463Related to #3434.
This PR moves the Connect to Studio page inside of the Setup webview.
Demo
Screen.Recording.2023-03-13.at.7.36.18.pm.mov