Skip to content

Commit

Permalink
Fix eslint errors
Browse files Browse the repository at this point in the history
Signed-off-by: Danila Gulderov <[email protected]>
  • Loading branch information
gulderov committed Mar 5, 2024
1 parent b8f3448 commit 67ee569
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 14 deletions.
37 changes: 24 additions & 13 deletions public/components/context_menu/context_menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,16 +175,20 @@ $(function () {
$(document).on('click', '#generateCSV', function () {
const timeRanges = getTimeFieldsFromUrl();
const queryUrl = replaceQueryURL(location.href);
const saved_search_id = getUuidFromUrl()[1];
generateInContextReport(timeRanges, queryUrl, 'csv', { saved_search_id });
const savedSearchId = getUuidFromUrl()[1];
generateInContextReport(timeRanges, queryUrl, 'csv', {
saved_search_id: savedSearchId,
});
});

// generate XLSX onclick
$(document).on('click', '#generateXLSX', function () {
const timeRanges = getTimeFieldsFromUrl();
const queryUrl = replaceQueryURL(location.href);
const saved_search_id = getUuidFromUrl()[1];
generateInContextReport(timeRanges, queryUrl, 'xlsx', { saved_search_id });
const savedSearchId = getUuidFromUrl()[1];
generateInContextReport(timeRanges, queryUrl, 'xlsx', {
saved_search_id: savedSearchId,
});
});

// navigate to Create report definition page with report source and pre-set time range
Expand Down Expand Up @@ -237,8 +241,8 @@ $(function () {
});

/* generate a report if flagged in URL params */
const checkURLParams = async () => {
const [hash, query] = location.href.split('#')[1].split('?');
async function checkURLParams() {
const [hash, query] = location.href.split('#')[1]?.split('?');
const params = new URLSearchParams(query);
const id = params.get(GENERATE_REPORT_PARAM);
if (!id) return;
Expand All @@ -258,7 +262,7 @@ const checkURLParams = async () => {
} finally {
$('#reportGenerationProgressModal').remove();
}
};
}

const isDiscoverNavMenu = (navMenu) => {
return (
Expand All @@ -284,7 +288,7 @@ const isVisualizationNavMenu = (navMenu) => {
};

function locationHashChanged() {
const observer = new MutationObserver(function (mutations) {
const observer = new MutationObserver(function () {
const navMenu = document.querySelectorAll(
'nav.euiHeaderLinks > div.euiHeaderLinks__list'
);
Expand All @@ -300,6 +304,7 @@ function locationHashChanged() {
return;
}
const menuItem = document.createElement('div');
// eslint-disable-next-line no-unsanitized/property
menuItem.innerHTML = getMenuItem(
i18n.translate('opensearch.reports.menu.name', {
defaultMessage: 'Reporting',
Expand All @@ -322,7 +327,7 @@ function locationHashChanged() {
});
}

$(window).one('hashchange', function (e) {
$(window).one('hashchange', function () {
locationHashChanged();
});
/**
Expand All @@ -343,10 +348,16 @@ window.onpopstate = history.onpushstate = () => {
locationHashChanged();
};

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

if (window.location.href.includes('/data-explorer/discover')) {
return '../../api';
}

return '../api';
}

async function getTenantInfoIfExists() {
Expand Down
5 changes: 4 additions & 1 deletion public/components/context_menu/context_menu_ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,10 @@ export const popoverMenuDiscover = (savedObjectAvailable) => {
<${button} class="${buttonClass}" type="button" data-test-subj="downloadPanel-GeneratePDF" id="generateXLSX">
<span data-html2canvas-ignore class="euiContextMenu__itemLayout">
<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" class="euiIcon euiIcon--medium euiIcon-isLoaded euiContextMenu__icon" focusable="false" role="img" aria-hidden="true"><path d="M9 9.114l1.85-1.943a.52.52 0 01.77 0c.214.228.214.6 0 .829l-1.95 2.05a1.552 1.552 0 01-2.31 0L5.41 8a.617.617 0 010-.829.52.52 0 01.77 0L8 9.082V.556C8 .249 8.224 0 8.5 0s.5.249.5.556v8.558z"></path><path d="M16 13.006V10h-1v3.006a.995.995 0 01-.994.994H3.01a.995.995 0 01-.994-.994V10h-1v3.006c0 1.1.892 1.994 1.994 1.994h10.996c1.1 0 1.994-.893 1.994-1.994z"></path></svg>
<span data-html2canvas-ignore class="euiContextMenuItem__text">${i18n.translate('opensearch.reports.menu.csv.generateXLSX', { defaultMessage: 'Generate XLSX' })}</span>
<span data-html2canvas-ignore class="euiContextMenuItem__text">${i18n.translate(
'opensearch.reports.menu.csv.generateXLSX',
{ defaultMessage: 'Generate XLSX' }
)}</span>
</span>
</button>
</div>
Expand Down

0 comments on commit 67ee569

Please sign in to comment.