Skip to content

Commit

Permalink
fix: correct filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
Saelmala committed Sep 4, 2024
1 parent f772712 commit 35c6207
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/api/manager/job/syncInventory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export async function runSyncInventory() {
}
);
return !existingSource;
});
}).map((source) => ({ ...source, lastConnected: new Date() }));

const sourcesToUpsert = [
...newSourcesToUpsert,
Expand Down
20 changes: 12 additions & 8 deletions src/components/filter/FilterOptions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,20 @@ function FilterOptions({ onFilteredSources }: FilterOptionsProps) {
for (const source of tempSet.values()) {
let shouldDelete = false;

if (source.ingest_type) {
const isNdiSelected =
onlyShowNdiSources && source.ingest_type.toUpperCase() === 'NDI';
const isBmdSelected =
onlyShowBmdSources && source.ingest_type.toUpperCase() === 'BMD';
const isSrtSelected =
onlyShowSrtSources && source.ingest_type.toUpperCase() === 'SRT';
const isFilteringByType =
onlyShowNdiSources || onlyShowBmdSources || onlyShowSrtSources;

if (isFilteringByType && !source.ingest_type) {
shouldDelete = true;
} else if (source.ingest_type) {
const ingestType = source.ingest_type.toUpperCase();

const isNdiSelected = onlyShowNdiSources && ingestType === 'NDI';
const isBmdSelected = onlyShowBmdSources && ingestType === 'BMD';
const isSrtSelected = onlyShowSrtSources && ingestType === 'SRT';

if (
(onlyShowNdiSources || onlyShowBmdSources || onlyShowSrtSources) &&
isFilteringByType &&
!isNdiSelected &&
!isBmdSelected &&
!isSrtSelected
Expand Down

0 comments on commit 35c6207

Please sign in to comment.