Skip to content

Commit

Permalink
Merge pull request #495 from delageniere/issue259
Browse files Browse the repository at this point in the history
Issue259
  • Loading branch information
delageniere authored Jun 18, 2019
2 parents f27cf15 + f5f3945 commit 3e2773e
Show file tree
Hide file tree
Showing 9 changed files with 158 additions and 36 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){
}
};


9 changes: 9 additions & 0 deletions js/ispyb-client/mx/datacollectiondataadapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
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
38 changes: 32 additions & 6 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,12 +36,15 @@ MXDataCollectionGrid.prototype.getPanel = function(dataCollectionGroup) {
tbar: this.getToolBar(),
items: [_this.activePanel.getPanel(dataCollectionGroup)]
});


return this.panel;
};

MXDataCollectionGrid.prototype.getToolBar = function() {
var _this = this;

//var proposalCode = this.proposal.Proposal_proposalCode;

function onMenuClicked(widget) {
if (_this.activePanel != widget) {
Expand All @@ -42,9 +55,7 @@ MXDataCollectionGrid.prototype.getToolBar = function() {
_this.reloadData(_this.dataCollectionGroup);
}
}
}


}

return Ext.create('Ext.toolbar.Toolbar', {
width: 500,
Expand Down Expand Up @@ -123,7 +134,7 @@ MXDataCollectionGrid.prototype.getToolBar = function() {
}
}
},
{
{
text: "<span class='glyphicon glyphicon-download-alt'> RTF summary</span>",
id : 'rtfBtn',
tooltip: 'Download Session Summary Report as RTF',
Expand Down Expand Up @@ -155,7 +166,20 @@ MXDataCollectionGrid.prototype.getToolBar = function() {
location.href = _this.rtfAnalysisUrl;
}
}
},
{
text: "<span class='glyphicon glyphicon-envelope'> Send Report </span>",
id : 'sendPdfBtn',
tooltip: 'Send Session Summary Report as PDF',
margin: '1 0 1 2',
hidden: _this.hideSendReport,
handler : function(){
if (_this.sendPdfUrl != null){
location.href = _this.sendPdfUrl;
}
}
},

'->',
{
html: '<span class="glyphicon glyphicon-download-alt"></span> Best results',
Expand Down Expand Up @@ -244,7 +268,9 @@ 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);
}

};

