-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5986 from gooddata/SHA_master
fix: ui for new exports
- Loading branch information
Showing
23 changed files
with
313 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
libs/sdk-ui-dashboard/src/model/commandHandlers/widgets/exportSlidesInsightWidgetHandler.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// (C) 2024-2025 GoodData Corporation | ||
import { SagaIterator } from "redux-saga"; | ||
import { call, select } from "redux-saga/effects"; | ||
import { IExportResult } from "@gooddata/sdk-backend-spi"; | ||
import { DashboardInsightWidgetExportResolved, insightWidgetExportResolved } from "../../events/insight.js"; | ||
import { DashboardContext } from "../../types/commonTypes.js"; | ||
import { PromiseFnReturnType } from "../../types/sagas.js"; | ||
import { invalidArgumentsProvided } from "../../events/general.js"; | ||
import { selectFilterContextFilters } from "../../store/filterContext/filterContextSelectors.js"; | ||
import { selectDashboardRef } from "../../store/meta/metaSelectors.js"; | ||
import { ensureAllTimeFilterForExport } from "../../../_staging/exportUtils/filterUtils.js"; | ||
import { ExportSlidesInsightWidget } from "../../commands/insight.js"; | ||
|
||
export function* exportSlidesInsightWidgetHandler( | ||
ctx: DashboardContext, | ||
cmd: ExportSlidesInsightWidget, | ||
): SagaIterator<DashboardInsightWidgetExportResolved> { | ||
const { ref, filename, exportType } = cmd.payload; | ||
const { workspace, backend } = ctx; | ||
|
||
const dashboardRef = yield select(selectDashboardRef); | ||
if (!dashboardRef) { | ||
throw invalidArgumentsProvided(ctx, cmd, "Dashboard to export to EXCEL must have an ObjRef."); | ||
} | ||
const filterContextFilters = yield select(selectFilterContextFilters); | ||
const effectiveFilters = ensureAllTimeFilterForExport(filterContextFilters); | ||
|
||
const exportDashboardToPresentation = backend | ||
.workspace(workspace) | ||
.dashboards().exportDashboardToPresentation; | ||
const result: PromiseFnReturnType<typeof exportDashboardToPresentation> = yield call( | ||
exportDashboardToPresentation, | ||
dashboardRef, | ||
exportType === "pptx" ? "PPTX" : "PDF", | ||
effectiveFilters, | ||
{ | ||
widgetIds: [ref], | ||
filename, | ||
}, | ||
); | ||
// prepend hostname if provided so that the results are downloaded from there, not from where the app is hosted | ||
const fullUri = ctx.backend.config.hostname | ||
? new URL(result.uri, ctx.backend.config.hostname).href | ||
: result.uri; | ||
const sanitizedResult: IExportResult = { | ||
...result, | ||
uri: fullUri, | ||
}; | ||
return insightWidgetExportResolved(ctx, sanitizedResult, cmd.correlationId); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.