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

Conversation

Projects
None yet
4 participants
@Calvinp
Contributor

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;

This comment has been minimized.

@Calvinp

Calvinp Aug 5, 2016

Contributor

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

@Calvinp

Calvinp Aug 5, 2016

Contributor

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

@Calvinp

This comment has been minimized.

Show comment
Hide comment
@Calvinp

Calvinp Aug 5, 2016

Contributor

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

Contributor

Calvinp commented Aug 5, 2016

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

Calvinp added some commits Aug 9, 2016

@kwm4385

This comment has been minimized.

Show comment
Hide comment
@kwm4385

kwm4385 Aug 9, 2016

Contributor

LGTM

Contributor

kwm4385 commented Aug 9, 2016

LGTM

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

This comment has been minimized.

@tpetr

tpetr Aug 9, 2016

Member

can you explain what this method does?

@tpetr

tpetr Aug 9, 2016

Member

can you explain what this method does?

This comment has been minimized.

@Calvinp

Calvinp Aug 9, 2016

Contributor

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.

@Calvinp

Calvinp Aug 9, 2016

Contributor

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.

This comment has been minimized.

@wolfd

wolfd Aug 9, 2016

Contributor

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

@wolfd

wolfd Aug 9, 2016

Contributor

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

This comment has been minimized.

@Calvinp

Calvinp Aug 9, 2016

Contributor

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.

@Calvinp

Calvinp Aug 9, 2016

Contributor

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.

@@ -1,9 +1,9 @@
import React from 'react';
export const getClickComponent = (component) => (
export const getClickComponent = (component, doFirst = (() => Promise.resolve())) => (

This comment has been minimized.

@tpetr

tpetr Aug 9, 2016

Member

i think you can replace () => Promise.resolve() with a method reference (Promise.resolve)

@tpetr

tpetr Aug 9, 2016

Member

i think you can replace () => Promise.resolve() with a method reference (Promise.resolve)

This comment has been minimized.

@Calvinp

Calvinp Aug 9, 2016

Contributor

I initially thought so too, but when I try to do that I get Uncaught TypeError: function resolve() { [native code] } called on non-object.

@Calvinp

Calvinp Aug 9, 2016

Contributor

I initially thought so too, but when I try to do that I get Uncaught TypeError: function resolve() { [native code] } called on non-object.

@tpetr

This comment has been minimized.

Show comment
Hide comment
@tpetr

tpetr Aug 9, 2016

Member

LGTM aside from my comments

Member

tpetr commented Aug 9, 2016

LGTM aside from my comments

@tpetr tpetr merged commit f963f97 into decaf Aug 10, 2016

1 of 2 checks passed

continuous-integration/travis-ci/push The Travis CI build could not complete due to an error
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@tpetr tpetr modified the milestone: 0.10.0 Aug 18, 2016

@ssalinas ssalinas deleted the run_now_fixes branch Nov 1, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment