diff --git a/packages/builder/src/pages/builder/portal/account/auditLogs/index.svelte b/packages/builder/src/pages/builder/portal/account/auditLogs/index.svelte index 4459eb12a5..125a67a03d 100644 --- a/packages/builder/src/pages/builder/portal/account/auditLogs/index.svelte +++ b/packages/builder/src/pages/builder/portal/account/auditLogs/index.svelte @@ -21,6 +21,7 @@ import UserRenderer from "./_components/UserRenderer.svelte" import TimeRenderer from "./_components/TimeRenderer.svelte" import AppColumnRenderer from "./_components/AppColumnRenderer.svelte" + import download from "downloadjs" const schema = { date: { width: "0.8fr" }, @@ -167,16 +168,29 @@ selectedLog = detail sidePanelVisible = true } + async function exportView() { + try { + const data = await API.exportView({ + viewName: view, + format: exportFormat, + }) + } catch (error) { + notifications.error(`Unable to export ${exportFormat.toUpperCase()} data`) + } + } const downloadLogs = async () => { try { - await auditLogs.download({ + let response = await auditLogs.downloadLogs({ startDate, endDate, - metadataSearch: logSearchTerm, + fullSearch: logSearchTerm, userIds: selectedUsers, appIds: selectedApps, + events: selectedEvents, }) + + // DO SOMETHING HERE??????????? } catch (error) { notifications.error(`Error downloading logs: ` + error.message) } @@ -193,6 +207,7 @@ onMount(async () => { await auditLogs.getEventDefinitions() + await licensing.init() }) @@ -214,7 +229,6 @@ range={true} label="Date Range" on:change={e => { - console.log(e) if (e.detail[0]?.length === 1) { startDate = e.detail[0][0].toISOString() } else if (e.detail[0]?.length > 1) { @@ -263,8 +277,11 @@ /> -
- downloadLogs()} name="Download" /> +
downloadLogs()} + style="padding-bottom: var(--spacing-s)" + > +
diff --git a/packages/frontend-core/src/api/auditLogs.js b/packages/frontend-core/src/api/auditLogs.js index 867644c23c..08e14328a1 100644 --- a/packages/frontend-core/src/api/auditLogs.js +++ b/packages/frontend-core/src/api/auditLogs.js @@ -8,7 +8,7 @@ const buildOpts = ({ events, }) => { const opts = {} - + if (bookmark) { opts.bookmark = bookmark } @@ -35,7 +35,7 @@ const buildOpts = ({ if (appIds.length) { opts.appIds = appIds } - + console.log(opts) return opts } @@ -58,7 +58,7 @@ export const buildAuditLogsEndpoints = API => ({ downloadLogs: async opts => { return await API.post({ - url: `/api/global/auditlogs/definitions`, + url: `/api/global/auditlogs/download`, body: buildOpts(opts), }) },