mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 00:12:56 +02:00
MDL-68977 user: Do not refresh participants table on load
This commit is contained in:
parent
dd9dea6148
commit
8503e0ee53
2
user/amd/build/participantsfilter.min.js
vendored
2
user/amd/build/participantsfilter.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -165,6 +165,9 @@ export const init = participantsRegionId => {
|
||||
* @param {HTMLElement} filterRow
|
||||
*/
|
||||
const removeFilterRow = async filterRow => {
|
||||
const filterType = filterRow.querySelector(Selectors.filter.fields.type);
|
||||
const hasFilterValue = !!filterType.value;
|
||||
|
||||
// Remove the filter object.
|
||||
removeFilterObject(filterRow.dataset.filterType);
|
||||
|
||||
@ -174,8 +177,10 @@ export const init = participantsRegionId => {
|
||||
// Update the list of available filter types.
|
||||
updateFiltersOptions();
|
||||
|
||||
// Refresh the table.
|
||||
updateTableFromFilter();
|
||||
if (hasFilterValue) {
|
||||
// Refresh the table if there was any content in this row.
|
||||
updateTableFromFilter();
|
||||
}
|
||||
|
||||
// Update filter fieldset legends.
|
||||
const filterLegends = await getAvailableFilterLegends();
|
||||
@ -337,7 +342,7 @@ export const init = participantsRegionId => {
|
||||
const filterPromises = filterConfig.map(([filterType, filterData]) => {
|
||||
if (filterType === 'courseid') {
|
||||
// The courseid is a special case.
|
||||
return Promise.resolve();
|
||||
return false;
|
||||
}
|
||||
|
||||
const filterValues = filterData.values;
|
||||
@ -345,11 +350,15 @@ export const init = participantsRegionId => {
|
||||
if (!filterValues.length) {
|
||||
// There are no values for this filter.
|
||||
// Skip it.
|
||||
return Promise.resolve();
|
||||
return false;
|
||||
}
|
||||
|
||||
return addFilterRow().then(([filterRow]) => addFilter(filterRow, filterType, filterValues));
|
||||
});
|
||||
}).filter(promise => promise);
|
||||
|
||||
if (!filterPromises.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
Promise.all(filterPromises).then(() => {
|
||||
return removeEmptyFilters();
|
||||
|
Loading…
x
Reference in New Issue
Block a user