Skip to content

Commit

Permalink
Fix reporting discover (#190)
Browse files Browse the repository at this point in the history
* Fix reporting discover

Signed-off-by: Derek Ho <[email protected]>

* Get it to work

Signed-off-by: Derek Ho <[email protected]>

* Revert api file and add extra quote for regex matching

Signed-off-by: Derek Ho <[email protected]>

* Add extra condition if coming from dashboards management

Signed-off-by: Derek Ho <[email protected]>

---------

Signed-off-by: Derek Ho <[email protected]>
  • Loading branch information
derek-ho authored Sep 19, 2023
1 parent 379adef commit 2d643cc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions public/components/context_menu/context_menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
Expand Down
2 changes: 1 addition & 1 deletion public/components/context_menu/context_menu_helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 2d643cc

Please sign in to comment.