Skip to content

Commit

Permalink
[frontend] fix widget clear filters (#5497)
Browse files Browse the repository at this point in the history
  • Loading branch information
jpkha committed Jan 15, 2024
1 parent 84cff00 commit b21037f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ const WidgetConfig = ({ workspace, widget, onComplete, closeMenu }) => {
setStepIndex(2);
}
setOpen(false);
setDataSelection(widget?.dataSelection ?? [initialSelection]);
};
const completeSetup = () => {
onComplete({
Expand Down Expand Up @@ -817,8 +818,7 @@ const WidgetConfig = ({ workspace, widget, onComplete, closeMenu }) => {
remarkGfmPlugin={true}
commonmark={true}
/>,
)
}
)}
l18n={{
write: t('Write'),
preview: t('Preview'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,17 @@ const WidgetFilters: FunctionComponent<WidgetFiltersProps> = ({ perspective, typ
/>
</>
)}
<div style={{ marginTop: 8 }}>{t('Result: the relationships with source respecting the source pre-query, target respecting the target pre-query, and matching:')}</div>

{ isFilterGroupNotEmpty(filters) && (
<FilterIconButton
filters={filters}
helpers={helpers}
/>
<>
{ perspective === 'relationships'
&& <div style={{ marginTop: 8 }}>{t('Result: the relationships with source respecting the source pre-query, target respecting the target pre-query, and matching:')}</div>
}
<FilterIconButton
filters={filters}
helpers={helpers}
/>
</>
) }
</Box>
</>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ interface useFiltersStateProps {
filters: FilterGroup,
latestAddFilterId?: string
}
const useFiltersState = (initFilters: FilterGroup = emptyFilterGroup): [FilterGroup, handleFilterHelpers] => {
const useFiltersState = (initFilters: FilterGroup = emptyFilterGroup, defaultClearFilters: FilterGroup = emptyFilterGroup): [FilterGroup, handleFilterHelpers] => {
const [filtersState, setFiltersState] = useState<useFiltersStateProps>({
filters: initFilters,
latestAddFilterId: undefined,
Expand Down Expand Up @@ -73,7 +73,7 @@ const useFiltersState = (initFilters: FilterGroup = emptyFilterGroup): [FilterGr
},
handleClearAllFilters: () => {
setFiltersState({
filters: initFilters,
filters: { ...defaultClearFilters },
latestAddFilterId: undefined });
},
handleRemoveFilterById: (id: string) => {
Expand Down

0 comments on commit b21037f

Please sign in to comment.