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

Run now fixes #1190

Merged
merged 10 commits into from
Aug 10, 2016
Merged

Run now fixes #1190

merged 10 commits into from
Aug 10, 2016

Conversation

Calvinp
Copy link
Contributor

@Calvinp Calvinp commented Aug 4, 2016

Implements the following changes:

  • A rerun button now appears on the task history table for requests whose tasks can be rerun.
  • The run now dialog imports default command line arguments from the previously run task - unless it's a rerun in which case it imports from the task to be rerun.
  • The run now dialog guesses that you want to tail the running log path.
  • Code cleanliness, including not mutating state.

@@ -59,7 +77,7 @@ export default class FormModal extends React.Component {
}

handleFormChange(name, value) {
const formState = this.state.formState;
const formState = Utils.deepClone(this.state.formState);
formState[name] = value;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was mutating the existing state, which is bad and was causing problems.

@Calvinp
Copy link
Contributor Author

Calvinp commented Aug 5, 2016

Forgot to cc here too... @tpetr @kwm4385 @wolfd

@kwm4385
Copy link
Contributor

kwm4385 commented Aug 9, 2016

LGTM

if (_.isEqual(this.state.formState, getDefaultFormState(this.props))) {
this.setState({formState: getDefaultFormState(newProps)});
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you explain what this method does?

Copy link
Contributor Author

@Calvinp Calvinp Aug 9, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What it does: If the new props set a new default form state, and the form hasn't been changed off of the default, this will update the current value of the form to the new default value.

Why it's needed: The default value of the command line arguments isn't always present when the modal is initially rendered on page load. When the run now button is pressed, the last task run (or the task to be rerun) is loaded, then the default command line args are taken from that task. The value of the field then needs to be updated with these command line arguments.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious why the command line args aren't always present. How is that data coming in?

Copy link
Contributor Author

@Calvinp Calvinp Aug 9, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The command line args are taken from:

  • The task being rerun, if you are rerunning a task.
  • Else the last task that was completed on that request.

Right now, to find the command line arguments, it's necessary to load the task's information. That's fine on the request detail page, as the task is already loaded (the command line args are part of the data retrieved while loading the task history table).

But on the requests page we don't load the task detail. At some point we need to load the detail of the last task run, but it doesn't make sense to do that before rendering (there could be thousands of requests, and we don't want to send an API call for each of them). So instead that call is only sent when a user clicks the run now button.

@tpetr
Copy link
Contributor

tpetr commented Aug 9, 2016

LGTM aside from my comments

@tpetr tpetr merged commit f963f97 into decaf Aug 10, 2016
@tpetr tpetr modified the milestone: 0.10.0 Aug 18, 2016
@ssalinas ssalinas deleted the run_now_fixes branch November 1, 2016 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants