mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-14 00:19:16 +01:00
fix: Add UI for showing 'create tag' errors
This commit is contained in:
parent
00f411d9d2
commit
0b58048c86
@ -45,8 +45,12 @@ class AddTagDialogComponent extends Component {
|
|||||||
if (!tag.type) {
|
if (!tag.type) {
|
||||||
tag.type = 'simple';
|
tag.type = 'simple';
|
||||||
}
|
}
|
||||||
await this.props.submit(this.props.featureToggleName, tag);
|
try {
|
||||||
this.setState({ openDialog: false, tag: { type: 'simple', value: '' } });
|
await this.props.submit(this.props.featureToggleName, tag);
|
||||||
|
this.setState({ openDialog: false, tag: { type: 'simple', value: '' } });
|
||||||
|
} catch (e) {
|
||||||
|
this.setState({ errors: { general: e.message } });
|
||||||
|
}
|
||||||
};
|
};
|
||||||
render() {
|
render() {
|
||||||
const { tag, errors, openDialog } = this.state;
|
const { tag, errors, openDialog } = this.state;
|
||||||
@ -82,6 +86,7 @@ class AddTagDialogComponent extends Component {
|
|||||||
onChange={v => this.setValue('value', v.target.value)}
|
onChange={v => this.setValue('value', v.target.value)}
|
||||||
/>
|
/>
|
||||||
</section>
|
</section>
|
||||||
|
{errors.general && <p style={{ color: 'red' }}>{errors.general}</p>}
|
||||||
<DialogActions>
|
<DialogActions>
|
||||||
<FormButtons submitText={submitText} onCancel={this.onCancel} />
|
<FormButtons submitText={submitText} onCancel={this.onCancel} />
|
||||||
</DialogActions>
|
</DialogActions>
|
||||||
|
Loading…
Reference in New Issue
Block a user