-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
T2viz ux improvements #330
Changes from all commits
75f47a6
d82045d
a948a34
545c6a7
01bedc2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,6 +63,9 @@ export class Text2Vega { | |
) | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
.toPromise<any>(); | ||
if (res.rawResponse.total === 0) { | ||
throw new Error(`There is no result with the generated query: '${value.ppl}'.`); | ||
} | ||
Comment on lines
+66
to
+68
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. would there a place to show this error on page? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, in text2viz.tsx line 110 |
||
return { ...value, sample: res.rawResponse }; | ||
}), | ||
// call llm to generate vega | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,6 +67,7 @@ export const Text2Viz = () => { | |
data, | ||
uiSettings, | ||
savedObjects, | ||
config, | ||
}, | ||
} = useOpenSearchDashboards<StartServices>(); | ||
|
||
|
@@ -106,7 +107,7 @@ export const Text2Viz = () => { | |
if (result.error) { | ||
notifications.toasts.addError(result.error, { | ||
title: i18n.translate('dashboardAssistant.feature.text2viz.error', { | ||
defaultMessage: 'Error while executing text to vega', | ||
defaultMessage: 'Error while executing text to visualization', | ||
}), | ||
}); | ||
} else { | ||
|
@@ -198,7 +199,7 @@ export const Text2Viz = () => { | |
}); | ||
|
||
setSubmitting(false); | ||
}, [selectedSource, input, status]); | ||
}, [selectedSource, input, status, notifications.toasts]); | ||
|
||
/** | ||
* Display the save visualization dialog to persist the current generated visualization | ||
|
@@ -342,16 +343,17 @@ export const Text2Viz = () => { | |
onChange={(e) => setInput(e.target.value)} | ||
fullWidth | ||
compressed | ||
prepend={<EuiIcon type={chatIcon} />} | ||
prepend={<EuiIcon type={config.branding.logo || chatIcon} />} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. will There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, url to svg is supported |
||
placeholder="Generate visualization with a natural language question." | ||
onKeyDown={(e) => e.key === 'Enter' && onSubmit()} | ||
disabled={!selectedSource} | ||
/> | ||
</EuiFlexItem> | ||
<EuiFlexItem grow={false}> | ||
<EuiButtonIcon | ||
aria-label="submit" | ||
onClick={onSubmit} | ||
isDisabled={loading || input.trim().length === 0} | ||
isDisabled={loading || input.trim().length === 0 || !selectedSource} | ||
display="base" | ||
size="s" | ||
iconType="returnKey" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this empty title is needed here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the default title is
Options
but we don't need a title, so set it to''