From 603d5ccdb487c5bfc667ccba57911b970209cbe1 Mon Sep 17 00:00:00 2001 From: juanf <juanf> Date: Mon, 17 Nov 2014 11:56:01 +0000 Subject: [PATCH] SSDM-1071 : PAPER - Empty Trashcan SVN: 32839 --- .../1/as/webapps/newbrowser/html/index.html | 4 +++ .../html/js/controllers/MainController.js | 18 ++++++----- .../SideMenu/SideMenuWidgetController.js | 3 ++ .../TrashManager/TrashManagerController.js | 31 +++++++++++++++++++ .../views/TrashManager/TrashManagerModel.js | 19 ++++++++++++ .../js/views/TrashManager/TrashManagerView.js | 25 +++++++++++++++ 6 files changed, 93 insertions(+), 7 deletions(-) create mode 100644 plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/TrashManager/TrashManagerController.js create mode 100644 plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/TrashManager/TrashManagerModel.js create mode 100644 plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/TrashManager/TrashManagerView.js diff --git a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/index.html b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/index.html index 8736e804367..65483c87520 100644 --- a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/index.html +++ b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/index.html @@ -92,6 +92,10 @@ <script type="text/javascript" src="./js/util/FormUtil.js"></script> <script type="text/javascript" src="./js/util/BlockScrollUtil.js"></script> + <script type="text/javascript" src="./js/views/TrashManager/TrashManagerController.js"></script> + <script type="text/javascript" src="./js/views/TrashManager/TrashManagerModel.js"></script> + <script type="text/javascript" src="./js/views/TrashManager/TrashManagerView.js"></script> + <script type="text/javascript" src="./js/views/StorageManager/StorageManagerController.js"></script> <script type="text/javascript" src="./js/views/StorageManager/StorageManagerModel.js"></script> <script type="text/javascript" src="./js/views/StorageManager/StorageManagerView.js"></script> diff --git a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/controllers/MainController.js b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/controllers/MainController.js index 420db054701..a02eebc2afc 100644 --- a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/controllers/MainController.js +++ b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/controllers/MainController.js @@ -90,8 +90,6 @@ function MainController(profile) { $("#main").show(); //Get Metadata from all sample types before showing the main menu - - this.serverFacade.listSampleTypes ( function(result) { //Load Sample Types @@ -166,6 +164,11 @@ function MainController(profile) { // switch (newViewChange) { + case "showTrashcanPage": + document.title = "Storage Manager"; + this._showTrashcan(); + window.scrollTo(0,0); + break; case "showStorageManager": document.title = "Storage Manager"; this._showStorageManager(); @@ -370,9 +373,6 @@ function MainController(profile) { this._showInspectors = function() { //Show Inspectors - //var examineController = new ExamineController(this); - //examineController.init($("#mainContainer")); - //this.currentView = examineController; this.inspector.repaint(); } @@ -401,7 +401,6 @@ function MainController(profile) { } this._showSampleHierarchyPage = function(permId) { - //Show View var localInstance = this; this.serverFacade.searchWithUniqueId(permId, function(data) { @@ -440,7 +439,12 @@ function MainController(profile) { this.currentView = sampleFormController; sampleFormController.init($("#mainContainer")); } - + + this._showTrashcan = function() { + var trashcanController = new TrashManagerController(this); + this.trashcanController = trashcanController; + trashcanController.init($("#mainContainer")); + } this._showViewSamplePage = function(sample, isELNSubExperiment) { //Show Form diff --git a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/SideMenu/SideMenuWidgetController.js b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/SideMenu/SideMenuWidgetController.js index 342e3c0ddcd..691ebb86bd5 100644 --- a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/SideMenu/SideMenuWidgetController.js +++ b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/SideMenu/SideMenuWidgetController.js @@ -304,6 +304,9 @@ function SideMenuWidgetController(mainController) { new SideMenuWidgetComponent(true, false, "Storage Manager", "Storage Manager", _this._sideMenuWidgetModel.menuStructure, null, "showStorageManager", null, "") ); } + _this._sideMenuWidgetModel.menuStructure.newMenuIfSelected.children.push( + new SideMenuWidgetComponent(true, false, "Trashcan", "Trashcan", _this._sideMenuWidgetModel.menuStructure, null, "showTrashcanPage", null, "") + ); _this._sideMenuWidgetView.repaintFirst($container); }); diff --git a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/TrashManager/TrashManagerController.js b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/TrashManager/TrashManagerController.js new file mode 100644 index 00000000000..5b2108166ca --- /dev/null +++ b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/TrashManager/TrashManagerController.js @@ -0,0 +1,31 @@ +/* + * Copyright 2014 ETH Zuerich, Scientific IT Services + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +function TrashManagerController(mainController) { + this._mainController = mainController; + this._trashManagerModel = new TrashManagerModel(); + this._trashManagerView = new TrashManagerView(this, this._trashManagerModel); + + this.init = function($container) { + var _this = this; + mainController.serverFacade.listDeletions(function(data) { + if(data.result && data.result.length > 0) { + //Fill Model + } + _this._trashManagerView.repaint($container); + }); + } +} \ No newline at end of file diff --git a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/TrashManager/TrashManagerModel.js b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/TrashManager/TrashManagerModel.js new file mode 100644 index 00000000000..d43ebb78587 --- /dev/null +++ b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/TrashManager/TrashManagerModel.js @@ -0,0 +1,19 @@ +/* + * Copyright 2014 ETH Zuerich, Scientific IT Services + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +function TrashManagerModel() { + +} \ No newline at end of file diff --git a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/TrashManager/TrashManagerView.js b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/TrashManager/TrashManagerView.js new file mode 100644 index 00000000000..eaf33f64353 --- /dev/null +++ b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/TrashManager/TrashManagerView.js @@ -0,0 +1,25 @@ +/* + * Copyright 2014 ETH Zuerich, Scientific IT Services + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +function TrashManagerView(trashManagerController, trashManagerModel) { + this._trashManagerController = trashManagerController; + this._trashManagerModel = trashManagerModel; + + this.repaint = function($container) { + $container.empty(); + $container.append("Hello Trashcan!"); + } +} \ No newline at end of file -- GitLab