From ddfc5718a74cc811452963ae72e56368ee09b22a Mon Sep 17 00:00:00 2001 From: juanf <juanf> Date: Mon, 17 Nov 2014 12:31:48 +0000 Subject: [PATCH] SSDM-1071 : PAPER - Empty Trashcan SVN: 32841 --- .../newbrowser/html/js/server/ServerFacade.js | 21 -------- .../views/TrashManager/TrashManagerModel.js | 2 +- .../js/views/TrashManager/TrashManagerView.js | 50 ++++++++++++++++++- 3 files changed, 50 insertions(+), 23 deletions(-) diff --git a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/server/ServerFacade.js b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/server/ServerFacade.js index 6607ce03d64..061230ff447 100644 --- a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/server/ServerFacade.js +++ b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/server/ServerFacade.js @@ -246,27 +246,6 @@ function ServerFacade(openbisServer) { GET += '&sessionID=' + this.openbisServer.getSession(); return GET; } - - this.fileTemplateDownload = function(entityType, operationKind) { - - $.ajax({ - type: 'POST', - url: '/openbis/openbis/template-download', - data: { - 'entityKind' : 'SAMPLE', - 'entityType' : 'UNKNOWN', - 'autoGenerate' : false, - 'with_experiments' : true, - 'with_space' : true, - 'batch_operation_kind' :'REGISTRATION', - 'timestamp' : new Date().getTime(), - 'sessionID' : this.openbisServer.getSession() - }, - success: function(result) { - alert(result); - } - }); - } // // Data Set Import Related Functions 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 index 994aaaa2ec3..fdb4b88b307 100644 --- 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 @@ -15,5 +15,5 @@ */ function TrashManagerModel() { - this.deletions = null; + this.deletions = []; } \ 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 index 5072e9f855c..1ed6e76170d 100644 --- 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 @@ -19,8 +19,12 @@ function TrashManagerView(trashManagerController, trashManagerModel) { this._trashManagerModel = trashManagerModel; this.repaint = function($container) { + var _this = this; $container.empty(); + // + // Form template and title + // var $containerColumn = $("<form>", { "class" : FormUtil.formColumClass + " form-horizontal", 'role' : "form", @@ -29,8 +33,52 @@ function TrashManagerView(trashManagerController, trashManagerModel) { }); var $trashIcon = $("<span>", { 'class' : 'glyphicon glyphicon-trash'}); - $containerColumn.append($("<h2>").append($trashIcon).append(" Trashcan")); + $containerColumn.append($("<h1>").append($trashIcon).append(" Trashcan")); + // + // Table + // + var columns = [ { + label : 'Entities', + property : 'entities', + sortable : true + } , { + label : 'Reason', + property : 'reason', + sortable : true + }]; + + var getDataList = function(callback) { + var dataList = []; + for(var delIdx = 0; delIdx < _this._trashManagerModel.deletions.length; delIdx++) { + var deletion = _this._trashManagerModel.deletions[delIdx]; + var entities = null; + for(var enIdx = 0; enIdx < deletion.deletedEntities.length; enIdx++) { + if(entities) { + entities += "<br>"; + } else { + entities = ""; + } + entities += deletion.deletedEntities[enIdx].entityKind + " - " + deletion.deletedEntities[enIdx].identifier + } + dataList.push({ + entities : entities, + reason : deletion.reasonOrNull + }); + } + callback(dataList); + } + + var dataGridContainer = $("<div>"); + var dataGrid = new DataGridController(null, columns, getDataList, null); + dataGrid.init(dataGridContainer); + $containerColumn.append(dataGridContainer); + // + // Empty all button + // + + + // $container.append($containerColumn); } } \ No newline at end of file -- GitLab