Skip to content

Commit

Permalink
Merge branch 'main' into fix_browser_warnings
Browse files Browse the repository at this point in the history
Signed-off-by: Jincheng Wan <45655760+Kapian1234@users.noreply.github.com>
  • Loading branch information
Kapian1234 authored Aug 5, 2024
2 parents 765a464 + 352d2e9 commit 8759e7b
Show file tree
Hide file tree
Showing 129 changed files with 4,934 additions and 21,841 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,6 @@ snapshots.js

# Yarn local mirror content
.yarn-local-mirror

# Ignore the generated antlr files
/src/plugins/data/public/antlr/opensearch_sql/grammar/.antlr
2 changes: 2 additions & 0 deletions changelogs/fragments/7391.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
feat:
- DQL Autocomplete ([#7391](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/7391))
2 changes: 2 additions & 0 deletions changelogs/fragments/7463.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
feat:
- Add MDS support along with a few cleanup and tests update ([#7463](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/7463))
2 changes: 2 additions & 0 deletions changelogs/fragments/7523.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
refactor:
- [Look&Feel] Apply small popover padding and add Oui tooltips ([#7523](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/7523))
2 changes: 2 additions & 0 deletions changelogs/fragments/7547.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fix:
- [Workspace] updating workspace-list-card and home-list-card ([#7547](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/7547))
2 changes: 2 additions & 0 deletions changelogs/fragments/7551.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fix:
- [navigation]feat: redirect user to home in global when workspace is enabled ([#7551](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/7551))
2 changes: 2 additions & 0 deletions changelogs/fragments/7565.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fix:
- [Workspace]Add workspaces and permissions fields into saved objects _bulk_get response ([#7565](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/7565))
2 changes: 2 additions & 0 deletions changelogs/fragments/7567.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fix:
- Fixes databases not being displayed upon success ([#7567](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/7567))
2 changes: 2 additions & 0 deletions changelogs/fragments/7581.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
feat:
- Fix discover options' location ([#7581](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/7581))
2 changes: 2 additions & 0 deletions changelogs/fragments/7585.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fix:
- Do not show surround doc links for PPL ([#7585](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/7585))
2 changes: 2 additions & 0 deletions changelogs/fragments/7596.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fix:
- Add validation for data source in get and bulk_get methods ([#7596](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/7596))
2 changes: 2 additions & 0 deletions changelogs/fragments/7609.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fix:
- Dataset nav to load external connections and update namespace ([#7609](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/7609))
2 changes: 2 additions & 0 deletions changelogs/fragments/7613.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fix:
- [navigation] add sample data to left navigation ([#7613](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/7613))
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"
]
}
}
16 changes: 10 additions & 6 deletions src/core/public/chrome/ui/header/collapsible_nav_group_enabled.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,14 @@ export function CollapsibleNavGroupEnabled({
const navGroupsMap = useObservable(observables.navGroupsMap$, {});
const currentNavGroup = useObservable(observables.currentNavGroup$, undefined);

const visibleUseCases = useMemo(
() =>
Object.values(navGroupsMap).filter(
(group) => group.type === undefined && group.status !== NavGroupStatus.Hidden
),
[navGroupsMap]
);

const navLinksForRender: ChromeNavLink[] = useMemo(() => {
if (currentNavGroup && currentNavGroup.id !== ALL_USE_CASE_ID) {
return fulfillRegistrationLinksToChromeNavLinks(
Expand All @@ -206,10 +214,6 @@ export function CollapsibleNavGroupEnabled({
);
}

const visibleUseCases = Object.values(navGroupsMap).filter(
(group) => group.type === undefined && group.status !== NavGroupStatus.Hidden
);

if (visibleUseCases.length === 1) {
return fulfillRegistrationLinksToChromeNavLinks(
navGroupsMap[visibleUseCases[0].id].navLinks || [],
Expand Down Expand Up @@ -269,7 +273,7 @@ export function CollapsibleNavGroupEnabled({
});

return fulfillRegistrationLinksToChromeNavLinks(navLinksForAll, navLinks);
}, [navLinks, navGroupsMap, currentNavGroup]);
}, [navLinks, navGroupsMap, currentNavGroup, visibleUseCases]);

const width = useMemo(() => {
if (!isNavOpen) {
Expand Down Expand Up @@ -332,13 +336,13 @@ export function CollapsibleNavGroupEnabled({
<>
<CollapsibleNavTop
navLinks={navLinks}
navGroupsMap={navGroupsMap}
navigateToApp={navigateToApp}
logos={logos}
onClickBack={() => setCurrentNavGroup(undefined)}
currentNavGroup={currentNavGroup}
shouldShrinkNavigation={!isNavOpen}
onClickShrink={closeNav}
visibleUseCases={visibleUseCases}
/>
<NavGroups
navLinks={navLinksForRender}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ describe('<CollapsibleNavTop />', () => {
return {
navLinks: mockedNavLinks,
navigateToApp: jest.fn(),
navGroupsMap: {},
logos: getLogos({}, mockBasePath.serverBasePath),
shouldShrinkNavigation: false,
visibleUseCases: [],
};
};
it('should render home icon', async () => {
Expand All @@ -74,23 +74,23 @@ describe('<CollapsibleNavTop />', () => {
});

it('should render back icon', async () => {
const { findByTestId } = render(
const { findByTestId, findByText } = render(
<CollapsibleNavTop
{...getMockedProps()}
navGroupsMap={{
navGroupFoo: {
visibleUseCases={[
{
id: 'navGroupFoo',
title: 'navGroupFoo',
description: 'navGroupFoo',
navLinks: [],
},
navGroupBar: {
{
id: 'navGroupBar',
title: 'navGroupBar',
description: 'navGroupBar',
navLinks: [],
},
}}
]}
currentNavGroup={{
id: 'navGroupFoo',
title: 'navGroupFoo',
Expand All @@ -100,6 +100,37 @@ describe('<CollapsibleNavTop />', () => {
/>
);
await findByTestId('collapsibleNavBackButton');
await findByText('Back');
});

it('should render back home icon', async () => {
const { findByTestId, findByText } = render(
<CollapsibleNavTop
{...getMockedProps()}
visibleUseCases={[
{
id: 'navGroupFoo',
title: 'navGroupFoo',
description: 'navGroupFoo',
navLinks: [],
},
{
id: 'navGroupBar',
title: 'navGroupBar',
description: 'navGroupBar',
navLinks: [],
},
]}
currentNavGroup={{
id: 'global',
title: 'navGroupFoo',
description: 'navGroupFoo',
navLinks: [],
}}
/>
);
await findByTestId('collapsibleNavBackButton');
await findByText('Home');
});

it('should render expand icon', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,46 +22,59 @@ import { ALL_USE_CASE_ID } from '../../../../../core/utils';

export interface CollapsibleNavTopProps {
navLinks: ChromeNavLink[];
navGroupsMap: Record<string, NavGroupItemInMap>;
currentNavGroup?: NavGroupItemInMap;
navigateToApp: InternalApplicationStart['navigateToApp'];
logos: Logos;
onClickBack?: () => void;
onClickShrink?: () => void;
shouldShrinkNavigation: boolean;
visibleUseCases: NavGroupItemInMap[];
}

export const CollapsibleNavTop = ({
navLinks,
navGroupsMap,
currentNavGroup,
navigateToApp,
logos,
onClickBack,
onClickShrink,
shouldShrinkNavigation,
visibleUseCases,
}: CollapsibleNavTopProps) => {
const homeLink = useMemo(() => navLinks.find((link) => link.id === 'home'), [navLinks]);

const shouldShowBackButton = useMemo(
() =>
currentNavGroup?.id !== ALL_USE_CASE_ID &&
!shouldShrinkNavigation &&
Object.values(navGroupsMap).filter((item) => !item.type).length > 1 &&
currentNavGroup,
[navGroupsMap, currentNavGroup, shouldShrinkNavigation]
const isOutsideWorkspace = useMemo(
() => !visibleUseCases.find((useCase) => useCase.id === currentNavGroup?.id),
[currentNavGroup, visibleUseCases]
);

const shouldShowBackButton = useMemo(() => {
if (!currentNavGroup || currentNavGroup.id === ALL_USE_CASE_ID || shouldShrinkNavigation) {
return false;
}

// It means user is in a specific type of workspace
if (visibleUseCases.length <= 1) {
return false;
}

if (isOutsideWorkspace) {
return true;
}

return visibleUseCases.length > 1;
}, [visibleUseCases, currentNavGroup, shouldShrinkNavigation, isOutsideWorkspace]);

const shouldShowHomeLink = useMemo(() => {
if (!homeLink || shouldShrinkNavigation) return false;

return !shouldShowBackButton;
}, [shouldShowBackButton, homeLink, shouldShrinkNavigation]);

const homeLinkProps = useMemo(() => {
if (shouldShowHomeLink) {
if (homeLink) {
const propsForHomeIcon = createEuiListItem({
link: homeLink as ChromeNavLink,
link: homeLink,
appId: 'home',
dataTestSubj: 'collapsibleNavHome',
navigateToApp,
Expand All @@ -74,7 +87,7 @@ export const CollapsibleNavTop = ({
}

return {};
}, [shouldShowHomeLink, homeLink, navigateToApp]);
}, [homeLink, navigateToApp]);

return (
<div className="side-naivgation-top">
Expand All @@ -91,13 +104,17 @@ export const CollapsibleNavTop = ({
<EuiFlexItem grow={false}>
<EuiButtonEmpty
size="l"
onClick={onClickBack}
onClick={isOutsideWorkspace ? homeLinkProps.onClick : onClickBack}
data-test-subj="collapsibleNavBackButton"
>
<EuiIcon type="arrowLeft" />
{i18n.translate('core.ui.primaryNav.backButtonLabel', {
defaultMessage: 'Back',
})}
{isOutsideWorkspace
? i18n.translate('core.ui.primaryNav.homeButtonLabel', {
defaultMessage: 'Home',
})
: i18n.translate('core.ui.primaryNav.backButtonLabel', {
defaultMessage: 'Back',
})}
</EuiButtonEmpty>
</EuiFlexItem>
) : null}
Expand Down
1 change: 1 addition & 0 deletions src/core/public/chrome/ui/header/recent_items.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export const RecentItems = ({
anchorPosition="downCenter"
repositionOnScroll
initialFocus={false}
panelPaddingSize="s"
>
<EuiTitle size="xxs">
<h4>Recents</h4>
Expand Down
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
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

import { includedFields } from './included_fields';

const BASE_FIELD_COUNT = 9;
const BASE_FIELD_COUNT = 11;

describe('includedFields', () => {
it('returns undefined if fields are not provided', () => {
Expand All @@ -56,6 +56,8 @@ Array [
"migrationVersion",
"updated_at",
"originId",
"workspaces",
"permissions",
"foo",
]
`);
Expand Down Expand Up @@ -90,6 +92,8 @@ Array [
"migrationVersion",
"updated_at",
"originId",
"workspaces",
"permissions",
"foo",
"bar",
]
Expand Down
2 changes: 2 additions & 0 deletions src/core/server/saved_objects/service/lib/included_fields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,7 @@ export function includedFields(type: string | string[] = '*', fields?: string[]
.concat('migrationVersion')
.concat('updated_at')
.concat('originId')
.concat('workspaces')
.concat('permissions')
.concat(fields); // v5 compatibility
}
2 changes: 2 additions & 0 deletions src/core/server/saved_objects/service/lib/repository.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2819,6 +2819,8 @@ describe('SavedObjectsRepository', () => {
'migrationVersion',
'updated_at',
'originId',
'workspaces',
'permissions',
'title',
],
}),
Expand Down
Loading

0 comments on commit 8759e7b

Please sign in to comment.