-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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] Persist hide chart option to local storage #114534
Merged
majagrubic
merged 14 commits into
elastic:master
from
majagrubic:save-chart-preferences
Oct 14, 2021
Merged
Changes from 12 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
31302c0
Persist hide chart to local storage
07f20ef
[Discover] Persist hide chart option to local storage
bbe9a2c
Merge branch 'master' into save-chart-preferences
kibanamachine b284d20
Fix state
ca30b2e
Fix dependency check
8e54395
Merge branch 'master' into save-chart-preferences
kibanamachine 12b250c
Set chart state to undefined
1cffac7
Update unit test
c443cb5
Do not override saved search preferences
9f11036
Fix missing import
2713bfc
Add a functional test
c1ba94e
Add a functional test
3afb19c
Fix functional test
51a73cc
Merge branch 'master' into save-chart-preferences
kibanamachine 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/* | ||
* 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 expect from '@kbn/expect'; | ||
import { FtrProviderContext } from '../../ftr_provider_context'; | ||
|
||
export default function ({ getService, getPageObjects }: FtrProviderContext) { | ||
const log = getService('log'); | ||
const esArchiver = getService('esArchiver'); | ||
const kibanaServer = getService('kibanaServer'); | ||
const PageObjects = getPageObjects(['common', 'discover', 'header', 'timePicker']); | ||
|
||
const defaultSettings = { | ||
defaultIndex: 'logstash-*', | ||
}; | ||
|
||
describe('discover show/hide chart test', function () { | ||
before(async function () { | ||
log.debug('load kibana index with default index pattern'); | ||
|
||
await kibanaServer.importExport.load('test/functional/fixtures/kbn_archiver/discover.json'); | ||
|
||
// and load a set of makelogs data | ||
await esArchiver.loadIfNeeded('test/functional/fixtures/es_archiver/logstash_functional'); | ||
await kibanaServer.uiSettings.replace(defaultSettings); | ||
await PageObjects.common.navigateToApp('discover'); | ||
await PageObjects.timePicker.setDefaultAbsoluteRange(); | ||
}); | ||
|
||
after(async () => { | ||
await kibanaServer.uiSettings.unset('timepicker:timeDefaults'); | ||
await kibanaServer.uiSettings.unset('defaultIndex'); | ||
}); | ||
|
||
it('shows chart by default', async function () { | ||
expect(await PageObjects.discover.isChartVisible()).to.be(true); | ||
}); | ||
|
||
it('hiding the chart persists the setting', async function () { | ||
await PageObjects.discover.toggleChartVisibility(); | ||
expect(await PageObjects.discover.isChartVisible()).to.be(false); | ||
|
||
await PageObjects.common.navigateToApp('dashboard'); | ||
await PageObjects.common.navigateToApp('discover'); | ||
await PageObjects.timePicker.setDefaultAbsoluteRange(); | ||
await PageObjects.header.waitUntilLoadingHasFinished(); | ||
|
||
expect(await PageObjects.discover.isChartVisible()).to.be(false); | ||
}); | ||
|
||
it('persists hidden chart option on the saved search ', async function () { | ||
const savedSearchTitle = 'chart hidden'; | ||
await PageObjects.discover.saveSearch(savedSearchTitle); | ||
|
||
await PageObjects.discover.toggleChartVisibility(); | ||
expect(await PageObjects.discover.isChartVisible()).to.be(true); | ||
|
||
await PageObjects.common.navigateToApp('discover'); | ||
await PageObjects.timePicker.setDefaultAbsoluteRange(); | ||
await PageObjects.header.waitUntilLoadingHasFinished(); | ||
expect(await PageObjects.discover.isChartVisible()).to.be(true); | ||
|
||
await PageObjects.discover.loadSavedSearch(savedSearchTitle); | ||
expect(await PageObjects.discover.isChartVisible()).to.be(false); | ||
}); | ||
}); | ||
} |
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'timepicker:timeDefaults' do we need to reset this? since it has not been set?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, I thought this was unsetting the default time in Discover 🤦♀️