Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ML] AIOps Hiding saved query controls #210556

Merged
merged 5 commits into from
Feb 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export interface QueryBarMenuProps extends WithCloseFilterEditorConfirmModalProp
showQueryInput?: boolean;
showFilterBar?: boolean;
showSaveQuery?: boolean;
showSavedQueryControls?: boolean;
timeRangeForSuggestionsOverride?: boolean;
filtersForSuggestions?: Filter[];
indexPatterns?: Array<DataView | string>;
Expand Down Expand Up @@ -110,6 +111,7 @@ function QueryBarMenuComponent({
showQueryInput,
showFilterBar,
showSaveQuery,
showSavedQueryControls,
indexPatterns,
timeRangeForSuggestionsOverride,
filtersForSuggestions,
Expand Down Expand Up @@ -176,6 +178,7 @@ function QueryBarMenuComponent({
timeFilter,
query,
showSaveQuery,
showSavedQueryControls,
showFilterBar,
showQueryInput,
savedQueryService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ export interface QueryBarMenuPanelsProps {
timeFilter?: SavedQueryTimeFilter;
query?: Query;
showSaveQuery?: boolean;
showSavedQueryControls?: boolean;
showQueryInput?: boolean;
showFilterBar?: boolean;
savedQueryService: SavedQueryService;
Expand Down Expand Up @@ -199,6 +200,7 @@ export function useQueryBarMenuPanels({
timeFilter,
query,
showSaveQuery,
showSavedQueryControls = true,
showFilterBar,
showQueryInput,
savedQueryService,
Expand All @@ -220,7 +222,10 @@ export function useQueryBarMenuPanels({
const { appName, usageCollection, uiSettings, http, storage, application } = kibana.services;
const reportUiCounter = usageCollection?.reportUiCounter.bind(usageCollection, appName);
const showSavedQueries =
showQueryInput && showFilterBar && application.capabilities.savedQueryManagement?.showQueries;
showSavedQueryControls &&
showQueryInput &&
showFilterBar &&
application.capabilities.savedQueryManagement?.showQueries;
const cancelPendingListingRequest = useRef<() => void>(() => {});

const [hasSavedQueries, setHasSavedQueries] = useState(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ export interface SearchBarOwnProps<QT extends AggregateQuery | Query = Query> {
query?: QT | Query;
// Show when user has privileges to save. See `canShowSavedQuery(...)` lib.
showSaveQuery?: boolean;
// Show the controls to save and load saved queries
showSavedQueryControls?: boolean;
savedQuery?: SavedQuery;
onQueryChange?: (payload: { dateRange: TimeRange; query?: QT | Query }) => void;
onQuerySubmit?: (
Expand Down Expand Up @@ -556,6 +558,7 @@ class SearchBarUI<QT extends (Query | AggregateQuery) | Query = Query> extends C
showQueryInput={this.props.showQueryInput}
showFilterBar={this.props.showFilterBar}
showSaveQuery={this.props.showSaveQuery}
showSavedQueryControls={this.props.showSavedQueryControls}
isDisabled={this.props.isDisabled}
buttonProps={{ size: this.shouldShowDatePickerAsBadge() ? 's' : 'm' }}
indexPatterns={this.props.indexPatterns}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ export const SearchPanelContent = ({
showFilterBar={true}
showDatePicker={false}
showQueryInput={true}
showSavedQueryControls={false}
query={searchInput}
onQuerySubmit={(params: { dateRange: TimeRange; query?: Query | undefined }) =>
searchHandler({ query: params.query })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export const SearchBarWrapper: FC<SearchBarProps> = ({
showDatePicker={false}
showQueryInput
query={resultQuery}
showSavedQueryControls={false}
filters={filters ?? []}
onQuerySubmit={onQuerySubmit}
indexPatterns={[dataView]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ export const SearchPanel: FC<Props> = ({ searchString, searchQueryLanguage, setS
showFilterBar={true}
showDatePicker={false}
showQueryInput={true}
showSavedQueryControls={false}
query={searchInput}
onQuerySubmit={(params: { dateRange: TimeRange; query?: Query | undefined }) =>
searchHandler({ query: params.query })
Expand Down