From f5f3945f5a7c8f152cf5ecafe1d8cd9fd0f5ae66 Mon Sep 17 00:00:00 2001 From: delageniere Date: Wed, 15 May 2019 17:45:24 +0200 Subject: [PATCH] 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); } + }; /**