From 6e3f9d55badba72e2e4c58f112a8e8d05bb06d3d Mon Sep 17 00:00:00 2001 From: delageniere Date: Thu, 9 May 2019 18:15:34 +0200 Subject: [PATCH 1/3] new button to send PDF report --- .../mx/datacollectiondataadapter.js | 9 +++ .../grid/mxdatacollectiongrid.js | 15 ++++- mx/dev.html | 2 + saxs/dev.html | 2 + test/dev.html | 57 ++++++++++++++++--- tracking/dev.html | 57 ++++++++++++++++--- 6 files changed, 127 insertions(+), 15 deletions(-) diff --git a/js/ispyb-client/mx/datacollectiondataadapter.js b/js/ispyb-client/mx/datacollectiondataadapter.js index 30d6d4a91..946313112 100644 --- a/js/ispyb-client/mx/datacollectiondataadapter.js +++ b/js/ispyb-client/mx/datacollectiondataadapter.js @@ -103,6 +103,15 @@ DataCollectionDataAdapter.prototype.getReportURLBySessionId = function(sessionId }; +/** +* This method sends by email the PDF report for the session +* @method sendPdfReport +*/ +DataCollectionDataAdapter.prototype.sendPdfReport = function(sessionId){ + var url = ('/{token}/proposal/{proposal}/mx/datacollection/session/{0}/report/send/pdf'.format([sessionId])); + return this.getUrl(url); +}; + /** * This method downloads a RTF report for the session * @method getRtfReportURLBySessionId diff --git a/js/mx/view/datacollection/grid/mxdatacollectiongrid.js b/js/mx/view/datacollection/grid/mxdatacollectiongrid.js index 50b719e14..93a961c68 100644 --- a/js/mx/view/datacollection/grid/mxdatacollectiongrid.js +++ b/js/mx/view/datacollection/grid/mxdatacollectiongrid.js @@ -123,7 +123,7 @@ MXDataCollectionGrid.prototype.getToolBar = function() { } } }, - { + { text: " RTF summary", id : 'rtfBtn', tooltip: 'Download Session Summary Report as RTF', @@ -156,6 +156,18 @@ MXDataCollectionGrid.prototype.getToolBar = function() { } } }, + { + text: " Send Report", + id : 'sendPdfBtn', + tooltip: 'Send Session Summary Report as PDF', + margin: '1 0 1 2', + handler : function(){ + if (_this.sendPdfUrl != null){ + location.href = _this.sendPdfUrl; + } + } + }, + '->', { html: ' Best results', @@ -244,6 +256,7 @@ MXDataCollectionGrid.prototype.load = function(dataCollectionGroup) { this.rtfUrl = EXI.getDataAdapter().mx.dataCollection.getRtfReportURLBySessionId(sessionId); this.pdfAnalysisUrl = EXI.getDataAdapter().mx.dataCollection.getAnalysisReportURLBySessionId(sessionId); this.rtfAnalysisUrl = EXI.getDataAdapter().mx.dataCollection.getRtfAnalysisReportURLBySessionId(sessionId); + this.sendPdfUrl = EXI.getDataAdapter().mx.dataCollection.sendPdfReport(sessionId); } }; diff --git a/mx/dev.html b/mx/dev.html index 59432b903..60079886a 100644 --- a/mx/dev.html +++ b/mx/dev.html @@ -33,6 +33,7 @@ + @@ -49,6 +50,7 @@ + diff --git a/saxs/dev.html b/saxs/dev.html index 90798544e..b09f490b6 100644 --- a/saxs/dev.html +++ b/saxs/dev.html @@ -35,6 +35,7 @@ + @@ -51,6 +52,7 @@ + diff --git a/test/dev.html b/test/dev.html index f331e9362..3e27eee3c 100644 --- a/test/dev.html +++ b/test/dev.html @@ -35,6 +35,7 @@ + @@ -51,6 +52,7 @@ + @@ -60,16 +62,57 @@ - + + + + + + - - - - - view-source:http://lindemaria:8082/EXI/test/dev.html#/welcome - + + + + + + + + + + + + + + + + + + + + + + + + + + view-source:http://lindemaria:8082/EXI/test/dev.html#/welcome + + + + + + + + + + + + + + + + diff --git a/tracking/dev.html b/tracking/dev.html index 3c8b003bd..b28a1ab7c 100644 --- a/tracking/dev.html +++ b/tracking/dev.html @@ -32,6 +32,7 @@ + @@ -48,6 +49,7 @@ + @@ -57,16 +59,57 @@ - + + + + + + - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 80bcc249ac26160981f29b200a40a8ee752cb92c Mon Sep 17 00:00:00 2001 From: delageniere Date: Mon, 13 May 2019 17:26:24 +0200 Subject: [PATCH 2/3] add a condition for FX --- .../grid/mxdatacollectiongrid.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/js/mx/view/datacollection/grid/mxdatacollectiongrid.js b/js/mx/view/datacollection/grid/mxdatacollectiongrid.js index 93a961c68..caac173e2 100644 --- a/js/mx/view/datacollection/grid/mxdatacollectiongrid.js +++ b/js/mx/view/datacollection/grid/mxdatacollectiongrid.js @@ -32,6 +32,8 @@ MXDataCollectionGrid.prototype.getPanel = function(dataCollectionGroup) { MXDataCollectionGrid.prototype.getToolBar = function() { var _this = this; + + //var proposalCode = this.proposal.Proposal_proposalCode; function onMenuClicked(widget) { if (_this.activePanel != widget) { @@ -42,9 +44,7 @@ MXDataCollectionGrid.prototype.getToolBar = function() { _this.reloadData(_this.dataCollectionGroup); } } - } - - + } return Ext.create('Ext.toolbar.Toolbar', { width: 500, @@ -155,12 +155,21 @@ MXDataCollectionGrid.prototype.getToolBar = function() { location.href = _this.rtfAnalysisUrl; } } - }, - { + }, + { text: " Send Report", id : 'sendPdfBtn', tooltip: 'Send Session Summary Report as PDF', margin: '1 0 1 2', + hidden: true, +/** function(){ + if (_this.proposalCode == 'FX'){ + false; + } else { + true; + } + }, +**/ handler : function(){ if (_this.sendPdfUrl != null){ location.href = _this.sendPdfUrl; From f5f3945f5a7c8f152cf5ecafe1d8cd9fd0f5ae66 Mon Sep 17 00:00:00 2001 From: delageniere Date: Wed, 15 May 2019 17:45:24 +0200 Subject: [PATCH 3/3] display send report only for FX --- js/core/security/credentialmanager.js | 1 + .../controller/mxdatacollectioncontroller.js | 21 +++++--------- .../datacollectionmxmainview.js | 7 +++-- .../grid/mxdatacollectiongrid.js | 28 +++++++++++-------- 4 files changed, 29 insertions(+), 28 deletions(-) diff --git a/js/core/security/credentialmanager.js b/js/core/security/credentialmanager.js index 442c63b8e..505553e14 100644 --- a/js/core/security/credentialmanager.js +++ b/js/core/security/credentialmanager.js @@ -160,3 +160,4 @@ CredentialManager.prototype.setActiveProposal = function(username, proposal){ } }; + diff --git a/js/mx/controller/mxdatacollectioncontroller.js b/js/mx/controller/mxdatacollectioncontroller.js index 9b5af0826..58a47655b 100644 --- a/js/mx/controller/mxdatacollectioncontroller.js +++ b/js/mx/controller/mxdatacollectioncontroller.js @@ -23,9 +23,6 @@ MxDataCollectionController.prototype.notFound = ExiGenericController.prototype.n MxDataCollectionController.prototype.init = function() { var _this = this; var listView; - - - Path.map("#/mx/datacollection/protein_acronym/:acronmys/main").to(function() { var mainView = new DataCollectionMxMainView(); EXI.addMainPanel(mainView); @@ -39,7 +36,8 @@ MxDataCollectionController.prototype.init = function() { Path.map("#/mx/proposal/:proposal/datacollection/session/:sessionId/main").to(function() { - var redirection = "#/mx/datacollection/session/" + this.params['sessionId'] +"/main"; + var redirection = "#/mx/datacollection/session/" + this.params['sessionId'] +"/main"; + this.proposal = this.params['proposal']; /** Are we logged in yet? */ if (EXI.credentialManager.getConnections().length > 0){ ExiGenericController.prototype.redirect( this.params['proposal'], redirection); @@ -52,18 +50,13 @@ MxDataCollectionController.prototype.init = function() { Path.map("#/mx/datacollection/session/:sessionId/main").to(function() { - - var mainView = new DataCollectionMxMainView({sessionId : this.params['sessionId']}); + + var proposals = EXI.credentialManager.getCredentials()[0].activeProposals; + var mainView = new DataCollectionMxMainView({sessionId : this.params['sessionId'], proposal : proposals[0]}); EXI.addMainPanel(mainView); EXI.hideNavigationPanel(); EXI.setLoadingMainPanel(true); - var onSuccessProposal = function (sender,proposal) { - if (proposal && proposal.length > 0) { - mainView.loadProposal(proposal[0]); - } - } - EXI.getDataAdapter({onSuccess : onSuccessProposal}).proposal.proposal.getProposalBySessionId(this.params['sessionId']); - + var onSuccess = function(sender, data){ mainView.loadCollections(data); EXI.setLoadingMainPanel(false); @@ -100,7 +93,7 @@ MxDataCollectionController.prototype.init = function() { Path.map("#/mx/datacollection/datacollectionid/:datacollectionid/main").to(function() { - var mainView = new DataCollectionMxMainView(); + var mainView = new DataCollectionMxMainView({sessionId : this.params['sessionId'], proposal : this.params['proposal']}); EXI.addMainPanel(mainView); EXI.hideNavigationPanel(); EXI.setLoadingMainPanel(true); diff --git a/js/mx/view/datacollection/datacollectionmxmainview.js b/js/mx/view/datacollection/datacollectionmxmainview.js index bfeb693fa..c4f41ab69 100644 --- a/js/mx/view/datacollection/datacollectionmxmainview.js +++ b/js/mx/view/datacollection/datacollectionmxmainview.js @@ -15,10 +15,13 @@ function DataCollectionMxMainView(args) { } if (args.technique) { this.technique = args.technique; + } + if (args.proposal) { + this.proposal = args.proposal; } } - - this.genericDataCollectionPanel = new MXDataCollectionGrid(); + + this.genericDataCollectionPanel = new MXDataCollectionGrid({proposal : this.proposal}); this.energyScanGrid = new EnergyScanGrid(); this.xfeScanGrid = new XFEScanGrid(); this.emStats = new EMSessionStats({sessionId: this.sessionId}); diff --git a/js/mx/view/datacollection/grid/mxdatacollectiongrid.js b/js/mx/view/datacollection/grid/mxdatacollectiongrid.js index caac173e2..ccefa3ced 100644 --- a/js/mx/view/datacollection/grid/mxdatacollectiongrid.js +++ b/js/mx/view/datacollection/grid/mxdatacollectiongrid.js @@ -9,12 +9,22 @@ function MXDataCollectionGrid(args) { /** DATACOLLECTION, DATACOLLECTION_COLLAPSED, PLATES_VIEW */ this.renderingType = 'DATACOLLECTION'; - + this.hideSendReport = true; + this.uncollapsedDataCollectionGrid = new UncollapsedDataCollectionGrid(); this.collapsedDataCollectionGrid = new CollapsedDataCollectionGrid(); this.containersDataCollectionGrid = new ContainersDataCollectionGrid(); - this.activePanel = this.uncollapsedDataCollectionGrid; + this.activePanel = this.uncollapsedDataCollectionGrid; + + if (args) { + if (args.proposal) { + this.proposal = args.proposal; + if (this.proposal.substring(0,2).toLowerCase() == 'fx'){ + this.hideSendReport = false + } + } + } } MXDataCollectionGrid.prototype.getPanel = function(dataCollectionGroup) { @@ -26,6 +36,7 @@ MXDataCollectionGrid.prototype.getPanel = function(dataCollectionGroup) { tbar: this.getToolBar(), items: [_this.activePanel.getPanel(dataCollectionGroup)] }); + return this.panel; }; @@ -157,19 +168,11 @@ MXDataCollectionGrid.prototype.getToolBar = function() { } }, { - text: " Send Report", + text: " Send Report ", id : 'sendPdfBtn', tooltip: 'Send Session Summary Report as PDF', margin: '1 0 1 2', - hidden: true, -/** function(){ - if (_this.proposalCode == 'FX'){ - false; - } else { - true; - } - }, -**/ + hidden: _this.hideSendReport, handler : function(){ if (_this.sendPdfUrl != null){ location.href = _this.sendPdfUrl; @@ -267,6 +270,7 @@ MXDataCollectionGrid.prototype.load = function(dataCollectionGroup) { this.rtfAnalysisUrl = EXI.getDataAdapter().mx.dataCollection.getRtfAnalysisReportURLBySessionId(sessionId); this.sendPdfUrl = EXI.getDataAdapter().mx.dataCollection.sendPdfReport(sessionId); } + }; /**