From 17a2eac97447f118615a8132805358af4e05b43f Mon Sep 17 00:00:00 2001 From: juanf <juanf> Date: Fri, 24 Apr 2015 15:14:13 +0000 Subject: [PATCH] SSDM-1724 : Plate View (ongoing work) SVN: 33910 --- .../1/as/webapps/eln-lims/html/css/style.css | 13 +++++++- .../eln-lims/html/js/server/ServerFacade.js | 30 +++++++++++++++++++ .../SampleForm/widgets/PlateController.js | 7 ++++- .../js/views/SampleForm/widgets/PlateModel.js | 11 +++++++ .../js/views/SampleForm/widgets/PlateView.js | 7 ++++- 5 files changed, 65 insertions(+), 3 deletions(-) diff --git a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/css/style.css b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/css/style.css index 3588c18264f..6e1f62cb940 100644 --- a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/css/style.css +++ b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/css/style.css @@ -461,7 +461,7 @@ table.downloads { } /* - * Plate Widget + * Plate & Storage Widget */ .gridTable { border : none !important; @@ -481,6 +481,17 @@ table.downloads { border-color: #CCCCCC; } +/* + * Plate Widget + */ +.gridTable td .well { + background-color: #E7E7E7; + } +.gridTable td .well:hover { + background-color: #C7C7C7; + cursor : pointer; +} + /* * Storage Widget */ diff --git a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/server/ServerFacade.js b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/server/ServerFacade.js index 8584269f6d8..de511d586bb 100644 --- a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/server/ServerFacade.js +++ b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/server/ServerFacade.js @@ -535,6 +535,36 @@ function ServerFacade(openbisServer) { this.openbisServer.searchForDataSets(dataSetCriteria, callbackFunction) } + this.searchContained = function(permId, callbackFunction) { + var matchClauses = []; + + var subCriteria = { + "@type" : "SearchSubCriteria", + "targetEntityKind" : "SAMPLE_CONTAINER", + "criteria" : { + matchClauses : [{ + "@type":"AttributeMatchClause", + fieldType : "ATTRIBUTE", + attribute : "PERM_ID", + desiredValue : permId + }], + operator : "MATCH_ALL_CLAUSES" + } + } + + var sampleCriteria = + { + matchClauses : matchClauses, + subCriterias : [ subCriteria ], + operator : "MATCH_ALL_CLAUSES" + }; + + var localReference = this; + this.openbisServer.searchForSamplesWithFetchOptions(sampleCriteria, ["PROPERTIES"], function(data) { + callbackFunction(localReference.getInitializedSamples(data.result)); + }); + } + this.searchWithIdentifier = function(sampleIdentifier, callbackFunction) { this.searchWithIdentifiers([sampleIdentifier], callbackFunction); diff --git a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/PlateController.js b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/PlateController.js index b9046a63aba..2b347df3332 100644 --- a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/PlateController.js +++ b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/PlateController.js @@ -19,6 +19,11 @@ function PlateController(sample) { this._plateView = new PlateView(this, this._plateModel); this.init = function($container) { - this._plateView.repaint($container); + var _this = this; + $container.append("Loading Wells ..."); + mainController.serverFacade.searchContained(this._plateModel.sample.permId, function(contained) { + _this._plateModel.wells = contained; + _this._plateView.repaint($container); + }); } } \ No newline at end of file diff --git a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/PlateModel.js b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/PlateModel.js index 2f5248f941d..c0b3bd972f2 100644 --- a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/PlateModel.js +++ b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/PlateModel.js @@ -16,6 +16,7 @@ function PlateModel(sample) { this.sample = sample; + this.wells = null; var getRowsAndColsFromPlateSample = function(sample) { try { @@ -34,6 +35,16 @@ function PlateModel(sample) { this.numRows = getRowsAndColsFromPlateSample(sample)[0]; this.numColumns = getRowsAndColsFromPlateSample(sample)[1]; + this.getWell = function(rowNum, colNum) { + var wellIdentifier = this.sample.identifier + ":" + this.getAlphabetLabel(rowNum) + colNum; + for(var wellIdx = 0; wellIdx < this.wells.length; wellIdx++) { + if(this.wells[wellIdx].identifier === wellIdentifier) { + var toReturn = this.wells[wellIdx]; + return toReturn; + } + } + return null; + } this.getAlphabetLabel = function(number) { var alphabet = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']; diff --git a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/PlateView.js b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/PlateView.js index 52f1798e24d..7eb6d9860e5 100644 --- a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/PlateView.js +++ b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/PlateView.js @@ -19,6 +19,7 @@ function PlateView(plateController, plateModel) { this.repaint = function($container) { var _this = this; + $container.empty(); var gridTable = $("<table>", { "class" : "table table-bordered gridTable" }); for(var i = 0; i <= this._plateModel.numRows; i++) { @@ -32,7 +33,11 @@ function PlateView(plateController, plateModel) { } else if (j === 0){ //header with row letter $cell = $("<th>").append(this._plateModel.getAlphabetLabel(i-1)); } else { - $cell = $("<td>"); + var well = this._plateModel.getWell(i-1,j); + $cell = $("<td>").append(" "); + if(well) { + $cell.addClass('well'); + } } $row.append($cell); } -- GitLab