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

[Discover next] Fixes dataset navigator menu styling & search error toast #7566

Merged
merged 1 commit into from
Jul 30, 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
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
"src/plugins/discover/public/application/view_components/canvas/discover_canvas.scss",
"src/plugins/discover/public/application/components/sidebar/discover_sidebar.scss",
"src/plugins/data/public/ui/query_string_input/_query_bar.scss",
"src/plugins/data/public/ui/query_editor/_query_editor.scss"
"src/plugins/data/public/ui/query_editor/_query_editor.scss",
"src/plugins/data/public/ui/dataset_navigator/_dataset_navigator.scss"
]
}
}
4 changes: 4 additions & 0 deletions src/core/public/notifications/toasts/toasts_api.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ export interface ErrorToastOptions extends ToastOptions {
* message will still be shown in the detailed error modal.
*/
toastMessage?: string;
/**
* The id of the error.
*/
id?: string;
}

const normalizeToast = (toastOrTitle: ToastInput): ToastInputFields => {
Expand Down
9 changes: 9 additions & 0 deletions src/plugins/data/public/search/search_interceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,17 @@

this.deps.toasts.addError(e, {
title: 'Search Error',
id: simpleHash(e.message),
Copy link
Member

Choose a reason for hiding this comment

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

🙌

});
}
}

// To be used as a unique identifier for each error
const simpleHash = (str: string) =>
str

Check warning on line 286 in src/plugins/data/public/search/search_interceptor.ts

View check run for this annotation

Codecov / codecov/patch

src/plugins/data/public/search/search_interceptor.ts#L286

Added line #L286 was not covered by tests
.split('')
// eslint-disable-next-line no-bitwise
.reduce((hash: number, char) => (hash << 5) + hash + char.charCodeAt(0), 5381)

Check warning on line 289 in src/plugins/data/public/search/search_interceptor.ts

View check run for this annotation

Codecov / codecov/patch

src/plugins/data/public/search/search_interceptor.ts#L289

Added line #L289 was not covered by tests
.toString();

export type ISearchInterceptor = PublicMethodsOf<SearchInterceptor>;
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
.dataSetNavigator {
padding: $euiSizeXS;
color: $euiColorPrimaryText;
max-height: 60vh;
overflow-y: auto;
scrollbar-width: thin;
scrollbar-color: $euiColorMediumShade $euiColorLightestShade;

&__icon {
margin-right: 4px;
Expand All @@ -19,26 +15,14 @@
padding: $euiSizeS;
}

&:not(:hover)::-webkit-scrollbar {
width: 0;
background: transparent;
}

&::-webkit-scrollbar {
width: 4px;
}

&::-webkit-scrollbar-track {
background: $euiColorLightestShade;
}

&::-webkit-scrollbar-thumb {
background-color: $euiColorMediumShade;
border-radius: 4px;
}

&__menu {
width: 365px;

.euiContextMenu__panel > div {
@include euiYScrollWithShadows;

max-height: 60vh;
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@ export const DataSetNavigator: React.FC<DataSetNavigatorProps> = ({
>
<EuiContextMenu
initialPanelId={0}
className="dataSetNavigator dataSetNavigator__menu"
className="dataSetNavigator__menu"
size="s"
panels={panels}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const DefaultInput: React.FC<DefaultInputProps> = ({
<div className="defaultEditor">
<div ref={headerRef} className="defaultEditor__header" />
<CodeEditor
height={200}
height={100}
languageId={languageId}
value={value}
onChange={onChange}
Expand Down
Loading