diff --git a/public/components/context_menu/context_menu.js b/public/components/context_menu/context_menu.js index 36cc142f..f587ab6e 100644 --- a/public/components/context_menu/context_menu.js +++ b/public/components/context_menu/context_menu.js @@ -336,6 +336,7 @@ window.onpopstate = history.onpushstate = () => { }; const getApiPath = () => { + if (window.location.href.includes('/data-explorer/discover/')) return '../../../api' if (window.location.href.includes('/data-explorer/discover')) return '../../api' return '../api' } diff --git a/public/components/context_menu/context_menu_helpers.js b/public/components/context_menu/context_menu_helpers.js index 3ebe5d76..1a1e9959 100644 --- a/public/components/context_menu/context_menu_helpers.js +++ b/public/components/context_menu/context_menu_helpers.js @@ -26,7 +26,7 @@ export const contextMenuViewReports = () => export const getTimeFieldsFromUrl = () => { const url = unhashUrl(window.location.href); - let [, fromDateString, toDateString] = url.match(timeRangeMatcher); + let [, fromDateString, toDateString] = url.match(timeRangeMatcher) ?? ["", "now-15m", "now"]; fromDateString = decodeURIComponent(fromDateString.replace(/[']+/g, '')); // convert time range to from date format in case time range is relative const fromDateFormat = dateMath.parse(fromDateString);