From 8854298df5412c2b84a99e4eff9baf25efcabbbc Mon Sep 17 00:00:00 2001 From: juanf <juanf> Date: Wed, 30 Sep 2015 10:47:30 +0000 Subject: [PATCH] SSDM-2450 : Polishing SVN: 34751 --- .../SampleTable/widgets/MoveSampleController.js | 12 +++++++++++- .../js/views/SideMenu/SideMenuWidgetController.js | 9 ++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleTable/widgets/MoveSampleController.js b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleTable/widgets/MoveSampleController.js index bce188a5390..1f3f0e4fb83 100644 --- a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleTable/widgets/MoveSampleController.js +++ b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleTable/widgets/MoveSampleController.js @@ -48,7 +48,17 @@ function MoveSampleController(samplePermId, successAction) { this._moveSampleModel.experimentIdentifier, this._moveSampleModel.experimentType, function(isOK) { if(isOK) { - Util.showSuccess("Sample " + _this._moveSampleModel.sample.identifier + " moved to " + _this._moveSampleModel.experimentIdentifier, function() { Util.unblockUI(); if(_this._moveSampleModel.successAction) { _this._moveSampleModel.successAction(); } }); + Util.showSuccess("Sample " + _this._moveSampleModel.sample.identifier + " moved to " + _this._moveSampleModel.experimentIdentifier, function() { + Util.unblockUI(); + if(_this._moveSampleModel.successAction) { + //Delete Sample from current experiment menu + mainController.sideMenu.deleteUniqueIdAndMoveToParent(_this._moveSampleModel.sample.identifier, true); + //Refresh Experiment where sample was moved + mainController.sideMenu.refreshSubExperiment(_this._moveSampleModel.experimentIdentifier); + + _this._moveSampleModel.successAction(); + } + }); } else { Util.showError("Sample " + _this._moveSampleModel.sample.identifier + " failed " + _this._moveSampleModel.experimentIdentifier, function() {}); } diff --git a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SideMenu/SideMenuWidgetController.js b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SideMenu/SideMenuWidgetController.js index b6c4fc6378f..d76ecca9497 100644 --- a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SideMenu/SideMenuWidgetController.js +++ b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SideMenu/SideMenuWidgetController.js @@ -30,7 +30,7 @@ function SideMenuWidgetController(mainController) { // External API for real time updates // - this.deleteUniqueIdAndMoveToParent = function(uniqueId) { + this.deleteUniqueIdAndMoveToParent = function(uniqueId, notMoveToParent) { var itemsToCheck = [this._sideMenuWidgetModel.menuStructure]; var currentItem = null; while(currentItem = itemsToCheck.shift()) { @@ -39,8 +39,11 @@ function SideMenuWidgetController(mainController) { var currentItemChild = currentItem.newMenuIfSelected.children[i]; if(currentItemChild.uniqueId === uniqueId) { currentItem.newMenuIfSelected.children.splice(i,1); - mainController.changeView(currentItem.newViewIfSelected, currentItem.newViewIfSelectedData); - this._sideMenuWidgetModel.pointerToMenuNode = currentItem; + if(!notMoveToParent) { + mainController.changeView(currentItem.newViewIfSelected, currentItem.newViewIfSelectedData); + this._sideMenuWidgetModel.pointerToMenuNode = currentItem; + } + this._sideMenuWidgetView.repaint(); return; } -- GitLab