Skip to content

Commit

Permalink
Added configurable default number of apps to show in the apps table (#…
Browse files Browse the repository at this point in the history
…3672)

Added configurable default number of apps to show in the apps table.
  • Loading branch information
abujeda authored Jul 18, 2024
1 parent 0a26b6b commit 06b2f14
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 2 deletions.
6 changes: 5 additions & 1 deletion apps/dashboard/app/javascript/apps.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
'use strict';

import { appsDatatablePageLength } from './config.js';

jQuery(function() {
const pageLength = appsDatatablePageLength();
$('#all-apps-table').DataTable({
stateSave: true
stateSave: false,
pageLength: pageLength
});
});
5 changes: 5 additions & 0 deletions apps/dashboard/app/javascript/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,9 @@ export function statusPollDelay() {
export function statusIndexUrl() {
const cfgData = configData();
return cfgData['statusIndexUrl'];
}

export function appsDatatablePageLength() {
const cfgData = configData();
return parseInt(cfgData['appsDatatablePageLength']);
}
5 changes: 4 additions & 1 deletion apps/dashboard/app/models/user_configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,10 @@ class UserConfiguration
# Custom pages configuration property
ConfigurationProperty.property(name: :custom_pages, default_value: {}),
# Support ticket configuration property
ConfigurationProperty.property(name: :support_ticket, default_value: {})
ConfigurationProperty.property(name: :support_ticket, default_value: {}),

# Datatables configuration for the apps pages
ConfigurationProperty.property(name: :apps_datatable, default_value: { page_length: 10 })
].freeze

def initialize(request_hostname: nil)
Expand Down
1 change: 1 addition & 0 deletions apps/dashboard/app/views/layouts/_config.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@
data-bc-index-url="<%= batch_connect_sessions_path %>"
data-status-poll-delay="<%= Configuration.status_poll_delay %>"
data-status-index-url="<%= system_status_path if respond_to?(:system_status_path) %>"
data-apps-datatable-page-length="<%= @user_configuration.apps_datatable[:page_length] %>"
></div>
1 change: 1 addition & 0 deletions apps/dashboard/test/models/user_configuration_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def teardown
interactive_apps_menu: [],
custom_pages: {},
support_ticket: {},
apps_datatable: { page_length: 10 },
}

# ensure all properties are tested
Expand Down

0 comments on commit 06b2f14

Please sign in to comment.