Skip to content
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

Fix dynamic uses of i18n and correct duplicate i18n identifiers in console plugin #8393

Merged
merged 2 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelogs/fragments/8393.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fix:
- Fix dynamic uses of i18n and correct duplicate i18n identifiers in console plugin ([#8393](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8393))
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ export const ImportFlyout = ({ close, refresh }: ImportFlyoutProps) => {
} else {
setStatus('error');
setError(
i18n.translate('console.ImportFlyout.importFileErrorMessage', {
i18n.translate('console.ImportFlyout.importFileErrorMessage.notJSON', {
defaultMessage: 'The selected file is not valid. Please select a valid JSON file.',
})
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,14 @@ function EditorUI({ initialTextValue, dataSourceId }: EditorProps) {
});
}, [sendCurrentRequestToOpenSearch, openDocumentation]);

const tooltipDefaultMessage =
dataSourceId === undefined ? `Select a data source` : `Click to send request`;

const toolTipButtonDiasbled = dataSourceId === undefined;
const toolTipButtonDisabled = dataSourceId === undefined;
const sendLabel = toolTipButtonDisabled
? i18n.translate('console.sendRequestButtonTooltip.withoutDataSourceId', {
defaultMessage: 'Select a data source',
})
: i18n.translate('console.sendRequestButtonTooltip', {
defaultMessage: 'Send request',
});

return (
<div style={abs} className="conApp">
Expand All @@ -243,19 +247,13 @@ function EditorUI({ initialTextValue, dataSourceId }: EditorProps) {
responsive={false}
>
<EuiFlexItem>
<EuiToolTip
content={i18n.translate('console.sendRequestButtonTooltip', {
defaultMessage: tooltipDefaultMessage,
})}
>
<EuiToolTip content={sendLabel}>
<button
onClick={sendCurrentRequestToOpenSearch}
data-test-subj="sendRequestButton"
aria-label={i18n.translate('console.sendRequestButtonTooltip', {
defaultMessage: tooltipDefaultMessage,
})}
aria-label={sendLabel}
className="conApp__editorActionButton conApp__editorActionButton--success"
disabled={toolTipButtonDiasbled}
disabled={toolTipButtonDisabled}
>
<EuiIcon type="play" />
</button>
Expand Down
Loading