From 81cab738417d16b7a068172d5d69cbd73c558734 Mon Sep 17 00:00:00 2001 From: Jincheng Wan <45655760+Kapian1234@users.noreply.github.com> Date: Mon, 30 Sep 2024 15:59:21 +0800 Subject: [PATCH] [Workspace] Redirect "Sample data" link to the page in the same workspace (#8330) * Redirect Sample data link to the page in the same workspace Signed-off-by: Kapian1234 * Changeset file for PR #8330 created/updated * Optimize the code Signed-off-by: Kapian1234 * Update unit test Signed-off-by: Kapian1234 * Update unit test Signed-off-by: Kapian1234 * Update unit test Signed-off-by: Kapian1234 * update snapshot Signed-off-by: Kapian1234 --------- Signed-off-by: Kapian1234 Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com> --- changelogs/fragments/8330.yml | 2 ++ .../application/utils/get_no_items_message.test.tsx | 3 ++- .../public/application/utils/get_no_items_message.tsx | 8 +------- 3 files changed, 5 insertions(+), 8 deletions(-) create mode 100644 changelogs/fragments/8330.yml diff --git a/changelogs/fragments/8330.yml b/changelogs/fragments/8330.yml new file mode 100644 index 000000000000..7aa37214ecd0 --- /dev/null +++ b/changelogs/fragments/8330.yml @@ -0,0 +1,2 @@ +fix: +- Redirect sample data link to the page in the same workspace ([#8330](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8330)) \ No newline at end of file diff --git a/src/plugins/dashboard/public/application/utils/get_no_items_message.test.tsx b/src/plugins/dashboard/public/application/utils/get_no_items_message.test.tsx index 785e1d334b80..6b06a4dc8498 100644 --- a/src/plugins/dashboard/public/application/utils/get_no_items_message.test.tsx +++ b/src/plugins/dashboard/public/application/utils/get_no_items_message.test.tsx @@ -31,6 +31,7 @@ describe('dashboard listing table with no item', () => { expect(component).toMatchSnapshot(); component.find(EuiLink).simulate('click'); - expect(application.navigateToApp).toHaveBeenCalledTimes(1); + + expect(application.navigateToApp).toHaveBeenCalledWith('import_sample_data'); }); }); diff --git a/src/plugins/dashboard/public/application/utils/get_no_items_message.tsx b/src/plugins/dashboard/public/application/utils/get_no_items_message.tsx index 15f97ceb6130..e9bcae1587d1 100644 --- a/src/plugins/dashboard/public/application/utils/get_no_items_message.tsx +++ b/src/plugins/dashboard/public/application/utils/get_no_items_message.tsx @@ -59,13 +59,7 @@ export const getNoItemsMessage = ( defaultMessage="New to OpenSearch Dashboards? {sampleDataInstallLink} to take a test drive." values={{ sampleDataInstallLink: ( - - application.navigateToApp('home', { - path: '#/tutorial_directory/sampleData', - }) - } - > + application.navigateToApp('import_sample_data')}>