Introduction
The current aim of this extensions is to accommodate two groups of modifications:
...
extending the interface to accommodate additional functionality without needing to deal with the internals.
Plugin structure
plugins folder
Each folder on this folder is a ELN UI extension.
Each extension currently contains a single file with name "plugin.js".
config.js file
Contains a section called PLUGINS_CONFIGURATION indicating the plugins to be loaded from the plugins folder.
| Code Block | ||
|---|---|---|
| ||
var PLUGINS_CONFIGURATION = {
extraPlugins : ["life-sciences", "flow", "microscopy"]
} |
plugin.js file
Contains the actual source of the plugin, we can distinguish three clear sections/patterns on the skeleton of the interface:
...
- onSampleSave: Reserved for internal use and discouraged to use. It is tricky to use properly.
- getExtraUtilities: Allows to extend the utilities menu. A great example is this template: https://sissource.ethz.ch/sispub/openbis/-/blob/master/ui-eln-lims/src/core-plugins/eln-lims/1/as/webapps/eln-lims/html/plugins/template-extra-utilities/plugin.js
Source Code Examples (plugin.js)
Configuration Only Extensions
An example with only type configurations extensions is show below.
| Code Block | ||
|---|---|---|
| ||
function MyTechnology() {
this.init();
}
$.extend(MyTechnology.prototype, ELNLIMSPlugin.prototype, {
init: function() {
},
experimentTypeDefinitionsExtension : {
"FOLDER": {
"TOOLBAR": { CREATE: false, FREEZE: false, EDIT: false, MOVE: false, DELETE: false, UPLOAD_DATASET: false, UPLOAD_DATASET_HELPER: false, EXPORT_ALL: false, EXPORT_METADATA: true }
}
},
sampleTypeDefinitionsExtension : {
"SAMPLE_TYPE" : {
"TOOLBAR": { CREATE : true, EDIT : true, FREEZE : true, MOVE : true, COPY: true, DELETE : true, PRINT: true, HIERARCHY_GRAPH : true, HIERARCHY_TABLE : true, UPLOAD_DATASET : true, UPLOAD_DATASET_HELPER : true, EXPORT_ALL : true, EXPORT_METADATA : true, TEMPLATES : true, BARCODE : true },
"SHOW" : false,
"SAMPLE_CHILDREN_DISABLED": false,
"SAMPLE_CHILDREN_ANY_TYPE_DISABLED" : false,
"SAMPLE_PARENTS_DISABLED": false,
"SAMPLE_PARENTS_ANY_TYPE_DISABLED": true,
"SAMPLE_PARENTS_HINT": [{
"LABEL": "Parent Label",
"TYPE": "PARENT_TYPE",
"ANNOTATION_PROPERTIES": []
}],
"SAMPLE_CHILDREN_HINT" : [{
"LABEL": "Children Label",
"TYPE": "CHILDREN_TYPE",
"MIN_COUNT" : 0,
"ANNOTATION_PROPERTIES": [{"TYPE" : "ANNOTATION.SYSTEM.COMMENTS", "MANDATORY" : false }]
}],
"ENABLE_STORAGE" : false,
"SHOW_ON_NAV": false,
"SHOW_ON_NAV_FOR_PARENT_TYPES": undefined,
extraToolbar : undefined
},
},
dataSetTypeDefinitionsExtension : {
"DATASET_TYPE" : {
"TOOLBAR": { EDIT : true, FREEZE : true, MOVE : true, ARCHIVE : true, DELETE : true, HIERARCHY_TABLE : true, EXPORT_ALL : true, EXPORT_METADATA : true },
"DATASET_PARENTS_DISABLED" : false,
extraToolbar : undefined
},
}
});
profile.plugins.push(new MyTechnology()); |
Toolbar Extensions
An example with only toolbar extensions is shown below, variables with a dollar sign '$' indicate they are jquery components:
| Code Block | ||
|---|---|---|
| ||
function MyTechnology() {
this.init();
}
$.extend(MyTechnology.prototype, ELNLIMSPlugin.prototype, {
init: function() {
},
sampleTypeDefinitionsExtension : {
"SAMPLE_TYPE" : {
extraToolbar : function(mode, sample) {
var toolbarModel = [];
if(mode === FormMode.VIEW) {
var $demoButton = FormUtil.getButtonWithIcon("glyphicon-heart", function () {
//This empty function could be a call to do something in particular
});
toolbarModel.push({ component : $demoButton, tooltip: "Demo" });
}
return toolbarModel;
}
},
},
dataSetTypeDefinitionsExtension : {
"DATASET_TYPE" : {
extraToolbar : function(mode, dataset) {
var toolbarModel = [];
if(mode === FormMode.VIEW) {
var $demoButton = FormUtil.getButtonWithIcon("glyphicon-heart", function () {
//This empty function could be a call to do something in particular
});
toolbarModel.push({ component : $demoButton, tooltip: "Demo" });
}
return toolbarModel;
}
},
}
});
profile.plugins.push(new MyTechnology()); |
Extra Views as Utilities
Please check the provided example: https://sissource.ethz.ch/sispub/openbis/-/blob/master/ui-eln-lims/src/core-plugins/eln-lims/1/as/webapps/eln-lims/html/plugins/template-extra-utilities/plugin.js
...
