Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/components/shared/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,8 @@ const TableHeadRows = ({ forceDeselectAll }: { forceDeselectAll: () => unknown }
let direction: ReverseOptions = "ASC";
if (reverse && reverse === "ASC") {
direction = "DESC";
} else if (reverse && reverse === "DESC") {
direction = "NONE";
}
dispatch(reverseTable(direction));
dispatch(updatePages());
Expand All @@ -199,7 +201,7 @@ const TableHeadRows = ({ forceDeselectAll }: { forceDeselectAll: () => unknown }
<th
key={key}
className={cn({
"col-sort": !!sortBy && column.name === sortBy,
"col-sort": reverse !== "NONE" && !!sortBy && column.name === sortBy,
sortable: true,
})}
onClick={() => sortByColumn(column.name)}
Expand All @@ -211,7 +213,7 @@ const TableHeadRows = ({ forceDeselectAll }: { forceDeselectAll: () => unknown }
className={cn("chevron-up", { active: reverse === "ASC" && column.name === sortBy })}
/>
<LuChevronDown
className={cn("chevron-down", { active: reverse === "ASC" && column.name === sortBy })}
className={cn("chevron-down", { active: reverse === "DESC" && column.name === sortBy })}
/>
</div>
</span>
Expand Down
5 changes: 3 additions & 2 deletions src/components/shared/TableFilters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ const TableFilters = ({
// simply by going to first page and then load resources.
// This helps increase performance by reducing the number of calls to load resources.
const applyFilterChangesDebounced = async () => {
console.log("Applying filter changes with value: " + itemValue);
// No matter what, we go to page one.
dispatch(goToPage(0));
// Reload of resource
Expand All @@ -149,8 +150,8 @@ const TableFilters = ({

useEffect(() => {
if (itemValue) {
// Call to apply filter changes with 500MS debounce!
const applyFilterChangesDebouncedTimeoutId = setTimeout(applyFilterChangesDebounced, 500);
// Call to apply filter changes with 600MS debounce!
const applyFilterChangesDebouncedTimeoutId = setTimeout(applyFilterChangesDebounced, 600);

return () => clearTimeout(applyFilterChangesDebouncedTimeoutId);
}
Expand Down
7 changes: 0 additions & 7 deletions src/slices/eventSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,13 +253,6 @@ export const fetchEvents = createAppAsyncThunk("events/fetchEvents", async (_, {
const state = getState();
let params: ReturnType<typeof getURLParams> & { getComments?: boolean } = getURLParams(state, "events");

// Add a secondary filter to enforce order of events
// (Elasticsearch does not guarantee ordering)
params = {
...params,
sort: params.sort ? params.sort + ",uid:asc" : "uid:asc",
};

// Only if the notes column is enabled, fetch comment information for events
if (state.events.columns.find(column => column.label === "EVENTS.EVENTS.TABLE.ADMINUI_NOTES" && !column.deactivated)) {
params = {
Expand Down
2 changes: 1 addition & 1 deletion src/slices/tableSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export type SubmitRow = {

export type Resource = "events" | "series" | "recordings" | "jobs" | "servers" | "services" | "users" | "groups" | "acls" | "themes"

export type ReverseOptions = "ASC" | "DESC"
export type ReverseOptions = "ASC" | "DESC" | "NONE"

export type TableState = {
status: "uninitialized" | "loading" | "succeeded" | "failed",
Expand Down
2 changes: 1 addition & 1 deletion src/utils/resourceUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export const getURLParams = (
};
}

if (getTableSortingForResource(state, resource)) {
if (getTableDirectionForResource(state, resource) !== "NONE") {
params = {
...params,
sort: getTableSortingForResource(state, resource)
Expand Down
Loading