forked from External/greenlight
Merge pull request #27 from zach-chai/delete_sync
finish delete recording feature
This commit is contained in:
commit
e093ead683
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,6 +69,9 @@ class BbbController < ApplicationController
|
|||
# DELETE /rooms/:id/recordings/:record_id
|
||||
def delete_recordings
|
||||
bbb_res = bbb_delete_recordings(params[:record_id])
|
||||
if bbb_res[:returncode]
|
||||
RecordingDeletesJob.perform_later(@user.username, params[:record_id])
|
||||
end
|
||||
render_bbb_response bbb_res
|
||||
end
|
||||
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
class RecordingDeletesJob < ApplicationJob
|
||||
include BbbApi
|
||||
|
||||
queue_as :default
|
||||
|
||||
def perform(room, record_id)
|
||||
tries = 0
|
||||
sleep_time = 2
|
||||
|
||||
while tries < 4
|
||||
bbb_res = bbb_get_recordings(nil, record_id)
|
||||
if !bbb_res[:recordings] || bbb_res[:messageKey] == 'noRecordings'
|
||||
ActionCable.server.broadcast "#{room}_recording_updates_channel",
|
||||
action: 'delete',
|
||||
record_id: record_id
|
||||
break
|
||||
end
|
||||
sleep sleep_time
|
||||
sleep_time = sleep_time * 2
|
||||
tries += 1
|
||||
end
|
||||
end
|
||||
end
|
|
@ -11,6 +11,7 @@ class RecordingUpdatesJob < ApplicationJob
|
|||
bbb_res = bbb_get_recordings(nil, record_id)
|
||||
if bbb_res[:recordings].first[:published].to_s == published
|
||||
ActionCable.server.broadcast "#{room}_recording_updates_channel",
|
||||
action: 'update',
|
||||
record_id: record_id,
|
||||
published: bbb_res[:recordings].first[:published]
|
||||
break
|
||||
|
|
|
@ -68,13 +68,16 @@
|
|||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<span class="alert-message">Recording was successfully published</span>
|
||||
<span class="alert-message"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="publish-alert">
|
||||
<%= t('recording_publish_success') %>
|
||||
<%= t('recording_published') %>
|
||||
</div>
|
||||
<div class="unpublish-alert">
|
||||
<%= t('recording_unpublish_success') %>
|
||||
<%= t('recording_unpublished') %>
|
||||
</div>
|
||||
<div class="delete-alert">
|
||||
<%= t('recording_deleted') %>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -41,8 +41,9 @@ en-US:
|
|||
past_recordings: Past Recordings
|
||||
powered_bigbluebutton: Powered by BigBlueButton
|
||||
presentation: Presentation
|
||||
recording_publish_success: Recording was successfully published
|
||||
recording_unpublish_success: Recording was successfully unpublished
|
||||
recording_deleted: Recording was deleted
|
||||
recording_published: Recording was published
|
||||
recording_unpublished: Recording was unpublished
|
||||
refresh_html: <a href="#" class="generate-link">Click refresh</a> to generate a new meeting URL
|
||||
session_url_explanation: The session will be taking place using the following URL
|
||||
start: Start
|
||||
|
|
Loading…
Reference in New Issue