Skip to content
Snippets Groups Projects
Commit 20e0ec1f authored by Aaron Ponti's avatar Aaron Ponti
Browse files

Minor tweaks.

parent 7390a97f
No related branches found
No related tags found
No related merge requests found
...@@ -174,14 +174,14 @@ $.extend(FlowCytometryTechnology.prototype, ELNLIMSPlugin.prototype, { ...@@ -174,14 +174,14 @@ $.extend(FlowCytometryTechnology.prototype, ELNLIMSPlugin.prototype, {
// Additional functionality // Additional functionality
renderParameterSelectionWidget: function ($container, model) { renderParameterSelectionWidget: function ($container, model) {
// Clear the container
$container.empty();
// Check that we ave the correct dataset type // Check that we ave the correct dataset type
if (!model.dataSetV3.type.code.endsWith("_FCSFILE")) { if (!model.dataSetV3.type.code.endsWith("_FCSFILE")) {
return; return;
} }
// Clear the container
$container.empty();
// //
// Retrieve the parameter info // Retrieve the parameter info
// //
......
...@@ -111,18 +111,18 @@ $.extend(MicroscopyTechnology.prototype, ELNLIMSPlugin.prototype, { ...@@ -111,18 +111,18 @@ $.extend(MicroscopyTechnology.prototype, ELNLIMSPlugin.prototype, {
return; return;
} }
// Clear the container
$container.empty();
if (microscopyExperimentSample.children.length === 0) { if (microscopyExperimentSample.children.length === 0) {
return; return;
} }
// Clear the container // Add legend
$container.empty();
// Add legend
var legend = $("<legend>") var legend = $("<legend>")
.text("File previews"); .text("File previews");
$container.append(legend); $container.append(legend);
// Prepare a div to host the thumbnails // Prepare a div to host the thumbnails
var sampleView_div = $("<div>"); var sampleView_div = $("<div>");
$container.append(sampleView_div); $container.append(sampleView_div);
...@@ -220,7 +220,7 @@ $.extend(MicroscopyTechnology.prototype, ELNLIMSPlugin.prototype, { ...@@ -220,7 +220,7 @@ $.extend(MicroscopyTechnology.prototype, ELNLIMSPlugin.prototype, {
}); });
}, },
formatSizeForDisplay : function (datasetSize) { formatSizeForDisplay: function (datasetSize) {
// Output // Output
var formattedDatasetSize = ""; var formattedDatasetSize = "";
...@@ -239,67 +239,67 @@ $.extend(MicroscopyTechnology.prototype, ELNLIMSPlugin.prototype, { ...@@ -239,67 +239,67 @@ $.extend(MicroscopyTechnology.prototype, ELNLIMSPlugin.prototype, {
return formattedDatasetSize; return formattedDatasetSize;
}, },
displayThumbnailForSample : function(model, sample, img_id) { displayThumbnailForSample: function (model, sample, img_id) {
// Get the datasets with type "MICROSCOPY_IMG_THUMBNAIL" for current sample // Get the datasets with type "MICROSCOPY_IMG_THUMBNAIL" for current sample
this.getMicroscopyImgThumbnailDataSetsForMicroscopySample( this.getMicroscopyImgThumbnailDataSetsForMicroscopySample(
model, model,
sample.experimentIdentifierOrNull, sample.experimentIdentifierOrNull,
sample.code, function(dataset) { sample.code, function (dataset) {
// Get the containers // Get the containers
if (dataset == null) { if (dataset == null) {
return; return;
} }
// Retrieve the file for the dataset and the associated URL // Retrieve the file for the dataset and the associated URL
mainController.openbisV1.listFilesForDataSet(dataset.code, '/', true, mainController.openbisV1.listFilesForDataSet(dataset.code, '/', true,
function(response) { function (response) {
// Make sure that we got some results from the DSS to process // Make sure that we got some results from the DSS to process
if (response.error) { if (response.error) {
// Thumbnail not found!
var imD = $("#" + img_id);
imD.attr("src", "./img/error.png");
imD.attr("title", "Could not find any files associated to this dataset!");
return;
}
// Find the thumbnail.png file
response.result.forEach(function(f) {
if (!f.isDirectory && f.pathInDataSet.toLowerCase() === "thumbnail.png") {
// Retrieve the file URL
mainController.openbisV1.getDownloadUrlForFileForDataSetInSession(
dataset.code, f.pathInDataSet, function(url){
// Replace the image
var eUrl = encodeURI(url);
eUrl = eUrl.replace('+', '%2B');
$("#" + img_id).attr("src", eUrl);
});
} else {
// Thumbnail not found! // Thumbnail not found!
var imD = $("#" + img_id); var imD = $("#" + img_id);
imD.attr("src", "./img/error.png"); imD.attr("src", "./img/error.png");
imD.attr("title", "Could not find a thumbnail for this dataset!"); imD.attr("title", "Could not find any files associated to this dataset!");
return;
} }
// Find the thumbnail.png file
response.result.forEach(function (f) {
if (!f.isDirectory && f.pathInDataSet.toLowerCase() === "thumbnail.png") {
// Retrieve the file URL
mainController.openbisV1.getDownloadUrlForFileForDataSetInSession(
dataset.code, f.pathInDataSet, function (url) {
// Replace the image
var eUrl = encodeURI(url);
eUrl = eUrl.replace('+', '%2B');
$("#" + img_id).attr("src", eUrl);
});
} else {
// Thumbnail not found!
var imD = $("#" + img_id);
imD.attr("src", "./img/error.png");
imD.attr("title", "Could not find a thumbnail for this dataset!");
}
});
}); });
}); });
});
}, },
getMicroscopyImgThumbnailDataSetsForMicroscopySample : function (model, expCode, sampleCode, action) { getMicroscopyImgThumbnailDataSetsForMicroscopySample: function (model, expCode, sampleCode, action) {
// Experiment criteria (experiment of type "COLLECTION" and code expCode) // Experiment criteria (experiment of type "COLLECTION" and code expCode)
var experimentCriteria = new SearchCriteria(); var experimentCriteria = new SearchCriteria();
...@@ -311,7 +311,7 @@ $.extend(MicroscopyTechnology.prototype, ELNLIMSPlugin.prototype, { ...@@ -311,7 +311,7 @@ $.extend(MicroscopyTechnology.prototype, ELNLIMSPlugin.prototype, {
SearchCriteriaMatchClause.createAttributeMatch( SearchCriteriaMatchClause.createAttributeMatch(
"TYPE", "COLLECTION") "TYPE", "COLLECTION")
); );
// Sample criteria (sample of type "MICROSCOPY_SAMPLE_TYPE" and code sampleCode) // Sample criteria (sample of type "MICROSCOPY_SAMPLE_TYPE" and code sampleCode)
var sampleCriteria = new SearchCriteria(); var sampleCriteria = new SearchCriteria();
sampleCriteria.addMatchClause( sampleCriteria.addMatchClause(
...@@ -322,14 +322,14 @@ $.extend(MicroscopyTechnology.prototype, ELNLIMSPlugin.prototype, { ...@@ -322,14 +322,14 @@ $.extend(MicroscopyTechnology.prototype, ELNLIMSPlugin.prototype, {
SearchCriteriaMatchClause.createAttributeMatch( SearchCriteriaMatchClause.createAttributeMatch(
"TYPE", "MICROSCOPY_SAMPLE_TYPE") "TYPE", "MICROSCOPY_SAMPLE_TYPE")
); );
// Dataset criteria // Dataset criteria
var datasetCriteria = new SearchCriteria(); var datasetCriteria = new SearchCriteria();
datasetCriteria.addMatchClause( datasetCriteria.addMatchClause(
SearchCriteriaMatchClause.createAttributeMatch( SearchCriteriaMatchClause.createAttributeMatch(
"TYPE", "MICROSCOPY_IMG_CONTAINER") "TYPE", "MICROSCOPY_IMG_CONTAINER")
); );
// Add sample and experiment search criteria as subcriteria // Add sample and experiment search criteria as subcriteria
datasetCriteria.addSubCriteria( datasetCriteria.addSubCriteria(
SearchSubCriteria.createSampleCriteria(sampleCriteria) SearchSubCriteria.createSampleCriteria(sampleCriteria)
...@@ -337,15 +337,15 @@ $.extend(MicroscopyTechnology.prototype, ELNLIMSPlugin.prototype, { ...@@ -337,15 +337,15 @@ $.extend(MicroscopyTechnology.prototype, ELNLIMSPlugin.prototype, {
datasetCriteria.addSubCriteria( datasetCriteria.addSubCriteria(
SearchSubCriteria.createExperimentCriteria(experimentCriteria) SearchSubCriteria.createExperimentCriteria(experimentCriteria)
); );
// Search // Search
mainController.openbisV1.searchForDataSets(datasetCriteria, function (response) { mainController.openbisV1.searchForDataSets(datasetCriteria, function (response) {
// Get the containers // Get the containers
if (response.error || response.result.length === 0) { if (response.error || response.result.length === 0) {
return null; return null;
} }
// All MICROSCOPY_IMG_CONTAINER datasets (i.e. a file series) contain a MICROSCOPY_IMG_OVERVIEW // All MICROSCOPY_IMG_CONTAINER datasets (i.e. a file series) contain a MICROSCOPY_IMG_OVERVIEW
// and a MICROSCOPY_IMG dataset; one of the series will also contain a MICROSCOPY_IMG_THUMBNAIL, // and a MICROSCOPY_IMG dataset; one of the series will also contain a MICROSCOPY_IMG_THUMBNAIL,
// which is what we are looking for here. // which is what we are looking for here.
...@@ -363,6 +363,6 @@ $.extend(MicroscopyTechnology.prototype, ELNLIMSPlugin.prototype, { ...@@ -363,6 +363,6 @@ $.extend(MicroscopyTechnology.prototype, ELNLIMSPlugin.prototype, {
} }
} }
}); });
} }
}); });
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment