filters on ids endpoint so we can get filters and perform select all on filtered table

This commit is contained in:
dekzter 2025-03-09 13:28:51 -04:00
parent 22c17aaaa3
commit 7aa30f2678
2 changed files with 20 additions and 9 deletions

View file

@ -281,13 +281,16 @@ export default class API {
return retval;
}
static async getAllStreamIds() {
const response = await fetch(`${host}/api/channels/streams/ids/`, {
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${await API.getAuthToken()}`,
},
});
static async getAllStreamIds(params) {
const response = await fetch(
`${host}/api/channels/streams/ids/?${params.toString()}`,
{
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${await API.getAuthToken()}`,
},
}
);
const retval = await response.json();
return retval;

View file

@ -342,7 +342,15 @@ const StreamsTable = ({}) => {
const onSelectAllChange = async (e) => {
const selectAll = e.target.checked;
if (selectAll) {
const ids = await API.getAllStreamIds();
// Get all stream IDs for current view
const params = new URLSearchParams();
// Apply debounced filters
Object.entries(debouncedFilters).forEach(([key, value]) => {
if (value) params.append(key, value);
});
const ids = await API.getAllStreamIds(params);
setSelectedStreamIds(ids);
} else {
setSelectedStreamIds([]);
@ -518,7 +526,7 @@ const StreamsTable = ({}) => {
*/
useEffect(() => {
fetchData();
}, [pagination]);
}, [pagination, debouncedFilters]);
useEffect(() => {
if (typeof window !== 'undefined') {