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

Fix No data selected appearance #8668

Merged
merged 1 commit into from
Oct 19, 2024
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
3 changes: 1 addition & 2 deletions src/plugins/data/public/ui/filter_bar/filter_options.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@ const FilterOptionsUI = (props: Props) => {
const uiSettings = opensearchDashboards.services.uiSettings;
const isPinned = uiSettings!.get(UI_SETTINGS.FILTERS_PINNED_BY_DEFAULT);
const useNewHeader = Boolean(uiSettings!.get(UI_SETTINGS.NEW_HOME_PAGE));
const [indexPattern] = props.indexPatterns;
const index = indexPattern && indexPattern.id;
const index = Array.isArray(props.indexPatterns) ? props.indexPatterns[0]?.id : undefined;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needed to make the no-index-pattern state to pass through.

const newFilter = buildEmptyFilter(isPinned, index);

const togglePopover = () => {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,22 @@
gutterSize="none"
className="defaultEditor__footerRow"
>
{footerItems.start?.map((item) => (
<EuiFlexItem grow={false} className="defaultEditor__footerItem">
{footerItems.start?.map((item, idx) => (
<EuiFlexItem

Check warning on line 81 in src/plugins/data/public/ui/query_editor/editors/default_editor/index.tsx

View check run for this annotation

Codecov / codecov/patch

src/plugins/data/public/ui/query_editor/editors/default_editor/index.tsx#L81

Added line #L81 was not covered by tests
key={`defaultEditor__footerItem-start-${idx}`}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just added key to get rid of react warning.

grow={false}
className="defaultEditor__footerItem"
>
{item}
</EuiFlexItem>
))}
<EuiFlexItem grow />
{footerItems.end?.map((item) => (
<EuiFlexItem grow={false} className="defaultEditor__footerItem">
{footerItems.end?.map((item, idx) => (
<EuiFlexItem

Check warning on line 91 in src/plugins/data/public/ui/query_editor/editors/default_editor/index.tsx

View check run for this annotation

Codecov / codecov/patch

src/plugins/data/public/ui/query_editor/editors/default_editor/index.tsx#L91

Added line #L91 was not covered by tests
key={`defaultEditor__footerItem-end-${idx}`}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just added key to get rid of react warning.

grow={false}
className="defaultEditor__footerItem"
>
{item}
</EuiFlexItem>
))}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ export const QueryLanguageSelector = (props: QueryLanguageSelectorProps) => {
button={
<EuiSmallButtonEmpty
iconSide="right"
iconSize="s"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EuiSmallButtonEmpty doesn't handle it, even tough it claims to do.

onClick={onButtonClick}
className="languageSelector__button"
iconType="arrowDown"
Expand Down
3 changes: 2 additions & 1 deletion src/plugins/data/public/ui/search_bar/search_bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,8 @@ class SearchBarUI extends Component<SearchBarProps, State> {
const showDatePicker = this.props.showDatePicker || this.props.showAutoRefreshOnly;
// TODO: MQL showQueryEditor should be a prop of it's own but using showQueryInput for now
const showQueryEditor =
this.props.showQueryInput && this.props.indexPatterns && this.state.query;
(this.props.showQueryInput && this.props.indexPatterns && this.state.query) ||
this.props.datasetSelectorRef?.current;
return this.props.showQueryBar && (showDatePicker || showQueryEditor);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,8 @@
*/

.discoverNoIndexPatterns-centerPanel {
height: 100%;
width: 100%;

// Push the centralized child up, just like ouiOverlayMask
padding-bottom: 10vh;

& > * {
@include euiLegibilityMaxWidth(100%);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

import React, { useEffect, useState, useRef, useCallback } from 'react';
import { EuiPanel } from '@elastic/eui';
import { EuiPanel, EuiSpacer } from '@elastic/eui';
import { TopNav } from './top_nav';
import { ViewProps } from '../../../../../data_explorer/public';
import { DiscoverTable } from './discover_table';
Expand Down Expand Up @@ -143,41 +143,47 @@
showSaveQuery={showSaveQuery}
/>

{!indexPattern && <DiscoverNoIndexPatterns />}
<>
{fetchState.status === ResultStatus.NO_RESULTS && (
<DiscoverNoResults
queryString={data.query.queryString}
query={data.query.queryString.getQuery()}
savedQuery={data.query.savedQueries}
timeFieldName={timeField}
/>
)}
{fetchState.status === ResultStatus.ERROR && (
<DiscoverNoResults
queryString={data.query.queryString}
query={data.query.queryString.getQuery()}
savedQuery={data.query.savedQueries}
timeFieldName={timeField}
/>
)}
{fetchState.status === ResultStatus.UNINITIALIZED && (
<DiscoverUninitialized onRefresh={() => refetch$.next()} />
)}
{fetchState.status === ResultStatus.LOADING && <LoadingSpinner />}
{fetchState.status === ResultStatus.READY && isEnhancementsEnabled && (
<>
<MemoizedDiscoverChartContainer {...fetchState} />
<MemoizedDiscoverTable rows={rows} scrollToTop={scrollToTop} />
</>
)}
{fetchState.status === ResultStatus.READY && !isEnhancementsEnabled && (
<EuiPanel hasShadow={false} paddingSize="none" className="dscCanvas_results">
<MemoizedDiscoverChartContainer {...fetchState} />
<MemoizedDiscoverTable rows={rows} scrollToTop={scrollToTop} />
</EuiPanel>
)}
</>
{indexPattern ? (
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the else to stop showing the spinner.

<>
{fetchState.status === ResultStatus.NO_RESULTS && (
<DiscoverNoResults
queryString={data.query.queryString}
query={data.query.queryString.getQuery()}
savedQuery={data.query.savedQueries}
timeFieldName={timeField}
/>
)}
{fetchState.status === ResultStatus.ERROR && (
<DiscoverNoResults
queryString={data.query.queryString}
query={data.query.queryString.getQuery()}
savedQuery={data.query.savedQueries}
timeFieldName={timeField}
/>
)}
{fetchState.status === ResultStatus.UNINITIALIZED && (
<DiscoverUninitialized onRefresh={() => refetch$.next()} />

Check warning on line 165 in src/plugins/discover/public/application/view_components/canvas/index.tsx

View check run for this annotation

Codecov / codecov/patch

src/plugins/discover/public/application/view_components/canvas/index.tsx#L165

Added line #L165 was not covered by tests
)}
{fetchState.status === ResultStatus.LOADING && <LoadingSpinner />}
{fetchState.status === ResultStatus.READY && isEnhancementsEnabled && (
<>
<MemoizedDiscoverChartContainer {...fetchState} />
<MemoizedDiscoverTable rows={rows} scrollToTop={scrollToTop} />
</>
)}
{fetchState.status === ResultStatus.READY && !isEnhancementsEnabled && (
<EuiPanel hasShadow={false} paddingSize="none" className="dscCanvas_results">
<MemoizedDiscoverChartContainer {...fetchState} />
<MemoizedDiscoverTable rows={rows} scrollToTop={scrollToTop} />
</EuiPanel>
)}
</>
) : (
<>
<EuiSpacer size="xxl" />
<DiscoverNoIndexPatterns />
</>
)}
</EuiPanel>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ export const TopNav = ({ opts, showSaveQuery, isEnhancementsEnabled }: TopNavPro
groupActions={showActionsInGroup}
screenTitle={screenTitle}
queryStatus={queryStatus}
showQueryBar={!!opts?.optionalRef?.datasetSelectorRef}
/>
</>
);
Expand Down
Loading