From 8e0cca5b4a1e01ff4c6a1d7a4649fe9e8198d8ff Mon Sep 17 00:00:00 2001 From: Zachary Chai Date: Tue, 21 Mar 2017 12:04:17 -0400 Subject: [PATCH] remove recording from client if 404 --- app/assets/javascripts/recordings.coffee | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/recordings.coffee b/app/assets/javascripts/recordings.coffee index 92c9b5a9..6d4f1549 100644 --- a/app/assets/javascripts/recordings.coffee +++ b/app/assets/javascripts/recordings.coffee @@ -250,23 +250,27 @@ class @Recordings data: data }).done((data) -> btn.prop('disabled', false) - ).fail((data) -> + ).fail((xhr, text) -> btn.prop('disabled', false) ) @getTable().on 'click', '.recording-delete', (event) -> btn = $(this) - row = table_api.row($(this).closest('tr')).data() + row = table_api.row($(this).closest('tr')) url = recordingsObject.getRecordingsURL() - id = row.id + id = row.data().id btn.prop('disabled', true) $.ajax({ method: 'DELETE', url: url+'/'+id }).done((data) -> btn.prop('disabled', false) - ).fail((data) -> + ).fail((xhr, text) -> btn.prop('disabled', false) + if xhr.status == 404 + row.remove(); + recordingsObject.draw() + showAlert(I18n.recording_deleted, 4000); ) @getTable().on 'draw.dt', (event) ->