Skip to content

Commit

Permalink
display send report only for FX
Browse files Browse the repository at this point in the history
  • Loading branch information
delageniere committed May 15, 2019
1 parent 80bcc24 commit f5f3945
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 28 deletions.
1 change: 1 addition & 0 deletions js/core/security/credentialmanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,4 @@ CredentialManager.prototype.setActiveProposal = function(username, proposal){
}
};


21 changes: 7 additions & 14 deletions js/mx/controller/mxdatacollectioncontroller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
7 changes: 5 additions & 2 deletions js/mx/view/datacollection/datacollectionmxmainview.js
Original file line number Diff line number Diff line change
Expand Up @@ -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});
Expand Down
28 changes: 16 additions & 12 deletions js/mx/view/datacollection/grid/mxdatacollectiongrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -26,6 +36,7 @@ MXDataCollectionGrid.prototype.getPanel = function(dataCollectionGroup) {
tbar: this.getToolBar(),
items: [_this.activePanel.getPanel(dataCollectionGroup)]
});


return this.panel;
};
Expand Down Expand Up @@ -157,19 +168,11 @@ MXDataCollectionGrid.prototype.getToolBar = function() {
}
},
{
text: "<span class='glyphicon glyphicon-envelope'> Send Report</span>",
text: "<span class='glyphicon glyphicon-envelope'> Send Report </span>",
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;
Expand Down Expand Up @@ -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);
}

};

/**
Expand Down

0 comments on commit f5f3945

Please sign in to comment.