forked from opensearch-project/OpenSearch-Dashboards
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[navigation]feat: add home icon in left bottom (opensearch-project#7802)
* feat: add home icon in left bottom Signed-off-by: SuZhou-Joe <[email protected]> * feat: remove useless padding Signed-off-by: SuZhou-Joe <[email protected]> * Changeset file for PR opensearch-project#7802 created/updated * fix: update snapshot Signed-off-by: SuZhou-Joe <[email protected]> * feat: use flush Signed-off-by: SuZhou-Joe <[email protected]> * feat: optimize style Signed-off-by: SuZhou-Joe <[email protected]> * feat: move features around in nav group Signed-off-by: SuZhou-Joe <[email protected]> * fix: typo Signed-off-by: SuZhou-Joe <[email protected]> * fix: unit test Signed-off-by: SuZhou-Joe <[email protected]> --------- Signed-off-by: SuZhou-Joe <[email protected]> Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
- Loading branch information
1 parent
e1e8169
commit 106b64c
Showing
14 changed files
with
144 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
feat: | ||
- Add home icon in left bottom ([#7802](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/7802)) |
8 changes: 4 additions & 4 deletions
8
src/core/public/chrome/ui/header/__snapshots__/collapsible_nav_group_enabled.test.tsx.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/plugins/home/public/application/components/home_icon.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import React from 'react'; | ||
import { fireEvent, render } from '@testing-library/react'; | ||
import { HomeIcon } from './home_icon'; | ||
import { coreMock } from '../../../../../core/public/mocks'; | ||
|
||
describe('<HomeIcon />', () => { | ||
it('should call chrome.navGroup.setCurrentNavGroup and application.navigateToApp methods from core service when click', () => { | ||
const coreStartMock = coreMock.createStart(); | ||
const { container } = render(<HomeIcon core={coreStartMock} appId="foo" />); | ||
const component = container.children[0]; | ||
fireEvent.click(component); | ||
expect(coreStartMock.application.navigateToApp).toBeCalledWith('foo'); | ||
}); | ||
}); |
20 changes: 20 additions & 0 deletions
20
src/plugins/home/public/application/components/home_icon.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import React from 'react'; | ||
import { EuiButtonIcon } from '@elastic/eui'; | ||
import { CoreStart } from 'opensearch-dashboards/public'; | ||
|
||
export function HomeIcon({ core, appId }: { core: CoreStart; appId: string }) { | ||
return ( | ||
<EuiButtonIcon | ||
aria-label="go-to-home" | ||
iconType="home" | ||
onClick={() => { | ||
core.application.navigateToApp(appId); | ||
}} | ||
/> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.