From 4da1ff9ef983231a002e97c3e307b0dd1aced37d Mon Sep 17 00:00:00 2001 From: felmer <franz-josef.elmer@id.ethz.ch> Date: Wed, 16 Feb 2022 14:44:01 +0100 Subject: [PATCH] SSDM-12312: extraToolActions handled, convenient function 'createReport' added --- .../html/js/controllers/MainController.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/controllers/MainController.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/controllers/MainController.js index a9f7408bd34..4910bb7bda0 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/controllers/MainController.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/controllers/MainController.js @@ -1023,6 +1023,25 @@ function MainController(profile) { FormUtil.downloadMetadataTemplateDialog(); }, "Download metadata.json template"); $header.append(FormUtil.getToolbar([{ component : $downloadMetadataTemplateButton }])); + if (profile.extraToolActions) { + profile.extraToolActions.forEach(function(actionDefinition) { + var $actionButton = FormUtil.getButtonWithText(actionDefinition.label, actionDefinition.action); + $header.append(FormUtil.getToolbar([{ component : $actionButton }])); + }); + } + } + + this.createReport = function(reportDefinition) { + var parameters = reportDefinition.parameters ? reportDefinition.parameters : {}; + mainController.serverFacade.customASService(parameters, function(result){ + var link = document.createElement('a'); + var mimeType = reportDefinition.mimeType ? reportDefinition.mimeType : "text/plain"; + link.href = "data:" + mimeType + ";" + (reportDefinition.binary ? "base64," : ",") + result; + link.download = reportDefinition.filename; + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); + }, reportDefinition.service); } -- GitLab