-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[Discover] Add a tour for Document Explorer #131125
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
Merged
Merged
Changes from all commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
0de46ce
[Discover] Add "Take a tour" button to the Document Explorer callout
jughosta a130dc6
[Discover] Tmp
jughosta bce3d08
[Discover] Add a first Document Explorer tour step
jughosta 52effd5
[Discover] Add other Document Explorer tour steps
jughosta 6b4c925
[Discover] Update tour steps positioning
jughosta 9045b72
[Discover] Add gifs to tour steps
jughosta 1de42b9
[Discover] Refactor how tour steps are registered
jughosta 30e4e82
[Discover] Add new step to the tour. Update tour steps text.
jughosta e6dfa0e
[Discover] Improve steps positioning
jughosta 0a41fa8
[Discover] Fix positioning for Add field step
jughosta 03d0643
[Discover] Add icons to tour steps
jughosta 8ef167f
[Discover] Reorganize components
jughosta 9253ce7
[Discover] Skip Columns step when it's not available
jughosta fe9be1a
[Discover] Rename components
jughosta 31caa7e
[Discover] Add some tests
jughosta 6887aa3
[Discover] Fix positioning
jughosta 06692b4
[Discover] Fix props
jughosta 5f1a6aa
[Discover] Render steps only if the tour is active
jughosta 579f4c2
[Discover] Update gifs
jughosta 39a15b8
[Discover] Add image alt text for gifs
jughosta c453834
[Discover] Tag the Take tour button
jughosta 6801bd0
[Discover] Update text and tests
jughosta c5e9ec8
[Discover] Add more tests
jughosta ac7d329
[Discover] Rename assets directory
jughosta c273fa0
[Discover] Fix tour in mobile view. Improve steps positioning and ani…
jughosta 7ad9033
[Discover] Update text in tour steps
jughosta 1b5b36f
[Discover] Update sort.gif
jughosta d6cd452
[Discover] Update image width
jughosta 24389ea
Update src/plugins/discover/public/components/discover_tour/discover_…
jughosta f91034c
Update src/plugins/discover/public/components/discover_tour/discover_…
jughosta a1ab85e
Merge branch 'main' into document-explorer-take-tour
kibanamachine 5edd1c2
Merge branch 'main' into document-explorer-take-tour
kibanamachine ce7d6d5
[Discover] Update sort.gif
jughosta 7614081
Merge branch 'main' into document-explorer-take-tour
kibanamachine 85729fb
Merge branch 'main' into document-explorer-take-tour
kibanamachine a8eec09
[Discover] Fix code style
jughosta File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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
63 changes: 63 additions & 0 deletions
63
src/plugins/discover/public/components/discover_tour/discover_tour.test.tsx
This file contains hidden or 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,63 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License | ||
| * 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
| * in compliance with, at your election, the Elastic License 2.0 or the Server | ||
| * Side Public License, v 1. | ||
| */ | ||
|
|
||
| import React from 'react'; | ||
| import { EuiTourStep, EuiButton } from '@elastic/eui'; | ||
| import { mountWithIntl } from '@kbn/test-jest-helpers'; | ||
| import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public'; | ||
| import { discoverServiceMock } from '../../__mocks__/services'; | ||
| import { DiscoverTourProvider } from './discover_tour_provider'; | ||
| import { useDiscoverTourContext } from './discover_tour_context'; | ||
| import { DISCOVER_TOUR_STEP_ANCHORS } from './discover_tour_anchors'; | ||
|
|
||
| describe('Discover tour', () => { | ||
| const mountComponent = (innerContent?: JSX.Element) => { | ||
| return mountWithIntl( | ||
| <KibanaContextProvider services={discoverServiceMock}> | ||
| <DiscoverTourProvider>{innerContent}</DiscoverTourProvider> | ||
| </KibanaContextProvider> | ||
| ); | ||
| }; | ||
|
|
||
| it('should start successfully', () => { | ||
| const buttonSubjToTestStart = 'discoverTourButtonTestStart'; | ||
| const InnerComponent = () => { | ||
| const tourContext = useDiscoverTourContext(); | ||
|
|
||
| return ( | ||
| <EuiButton onClick={tourContext.onStartTour} data-test-subj={buttonSubjToTestStart}> | ||
| {'Start the tour'} | ||
| </EuiButton> | ||
| ); | ||
| }; | ||
|
|
||
| const component = mountComponent(<InnerComponent />); | ||
| // all steps are hidden by default | ||
| expect(component.find(EuiTourStep)).toHaveLength(0); | ||
|
|
||
| // one step should become visible after the tour is triggered | ||
| component.find(`[data-test-subj="${buttonSubjToTestStart}"]`).at(0).simulate('click'); | ||
|
|
||
| expect(component.find(EuiTourStep)).toHaveLength(5); | ||
| expect( | ||
| component.find({ anchor: DISCOVER_TOUR_STEP_ANCHORS.addFields, isStepOpen: true }) | ||
| ).toHaveLength(1); | ||
| expect( | ||
| component.find({ anchor: DISCOVER_TOUR_STEP_ANCHORS.reorderColumns, isStepOpen: false }) | ||
| ).toHaveLength(1); | ||
| expect( | ||
| component.find({ anchor: DISCOVER_TOUR_STEP_ANCHORS.sort, isStepOpen: false }) | ||
| ).toHaveLength(1); | ||
| expect( | ||
| component.find({ anchor: DISCOVER_TOUR_STEP_ANCHORS.changeRowHeight, isStepOpen: false }) | ||
| ).toHaveLength(1); | ||
| expect( | ||
| component.find({ anchor: DISCOVER_TOUR_STEP_ANCHORS.expandDocument, isStepOpen: false }) | ||
| ).toHaveLength(1); | ||
| }); | ||
| }); |
22 changes: 22 additions & 0 deletions
22
src/plugins/discover/public/components/discover_tour/discover_tour_anchors.tsx
This file contains hidden or 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,22 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License | ||
| * 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
| * in compliance with, at your election, the Elastic License 2.0 or the Server | ||
| * Side Public License, v 1. | ||
| */ | ||
|
|
||
| import { htmlIdGenerator } from '@elastic/eui'; | ||
|
|
||
| export const DISCOVER_TOUR_STEP_ANCHOR_IDS = { | ||
| addFields: htmlIdGenerator('dsc-tour-step-add-fields')(), | ||
| expandDocument: htmlIdGenerator('dsc-tour-step-expand')(), | ||
| }; | ||
|
|
||
| export const DISCOVER_TOUR_STEP_ANCHORS = { | ||
| addFields: `#${DISCOVER_TOUR_STEP_ANCHOR_IDS.addFields}`, | ||
| reorderColumns: '[data-test-subj="dataGridColumnSelectorButton"]', | ||
| sort: '[data-test-subj="dataGridColumnSortingButton"]', | ||
| changeRowHeight: '[data-test-subj="dataGridDisplaySelectorButton"]', | ||
| expandDocument: `#${DISCOVER_TOUR_STEP_ANCHOR_IDS.expandDocument}`, | ||
| }; |
25 changes: 25 additions & 0 deletions
25
src/plugins/discover/public/components/discover_tour/discover_tour_context.ts
This file contains hidden or 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,25 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License | ||
| * 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
| * in compliance with, at your election, the Elastic License 2.0 or the Server | ||
| * Side Public License, v 1. | ||
| */ | ||
|
|
||
| import { createContext, useContext } from 'react'; | ||
|
|
||
| export interface DiscoverTourContextProps { | ||
| onStartTour: () => void; | ||
| onNextTourStep: () => void; | ||
| onFinishTour: () => void; | ||
| } | ||
|
|
||
| export const DiscoverTourContext = createContext<DiscoverTourContextProps>({ | ||
| onStartTour: () => {}, | ||
| onNextTourStep: () => {}, | ||
| onFinishTour: () => {}, | ||
| }); | ||
|
|
||
| export const useDiscoverTourContext = () => { | ||
| return useContext(DiscoverTourContext); | ||
| }; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.