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

Display series name instead of dataset codes in the ImageViewerWidget pull-down menu.

parent de5dda47
No related branches found
No related tags found
No related merge requests found
...@@ -71,6 +71,29 @@ $.extend(MicroscopyTechnology.prototype, ELNLIMSPlugin.prototype, { ...@@ -71,6 +71,29 @@ $.extend(MicroscopyTechnology.prototype, ELNLIMSPlugin.prototype, {
// Create the image viewer component for the specific data sets // Create the image viewer component for the specific data sets
var widget = new ImageViewerWidget(screningFacade, imageViewerDataSets); var widget = new ImageViewerWidget(screningFacade, imageViewerDataSets);
// Customize the widget
widget.addLoadListener(function () {
widget.getDataSetChooserWidget().then(function (chooser) {
var view = chooser.getView();
// Show the series name instead of the dataset code
view.getDataSetText = function (dataSetCode) {
// Return the series name
for (var i = 0; i < model.datasets.length; i++) {
if (model.datasets[i].code === dataSetCode) {
return model.datasets[i].properties.MICROSCOPY_IMG_CONTAINER_NAME;
}
}
// If not found, return the dataset code
return dataSetCode;
};
});
});
// Render the component and add it to the page // Render the component and add it to the page
$container.append($('<legend>').text('Microscopy Viewer')); $container.append($('<legend>').text('Microscopy Viewer'));
var $imageWidgetContainer = new $('<div>'); var $imageWidgetContainer = new $('<div>');
...@@ -93,6 +116,27 @@ $.extend(MicroscopyTechnology.prototype, ELNLIMSPlugin.prototype, { ...@@ -93,6 +116,27 @@ $.extend(MicroscopyTechnology.prototype, ELNLIMSPlugin.prototype, {
// Create the image viewer component for the specific data sets // Create the image viewer component for the specific data sets
var widget = new ImageViewerWidget(screningFacade, [model.dataSetV3.permId.permId]); var widget = new ImageViewerWidget(screningFacade, [model.dataSetV3.permId.permId]);
// Customize the widget
widget.addLoadListener(function () {
widget.getDataSetChooserWidget().then(function (chooser) {
var view = chooser.getView();
// Show the series name instead of the dataset code
view.getDataSetText = function (dataSetCode) {
// Return the series name
if (model.dataSet.code === dataSetCode) {
return model.dataSet.properties.MICROSCOPY_IMG_CONTAINER_NAME;
} else {
// Fall-back (that should not happen)
return dataSetCode;
}
};
});
});
// Render the component and add it to the page // Render the component and add it to the page
$container.append($('<legend>').text('Microscopy Viewer')); $container.append($('<legend>').text('Microscopy Viewer'));
var $imageWidgetContainer = new $('<div>'); var $imageWidgetContainer = new $('<div>');
......
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