fix: Timeline should should show folder media even without camera support (#2216)
- Closes #2205
This commit is contained in:
@@ -1,14 +1,16 @@
|
||||
import { CameraManager } from '../camera-manager/manager';
|
||||
import { CapabilitySearchOptions } from '../camera-manager/types';
|
||||
import { AdvancedCameraCardView } from '../config/schema/common/const';
|
||||
import { Query } from './query';
|
||||
import { QueryResults } from './query-results';
|
||||
|
||||
/**
|
||||
* Get cameraIDs that are relevant for a given view name based on camera
|
||||
* capability (if camera specified).
|
||||
*/
|
||||
export const getCameraIDsForViewName = (
|
||||
cameraManager: CameraManager,
|
||||
viewName: AdvancedCameraCardView,
|
||||
cameraManager: CameraManager,
|
||||
cameraID?: string,
|
||||
): Set<string> => {
|
||||
switch (viewName) {
|
||||
@@ -47,3 +49,27 @@ export const getCameraIDsForViewName = (
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
export const isViewSupportedByCamera = (
|
||||
view: AdvancedCameraCardView,
|
||||
cameraManager: CameraManager,
|
||||
cameraID: string,
|
||||
): boolean => {
|
||||
return !!getCameraIDsForViewName(view, cameraManager, cameraID).size;
|
||||
};
|
||||
|
||||
/**
|
||||
* Whether a view is supported by a given query ONLY (i.e. regardless of what
|
||||
* the camera supports).
|
||||
*/
|
||||
export const isViewSupportedByQueryOnly = (
|
||||
view: AdvancedCameraCardView,
|
||||
query?: Query | null,
|
||||
queryResults?: QueryResults | null,
|
||||
): boolean => {
|
||||
switch (view) {
|
||||
case 'timeline':
|
||||
return !!query?.getQuery() && !!queryResults?.hasResults();
|
||||
}
|
||||
return false;
|
||||
};
|
||||
Reference in New Issue
Block a user