fix: check for desktop

This commit is contained in:
Jingjing Xie
2021-07-07 14:15:24 +02:00
parent c888dd9fe4
commit cca315efbb

View File

@@ -2,7 +2,6 @@ import definition from "./definition";
import { exportXLS } from "./excel-export";
import { initializeDataCube, initializeDesignList } from "./dataset";
import initializeStore from "./store";
import qlik from "qlik";
import React from "react";
import ReactDOM from "react-dom";
import Root from "./root.jsx";
@@ -110,13 +109,17 @@ export default ({ flags }) => ({
return menu;
}
// Export as XLS is removed from desktop because the desktop wrapper blocks downloads.
// isPersonalMode returns true for both desktop and QCS
// By checking both if has download dialog and if is QCS can enable Export as XLS option on QCS
const app = qlik.currApp(this);
const app = this.backendApi.model.app;
const isPersonalResult = await app.global.isPersonalMode();
if (this.backendApi.model.layout.qMeta.privileges.indexOf('exportdata') !== -1 || (flags.isEnabled('DOWNLOAD_USE_REPORTING') && isPersonalResult && isPersonalResult.qReturn)) {
// Export as XLS option is removed from desktop because the desktop wrapper blocks downloads.
// Enabled for windows and QCS
// isPersonalMode returns true for both desktop and QCS
// By checking both if has download dialog and if is QCS can enable Export as XLS option on QCS
if (
(this.backendApi.model.layout.qMeta.privileges.includes('exportdata') && !isPersonalResult) ||
(flags.isEnabled('DOWNLOAD_USE_REPORTING') && isPersonalResult)
) {
menu.addItem({
translation: 'Export as XLS',
tid: 'export-excel',