From 901c25e4b41806471a3fbc075e40b8ea33c8fa2b Mon Sep 17 00:00:00 2001 From: parkera <parkera> Date: Tue, 7 Jun 2016 09:06:41 +0000 Subject: [PATCH] SSDM-3632 : Batch delete on sample table SVN: 36639 --- .../SampleTable/SampleTableController.js | 4 +-- .../js/views/SampleTable/SampleTableView.js | 30 +++++++++++++++++++ 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleTable/SampleTableController.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleTable/SampleTableController.js index 4c7cb6c8245..a0680da146b 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleTable/SampleTableController.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleTable/SampleTableController.js @@ -83,8 +83,8 @@ function SampleTableController(parentController, title, experimentIdentifier, pr } //Create and display table - var dataGridController = SampleDataGridUtil.getSampleDataGrid(selectedSampleTypeCode, samples, null, null, null, null, null, null, false); - dataGridController.init(this._sampleTableView.getTableContainer()); + this._sampleTableView._dataGridController = SampleDataGridUtil.getSampleDataGrid(selectedSampleTypeCode, samples, null, null, null, null, null, null, true); + this._sampleTableView._dataGridController.init(this._sampleTableView.getTableContainer()); } } } \ No newline at end of file diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleTable/SampleTableView.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleTable/SampleTableView.js index 23cf419fa7f..242c0906d85 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleTable/SampleTableView.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleTable/SampleTableView.js @@ -128,6 +128,36 @@ function SampleTableView(sampleTableController, sampleTableModel) { _this.updateSamples(_this._sampleTableModel.experimentIdentifier); }); $list.append($batchUpdateOption); + + var $batchDeleteOption = $("<li>", { 'role' : 'presentation' }).append($("<a>", {'title' : 'Delete Samples'}).append("Delete Samples")); + $batchDeleteOption.click(function() { + var grid = _this._dataGridController._grid; + var selected = grid.getSelected(); + if(selected != undefined && selected.length == 0){ + alert("Please select at least one sample to delete!"); + }else{ + var warningText = "The next samples will be deleted: "; + var sampleTechIds = []; + for(var sIdx = 0; sIdx < selected.length; sIdx++) { + sampleTechIds.push(selected[sIdx].id); + warningText += selected[sIdx].identifier + " "; + } + + var modalView = new DeleteEntityController(function(reason) { + mainController.serverFacade.deleteSamples(sampleTechIds, reason, function(data) { + if(data.error) { + Util.showError(data.error.message); + } else { + Util.showSuccess("Sample/s Deleted"); + mainController.refreshView(); + } + }); + }, true, warningText); + modalView.init(); + } + }); + $list.append($batchDeleteOption); + return $dropDownMenu; } -- GitLab