Skip to content

Commit

Permalink
fix(ui): Unscrollable error message when saving YAML (argoproj#4152) (a…
Browse files Browse the repository at this point in the history
…rgoproj#4195)

Co-authored-by: Michael Crenshaw <[email protected]>
  • Loading branch information
rbreeze and crenshaw-dev authored Apr 29, 2022
1 parent 1533698 commit 40a4061
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
8 changes: 8 additions & 0 deletions ui/src/app/shared/components/yaml-editor/yaml-editor.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
.yaml-editor {
position: relative;

&__error {
display: block;
word-wrap: break-word;
width: 290px;
overflow-y: scroll;
max-height: 500px;
}

&__buttons {
position: absolute;
right: 1em;
Expand Down
19 changes: 15 additions & 4 deletions ui/src/app/shared/components/yaml-editor/yaml-editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,24 @@ export class YamlEditor<T> extends React.Component<
try {
const updated = jsYaml.load(this.model.getLinesContent().join('\n'));
const patch = jsonMergePatch.generate(props.input, updated);
const unmounted = await this.props.onSave(JSON.stringify(patch || {}), 'application/merge-patch+json');
if (unmounted !== true) {
this.setState({editing: false});
try {
const unmounted = await this.props.onSave(JSON.stringify(patch || {}), 'application/merge-patch+json');
if (unmounted !== true) {
this.setState({editing: false});
}
} catch (e) {
ctx.notifications.show({
content: (
<div className='yaml-editor__error'>
<ErrorNotification title='Unable to save changes' e={e} />
</div>
),
type: NotificationType.Error
});
}
} catch (e) {
ctx.notifications.show({
content: <ErrorNotification title='Unable to save changes' e={e} />,
content: <ErrorNotification title='Unable to validate changes' e={e} />,
type: NotificationType.Error
});
}
Expand Down

0 comments on commit 40a4061

Please sign in to comment.