Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix reporting discover #190

Merged
merged 4 commits into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion public/components/context_menu/context_menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ const generateInContextReport = async (
reportSource = 'Saved search';
}

console.log( `${getApiPath()}/reporting/generateReport?${new URLSearchParams(
uiSettingsService.getSearchParams()
)}`)

// create query body
const contextMenuOnDemandReport = {
query_url: queryUrl,
Expand Down Expand Up @@ -87,7 +91,7 @@ const generateInContextReport = async (
};

fetch(
`${getApiPath()}/reporting/generateReport?${new URLSearchParams(
`../api/reporting/generateReport?${new URLSearchParams(
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is something wrong here - getApiPath is returning two different things for discover 1.0 and discover 2.0, causing reporting to fail when in new discover, need to look into this

uiSettingsService.getSearchParams()
)}`,
{
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