/**
Expand Down
2 changes: 2 additions & 0 deletions mx/dev.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

<!-- bower:js -->
<script src="../bower_components/jquery/dist/jquery.js"></script>
<script src="../bower_components/zeroclipboard/dist/ZeroClipboard.js"></script>
<script src="../bower_components/moment/moment.js"></script>
<script src="../bower_components/pikaday/pikaday.js"></script>
<script src="../bower_components/handsontable/dist/handsontable.js"></script>
Expand All @@ -49,6 +50,7 @@
<script src="../bower_components/notifyjs/dist/notify.js"></script>
<script src="../bower_components/bootstrap-multiselect/dist/js/bootstrap-multiselect.js"></script>
<script src="../bower_components/eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min.js"></script>
<script src="../bower_components/file-saver/FileSaver.js"></script>
<script src="../bower_components/html-docx-js/dist/html-docx.js"></script>
<!-- endbower -->

Expand Down
2 changes: 2 additions & 0 deletions saxs/dev.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

<!-- bower:js -->
<script src="../bower_components/jquery/dist/jquery.js"></script>
<script src="../bower_components/zeroclipboard/dist/ZeroClipboard.js"></script>
<script src="../bower_components/moment/moment.js"></script>
<script src="../bower_components/pikaday/pikaday.js"></script>
<script src="../bower_components/handsontable/dist/handsontable.js"></script>
Expand All @@ -51,6 +52,7 @@
<script src="../bower_components/notifyjs/dist/notify.js"></script>
<script src="../bower_components/bootstrap-multiselect/dist/js/bootstrap-multiselect.js"></script>
<script src="../bower_components/eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min.js"></script>
<script src="../bower_components/file-saver/FileSaver.js"></script>
<script src="../bower_components/html-docx-js/dist/html-docx.js"></script>
<!-- endbower -->

Expand Down
57 changes: 50 additions & 7 deletions test/dev.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

<!-- bower:js -->
<script src="../bower_components/jquery/dist/jquery.js"></script>
<script src="../bower_components/zeroclipboard/dist/ZeroClipboard.js"></script>
<script src="../bower_components/moment/moment.js"></script>
<script src="../bower_components/pikaday/pikaday.js"></script>
<script src="../bower_components/handsontable/dist/handsontable.js"></script>
Expand All @@ -51,6 +52,7 @@
<script src="../bower_components/notifyjs/dist/notify.js"></script>
<script src="../bower_components/bootstrap-multiselect/dist/js/bootstrap-multiselect.js"></script>
<script src="../bower_components/eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min.js"></script>
<script src="../bower_components/file-saver/FileSaver.js"></script>
<script src="../bower_components/html-docx-js/dist/html-docx.js"></script>
<!-- endbower -->

Expand All @@ -60,16 +62,57 @@


<!-- EXI-UI-UTILS -->

<script src="../bower_components/exi-ui-utils/js/bui.js"></script>
<script src="../bower_components/exi-ui-utils/js/dygraphwidget.js"></script>
<script src="../bower_components/exi-ui-utils/js/event.js"></script>
<script src="../bower_components/exi-ui-utils/js/imageutils.js"></script>
<script src="../bower_components/exi-ui-utils/js/progressbar.js"></script>
<script src="../bower_components/exi-ui-utils/js/string.js"></script>


<!-- ISPYB-JS-API -->




view-source:http://lindemaria:8082/EXI/test/dev.html#/welcome

<script src="../bower_components/ispyb-js-api/js/dataadapter.js"></script>
<script src="../bower_components/ispyb-js-api/js/event.js"></script>
<script src="../bower_components/ispyb-js-api/js/exi/exidataadapter.js"></script>
<script src="../bower_components/ispyb-js-api/js/exi/exidataadaptergroup.js"></script>
<script src="../bower_components/ispyb-js-api/js/security/authenticationdataadapter.js"></script>
<script src="../bower_components/ispyb-js-api/js/proposal/dataadapterfactory.js"></script>
<script src="../bower_components/ispyb-js-api/js/proposal/dewardataadapter.js"></script>
<script src="../bower_components/ispyb-js-api/js/proposal/labcontactdataadapter.js"></script>
<script src="../bower_components/ispyb-js-api/js/proposal/proposaldataadapter.js"></script>
<script src="../bower_components/ispyb-js-api/js/proposal/proposaldataadaptergroup.js"></script>
<script src="../bower_components/ispyb-js-api/js/proposal/sessiondataadapter.js"></script>
<script src="../bower_components/ispyb-js-api/js/proposal/shippingdataadapter.js"></script>
<script src="../bower_components/ispyb-js-api/js/mx/autoprocintegrationdataadapter.js"></script>
<script src="../bower_components/ispyb-js-api/js/mx/crystaldataadapter.js"></script>
<script src="../bower_components/ispyb-js-api/js/mx/datacollectiondataadapter.js"></script>
<script src="../bower_components/ispyb-js-api/js/mx/datacollectiongroupdataadapter.js"></script>
<script src="../bower_components/ispyb-js-api/js/mx/energyscandataadapter.js"></script>
<script src="../bower_components/ispyb-js-api/js/mx/mxdataadapterfactory.js"></script>
<script src="../bower_components/ispyb-js-api/js/mx/mxdataadaptergroup.js"></script>
<script src="../bower_components/ispyb-js-api/js/mx/phasingdataadapter.js"></script>
<script src="../bower_components/ispyb-js-api/js/mx/proteindataadapter.js"></script>
<script src="../bower_components/ispyb-js-api/js/mx/sampledataadapter.js"></script>
<script src="../bower_components/ispyb-js-api/js/mx/statisticsdataadapter.js"></script>
<script src="../bower_components/ispyb-js-api/js/mx/workflowdataadapter.js"></script>
<script src="../bower_components/ispyb-js-api/js/mx/workflowstepdataadapter.js"></script>
<script src="../bower_components/ispyb-js-api/js/mx/xfescandataadapter.js"></script>view-source:http://lindemaria:8082/EXI/test/dev.html#/welcome
<script src="../bower_components/ispyb-js-api/js/saxs/buffersaxsdataadapter.js"></script>
<script src="../bower_components/ispyb-js-api/js/saxs/datacollectionsaxsdataadapter.js"></script>
<script src="../bower_components/ispyb-js-api/js/saxs/experiment.js"></script>
<script src="../bower_components/ispyb-js-api/js/saxs/experimentlist.js"></script>
<script src="../bower_components/ispyb-js-api/js/saxs/experimentsaxsdataadapter.js"></script>
<script src="../bower_components/ispyb-js-api/js/saxs/framesaxsdataadapter.js"></script>
<script src="../bower_components/ispyb-js-api/js/saxs/hplcsaxsdataadapter.js"></script>
<script src="../bower_components/ispyb-js-api/js/saxs/macromoleculesaxsdataadapter.js"></script>
<script src="../bower_components/ispyb-js-api/js/saxs/measurementsaxsdataadapter.js"></script>
<script src="../bower_components/ispyb-js-api/js/saxs/modelsaxsdataadapter.js"></script>
<script src="../bower_components/ispyb-js-api/js/saxs/saxsdataadapterfactory.js"></script>
<script src="../bower_components/ispyb-js-api/js/saxs/saxsdataadaptergroup.js"></script>
<script src="../bower_components/ispyb-js-api/js/saxs/specimensaxsdataadapter.js"></script>
<script src="../bower_components/ispyb-js-api/js/saxs/stocksolutionsaxsdataadapter.js"></script>
<script src="../bower_components/ispyb-js-api/js/saxs/subtractionsaxsdataadapter.js"></script>
<script src="../bower_components/ispyb-js-api/js/saxs/templatesaxsdataadapter.js"></script>

<!-- DUST -->
<script src="../js/dust/helpers.js"></script>
Expand Down
Loading

0 comments on commit 3e2773e

Please sign in to comment.