From 20e0ec1f929efd7813958c2948d78a870964351c Mon Sep 17 00:00:00 2001 From: Aaron Ponti <aaron.ponti@bsse.ethz.ch> Date: Thu, 16 May 2019 16:25:55 +0200 Subject: [PATCH] Minor tweaks. --- .../js/plugins/FlowCytometryTechnology.js | 6 +- .../html/js/plugins/MicroscopyTechnology.js | 124 +++++++++--------- 2 files changed, 65 insertions(+), 65 deletions(-) diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/plugins/FlowCytometryTechnology.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/plugins/FlowCytometryTechnology.js index deffccd1f66..bd6a377e9d0 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/plugins/FlowCytometryTechnology.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/plugins/FlowCytometryTechnology.js @@ -174,14 +174,14 @@ $.extend(FlowCytometryTechnology.prototype, ELNLIMSPlugin.prototype, { // Additional functionality renderParameterSelectionWidget: function ($container, model) { - // Clear the container - $container.empty(); - // Check that we ave the correct dataset type if (!model.dataSetV3.type.code.endsWith("_FCSFILE")) { return; } + // Clear the container + $container.empty(); + // // Retrieve the parameter info // diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/plugins/MicroscopyTechnology.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/plugins/MicroscopyTechnology.js index f1b730828af..83232d97754 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/plugins/MicroscopyTechnology.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/plugins/MicroscopyTechnology.js @@ -111,18 +111,18 @@ $.extend(MicroscopyTechnology.prototype, ELNLIMSPlugin.prototype, { return; } + // Clear the container + $container.empty(); + if (microscopyExperimentSample.children.length === 0) { return; } - // Clear the container - $container.empty(); - - // Add legend + // Add legend var legend = $("<legend>") .text("File previews"); $container.append(legend); - + // Prepare a div to host the thumbnails var sampleView_div = $("<div>"); $container.append(sampleView_div); @@ -220,7 +220,7 @@ $.extend(MicroscopyTechnology.prototype, ELNLIMSPlugin.prototype, { }); }, - formatSizeForDisplay : function (datasetSize) { + formatSizeForDisplay: function (datasetSize) { // Output var formattedDatasetSize = ""; @@ -239,67 +239,67 @@ $.extend(MicroscopyTechnology.prototype, ELNLIMSPlugin.prototype, { 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 this.getMicroscopyImgThumbnailDataSetsForMicroscopySample( model, sample.experimentIdentifierOrNull, - sample.code, function(dataset) { - - // Get the containers - if (dataset == null) { - return; - } - - // Retrieve the file for the dataset and the associated URL - mainController.openbisV1.listFilesForDataSet(dataset.code, '/', true, - function(response) { - - // Make sure that we got some results from the DSS to process - 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 { - + sample.code, function (dataset) { + + // Get the containers + if (dataset == null) { + return; + } + + // Retrieve the file for the dataset and the associated URL + mainController.openbisV1.listFilesForDataSet(dataset.code, '/', true, + function (response) { + + // Make sure that we got some results from the DSS to process + if (response.error) { + // Thumbnail not found! var imD = $("#" + img_id); 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) var experimentCriteria = new SearchCriteria(); @@ -311,7 +311,7 @@ $.extend(MicroscopyTechnology.prototype, ELNLIMSPlugin.prototype, { SearchCriteriaMatchClause.createAttributeMatch( "TYPE", "COLLECTION") ); - + // Sample criteria (sample of type "MICROSCOPY_SAMPLE_TYPE" and code sampleCode) var sampleCriteria = new SearchCriteria(); sampleCriteria.addMatchClause( @@ -322,14 +322,14 @@ $.extend(MicroscopyTechnology.prototype, ELNLIMSPlugin.prototype, { SearchCriteriaMatchClause.createAttributeMatch( "TYPE", "MICROSCOPY_SAMPLE_TYPE") ); - + // Dataset criteria var datasetCriteria = new SearchCriteria(); datasetCriteria.addMatchClause( SearchCriteriaMatchClause.createAttributeMatch( "TYPE", "MICROSCOPY_IMG_CONTAINER") ); - + // Add sample and experiment search criteria as subcriteria datasetCriteria.addSubCriteria( SearchSubCriteria.createSampleCriteria(sampleCriteria) @@ -337,15 +337,15 @@ $.extend(MicroscopyTechnology.prototype, ELNLIMSPlugin.prototype, { datasetCriteria.addSubCriteria( SearchSubCriteria.createExperimentCriteria(experimentCriteria) ); - + // Search mainController.openbisV1.searchForDataSets(datasetCriteria, function (response) { - + // Get the containers if (response.error || response.result.length === 0) { return null; } - + // 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, // which is what we are looking for here. @@ -363,6 +363,6 @@ $.extend(MicroscopyTechnology.prototype, ELNLIMSPlugin.prototype, { } } }); - + } }); -- GitLab