mirror of
https://github.com/Dispatcharr/Dispatcharr.git
synced 2026-07-20 16:51:10 +00:00
filters on ids endpoint so we can get filters and perform select all on filtered table
This commit is contained in:
parent
22c17aaaa3
commit
7aa30f2678
2 changed files with 20 additions and 9 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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') {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue