forked from External/greenlight
master #1
|
@ -98,4 +98,4 @@
|
||||||
|
|
||||||
.admin-tabs {
|
.admin-tabs {
|
||||||
justify-content: space-around;
|
justify-content: space-around;
|
||||||
}
|
}
|
|
@ -56,12 +56,19 @@ class AdminsController < ApplicationController
|
||||||
|
|
||||||
# GET /admins/server_recordings
|
# GET /admins/server_recordings
|
||||||
def server_recordings
|
def server_recordings
|
||||||
server_rooms = rooms_list_for_recordings
|
@search = params[:search] || ""
|
||||||
|
|
||||||
@search, @order_column, @order_direction, recs =
|
if @search.present?
|
||||||
all_recordings(server_rooms, params.permit(:search, :column, :direction), true, true)
|
if @search.include? "@"
|
||||||
|
user_email = @search
|
||||||
|
else
|
||||||
|
room_uid = @search
|
||||||
|
end
|
||||||
|
else
|
||||||
|
@latest = true
|
||||||
|
end
|
||||||
|
|
||||||
@pagy, @recordings = pagy_array(recs)
|
@pagy, @recordings = pagy_array(recordings_to_show(user_email, room_uid))
|
||||||
end
|
end
|
||||||
|
|
||||||
# GET /admins/rooms
|
# GET /admins/rooms
|
||||||
|
|
|
@ -56,12 +56,22 @@ module Populator
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns list of rooms needed to get the recordings on the server
|
# Returns the correct recordings based on the users inputs
|
||||||
def rooms_list_for_recordings
|
def recordings_to_show(user = nil, room = nil)
|
||||||
if Rails.configuration.loadbalanced_configuration
|
if user.present?
|
||||||
Room.includes(:owner).where(users: { provider: @user_domain }).pluck(:bbb_id)
|
# Find user and get his recordings
|
||||||
|
rooms = User.find_by(email: user)&.rooms&.pluck(:bbb_id)
|
||||||
|
return all_recordings(rooms) if user.present?
|
||||||
|
|
||||||
|
[] # return no recs if room not found
|
||||||
|
elsif room.present?
|
||||||
|
# Find room and get its recordings
|
||||||
|
room = Room.find_by(uid: room)&.bbb_id
|
||||||
|
return all_recordings([room]) if room.present?
|
||||||
|
|
||||||
|
[]
|
||||||
else
|
else
|
||||||
Room.pluck(:bbb_id)
|
latest_recordings
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -75,4 +85,36 @@ module Populator
|
||||||
|
|
||||||
list.admins_search(@search).order(updated_at: :desc)
|
list.admins_search(@search).order(updated_at: :desc)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
# Returns exactly 1 page of the latest recordings
|
||||||
|
def latest_recordings
|
||||||
|
return_length = Rails.configuration.pagination_number
|
||||||
|
recordings = []
|
||||||
|
counter = 0
|
||||||
|
|
||||||
|
# Manually paginate through the rooms
|
||||||
|
while recordings.length < return_length
|
||||||
|
rooms = if Rails.configuration.loadbalanced_configuration
|
||||||
|
Room.includes(:owner)
|
||||||
|
.where(users: { provider: @user_domain })
|
||||||
|
.order(last_session: :desc)
|
||||||
|
.limit(return_length)
|
||||||
|
.offset(counter * return_length)
|
||||||
|
.pluck(:bbb_id)
|
||||||
|
else
|
||||||
|
Room.order(last_session: :desc)
|
||||||
|
.limit(return_length)
|
||||||
|
.offset(counter * return_length)
|
||||||
|
.pluck(:bbb_id)
|
||||||
|
end
|
||||||
|
|
||||||
|
break if rooms.blank?
|
||||||
|
counter += 1
|
||||||
|
recordings.push(*all_recordings(rooms))
|
||||||
|
end
|
||||||
|
|
||||||
|
recordings[0..return_length]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -37,7 +37,7 @@ module Recorder
|
||||||
def all_recordings(room_bbb_ids, search_params = {}, ret_search_params = false, search_name = false)
|
def all_recordings(room_bbb_ids, search_params = {}, ret_search_params = false, search_name = false)
|
||||||
res = { recordings: [] }
|
res = { recordings: [] }
|
||||||
|
|
||||||
until room_bbb_ids.empty?
|
until room_bbb_ids.empty? || res[:recordings].length > Rails.configuration.pagination_number
|
||||||
# bbb.get_recordings returns an object
|
# bbb.get_recordings returns an object
|
||||||
# take only the array portion of the object that is returned
|
# take only the array portion of the object that is returned
|
||||||
full_res = get_multiple_recordings(room_bbb_ids.pop(Rails.configuration.pagination_number))
|
full_res = get_multiple_recordings(room_bbb_ids.pop(Rails.configuration.pagination_number))
|
||||||
|
|
|
@ -51,7 +51,7 @@ class Room < ApplicationRecord
|
||||||
# Rely on manual ordering if trying to sort by status
|
# Rely on manual ordering if trying to sort by status
|
||||||
return order_by_status(table, running_ids) if column == "status"
|
return order_by_status(table, running_ids) if column == "status"
|
||||||
|
|
||||||
return table.order("COALESCE(rooms.last_session,rooms.created_at) DESC") if column == "created_at"
|
return table.order(Arel.sql("COALESCE(rooms.last_session,rooms.created_at) DESC")) if column == "created_at"
|
||||||
|
|
||||||
return table.order(Arel.sql("rooms.#{column} #{direction}")) if table.column_names.include?(column)
|
return table.order(Arel.sql("rooms.#{column} #{direction}")) if table.column_names.include?(column)
|
||||||
|
|
||||||
|
|
|
@ -90,6 +90,11 @@
|
||||||
<button class= "merge-user dropdown-item" data-path="<%= merge_user_path(user_uid: user.uid) %>" data-info="<%= user.slice(:name, :email, :uid).to_json %>" data-toggle="modal" data-target="#mergeUserModal">
|
<button class= "merge-user dropdown-item" data-path="<%= merge_user_path(user_uid: user.uid) %>" data-info="<%= user.slice(:name, :email, :uid).to_json %>" data-toggle="modal" data-target="#mergeUserModal">
|
||||||
<i class="dropdown-icon fas fa-user-friends"></i> <%= t("administrator.users.settings.merge") %>
|
<i class="dropdown-icon fas fa-user-friends"></i> <%= t("administrator.users.settings.merge") %>
|
||||||
</button>
|
</button>
|
||||||
|
<% unless user.rooms.length.zero? %>
|
||||||
|
<%= link_to admin_recordings_path(search: user.email), class: "dropdown-item" do %>
|
||||||
|
<i class="dropdown-icon fas fa-video"></i> <%= t("administrator.rooms.table.recordings") %>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
<%= button_to admin_ban_path(user_uid: user.uid), class: "dropdown-item", "data-disable": "" do %>
|
<%= button_to admin_ban_path(user_uid: user.uid), class: "dropdown-item", "data-disable": "" do %>
|
||||||
<i class="dropdown-icon fas fa-lock"></i> <%= t("administrator.users.settings.ban") %>
|
<i class="dropdown-icon fas fa-lock"></i> <%= t("administrator.users.settings.ban") %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -93,7 +93,7 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<% if !@recordings.empty?%>
|
<% if !@recordings.empty? && !@latest%>
|
||||||
<div class="float-md-right mt-4">
|
<div class="float-md-right mt-4">
|
||||||
<%== pagy_bootstrap_nav(@pagy) %>
|
<%== pagy_bootstrap_nav(@pagy) %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -65,6 +65,9 @@
|
||||||
<a href="" data-toggle="modal" data-target="#createRoomModal" class="update-room dropdown-item" data-settings-path="<%= room_settings_path(room) %>">
|
<a href="" data-toggle="modal" data-target="#createRoomModal" class="update-room dropdown-item" data-settings-path="<%= room_settings_path(room) %>">
|
||||||
<i class="dropdown-icon fas fa-cog"></i> <%= t("room.settings") %>
|
<i class="dropdown-icon fas fa-cog"></i> <%= t("room.settings") %>
|
||||||
</a>
|
</a>
|
||||||
|
<%= link_to admin_recordings_path(search: room.uid), class: "dropdown-item" do %>
|
||||||
|
<i class="dropdown-icon fas fa-video"></i> <%= t("administrator.rooms.table.recordings") %>
|
||||||
|
<% end %>
|
||||||
<% if preupload_allowed? %>
|
<% if preupload_allowed? %>
|
||||||
<a href="" data-toggle="modal" data-target="#preuploadPresentationModal" class="preupload-room dropdown-item" data-path="<%= preupload_presentation_path(room) %>" data-settings-path="<%= current_presentation_path(room) %>" data-remove="<%= remove_presentation_path(room) %>">
|
<a href="" data-toggle="modal" data-target="#preuploadPresentationModal" class="preupload-room dropdown-item" data-path="<%= preupload_presentation_path(room) %>" data-settings-path="<%= current_presentation_path(room) %>" data-remove="<%= remove_presentation_path(room) %>">
|
||||||
<i class="dropdown-icon fas fa-file-upload"></i> <%= t("room.add_presentation") %>
|
<i class="dropdown-icon fas fa-file-upload"></i> <%= t("room.add_presentation") %>
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
<div class="card-body p-6">
|
<div class="card-body p-6">
|
||||||
<div class="card-title text-primary">
|
<div class="card-title text-primary">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<%= render "shared/components/subtitle", subtitle: setting_title, search: search %>
|
<%= render "shared/components/subtitle", subtitle: setting_title, search: search, search_info: defined?(search_info) ? search_info : "" %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
<%= render "admins/components/menu_buttons" %>
|
<%= render "admins/components/menu_buttons" %>
|
||||||
</div>
|
</div>
|
||||||
<div id="server_recordings" class="col-lg-9">
|
<div id="server_recordings" class="col-lg-9">
|
||||||
<%= render "admins/components/setting_view", setting_id: "recordings", setting_title: t("administrator.recordings.title"), search: true %>
|
<%= render "admins/components/setting_view", setting_id: "recordings", setting_title: t("administrator.recordings.latest"), search: true, search_info: t("administrator.recordings.search_info") %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -35,6 +35,14 @@
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<% if defined?(search_info) && search_info.present? %>
|
||||||
|
<div class="float-right mt-5">
|
||||||
|
<small>
|
||||||
|
<i class="fas fa-info-circle"></i>
|
||||||
|
<%= search_info %>
|
||||||
|
</small>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<% else %>
|
<% else %>
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
|
|
|
@ -138,8 +138,10 @@ en:
|
||||||
settings: Site Settings successfully changed
|
settings: Site Settings successfully changed
|
||||||
unauthorized: You are not authorized to perform actions on this user
|
unauthorized: You are not authorized to perform actions on this user
|
||||||
recordings:
|
recordings:
|
||||||
|
latest: Latest Recordings
|
||||||
title: Server Recordings
|
title: Server Recordings
|
||||||
no_recordings: This server has no recordings.
|
no_recordings: This server has no recordings.
|
||||||
|
search_info: Enter a user's full email or a room's uid
|
||||||
roles:
|
roles:
|
||||||
appear_in_share_list: Include users with this role in the dropdown for sharing rooms
|
appear_in_share_list: Include users with this role in the dropdown for sharing rooms
|
||||||
can_create_rooms: Can create rooms
|
can_create_rooms: Can create rooms
|
||||||
|
|
|
@ -28,6 +28,26 @@ describe AdminsController, type: :controller do
|
||||||
@admin.set_role :admin
|
@admin.set_role :admin
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "Server Recordings" do
|
||||||
|
it "renders the server_recordings page" do
|
||||||
|
@request.session[:user_id] = @admin.id
|
||||||
|
|
||||||
|
get :server_recordings
|
||||||
|
|
||||||
|
expect(response).to render_template(:server_recordings)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "Server Rooms" do
|
||||||
|
it "renders the server_rooms page" do
|
||||||
|
@request.session[:user_id] = @admin.id
|
||||||
|
|
||||||
|
get :server_rooms
|
||||||
|
|
||||||
|
expect(response).to render_template(:server_rooms)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe "User Roles" do
|
describe "User Roles" do
|
||||||
before do
|
before do
|
||||||
allow(Rails.configuration).to receive(:enable_email_verification).and_return(true)
|
allow(Rails.configuration).to receive(:enable_email_verification).and_return(true)
|
||||||
|
|
Loading…
Reference in New Issue