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

[Infrastructure UI] Hosts View: Unified Search bar with auto-refresh enabled #157011

Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,16 @@ storiesOf('SearchBar', module)
showDatePicker: false,
} as SearchBarProps)
)
.add('with date picker off', () =>
.add('with the default date picker auto refresh interval on', () =>
wrapSearchBarInContext({
showDatePicker: false,
showDatePicker: true,
onRefreshChange: action('onRefreshChange'),
} as SearchBarProps)
)
.add('with the default date picker auto refresh interval off', () =>
wrapSearchBarInContext({
showDatePicker: true,
isAutoRefreshDisabled: true,
} as SearchBarProps)
)
.add('with only the date picker on', () =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,11 @@ export function createSearchBar({
filters={filters}
query={query}
onFiltersUpdated={defaultFiltersUpdated(data.query, props.onFiltersUpdated)}
onRefreshChange={defaultOnRefreshChange(data.query, props.onRefreshChange)}
onRefreshChange={
!props.isAutoRefreshDisabled
? defaultOnRefreshChange(data.query, props.onRefreshChange)
: undefined
}
savedQuery={savedQuery}
onQuerySubmit={defaultOnQuerySubmit(props, data.query, query)}
onRefresh={props.onRefresh}
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/unified_search/public/search_bar/search_bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ export interface SearchBarOwnProps<QT extends AggregateQuery | Query = Query> {
// Autorefresh
onRefreshChange?: (options: { isPaused: boolean; refreshInterval: number }) => void;
indicateNoData?: boolean;
// Disables the default auto-refresh option inside the date picker
isAutoRefreshDisabled?: boolean;

placeholder?: string;
isClearable?: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export const UnifiedSearchBar = () => {
showQueryInput
showQueryMenu
useDefaultBehaviors
isAutoRefreshDisabled
/>
</EuiFlexItem>
<EuiFlexItem>
Expand Down