From d28fdd45498c99ba83a08f8b7b149245bd6cd78c Mon Sep 17 00:00:00 2001 From: Zhongnan Su Date: Mon, 7 Mar 2022 16:45:42 -0800 Subject: [PATCH] update regex to match custom saved object id (#298) Signed-off-by: Zhongnan Su --- .../public/components/context_menu/context_menu.js | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/dashboards-reports/public/components/context_menu/context_menu.js b/dashboards-reports/public/components/context_menu/context_menu.js index 689fff36..e530472f 100644 --- a/dashboards-reports/public/components/context_menu/context_menu.js +++ b/dashboards-reports/public/components/context_menu/context_menu.js @@ -5,7 +5,6 @@ /* eslint-disable no-restricted-globals */ import $ from 'jquery'; -import dateMath from '@elastic/datemath'; import { i18n } from '@osd/i18n'; import { readStreamToFile } from '../main/main_utils'; import { @@ -21,9 +20,7 @@ import { popoverMenuDiscover, getMenuItem, } from './context_menu_ui'; -import { timeRangeMatcher } from '../utils/utils'; import { parse } from 'url'; -import { unhashUrl } from '../../../../../src/plugins/opensearch_dashboards_utils/public'; import { uiSettingsService } from '../utils/settings_service'; const generateInContextReport = async ( @@ -126,11 +123,8 @@ const generateInContextReport = async ( }; // try to match uuid and user entered custom-id followed by '?' in URL, which would be the saved search id for discover URL -// custom id example: v1s-f00-b4r1-01 -const getUuidFromUrl = () => - window.location.href.match( - /([0-9a-z]+-[0-9a-z]+)+\?/ - ); +// custom id example: v1s-f00-b4r1-01, Filebeat-Apache-Dashboard-ecs, +const getUuidFromUrl = () => window.location.href.match(/[0-9a-zA-Z-]+\?/); const isDiscover = () => window.location.href.includes('discover'); // open Download drop-down