Skip to content

Commit

Permalink
Merge pull request #949 from pradnya-orchestral/Rerun_action_new_enha…
Browse files Browse the repository at this point in the history
…ncements

Rerun action new enhancements
  • Loading branch information
m4dcoder committed Mar 7, 2022
2 parents 756720d + 1cd20bf commit bf005ce
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
9 changes: 7 additions & 2 deletions apps/st2-history/history-details.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,12 @@ export default class HistoryDetails extends React.Component {

render() {
const { section, execution, displayUTC, handleToggleUTC } = this.props;


let actionParameters;
if(execution) {
actionParameters = {...execution.parameters };
}

if (!execution) {
return null;
}
Expand Down Expand Up @@ -269,7 +274,7 @@ export default class HistoryDetails extends React.Component {
{ section === 'rerun' ? (
<HistoryPopup
action={execution.action.ref}
payload={execution.parameters}
payload={actionParameters}
spec={{
type: 'object',
properties: {
Expand Down
2 changes: 2 additions & 0 deletions apps/st2-history/history-popup.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ export default class HistoryPopup extends React.Component {
return (
<div className="st2-rerun">
<Popup title="Rerun an execution" onCancel={onCancel} data-test="rerun_popup">
<h4 style={{ padding:'20px 20px 0', fontSize: '20px', fontWeight: 'normal', marginBlockStart: 'auto' }}>The input values from the previous run are applied by default and displayed in black. The original default values of the action parameters are displayed in grey.</h4>

<form>
<DetailsPanel>
<DetailsPanelBody>
Expand Down
11 changes: 5 additions & 6 deletions modules/st2-auto-form/fields/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export class BaseTextField extends React.Component {
if ((v === '' || v === undefined) && spec.required) {
return 'parameter is required';
}


if (isJinja(v)) {
return false;
Expand All @@ -94,7 +95,6 @@ export class BaseTextField extends React.Component {

handleChange(e, value) {
e.stopPropagation();

const invalid = this.validate(value, this.props.spec);

if (this.props.name === 'timeout' || this.props.name === 'limit') {
Expand All @@ -113,17 +113,16 @@ export class BaseTextField extends React.Component {
const { icon } = this.constructor;
const { invalid } = this.state;
const { spec={} } = this.props;

const wrapperProps = Object.assign({}, this.props);

if (invalid) {
wrapperProps.invalid = invalid;
}

const inputProps = {
className: 'st2-auto-form__field',
type: spec.secret ? 'password' : 'text',
placeholder: this.toStateValue(spec.default),
placeholder:this.toStateValue(spec.default),
disabled: this.props.disabled,
value: this.state.value,
onChange: (e) => this.handleChange(e, e.target.value),
Expand All @@ -149,14 +148,14 @@ export class BaseTextareaField extends BaseTextField {
const { spec={} } = this.props;

const wrapperProps = Object.assign({}, this.props);

if (invalid) {
wrapperProps.invalid = invalid;
}

const inputProps = {
className: 'st2-auto-form__field',
placeholder: this.toStateValue(spec.default),
placeholder: this.toStateValue(spec.default),
disabled: this.props.disabled,
value: this.state.value,
onChange: (e) => this.handleChange(e, e.target.value),
Expand Down
2 changes: 1 addition & 1 deletion modules/st2-auto-form/tests/test-array.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ describe('AutoForm ArrayField', () => {
};

const c = new TestComponent(<ArrayField {...props} />);

expect(c.field().props.placeholder).to.be.equal('1, 2, 3');

});

it('allows you to put a jinja template in the field', () => {
Expand Down

0 comments on commit bf005ce

Please sign in to comment.