From cc190d7449967c3e75fa6d013ff7b12f77f4dfde Mon Sep 17 00:00:00 2001 From: Carl Eberhard Date: Wed, 19 Dec 2012 15:46:55 -0500 Subject: [PATCH] history panel: fix delete function to use show_deleted --- static/scripts/mvc/dataset/hda-base.js | 3 ++- static/scripts/mvc/dataset/hda-edit.js | 9 +++------ static/scripts/mvc/history/history-panel.js | 7 +++++++ templates/root/alternate_history.mako | 3 +-- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/static/scripts/mvc/dataset/hda-base.js b/static/scripts/mvc/dataset/hda-base.js index cfe1fc79dc0..7dc2f5dc5e2 100644 --- a/static/scripts/mvc/dataset/hda-base.js +++ b/static/scripts/mvc/dataset/hda-base.js @@ -44,7 +44,8 @@ var HDABaseView = BaseView.extend( LoggableMixin ).extend( this.expanded = attributes.expanded || false; // re-render the entire view on any model change - this.model.bind( 'change', this.render, this ); + this.model.bind( 'change', this.render , this ); + //this.bind( 'all', function( event ){ // this.log( event ); //}, this ); diff --git a/static/scripts/mvc/dataset/hda-edit.js b/static/scripts/mvc/dataset/hda-edit.js index 03e9114f80c..40e6d930846 100644 --- a/static/scripts/mvc/dataset/hda-edit.js +++ b/static/scripts/mvc/dataset/hda-edit.js @@ -118,9 +118,6 @@ var HDAEditView = HDABaseView.extend( LoggableMixin ).extend( id : 'historyItemDeleter-' + this.model.get( 'id' ), icon_class : 'delete', on_click : function() { - // Provide feedback by hiding from view immediately. - self.$el.slideUp(); - // Delete the dataset on the server and update HDA + view depending on success/failure. // FIXME: when HDA-delete is implemented in the API, can call set(), then save directly // on the model. @@ -134,13 +131,13 @@ var HDAEditView = HDABaseView.extend( LoggableMixin ).extend( }, success: function() { // FIXME: setting model attribute causes re-rendering, which is unnecessary. - self.model.set( 'deleted', true ); - self.$el.remove(); + //self.$el.remove(); + self.model.set({ deleted: true }); } }); // Return false so that anchor action (page reload) does not happen. - return false; + //return false; } }; if( this.model.get( 'deleted' ) || this.model.get( 'purged' ) ){ diff --git a/static/scripts/mvc/history/history-panel.js b/static/scripts/mvc/history/history-panel.js index 6a48ca99b5f..89e2c167a5a 100644 --- a/static/scripts/mvc/history/history-panel.js +++ b/static/scripts/mvc/history/history-panel.js @@ -163,6 +163,11 @@ var HistoryPanel = BaseView.extend( LoggableMixin ).extend( this.model.hdas.bind( 'add', this.add, this ); this.model.hdas.bind( 'reset', this.addAll, this ); + // when a hda model is (un)deleted or (un)hidden, re-render entirely + //TODO??: purged + //TODO??: could be more selective here + this.model.hdas.bind( 'change:deleted change:hidden', this.render, this ); + // if an a hidden hda is created (gen. by a workflow), moves thru the updater to the ready state, // then: remove it from the collection if the panel is set to NOT show hidden datasets this.model.hdas.bind( 'change:state', @@ -292,6 +297,7 @@ var HistoryPanel = BaseView.extend( LoggableMixin ).extend( // fade out existing, swap with the new, fade in, set up behaviours $( historyView ).queue( setUpQueueName, function( next ){ historyView.$el.fadeOut( 'fast', function(){ next(); }); + //historyView.$el.show( function(){ next(); }); }); $( historyView ).queue( setUpQueueName, function( next ){ // swap over from temp div newRender @@ -299,6 +305,7 @@ var HistoryPanel = BaseView.extend( LoggableMixin ).extend( historyView.$el.append( newRender.children() ); historyView.$el.fadeIn( 'fast', function(){ next(); }); + //historyView.$el.show( function(){ next(); }); }); $( historyView ).queue( setUpQueueName, function( next ){ this.log( historyView + ' rendered:', historyView.$el ); diff --git a/templates/root/alternate_history.mako b/templates/root/alternate_history.mako index 5132df9d642..e145c099709 100644 --- a/templates/root/alternate_history.mako +++ b/templates/root/alternate_history.mako @@ -144,8 +144,7 @@ ${ unquote_plus( h.to_json_string( url_dict ) ) } #TODO: via api #TODO: show deleted handled by history - 'delete' : h.url_for( controller='dataset', action='delete', - dataset_id=encoded_id_template, show_deleted_on_refresh=show_deleted ), + 'delete' : h.url_for( controller='dataset', action='delete_async', dataset_id=encoded_id_template ), # ................................................................ download links (and associated meta files), 'download' : h.url_for( controller='/dataset', action='display',