Skip to content

Commit

Permalink
Fix dynamic uses of i18n and correct duplicate i18n identifiers in co…
Browse files Browse the repository at this point in the history
…nsole plugin (opensearch-project#8393)

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

Signed-off-by: Miki <[email protected]>

* Changeset file for PR opensearch-project#8393 created/updated

---------

Signed-off-by: Miki <[email protected]>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
  • Loading branch information
1 parent 03ec9b9 commit 391e2ac
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
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

0 comments on commit 391e2ac

Please sign in to comment.