Skip to content

Commit

Permalink
Added pagination to recording tables
Browse files Browse the repository at this point in the history
  • Loading branch information
farhatahmad committed Nov 2, 2023
1 parent 3a810f9 commit 29c3a6f
Show file tree
Hide file tree
Showing 17 changed files with 27 additions and 20 deletions.
2 changes: 0 additions & 2 deletions app/assets/stylesheets/application.bootstrap.scss
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,6 @@ input.search-bar {
}

#footer {
margin-top: $footer-buffer-height;

#footer-container {
border-top: 1px solid #d0d5dd;
}
Expand Down
6 changes: 3 additions & 3 deletions app/assets/stylesheets/helpers.scss
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@
}

.no-header-height {
min-height: calc(100vh - $footer-height - $footer-buffer-height);
min-height: calc(100vh - $footer-height);
}

.regular-height {
min-height: calc(100vh - $header-height - $footer-height - $footer-buffer-height);
min-height: calc(100vh - $header-height - $footer-height);

.vertical-center {
min-height: calc(100vh - $header-height - $header-height - $footer-height - $footer-buffer-height);
min-height: calc(100vh - $header-height - $header-height - $footer-height);
}
}

Expand Down
9 changes: 7 additions & 2 deletions app/assets/stylesheets/recordings.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,15 @@
//
// You should have received a copy of the GNU Lesser General Public License along
// with Greenlight; if not, see <http://www.gnu.org/licenses/>.
#user-recordings {
min-height: 699px;
}

#user-recordings, #room-recordings {
min-height: 400px;
#room-recordings {
min-height: 491px;
}

#user-recordings, #room-recordings {
table {
border-top-right-radius: $border-radius-lg;
border-top-left-radius: $border-radius-lg;
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/api/v1/recordings_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class RecordingsController < ApiController
def index
sort_config = config_sorting(allowed_columns: %w[name length visibility])

pagy, recordings = pagy(current_user.recordings&.order(sort_config, recorded_at: :desc)&.search(params[:search]))
pagy, recordings = pagy(current_user.recordings&.order(sort_config, recorded_at: :desc)&.search(params[:search]), items: 5)
render_data data: recordings, meta: pagy_metadata(pagy), status: :ok
end

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/api/v1/rooms_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def purge_presentation
def recordings
sort_config = config_sorting(allowed_columns: %w[name length visibility])

pagy, room_recordings = pagy(@room.recordings&.order(sort_config, recorded_at: :desc)&.search(params[:q]))
pagy, room_recordings = pagy(@room.recordings&.order(sort_config, recorded_at: :desc)&.search(params[:q]), items: 3)
render_data data: room_recordings, meta: pagy_metadata(pagy), status: :ok
end

Expand Down
2 changes: 1 addition & 1 deletion app/javascript/components/admin/manage_users/EditUser.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default function EditUser() {
}

return (
<div id="admin-panel" className="pb-3">
<div id="admin-panel" className="pb-4">
<h3 className="py-5"> { t('admin.admin_panel') } </h3>
<Card className="border-0 card-shadow">
<Tab.Container activekey="users">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export default function ManageUsers() {
}

return (
<div id="admin-panel" className="pb-3">
<div id="admin-panel" className="pb-4">
<h3 className="py-5">{t('admin.admin_panel')}</h3>
<Card className="border-0 card-shadow">
<Tab.Container activeKey="users">
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/components/admin/roles/EditRole.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default function EditRole() {
if (isLoading) return null;

return (
<div id="admin-panel" className="pb-3">
<div id="admin-panel" className="pb-4">
<h3 className="py-5">{ t('admin.admin_panel') }</h3>
<Card className="border-0 card-shadow">
<Tab.Container activeKey="roles">
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/components/admin/roles/Roles.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default function Roles() {
}

return (
<div id="admin-panel" className="pb-3">
<div id="admin-panel" className="pb-4">
<h3 className="py-5"> { t('admin.admin_panel') } </h3>
<Card className="border-0 card-shadow">
<Tab.Container activeKey="roles">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default function RoomConfig() {
}

return (
<div id="admin-panel" className="pb-3">
<div id="admin-panel" className="pb-4">
<h3 className="py-5"> { t('admin.admin_panel') } </h3>
<Card className="border-0 card-shadow">
<Tab.Container activeKey="room_configuration">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default function ServerRecordings() {
}

return (
<div id="admin-panel" className="pb-3">
<div id="admin-panel" className="pb-4">
<h3 className="py-5"> {t('admin.admin_panel')} </h3>
<Card className="border-0 card-shadow">
<Tab.Container activeKey="server_recordings">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default function ServerRooms() {
}

return (
<div id="admin-panel" className="pb-3">
<div id="admin-panel" className="pb-4">
<h3 className="py-5"> { t('admin.admin_panel') } </h3>
<Card className="border-0 card-shadow">
<Tab.Container activeKey="server_rooms">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default function SiteSettings() {
}

return (
<div id="admin-panel" className="pb-3">
<div id="admin-panel" className="pb-4">
<h3 className="py-5">{ t('admin.admin_panel') }</h3>
<Card className="border-0 card-shadow">
<Tab.Container activeKey="site_settings">
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/components/admin/tenants/Tenants.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default function Tenants() {
const { data: tenants, isLoading } = useTenants({ search: searchInput, page });

return (
<div id="admin-panel" className="pb-3">
<div id="admin-panel" className="pb-4">
<h3 className="py-5">{ t('admin.admin_panel') }</h3>
<Card className="border-0 card-shadow">
<Tab.Container activeKey="tenants">
Expand Down
6 changes: 4 additions & 2 deletions app/javascript/components/recordings/RecordingsList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import SearchBar from '../shared_components/search/SearchBar';
import ProcessingRecordingRow from './ProcessingRecordingRow';

export default function RecordingsList({
recordings, isLoading, setPage, searchInput, setSearchInput, recordingsProcessing, adminTable,
recordings, isLoading, setPage, searchInput, setSearchInput, recordingsProcessing, adminTable, numPlaceholders,
}) {
const { t } = useTranslation();

Expand Down Expand Up @@ -65,7 +65,7 @@ export default function RecordingsList({
<tbody className="border-top-0">
{[...Array(recordingsProcessing)].map(() => <ProcessingRecordingRow />)}
{
(isLoading && [...Array(7)].map((val, idx) => (
(isLoading && [...Array(numPlaceholders)].map((val, idx) => (
// eslint-disable-next-line react/no-array-index-key
<RecordingsListRowPlaceHolder key={idx} />
)))
Expand Down Expand Up @@ -103,6 +103,7 @@ RecordingsList.defaultProps = {
recordingsProcessing: 0,
searchInput: '',
adminTable: false,
numPlaceholders: 7,
};

RecordingsList.propTypes = {
Expand Down Expand Up @@ -132,4 +133,5 @@ RecordingsList.propTypes = {
setSearchInput: PropTypes.func.isRequired,
recordingsProcessing: PropTypes.number,
adminTable: PropTypes.bool,
numPlaceholders: PropTypes.number,
};
1 change: 1 addition & 0 deletions app/javascript/components/recordings/UserRecordings.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export default function UserRecordings() {
setPage={setPage}
setSearchInput={setSearchInput}
searchInput={searchInput}
numPlaceholders={5}
/>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export default function RoomRecordings() {
setSearchInput={setSearchInput}
searchInput={searchInput}
recordingsProcessing={roomRecordingsProcessing.data}
numPlaceholders={3}
/>
</div>
);
Expand Down

0 comments on commit 29c3a6f

Please sign in to comment.