Skip to content

Commit 62c1489

Browse files
committed
fix(ui): Hooks create page fix
PulseBindings component was expecting non-empty autocompletion list. That was only passed on the Pulse Exchanges page but not on the Hooks Create/Edit page.
1 parent b305417 commit 62c1489

File tree

4 files changed

+31
-2
lines changed

4 files changed

+31
-2
lines changed

changelog/bnW-iDD1R0-0D7rBUNF0Zw.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
audience: users
2+
level: patch
3+
---
4+
5+
Fixes UI bug with hooks creation form, where changing Exchange input resulted in error message.

ui/src/components/HookForm/index.jsx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
import React, { Component, Fragment } from 'react';
2-
import { func, string, bool, oneOfType, object, array } from 'prop-types';
2+
import {
3+
func,
4+
string,
5+
bool,
6+
oneOfType,
7+
object,
8+
array,
9+
arrayOf,
10+
} from 'prop-types';
311
import classNames from 'classnames';
412
import { equals, assocPath } from 'ramda';
513
import cloneDeep from 'lodash.clonedeep';
@@ -194,6 +202,8 @@ export default class HookForm extends Component {
194202
* onComplete handler after successfully deleting a hook.
195203
* */
196204
onDialogActionDeleteComplete: func,
205+
/** Autocomplete values for exchanges input */
206+
exchangesDictionary: arrayOf(string),
197207
};
198208

199209
static defaultProps = {
@@ -210,6 +220,7 @@ export default class HookForm extends Component {
210220
onDialogDeleteHook: null,
211221
deleteDialogOpen: null,
212222
onDialogActionDeleteComplete: null,
223+
exchangesDictionary: [],
213224
};
214225

215226
state = {
@@ -536,6 +547,7 @@ export default class HookForm extends Component {
536547
onDialogActionDeleteComplete,
537548
onDialogDeleteHook,
538549
onDialogOpen,
550+
exchangesDictionary,
539551
} = this.props;
540552
const {
541553
routingKeyPattern,
@@ -719,6 +731,7 @@ export default class HookForm extends Component {
719731
onPulseExchangeChange={this.handlePulseExchangeChange}
720732
pulseExchange={pulseExchange}
721733
pattern={routingKeyPattern}
734+
exchangesDictionary={exchangesDictionary}
722735
/>
723736
}
724737
/>

ui/src/components/PulseBindings/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export default class PulseBindings extends Component {
7676
<div className={classes.inputList}>
7777
<Autocomplete
7878
freeSolo
79-
options={exchangesDictionary}
79+
options={exchangesDictionary || []}
8080
inputValue={pulseExchange}
8181
onInputChange={(event, newValue) =>
8282
onPulseExchangeChange({

ui/src/views/Hooks/ViewHook/index.jsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import createHookQuery from './createHook.graphql';
1010
import deleteHookQuery from './deleteHook.graphql';
1111
import updateHookQuery from './updateHook.graphql';
1212
import triggerHookQuery from './triggerHook.graphql';
13+
import exchangesList from '../../../utils/exchangesList';
1314

1415
@withApollo
1516
@graphql(hookQuery, {
@@ -34,8 +35,15 @@ export default class ViewHook extends Component {
3435
variant: 'success',
3536
open: false,
3637
},
38+
exchangesDictionary: null,
3739
};
3840

41+
async componentDidMount() {
42+
this.setState({
43+
exchangesDictionary: await exchangesList(),
44+
});
45+
}
46+
3947
preRunningAction = () => {
4048
this.setState({ dialogError: null, actionLoading: true });
4149
};
@@ -164,6 +172,7 @@ export default class ViewHook extends Component {
164172
deleteDialogOpen,
165173
dialogOpen,
166174
snackbar,
175+
exchangesDictionary,
167176
} = this.state;
168177
const error = (data && data.error) || err;
169178
const hookLastFires =
@@ -183,6 +192,7 @@ export default class ViewHook extends Component {
183192
dialogError={dialogError}
184193
actionLoading={actionLoading}
185194
onCreateHook={this.handleCreateHook}
195+
exchangesDictionary={exchangesDictionary}
186196
/>
187197
</Fragment>
188198
) : (
@@ -206,6 +216,7 @@ export default class ViewHook extends Component {
206216
onDialogActionError={this.handleDialogActionError}
207217
onDialogOpen={this.handleDialogOpen}
208218
onDialogDeleteHook={this.handleDeleteDialogHook}
219+
exchangesDictionary={exchangesDictionary}
209220
/>
210221
)}
211222
</Fragment>

0 commit comments

Comments
 (0)