Skip to content

Commit

Permalink
fix: add ingest type to database
Browse files Browse the repository at this point in the history
  • Loading branch information
Saelmala committed Aug 26, 2024
1 parent f31a8a8 commit 6d30625
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 110 deletions.
7 changes: 5 additions & 2 deletions src/api/manager/job/syncInventory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ async function getSourcesFromAPI() {
},
ingest_name: ingest.name,
ingest_source_name: source.name,
ingest_type: source.type,
video_stream: {
width: source?.video_stream?.width,
height: source?.video_stream?.height,
Expand Down Expand Up @@ -60,7 +61,8 @@ export async function runSyncInventory() {
const apiSource = apiSources.find((source) => {
return (
source.ingest_name === inventorySource.ingest_name &&
source.ingest_source_name === inventorySource.ingest_source_name
source.ingest_source_name === inventorySource.ingest_source_name &&
source.ingest_type === inventorySource.type
);
});
if (!apiSource) {
Expand All @@ -81,7 +83,8 @@ export async function runSyncInventory() {
(inventorySource) => {
return (
source.ingest_name === inventorySource.ingest_name &&
source.ingest_source_name === inventorySource.ingest_source_name
source.ingest_source_name === inventorySource.ingest_source_name &&
source.ingest_type === inventorySource.ingest_type
);
}
);
Expand Down
24 changes: 0 additions & 24 deletions src/app/api/manager/sources/resources/[id]/route.ts

This file was deleted.

17 changes: 0 additions & 17 deletions src/app/api/manager/sources/resources/route.ts

This file was deleted.

30 changes: 11 additions & 19 deletions src/components/filter/FilterOptions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@ import FilterDropdown from './FilterDropdown';
import { ClickAwayListener } from '@mui/base';
import { SourceWithId } from '../../interfaces/Source';
import { FilterContext } from '../inventory/FilterContext';
import { useResources } from '../../hooks/sources/useResources';

type FilterOptionsProps = {
onFilteredSources: (sources: Map<string, SourceWithId>) => void;
};

function FilterOptions({ onFilteredSources }: FilterOptionsProps) {
const { locations, types, sources } = useContext(FilterContext);
const [resources] = useResources();

const [onlyShowActiveSources, setOnlyShowActiveSources] = useState(false);
const [onlyShowNdiSources, setOnlyShowNdiSources] = useState(false);
Expand Down Expand Up @@ -107,21 +105,15 @@ function FilterOptions({ onFilteredSources }: FilterOptionsProps) {

const filterSources = async () => {
for (const source of tempSet.values()) {
const correspondingResource = resources.find(
(resource) => resource.name === source.ingest_source_name
);
let shouldDelete = false;

if (correspondingResource) {
let shouldDelete = false;
if (source.ingest_type) {
const isNdiSelected =
onlyShowNdiSources &&
correspondingResource.type.toUpperCase() === 'NDI';
onlyShowNdiSources && source.ingest_type.toUpperCase() === 'NDI';
const isBmdSelected =
onlyShowBmdSources &&
correspondingResource.type.toUpperCase() === 'BMD';
onlyShowBmdSources && source.ingest_type.toUpperCase() === 'BMD';
const isSrtSelected =
onlyShowSrtSources &&
correspondingResource.type.toUpperCase() === 'SRT';
onlyShowSrtSources && source.ingest_type.toUpperCase() === 'SRT';

if (
(onlyShowNdiSources || onlyShowBmdSources || onlyShowSrtSources) &&
Expand All @@ -131,14 +123,14 @@ function FilterOptions({ onFilteredSources }: FilterOptionsProps) {
) {
shouldDelete = true;
}
}

if (onlyShowActiveSources && source.status === 'gone') {
shouldDelete = true;
}
if (onlyShowActiveSources && source.status === 'gone') {
shouldDelete = true;
}

if (shouldDelete) {
tempSet.delete(source._id.toString());
}
if (shouldDelete) {
tempSet.delete(source._id.toString());
}
}
};
Expand Down
48 changes: 0 additions & 48 deletions src/hooks/sources/useResources.tsx

This file was deleted.

1 change: 1 addition & 0 deletions src/interfaces/Source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export interface Source {
};
ingest_name: string;
ingest_source_name: string;
ingest_type: string;
video_stream: VideoStream;
audio_stream: AudioStream;
}
Expand Down

0 comments on commit 6d30625

Please sign in to comment.