All files / src/apps/concepts/redux selectors.ts

71.43% Statements 10/14
0% Branches 0/2
0% Functions 0/1
76.92% Lines 10/13

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52                                  1x     1x     1x 1x     1x 1x     1x     1x     1x     1x                      
import {
  AppState,
  errorListSelector,
  loadingSelector,
  progressSelector
} from "../../../redux";
import {
  RETRIEVE_ACTIVE_CONCEPTS_ACTION,
  RETRIEVE_CONCEPT_ACTION,
  RETRIEVE_CONCEPTS_ACTION,
  UPSERT_CONCEPT_ACTION,
  UPSERT_CONCEPT_AND_MAPPINGS,
  UPSERT_MAPPING_ACTION
} from "./actionTypes";
import { errorSelector } from "../../../redux/selectors";
import { removeReferencesFromDictionaryLoadingSelector } from "../../dictionaries/redux";
 
export const upsertConceptAndMappingsLoadingSelector = loadingSelector(
  UPSERT_CONCEPT_AND_MAPPINGS
);
export const upsertConceptAndMappingsProgressSelector = progressSelector(
  UPSERT_CONCEPT_AND_MAPPINGS
);
export const upsertConceptErrorsSelector = errorSelector(UPSERT_CONCEPT_ACTION);
export const viewConceptLoadingSelector = loadingSelector(
  RETRIEVE_CONCEPT_ACTION
);
export const viewConceptErrorsSelector = errorSelector(RETRIEVE_CONCEPT_ACTION);
export const viewConceptsLoadingSelector = loadingSelector(
  RETRIEVE_CONCEPTS_ACTION
);
export const viewConceptsErrorsSelector = errorSelector(
  RETRIEVE_CONCEPTS_ACTION
);
export const viewActiveConceptsLoadingSelector = loadingSelector(
  RETRIEVE_ACTIVE_CONCEPTS_ACTION
);
export const viewActiveConceptsErrorsSelector = errorSelector(
  RETRIEVE_ACTIVE_CONCEPTS_ACTION
);
export const upsertAllMappingsErrorSelector = errorListSelector(
  UPSERT_MAPPING_ACTION
);
export function removeConceptsFromDictionaryLoadingSelector(state: AppState) {
  const removeReferencesStatus = removeReferencesFromDictionaryLoadingSelector(
    state
  );
  if (!removeReferencesStatus) return false;
 
  return (removeReferencesStatus as boolean[]).includes(true);
}