diff --git a/app/controllers/api/v1/admin/server_recordings_controller.rb b/app/controllers/api/v1/admin/server_recordings_controller.rb index 1e8f6ff2ed923539d33466bed1edfad07bb54a59..35ba73269cd20771e24f55beb90658022377366f 100644 --- a/app/controllers/api/v1/admin/server_recordings_controller.rb +++ b/app/controllers/api/v1/admin/server_recordings_controller.rb @@ -31,11 +31,11 @@ module Api recordings = Recording.includes(:user) .with_provider(current_provider) - .order(sort_config) - &.search(params[:search]) + .order(sort_config, recorded_at: :desc) + &.server_search(params[:search]) pagy, recordings = pagy(recordings) - render_data data: recordings, meta: pagy_metadata(pagy), status: :ok + render_data data: recordings, serializer: ServerRecordingSerializer, meta: pagy_metadata(pagy), status: :ok end end end diff --git a/app/javascript/components/admin/server_rooms/ServerRoomRow.jsx b/app/javascript/components/admin/server_rooms/ServerRoomRow.jsx index 208f621b0ece6b5a5ecf8950b9179cb495758a3e..e67eb1fede8a8a0f55df4dd5b13d884f0cd46da0 100644 --- a/app/javascript/components/admin/server_rooms/ServerRoomRow.jsx +++ b/app/javascript/components/admin/server_rooms/ServerRoomRow.jsx @@ -51,7 +51,7 @@ export default function ServerRoomRow({ room }) { return t('admin.server_rooms.no_meeting_yet'); } if (online) { - return t('admin.server_rooms.current_session', { lastSession }); + return t('admin.server_rooms.current_session', { lastSession: localizedTime }); } return t('admin.server_rooms.last_session', { localizedTime }); }; diff --git a/app/javascript/components/recordings/RecordingRow.jsx b/app/javascript/components/recordings/RecordingRow.jsx index 849a091a2ab2ac8f9e0e2ac6c251eb6a004225d0..576db2da6b3c8d51d8097dcf69f0147c6f9ee390 100644 --- a/app/javascript/components/recordings/RecordingRow.jsx +++ b/app/javascript/components/recordings/RecordingRow.jsx @@ -42,6 +42,7 @@ export default function RecordingRow({ const visibilityAPI = useVisibilityAPI(); const [isEditing, setIsEditing] = useState(false); const [isUpdating, setIsUpdating] = useState(false); + const [display, setDisplay] = useState('invisible'); const currentUser = useAuth(); const redirectRecordingUrl = useRedirectRecordingUrl(); @@ -53,7 +54,12 @@ export default function RecordingRow({ ); return ( - <tr key={recording.id} className="align-middle text-muted border border-2"> + <tr + key={recording.id} + className="align-middle text-muted border border-2" + onMouseEnter={() => setDisplay('visible')} + onMouseLeave={() => setDisplay('invisible')} + > <td className="border-end-0 text-dark"> <Stack direction="horizontal" className="py-2"> <div className="recording-icon-circle rounded-circle me-3 d-flex justify-content-center"> @@ -79,7 +85,7 @@ export default function RecordingRow({ aria-hidden="true" onClick={() => !isUpdating && setIsEditing(true)} onBlur={() => setIsEditing(false)} - className="hi-s text-muted ms-1 mb-1" + className={`hi-s text-muted ms-1 mb-1 ${display}`} /> </> ) @@ -89,6 +95,7 @@ export default function RecordingRow({ } </strong> <span className="small text-muted"> {localizedTime} </span> + {adminTable && <span className="small text-muted fw-bold"> {recording?.user_name} </span>} </Stack> </Stack> </td> @@ -187,6 +194,7 @@ RecordingRow.propTypes = { protectable: PropTypes.bool, recorded_at: PropTypes.string.isRequired, map: PropTypes.func, + user_name: PropTypes.string, }).isRequired, visibilityMutation: PropTypes.func.isRequired, deleteMutation: PropTypes.func.isRequired, diff --git a/app/models/recording.rb b/app/models/recording.rb index 94578602c2917649fb86149759e0e8fe4b9ca70e..648d56be59f150bf6d575f3ee4acd4bbbe0015ff 100644 --- a/app/models/recording.rb +++ b/app/models/recording.rb @@ -55,4 +55,17 @@ class Recording < ApplicationRecord all.includes(:formats) end + + def self.server_search(input) + if input + return joins(:formats) + .where('recordings.name ILIKE :input OR ' \ + 'recordings.visibility ILIKE :input OR ' \ + 'formats.recording_type ILIKE :input OR ' \ + '"user"."name" ILIKE :input', input: "%#{input}%") + .includes(:formats) + end + + all.includes(:formats) + end end diff --git a/app/serializers/server_recording_serializer.rb b/app/serializers/server_recording_serializer.rb new file mode 100644 index 0000000000000000000000000000000000000000..d30a102d4bfbd249bd5eb2b82738270f08e8cf6c --- /dev/null +++ b/app/serializers/server_recording_serializer.rb @@ -0,0 +1,25 @@ +# BigBlueButton open source conferencing system - http://www.bigbluebutton.org/. +# +# Copyright (c) 2022 BigBlueButton Inc. and by respective authors (see below). +# +# This program is free software; you can redistribute it and/or modify it under the +# terms of the GNU Lesser General Public License as published by the Free Software +# Foundation; either version 3.0 of the License, or (at your option) any later +# version. +# +# Greenlight is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License along +# with Greenlight; if not, see <http://www.gnu.org/licenses/>. + +# frozen_string_literal: true + +class ServerRecordingSerializer < RecordingSerializer + attributes :user_name + + def user_name + object.user.name + end +end