forked from External/greenlight
		
	finish delete recording feature
This commit is contained in:
		@@ -8,17 +8,19 @@
 | 
			
		||||
    {
 | 
			
		||||
      received: function(data) {
 | 
			
		||||
        var table = $("#recordings").DataTable();
 | 
			
		||||
        var rowData = table.row("#"+data.record_id).data();
 | 
			
		||||
        rowData.published = data.published
 | 
			
		||||
        table.row("#"+data.record_id).data(rowData).draw();
 | 
			
		||||
        var publish = (data.published) ? 'publish' : 'unpublish';
 | 
			
		||||
        var row = table.row("#"+data.record_id);
 | 
			
		||||
        if (data.action === 'update') {
 | 
			
		||||
          var rowData = row.data();
 | 
			
		||||
          rowData.published = data.published
 | 
			
		||||
          table.row("#"+data.record_id).data(rowData).draw();
 | 
			
		||||
 | 
			
		||||
        // show alert success alert
 | 
			
		||||
        $('.alert-template .alert-message').html($('.'+publish+'-alert').html());
 | 
			
		||||
        $('#alerts').html($('.alert-template').html());
 | 
			
		||||
        setTimeout(function() {
 | 
			
		||||
          $('#alerts > .alert').alert('close');
 | 
			
		||||
        }, 4000);
 | 
			
		||||
          var publish = (data.published) ? 'publish' : 'unpublish';
 | 
			
		||||
          showAlert($('.'+publish+'-alert').html(), 4000);
 | 
			
		||||
        } else if (data.action === 'delete') {
 | 
			
		||||
          row.remove().draw();
 | 
			
		||||
 | 
			
		||||
          showAlert($('.delete-alert').html(), 4000);
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    });
 | 
			
		||||
  };
 | 
			
		||||
 
 | 
			
		||||
@@ -187,14 +187,18 @@
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    $('#recordings').on('click', '.recording-delete', function(event) {
 | 
			
		||||
      var btn = $(this);
 | 
			
		||||
      var row = recordingsTable.api().row($(this).closest('tr')).data();
 | 
			
		||||
      var url = $('.meeting-url').val();
 | 
			
		||||
      var id = row.id;
 | 
			
		||||
      btn.prop('disabled', true);
 | 
			
		||||
      $.ajax({
 | 
			
		||||
        method: 'DELETE',
 | 
			
		||||
        url: url+'/recordings/'+id
 | 
			
		||||
      }).done(function() {
 | 
			
		||||
        recordingsTable.api().row("#"+id).remove().draw();
 | 
			
		||||
 | 
			
		||||
      }).fail(function(data) {
 | 
			
		||||
        btn.prop('disabled', false);
 | 
			
		||||
      });
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -76,3 +76,18 @@ var loopJoin = function() {
 | 
			
		||||
    console.info("meeting join failed");
 | 
			
		||||
  });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
var showAlert = function(html, timeout_delay) {
 | 
			
		||||
  if (!html) {
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  $('.alert-template .alert-message').html(html);
 | 
			
		||||
  $('#alerts').html($('.alert-template').html());
 | 
			
		||||
 | 
			
		||||
  if (timeout_delay) {
 | 
			
		||||
    setTimeout(function() {
 | 
			
		||||
      $('#alerts > .alert').alert('close');
 | 
			
		||||
    }, timeout_delay);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user