Skip to content

Commit

Permalink
Merge pull request elastic#16 from abdulloh76/saved-filters-issue
Browse files Browse the repository at this point in the history
Fixed issues with adding saved filters
  • Loading branch information
stratoula authored Mar 1, 2022
2 parents 38d9a12 + 90d7c37 commit dd9a7ba
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/plugins/data/public/ui/filter_bar/filter_bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,10 @@ const FilterBarUI = React.memo(function FilterBarUI(props: Props) {
onFiltersUpdated(updatedFilters);
props?.onMultipleFiltersUpdated?.(updatedMultipleFilters);
groupRef.current?.focus();
const savedFiltersGroupIds = selectedSavedFiltersGroupIds.filter(
(gId) => !groupIds.includes(gId)
);
setSelectedSavedFiltersGroupIds(savedFiltersGroupIds);
}

function onUpdateFilterGroup(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,7 @@ export function EditFilterModal({
const [selectedIndexPattern, setSelectedIndexPattern] = useState(
getIndexPatternFromFilter(filter, indexPatterns)
);
const [addFilterMode, setAddFilterMode] = useState<string>(
initialAddFilterMode ?? QUICK_FORM.type
);
const [addFilterMode, setAddFilterMode] = useState<string>(initialAddFilterMode ?? tabs[0].type);
const [customLabel, setCustomLabel] = useState<string>(initialLabel || '');
const [queryDsl, setQueryDsl] = useState<string>(
JSON.stringify(
Expand Down Expand Up @@ -145,7 +143,7 @@ export function EditFilterModal({
]
);
const [groupsCount, setGroupsCount] = useState<number>(
(new Set(localFilters.map(filter => filter.groupId))).size
new Set(localFilters.map((filter) => filter.groupId)).size
);
const [savedQueries, setSavedQueries] = useState<SavedQuery[]>([]);
const [submitDisabled, setSubmitDisabled] = useState(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ export function SaveQueryForm({

const onClickSave = useCallback(() => {
if (validate()) {
filters?.forEach((f) => {
f.meta.alias = title;
});
onSave({
id: savedQuery?.id,
title,
Expand Down

0 comments on commit dd9a7ba

Please sign in to comment.