mirror of
https://github.com/Radarr/Radarr.git
synced 2026-03-27 17:54:34 -04:00
33 lines
900 B
TypeScript
33 lines
900 B
TypeScript
import { createSelector } from 'reselect';
|
|
import AppState from 'App/State/AppState';
|
|
|
|
function createQueueStatusSelector() {
|
|
return createSelector(
|
|
(state: AppState) => state.queue.status.isPopulated,
|
|
(state: AppState) => state.queue.status.item,
|
|
(state: AppState) => state.queue.options.includeUnknownMovieItems,
|
|
(isPopulated, status, includeUnknownMovieItems) => {
|
|
const {
|
|
errors,
|
|
warnings,
|
|
unknownErrors,
|
|
unknownWarnings,
|
|
count,
|
|
totalCount,
|
|
} = status;
|
|
|
|
return {
|
|
...status,
|
|
isPopulated,
|
|
count: includeUnknownMovieItems ? totalCount : count,
|
|
errors: includeUnknownMovieItems ? errors || unknownErrors : errors,
|
|
warnings: includeUnknownMovieItems
|
|
? warnings || unknownWarnings
|
|
: warnings,
|
|
};
|
|
}
|
|
);
|
|
}
|
|
|
|
export default createQueueStatusSelector;
|