-
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
Watch for dvc.yaml changes for manually added stages #3365
Changes from 6 commits
238eaef
15f8c9b
c780695
08fb633
604634e
0f4d8a9
cb49803
fff3a20
78866e1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,16 +5,28 @@ import { IconButton } from '../../shared/components/button/IconButton' | |
import { Add } from '../../shared/components/icons' | ||
import { sendMessage } from '../../shared/vscode' | ||
|
||
export const AddStage: React.FC = () => ( | ||
<div className={styles.addConfigButton}> | ||
interface AddStageProps { | ||
hasValidDvcYaml: boolean | ||
} | ||
|
||
export const AddStage: React.FC<AddStageProps> = ({ hasValidDvcYaml }) => ( | ||
<div className={styles.addConfigButton} data-testid="aaa"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we name this id to be a more clear name? Though it looks like it isn't being used anywhere 🤔 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice catch It was for quick testing (had a lot of trouble testing the shadow DOM button), but I forgot to remove it after. |
||
<p>Easily and efficiently reproduce your experiments </p> | ||
<IconButton | ||
icon={Add} | ||
onClick={() => | ||
hasValidDvcYaml && | ||
sendMessage({ type: MessageFromWebviewType.ADD_CONFIGURATION }) | ||
} | ||
text="Add a Pipeline Stage" | ||
disabled={!hasValidDvcYaml} | ||
/> | ||
{!hasValidDvcYaml && ( | ||
<p className={styles.error}> | ||
Your dvc.yaml file should contain valid yaml before adding any pipeline | ||
stages. | ||
</p> | ||
)} | ||
<p> | ||
<a href="https://dvc.org/doc/user-guide/project-structure/dvcyaml-files#stages"> | ||
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.
[Q] Is there any way that
this.hasValidDvcYaml
isn't!this.hasStages
? Isthis.hasValidDvcYaml === !this.hasConfig
always true? What values of stages mean that we need both variables? Can we refactor to make it more obvious? (my brain is tiny)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.
dvc stage list
will return '' if no pipelines were found. It will return an error ('./dvc.yaml' validation failed.
) if thedvc.yaml
file is broken. thelistStages
command will return the result, but it has acatch
clause that will return undefined.In other words,
hasInvalidDvcYaml = hasStages() === undefined
anddoesNotHaveConfig = hasStages() === ''
.We cannot test accurately for
hasConfig
ifhasValidDvcYaml
istrue
, but I chose to set it to false because it shows the message at the bottom of the table.