Skip to content

Commit

Permalink
refactor filter indicator, rename scope type
Browse files Browse the repository at this point in the history
  • Loading branch information
eperedo committed Dec 16, 2024
1 parent b297bbb commit 683b36c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/domain/entities/Indicator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export type IndicatorAttrs = {
theme: string;
status: string;
type: "outputs" | "outcomes";
scope: ScopeType;
scope: IndicatorScope;
group: string;
disaggregation: Maybe<NamedRef>;
coreCompetency: CoreCompetency;
Expand All @@ -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<IndicatorAttrs>() {
setRelatedDataElements(
Expand Down
3 changes: 0 additions & 3 deletions src/utils/uid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions src/webapp/components/dataset-wizard/FilterIndicators.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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"
/>

Expand Down Expand Up @@ -139,7 +139,7 @@ export type ChipFilterProps = {
items: ChipItem[];
label: string;
onChange: (item: ChipItem[]) => void;
value: string | string[];
value: string[];
mode?: "single" | "multiple";
};

Expand Down
2 changes: 1 addition & 1 deletion src/webapp/components/dataset-wizard/IndicatorsDataSet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ export const IndicatorsDataSet = React.memo((props: IndicatorsDataSetProps) => {
>
<FilterIndicators
scopes={scopes}
scopeValue={scope}
scopeValue={[scope]}
onFilterChange={updateFilter}
coreCompetencies={coreCompetencies}
showCloseButton={!isLargeDesktop}
Expand Down

0 comments on commit 683b36c

Please sign in to comment.