-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Add ability to update a variable #12011
Conversation
8410b82
to
4050192
Compare
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.
Looks good. Just a few comments/suggestions
super(props) | ||
|
||
const {variable} = this.props | ||
const script = _.get(variable, 'arguments.values.query') |
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.
does there need to be a default in this get? like ""
?
<Button | ||
text="Submit" | ||
type={ButtonType.Submit} | ||
onClick={this.handleSubmit} |
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.
Forms have an onSubmit
prop. Since this Button is already type submit, you could remove this.handleSubmit
to the onSubmit prop on the form and then get default browser behavior here
return !!variable.name && !!script | ||
} | ||
|
||
private handleSubmit = (e): void => { |
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.
could you type annotate e?
} | ||
|
||
private handleCloseOverlay = () => { | ||
this.setState({variableOverlayState: OverlayState.Closed}) |
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 this also reset variableID to null
?
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.
good catch!
variable.id, | ||
variable | ||
) | ||
notify(updateVariableSuccess(updatedVariable.name)) |
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.
nice!
|
||
interface Props { | ||
variable: Variable | ||
onDeleteVariable: (variable: Variable) => void | ||
onUpdateVariable: (variable: Partial<Variable>) => void | ||
onEditVariable: (variable: Variable) => void |
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.
perhaps there is a better name distinction between these two props? both of those names seem like they would do the same thing.
aa99185
to
35e7d42
Compare
35e7d42
to
9ccb785
Compare
Closes #11844
This PR adds the ability to edit a variable's name and query from the Variables tab of the orgs page. It also includes notifications for when an update succeeds or fails.