Skip to content

Commit

Permalink
[Search] update copy for try in console button, to Run in Console (el…
Browse files Browse the repository at this point in the history
…astic#190412)

## Summary

Updated the default copy for "Try in Console" to be "Run in Console"
instead.

### Screenshots
<img width="716" alt="image"
src="https://github.com/user-attachments/assets/ccd102ec-4732-429f-bb7b-76c157481c09">

### Checklist

- [x] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
  • Loading branch information
TattdCodeMonkey authored Aug 13, 2024
1 parent 1934584 commit be2b853
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ describe('TryInConsoleButton', () => {
const wrapper = render(<TryInConsoleButton {...defaultProps(props)} />);

expect(wrapper.getByTestId('tryInConsoleButton')).toBeTruthy();
expect(wrapper.getByRole('button')).toHaveTextContent('Try in Console');
expect(wrapper.getByRole('button')).toHaveTextContent('Run in Console');
expect(mockLocatorUseUrl).toHaveBeenCalledWith(
{
loadFrom: 'data:text/plain,OIUQKgBA9A+gzgFwIYLkA',
Expand All @@ -87,7 +87,7 @@ describe('TryInConsoleButton', () => {
const wrapper = render(<TryInConsoleButton {...defaultProps(props)} />);

expect(wrapper.getByTestId('tryInConsoleLink')).toBeTruthy();
expect(wrapper.getByRole('button')).toHaveTextContent('Try in Console');
expect(wrapper.getByRole('button')).toHaveTextContent('Run in Console');
});
it('renders null if dev tools are unavailable', async () => {
const props: Partial<TryInConsoleButtonProps> = {
Expand Down Expand Up @@ -153,15 +153,15 @@ describe('TryInConsoleButton', () => {
const props: Partial<TryInConsoleButtonProps> = { request: 'GET /_stats' };
render(<TryInConsoleButton {...defaultProps(props)} />);

fireEvent.click(screen.getByText('Try in Console'));
fireEvent.click(screen.getByText('Run in Console'));

expect(windowOpenSpy).toHaveBeenCalledTimes(1);
expect(windowOpenSpy).toHaveBeenCalledWith('/app/test/dev_tools', '_blank', 'noreferrer');
});
it('can open in new tab without data', async () => {
render(<TryInConsoleButton {...defaultProps({})} />);

fireEvent.click(screen.getByText('Try in Console'));
fireEvent.click(screen.getByText('Run in Console'));

expect(mockLocatorUseUrl).toHaveBeenCalledWith({}, undefined, [undefined]);
expect(windowOpenSpy).toHaveBeenCalledTimes(1);
Expand All @@ -175,7 +175,7 @@ describe('TryInConsoleButton', () => {
/>
);

fireEvent.click(screen.getByText('Try in Console'));
fireEvent.click(screen.getByText('Run in Console'));

expect(windowOpenSpy).toHaveBeenCalledTimes(0);
expect(mockConsole.openEmbeddedConsole).toHaveBeenCalledTimes(1);
Expand All @@ -185,7 +185,7 @@ describe('TryInConsoleButton', () => {
mockConsole.isEmbeddedConsoleAvailable.mockReturnValue(false);
render(<TryInConsoleButton {...defaultProps({ consolePlugin: mockConsole })} />);

fireEvent.click(screen.getByText('Try in Console'));
fireEvent.click(screen.getByText('Run in Console'));

expect(windowOpenSpy).toHaveBeenCalledTimes(1);
expect(mockConsole.openEmbeddedConsole).toHaveBeenCalledTimes(0);
Expand Down
12 changes: 7 additions & 5 deletions packages/kbn-try-in-console/components/try_in_console_button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ import type { ConsolePluginStart } from '@kbn/console-plugin/public';
import { i18n } from '@kbn/i18n';
import { compressToEncodedURIComponent } from 'lz-string';

const TRY_IN_CONSOLE = i18n.translate('tryInConsole.button', { defaultMessage: 'Try in Console' });
const RUN_IN_CONSOLE = i18n.translate('tryInConsole.button.text', {
defaultMessage: 'Run in Console',
});

export interface TryInConsoleButtonProps {
request?: string;
Expand All @@ -32,7 +34,7 @@ export const TryInConsoleButton = ({
application,
consolePlugin,
sharePlugin,
content = TRY_IN_CONSOLE,
content = RUN_IN_CONSOLE,
showIcon = true,
type = 'emptyButton',
}: TryInConsoleButtonProps) => {
Expand Down Expand Up @@ -70,11 +72,11 @@ export const TryInConsoleButton = ({
consolePlugin?.isEmbeddedConsoleAvailable?.()
) {
return i18n.translate('tryInConsole.embeddedConsoleButton.ariaLabel', {
defaultMessage: 'Try in Console - opens in embedded console',
defaultMessage: 'Run in Console - opens in embedded console',
});
}
return i18n.translate('tryInConsole.inNewTab.button.ariaLabel', {
defaultMessage: 'Try in Console - opens in a new tab',
defaultMessage: 'Run in Console - opens in a new tab',
});
};

Expand All @@ -83,7 +85,7 @@ export const TryInConsoleButton = ({
'aria-label': getAriaLabel(),
onClick,
};
const iconType = showIcon ? 'popout' : undefined;
const iconType = showIcon ? 'play' : undefined;

switch (type) {
case 'link':
Expand Down
1 change: 0 additions & 1 deletion x-pack/plugins/translations/translations/fr-FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -7697,7 +7697,6 @@
"timelion.vis.invalidIntervalErrorMessage": "Format d'intervalle non valide.",
"timelion.vis.selectIntervalHelpText": "Choisissez une option ou créez une valeur personnalisée. Exemples : 30s, 20m, 24h, 2d, 1w, 1M",
"timelion.vis.selectIntervalPlaceholder": "Choisir un intervalle",
"tryInConsole.button": "Essayer dans la console",
"uiActions.actionPanel.more": "Plus",
"uiActions.actionPanel.title": "Options",
"uiActions.errors.incompatibleAction": "Action non compatible",
Expand Down
1 change: 0 additions & 1 deletion x-pack/plugins/translations/translations/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -7691,7 +7691,6 @@
"timelion.vis.invalidIntervalErrorMessage": "無効な間隔フォーマット。",
"timelion.vis.selectIntervalHelpText": "オプションを選択するかカスタム値を作成します。例:30s、20m、24h、2d、1w、1M",
"timelion.vis.selectIntervalPlaceholder": "間隔を選択",
"tryInConsole.button": "コンソールで試す",
"uiActions.actionPanel.more": "詳細",
"uiActions.actionPanel.title": "オプション",
"uiActions.errors.incompatibleAction": "操作に互換性がありません",
Expand Down
1 change: 0 additions & 1 deletion x-pack/plugins/translations/translations/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -7704,7 +7704,6 @@
"timelion.vis.invalidIntervalErrorMessage": "时间间隔格式无效。",
"timelion.vis.selectIntervalHelpText": "选择选项或创建定制值。示例:30s、20m、24h、2d、1w、1M",
"timelion.vis.selectIntervalPlaceholder": "选择时间间隔",
"tryInConsole.button": "在 Console 中试用",
"uiActions.actionPanel.more": "更多",
"uiActions.actionPanel.title": "选项",
"uiActions.errors.incompatibleAction": "操作不兼容",
Expand Down

0 comments on commit be2b853

Please sign in to comment.