Skip to content

Commit bf005ce

Browse files
authored
Merge pull request #949 from pradnya-orchestral/Rerun_action_new_enhancements
Rerun action new enhancements
2 parents 756720d + 1cd20bf commit bf005ce

File tree

4 files changed

+15
-9
lines changed

4 files changed

+15
-9
lines changed

apps/st2-history/history-details.component.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,12 @@ export default class HistoryDetails extends React.Component {
106106

107107
render() {
108108
const { section, execution, displayUTC, handleToggleUTC } = this.props;
109-
109+
110+
let actionParameters;
111+
if(execution) {
112+
actionParameters = {...execution.parameters };
113+
}
114+
110115
if (!execution) {
111116
return null;
112117
}
@@ -269,7 +274,7 @@ export default class HistoryDetails extends React.Component {
269274
{ section === 'rerun' ? (
270275
<HistoryPopup
271276
action={execution.action.ref}
272-
payload={execution.parameters}
277+
payload={actionParameters}
273278
spec={{
274279
type: 'object',
275280
properties: {

apps/st2-history/history-popup.component.js

+2
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ export default class HistoryPopup extends React.Component {
9999
return (
100100
<div className="st2-rerun">
101101
<Popup title="Rerun an execution" onCancel={onCancel} data-test="rerun_popup">
102+
<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>
103+
102104
<form>
103105
<DetailsPanel>
104106
<DetailsPanelBody>

modules/st2-auto-form/fields/base.js

+5-6
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ export class BaseTextField extends React.Component {
7979
if ((v === '' || v === undefined) && spec.required) {
8080
return 'parameter is required';
8181
}
82+
8283

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

9596
handleChange(e, value) {
9697
e.stopPropagation();
97-
9898
const invalid = this.validate(value, this.props.spec);
9999

100100
if (this.props.name === 'timeout' || this.props.name === 'limit') {
@@ -113,17 +113,16 @@ export class BaseTextField extends React.Component {
113113
const { icon } = this.constructor;
114114
const { invalid } = this.state;
115115
const { spec={} } = this.props;
116-
117116
const wrapperProps = Object.assign({}, this.props);
118-
117+
119118
if (invalid) {
120119
wrapperProps.invalid = invalid;
121120
}
122121

123122
const inputProps = {
124123
className: 'st2-auto-form__field',
125124
type: spec.secret ? 'password' : 'text',
126-
placeholder: this.toStateValue(spec.default),
125+
placeholder:this.toStateValue(spec.default),
127126
disabled: this.props.disabled,
128127
value: this.state.value,
129128
onChange: (e) => this.handleChange(e, e.target.value),
@@ -149,14 +148,14 @@ export class BaseTextareaField extends BaseTextField {
149148
const { spec={} } = this.props;
150149

151150
const wrapperProps = Object.assign({}, this.props);
152-
151+
153152
if (invalid) {
154153
wrapperProps.invalid = invalid;
155154
}
156155

157156
const inputProps = {
158157
className: 'st2-auto-form__field',
159-
placeholder: this.toStateValue(spec.default),
158+
placeholder: this.toStateValue(spec.default),
160159
disabled: this.props.disabled,
161160
value: this.state.value,
162161
onChange: (e) => this.handleChange(e, e.target.value),

modules/st2-auto-form/tests/test-array.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ describe('AutoForm ArrayField', () => {
9191
};
9292

9393
const c = new TestComponent(<ArrayField {...props} />);
94-
9594
expect(c.field().props.placeholder).to.be.equal('1, 2, 3');
95+
9696
});
9797

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

0 commit comments

Comments
 (0)