mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
data lirbaries: support for showing deleted datasets in the folderview
This commit is contained in:
@@ -43,7 +43,7 @@ class FolderContentsController( BaseAPIController, UsesLibraryMixin, UsesLibrary
|
||||
:raises: MalformedId, InconsistentDatabase, ObjectNotFound,
|
||||
InternalServerError
|
||||
"""
|
||||
deleted = kwd.get( 'deleted', 'missing' )
|
||||
deleted = kwd.get( 'include_deleted', 'missing' )
|
||||
try:
|
||||
deleted = util.asbool( deleted )
|
||||
except ValueError:
|
||||
|
||||
@@ -13,6 +13,9 @@ function(mod_masthead,
|
||||
|
||||
var FolderListView = Backbone.View.extend({
|
||||
el : '#folder_items_element',
|
||||
defaults: {
|
||||
'include_deleted' : false
|
||||
},
|
||||
// progress percentage
|
||||
progress: 0,
|
||||
// progress rate per one item
|
||||
@@ -38,15 +41,21 @@ var FolderListView = Backbone.View.extend({
|
||||
this.fetchFolder();
|
||||
},
|
||||
|
||||
fetchFolder: function(){
|
||||
fetchFolder: function(options){
|
||||
// this.options = _.defaults(this.options, options);
|
||||
var options = options || {};
|
||||
this.options.include_deleted = options.include_deleted;
|
||||
var that = this;
|
||||
this.folderContainer = new mod_library_model.FolderContainer({id: this.options.id});
|
||||
this.folderContainer.url = this.folderContainer.attributes.urlRoot + this.options.id + '/contents';
|
||||
if (this.options.include_deleted){
|
||||
this.folderContainer.url = this.folderContainer.url + '?include_deleted=true';
|
||||
}
|
||||
this.folderContainer.fetch({
|
||||
success: function(folder_container) {
|
||||
that.folder_container = folder_container;
|
||||
that.render();
|
||||
that.addAll(folder_container.get('folder').models)
|
||||
that.addAll(folder_container.get('folder').models);
|
||||
},
|
||||
error: function(model, response){
|
||||
if (typeof response.responseJSON !== "undefined"){
|
||||
@@ -59,7 +68,7 @@ var FolderListView = Backbone.View.extend({
|
||||
},
|
||||
|
||||
render: function (options) {
|
||||
this.options = _.defaults(this.options || {}, options);
|
||||
this.options = _.defaults(this.options, options);
|
||||
var template = this.templateFolder();
|
||||
|
||||
// TODO move to server
|
||||
@@ -93,6 +102,7 @@ var FolderListView = Backbone.View.extend({
|
||||
_.each(models.reverse(), function(model) {
|
||||
Galaxy.libraries.folderListView.collection.add(model);
|
||||
});
|
||||
$("#center [data-toggle]").tooltip();
|
||||
this.checkEmptiness();
|
||||
},
|
||||
|
||||
|
||||
@@ -36,7 +36,11 @@ var FolderRowView = Backbone.View.extend({
|
||||
template = this.templateRowFolder();
|
||||
} else {
|
||||
this.options.type = 'file';
|
||||
template = this.templateRowFile();
|
||||
if (folder_item.get('deleted')){
|
||||
template = this.templateRowDeletedFile();
|
||||
} else {
|
||||
template = this.templateRowFile();
|
||||
}
|
||||
}
|
||||
this.setElement(template({content_item:folder_item}));
|
||||
this.$el.show();
|
||||
@@ -226,6 +230,23 @@ var FolderRowView = Backbone.View.extend({
|
||||
tmpl_array.push(' <td><%= _.escape(content_item.get("update_time")) %></td>'); // time updated
|
||||
tmpl_array.push('</tr>');
|
||||
|
||||
return _.template(tmpl_array.join(''));
|
||||
},
|
||||
|
||||
templateRowDeletedFile: function(){
|
||||
tmpl_array = [];
|
||||
|
||||
tmpl_array.push('<tr class="active" id="<%- content_item.id %>">');
|
||||
tmpl_array.push(' <td>');
|
||||
tmpl_array.push(' <span title="Dataset" class="fa fa-file-o"></span>');
|
||||
tmpl_array.push(' </td>');
|
||||
tmpl_array.push(' <td><span data-toggle="tooltip" data-placement="top" title="Marked deleted" style="color:grey;" class="fa fa-ban fa-lg"> </span></td>');
|
||||
tmpl_array.push(' <td style="color:grey;"><%- content_item.get("name") %></td>'); // dataset
|
||||
tmpl_array.push(' <td><%= _.escape(content_item.get("data_type")) %></td>'); // data type
|
||||
tmpl_array.push(' <td><%= _.escape(content_item.get("readable_size")) %></td>'); // size
|
||||
tmpl_array.push(' <td><%= _.escape(content_item.get("update_time")) %></td>'); // time updated
|
||||
tmpl_array.push('</tr>');
|
||||
|
||||
return _.template(tmpl_array.join(''));
|
||||
},
|
||||
|
||||
|
||||
@@ -12,9 +12,10 @@ var FolderToolbarView = Backbone.View.extend({
|
||||
el: '#center',
|
||||
|
||||
events: {
|
||||
'click #toolbtn_create_folder' : 'createFolderFromModal',
|
||||
'click #toolbtn_bulk_import' : 'modalBulkImport',
|
||||
'click .toolbtn_add_files' : 'addFilesToFolderModal'
|
||||
'click #toolbtn_create_folder' : 'createFolderFromModal',
|
||||
'click #toolbtn_bulk_import' : 'modalBulkImport',
|
||||
'click .toolbtn_add_files' : 'addFilesToFolderModal',
|
||||
'click #include_deleted_datasets_chk' : 'check_include_deleted'
|
||||
},
|
||||
|
||||
defaults: {
|
||||
@@ -389,6 +390,21 @@ var FolderToolbarView = Backbone.View.extend({
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Handles the click on 'show deleted' checkbox
|
||||
*/
|
||||
check_include_deleted: function(event){
|
||||
if (event.target.checked){
|
||||
Galaxy.libraries.folderListView.collection = new mod_library_model.Folder();
|
||||
Galaxy.libraries.folderListView.listenTo(Galaxy.libraries.folderListView.collection, 'add', Galaxy.libraries.folderListView.renderOne);
|
||||
Galaxy.libraries.folderListView.fetchFolder({include_deleted: true});
|
||||
} else{
|
||||
Galaxy.libraries.folderListView.collection = new mod_library_model.Folder();
|
||||
Galaxy.libraries.folderListView.listenTo(Galaxy.libraries.folderListView.collection, 'add', Galaxy.libraries.folderListView.renderOne);
|
||||
Galaxy.libraries.folderListView.fetchFolder({include_deleted: false});
|
||||
}
|
||||
},
|
||||
|
||||
templateToolBar: function(){
|
||||
tmpl_array = [];
|
||||
|
||||
|
||||
@@ -221,7 +221,11 @@ var LibraryRowView = Backbone.View.extend({
|
||||
|
||||
tmpl_array.push(' <tr class="<% if(library.get("deleted") === true) { print("active") } %>" style="display:none;" data-id="<%- library.get("id") %>">');
|
||||
tmpl_array.push(' <% if(!edit_mode) { %>');
|
||||
tmpl_array.push(' <td><a href="#folders/<%- library.get("root_folder_id") %>"><%- library.get("name") %></a></td>');
|
||||
tmpl_array.push(' <% if(library.get("deleted")) { %>');
|
||||
tmpl_array.push(' <td style="color:grey;"><%- library.get("name") %></td>');
|
||||
tmpl_array.push(' <% } else { %>');
|
||||
tmpl_array.push(' <td><a href="#folders/<%- library.get("root_folder_id") %>"><%- library.get("name") %></a></td>');
|
||||
tmpl_array.push(' <% } %>');
|
||||
tmpl_array.push(' <td><%= _.escape(library.get("description")) %></td>');
|
||||
tmpl_array.push(' <td><%= _.escape(library.get("synopsis")) %></td>');
|
||||
tmpl_array.push(' <% } else if(edit_mode){ %>');
|
||||
@@ -230,9 +234,9 @@ var LibraryRowView = Backbone.View.extend({
|
||||
tmpl_array.push(' <td><input type="text" class="form-control input_library_synopsis" placeholder="synopsis" value="<%- library.get("synopsis") %>"></td>');
|
||||
tmpl_array.push(' <% } %>');
|
||||
tmpl_array.push(' <td class="right-center">');
|
||||
tmpl_array.push(' <% if(library.get("deleted") === true) { %>');
|
||||
tmpl_array.push(' <% if(library.get("deleted")) { %>');
|
||||
tmpl_array.push(' <span data-toggle="tooltip" data-placement="top" title="Marked deleted" style="color:grey;" class="fa fa-ban fa-lg deleted_lib_ico"> </span>');
|
||||
tmpl_array.push(' <% } else if(library.get("public") === true) { %>');
|
||||
tmpl_array.push(' <% } else if(library.get("public")) { %>');
|
||||
tmpl_array.push(' <span data-toggle="tooltip" data-placement="top" title="Public" style="color:grey;" class="fa fa-globe fa-lg public_lib_ico"> </span>');
|
||||
tmpl_array.push(' <% }%>');
|
||||
// tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Upload to library" class="primary-button btn-xs upload_library_btn" type="button" style="<% if(button_config.upload_library_btn === false) { print("display:none;") } %>"><span class="fa fa-upload"></span></button>');
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user