Skip to content

Commit

Permalink
Merge pull request #11 from abdulloh76/save-from-edit
Browse files Browse the repository at this point in the history
Save the filter badge from edit by giving label
  • Loading branch information
stratoula authored Feb 4, 2022
2 parents 8f4609b + 81c57c7 commit df7107c
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/plugins/data/public/ui/filter_bar/filter_bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ const FilterBarUI = React.memo(function FilterBarUI(props: Props) {
timeRangeForSuggestionsOverride={props.timeRangeForSuggestionsOverride}
savedQueryManagement={undefined}
initialAddFilterMode={undefined}
saveFilters={props.onFilterSave}
/>
)}
</EuiFlexItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -365,13 +365,15 @@ export function AddFilterModal({
$state.store
);
onSubmit([builtCustomFilter]);
saveFilters({
title: customLabel,
description: '',
shouldIncludeFilters: false,
shouldIncludeTimefilter: false,
filters: [builtCustomFilter],
});
if (alias) {
saveFilters({
title: customLabel,
description: '',
shouldIncludeFilters: false,
shouldIncludeTimefilter: false,
filters: [builtCustomFilter],
});
}
} else if (addFilterMode === 'quick_form' && selectedIndexPattern) {
const builtFilters = localFilters.map((localFilter) => {
if (localFilter.field && localFilter.operator) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ import { GenericComboBox } from '../filter_bar/filter_editor/generic_combo_box';
import { PhraseValueInput } from '../filter_bar/filter_editor/phrase_value_input';
import { PhrasesValuesInput } from '../filter_bar/filter_editor/phrases_values_input';
import { RangeValueInput } from '../filter_bar/filter_editor/range_value_input';
import { SavedQueryMeta } from '../saved_query_form';

import { IIndexPattern, IFieldType } from '../..';

Expand Down Expand Up @@ -94,6 +95,7 @@ export function EditFilterModal({
savedQueryManagement,
initialAddFilterMode,
onRemoveFilterGroup,
saveFilters,
}: {
onSubmit: (filters: Filter[]) => void;
onMultipleFiltersSubmit: (filters: FilterGroup[], buildFilters: Filter[]) => void;
Expand All @@ -106,6 +108,7 @@ export function EditFilterModal({
savedQueryManagement?: JSX.Element;
initialAddFilterMode?: string;
onRemoveFilterGroup: (groupId: string) => void;
saveFilters: (savedQueryMeta: SavedQueryMeta) => void;
}) {
const [selectedIndexPattern, setSelectedIndexPattern] = useState(
getIndexPatternFromFilter(filter, indexPatterns)
Expand Down Expand Up @@ -385,6 +388,15 @@ export function EditFilterModal({
$state.store
);
onSubmit([builtCustomFilter]);
if (alias) {
saveFilters({
title: customLabel,
description: '',
shouldIncludeFilters: false,
shouldIncludeTimefilter: false,
filters: [builtCustomFilter],
});
}
} else if (addFilterMode === 'quick_form' && selectedIndexPattern) {
const builtFilters = localFilters.map((localFilter) => {
if (localFilter.field && localFilter.operator) {
Expand All @@ -406,6 +418,15 @@ export function EditFilterModal({
) as Filter[];
// onSubmit(finalFilters);
onMultipleFiltersSubmit(localFilters, finalFilters);
if (alias) {
saveFilters({
title: customLabel,
description: '',
shouldIncludeFilters: false,
shouldIncludeTimefilter: false,
filters: finalFilters,
});
}
}
} else if (addFilterMode === 'saved_filters') {
applySavedQueries();
Expand Down

0 comments on commit df7107c

Please sign in to comment.