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) {
|
received: function(data) {
|
||||||
var table = $("#recordings").DataTable();
|
var table = $("#recordings").DataTable();
|
||||||
var rowData = table.row("#"+data.record_id).data();
|
var row = table.row("#"+data.record_id);
|
||||||
|
if (data.action === 'update') {
|
||||||
|
var rowData = row.data();
|
||||||
rowData.published = data.published
|
rowData.published = data.published
|
||||||
table.row("#"+data.record_id).data(rowData).draw();
|
table.row("#"+data.record_id).data(rowData).draw();
|
||||||
var publish = (data.published) ? 'publish' : 'unpublish';
|
|
||||||
|
|
||||||
// show alert success alert
|
var publish = (data.published) ? 'publish' : 'unpublish';
|
||||||
$('.alert-template .alert-message').html($('.'+publish+'-alert').html());
|
showAlert($('.'+publish+'-alert').html(), 4000);
|
||||||
$('#alerts').html($('.alert-template').html());
|
} else if (data.action === 'delete') {
|
||||||
setTimeout(function() {
|
row.remove().draw();
|
||||||
$('#alerts > .alert').alert('close');
|
|
||||||
}, 4000);
|
showAlert($('.delete-alert').html(), 4000);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -187,14 +187,18 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#recordings').on('click', '.recording-delete', function(event) {
|
$('#recordings').on('click', '.recording-delete', function(event) {
|
||||||
|
var btn = $(this);
|
||||||
var row = recordingsTable.api().row($(this).closest('tr')).data();
|
var row = recordingsTable.api().row($(this).closest('tr')).data();
|
||||||
var url = $('.meeting-url').val();
|
var url = $('.meeting-url').val();
|
||||||
var id = row.id;
|
var id = row.id;
|
||||||
|
btn.prop('disabled', true);
|
||||||
$.ajax({
|
$.ajax({
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
url: url+'/recordings/'+id
|
url: url+'/recordings/'+id
|
||||||
}).done(function() {
|
}).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");
|
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
|
# DELETE /rooms/:id/recordings/:record_id
|
||||||
def delete_recordings
|
def delete_recordings
|
||||||
bbb_res = bbb_delete_recordings(params[:record_id])
|
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
|
render_bbb_response bbb_res
|
||||||
end
|
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)
|
bbb_res = bbb_get_recordings(nil, record_id)
|
||||||
if bbb_res[:recordings].first[:published].to_s == published
|
if bbb_res[:recordings].first[:published].to_s == published
|
||||||
ActionCable.server.broadcast "#{room}_recording_updates_channel",
|
ActionCable.server.broadcast "#{room}_recording_updates_channel",
|
||||||
|
action: 'update',
|
||||||
record_id: record_id,
|
record_id: record_id,
|
||||||
published: bbb_res[:recordings].first[:published]
|
published: bbb_res[:recordings].first[:published]
|
||||||
break
|
break
|
||||||
|
|
|
@ -68,13 +68,16 @@
|
||||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||||
<span aria-hidden="true">×</span>
|
<span aria-hidden="true">×</span>
|
||||||
</button>
|
</button>
|
||||||
<span class="alert-message">Recording was successfully published</span>
|
<span class="alert-message"></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="publish-alert">
|
<div class="publish-alert">
|
||||||
<%= t('recording_publish_success') %>
|
<%= t('recording_published') %>
|
||||||
</div>
|
</div>
|
||||||
<div class="unpublish-alert">
|
<div class="unpublish-alert">
|
||||||
<%= t('recording_unpublish_success') %>
|
<%= t('recording_unpublished') %>
|
||||||
|
</div>
|
||||||
|
<div class="delete-alert">
|
||||||
|
<%= t('recording_deleted') %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -41,8 +41,9 @@ en-US:
|
||||||
past_recordings: Past Recordings
|
past_recordings: Past Recordings
|
||||||
powered_bigbluebutton: Powered by BigBlueButton
|
powered_bigbluebutton: Powered by BigBlueButton
|
||||||
presentation: Presentation
|
presentation: Presentation
|
||||||
recording_publish_success: Recording was successfully published
|
recording_deleted: Recording was deleted
|
||||||
recording_unpublish_success: Recording was successfully unpublished
|
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
|
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
|
session_url_explanation: The session will be taking place using the following URL
|
||||||
start: Start
|
start: Start
|
||||||
|
|
Loading…
Reference in New Issue