From 683b36cc3c01e87f1f3bf341d0f0a2d984150597 Mon Sep 17 00:00:00 2001 From: Eduardo Peredo Rivero Date: Mon, 16 Dec 2024 12:28:00 -0500 Subject: [PATCH] refactor filter indicator, rename scope type --- src/domain/entities/Indicator.ts | 4 ++-- src/utils/uid.ts | 3 --- src/webapp/components/dataset-wizard/FilterIndicators.tsx | 6 +++--- src/webapp/components/dataset-wizard/IndicatorsDataSet.tsx | 2 +- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/domain/entities/Indicator.ts b/src/domain/entities/Indicator.ts index 49f08e45..84fe8edc 100644 --- a/src/domain/entities/Indicator.ts +++ b/src/domain/entities/Indicator.ts @@ -12,7 +12,7 @@ export type IndicatorAttrs = { theme: string; status: string; type: "outputs" | "outcomes"; - scope: ScopeType; + scope: IndicatorScope; group: string; disaggregation: Maybe; coreCompetency: CoreCompetency; @@ -21,7 +21,7 @@ export type IndicatorAttrs = { relatedDataElements: DataElement[]; }; -export type ScopeType = "core" | "local" | "donor"; +export type IndicatorScope = "core" | "local" | "donor"; export class Indicator extends Struct() { setRelatedDataElements( diff --git a/src/utils/uid.ts b/src/utils/uid.ts index 673111d6..9032ebb7 100644 --- a/src/utils/uid.ts +++ b/src/utils/uid.ts @@ -45,9 +45,6 @@ export function generateUid(): string { return randomChars; } -// @ts-ignore -window.generateUid = generateUid; - const fullUidRegex = /^[a-zA-Z]{1}[a-zA-Z0-9]{10}$/; export function isValidUid(code: string | undefined | null): boolean { diff --git a/src/webapp/components/dataset-wizard/FilterIndicators.tsx b/src/webapp/components/dataset-wizard/FilterIndicators.tsx index b5b00893..58dcbd68 100644 --- a/src/webapp/components/dataset-wizard/FilterIndicators.tsx +++ b/src/webapp/components/dataset-wizard/FilterIndicators.tsx @@ -19,7 +19,7 @@ export type FilterIndicatorsProps = { onClose: () => void; onFilterChange: (scope: ChipItem[], type: FilterType) => void; scopes: string[]; - scopeValue: string; + scopeValue: string[]; showCloseButton?: boolean; themes: string[]; theme: string; @@ -104,7 +104,7 @@ export const FilterIndicators = React.memo((props: FilterIndicatorsProps) => { items={types.map(t => ({ text: t, value: t }))} label={i18n.t("Type")} onChange={value => onFilterChange(value, "outputType")} - value={selectedType} + value={[selectedType]} mode="single" /> @@ -139,7 +139,7 @@ export type ChipFilterProps = { items: ChipItem[]; label: string; onChange: (item: ChipItem[]) => void; - value: string | string[]; + value: string[]; mode?: "single" | "multiple"; }; diff --git a/src/webapp/components/dataset-wizard/IndicatorsDataSet.tsx b/src/webapp/components/dataset-wizard/IndicatorsDataSet.tsx index 984845f0..b0189f5c 100644 --- a/src/webapp/components/dataset-wizard/IndicatorsDataSet.tsx +++ b/src/webapp/components/dataset-wizard/IndicatorsDataSet.tsx @@ -157,7 +157,7 @@ export const IndicatorsDataSet = React.memo((props: IndicatorsDataSetProps) => { >