Skip to content

Commit

Permalink
[Discover next] Fixes dataset navigator menu styling & search error t…
Browse files Browse the repository at this point in the history
…oast (opensearch-project#7566)

Signed-off-by: Ashwin P Chandran <[email protected]>
  • Loading branch information
ashwin-pc authored and ananzh committed Jul 30, 2024
1 parent f637648 commit ea4071c
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 25 deletions.
3 changes: 2 additions & 1 deletion packages/osd-stylelint-config/config/global_selectors.json
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 @@ export class SearchInterceptor {

this.deps.toasts.addError(e, {
title: 'Search Error',
id: simpleHash(e.message),
});
}
}

// To be used as a unique identifier for each error
const simpleHash = (str: string) =>
str
.split('')
// eslint-disable-next-line no-bitwise
.reduce((hash: number, char) => (hash << 5) + hash + char.charCodeAt(0), 5381)
.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

0 comments on commit ea4071c

Please sign in to comment.