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 url parsing #353

Merged
merged 1 commit into from
May 7, 2024
Merged
Changes from all commits
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
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 @@ -87,7 +87,7 @@
};

fetch(
`${getApiPath()}/reporting/generateReport?${new URLSearchParams(

Check failure on line 90 in public/components/context_menu/context_menu.js

View workflow job for this annotation

GitHub Actions / Lint

'getApiPath' was used before it was defined
uiSettingsService.getSearchParams()
)}`,
{
Expand Down Expand Up @@ -175,7 +175,7 @@
$(document).on('click', '#generateCSV', function () {
const timeRanges = getTimeFieldsFromUrl();
const queryUrl = replaceQueryURL(location.href);
const saved_search_id = getUuidFromUrl()[1];

Check failure on line 178 in public/components/context_menu/context_menu.js

View workflow job for this annotation

GitHub Actions / Lint

Identifier 'saved_search_id' is not in camel case
generateInContextReport(timeRanges, queryUrl, 'csv', { saved_search_id });
});

Expand All @@ -183,7 +183,7 @@
$(document).on('click', '#generateXLSX', function () {
const timeRanges = getTimeFieldsFromUrl();
const queryUrl = replaceQueryURL(location.href);
const saved_search_id = getUuidFromUrl()[1];

Check failure on line 186 in public/components/context_menu/context_menu.js

View workflow job for this annotation

GitHub Actions / Lint

Identifier 'saved_search_id' is not in camel case
generateInContextReport(timeRanges, queryUrl, 'xlsx', { saved_search_id });
});

Expand Down Expand Up @@ -232,12 +232,13 @@
});
});

checkURLParams();

Check failure on line 235 in public/components/context_menu/context_menu.js

View workflow job for this annotation

GitHub Actions / Lint

'checkURLParams' was used before it was defined
locationHashChanged();
});

/* generate a report if flagged in URL params */
const checkURLParams = async () => {
if (!location.href.includes('#')) return;
const [hash, query] = location.href.split('#')[1].split('?');
const params = new URLSearchParams(query);
const id = params.get(GENERATE_REPORT_PARAM);
Expand Down Expand Up @@ -284,7 +285,7 @@
};

function locationHashChanged() {
const observer = new MutationObserver(function (mutations) {

Check failure on line 288 in public/components/context_menu/context_menu.js

View workflow job for this annotation

GitHub Actions / Lint

'mutations' is defined but never used. Allowed unused args must match /^_/u

Check failure on line 288 in public/components/context_menu/context_menu.js

View workflow job for this annotation

GitHub Actions / Lint

'mutations' is defined but never used
const navMenu = document.querySelectorAll(
'nav.euiHeaderLinks > div.euiHeaderLinks__list'
);
Expand All @@ -300,7 +301,7 @@
return;
}
const menuItem = document.createElement('div');
menuItem.innerHTML = getMenuItem(

Check failure on line 304 in public/components/context_menu/context_menu.js

View workflow job for this annotation

GitHub Actions / Lint

Unsafe assignment to innerHTML
i18n.translate('opensearch.reports.menu.name', {
defaultMessage: 'Reporting',
})
Expand All @@ -322,7 +323,7 @@
});
}

$(window).one('hashchange', function (e) {

Check failure on line 326 in public/components/context_menu/context_menu.js

View workflow job for this annotation

GitHub Actions / Lint

'e' is defined but never used. Allowed unused args must match /^_/u

Check failure on line 326 in public/components/context_menu/context_menu.js

View workflow job for this annotation

GitHub Actions / Lint

'e' is defined but never used
locationHashChanged();
});
/**
Expand All @@ -344,7 +345,7 @@
};

const getApiPath = () => {
if (window.location.href.includes('/data-explorer/discover/')) return '../../../api'

Check failure on line 348 in public/components/context_menu/context_menu.js

View workflow job for this annotation

GitHub Actions / Lint

Replace `·return·'../../../api'` with `⏎····return·'../../../api';`
if (window.location.href.includes('/data-explorer/discover')) return '../../api'
return '../api'
}
Expand Down
Loading