-
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
[Cases] Handle lens actions in Serverless #163581
Merged
js-jankisalvi
merged 23 commits into
elastic:main
from
js-jankisalvi:hide-lens-actions-serverless
Aug 14, 2023
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
8c2a2e2
hide solution picker for serverless
js-jankisalvi b803cd8
unit test added
js-jankisalvi 00abb4a
Merge remote-tracking branch 'upstream/main' into hide-lens-actions-s…
js-jankisalvi 967d6f0
update post case to have default owner in case of no owners available
js-jankisalvi ce954dc
Merge remote-tracking branch 'upstream/main' into hide-lens-actions-s…
js-jankisalvi fdbd3aa
Merge remote-tracking branch 'upstream/main' into hide-lens-actions-s…
js-jankisalvi 5b18d96
add functional tests to add lens to case
js-jankisalvi de5e9b6
check that solution picker is not visible
js-jankisalvi 36b78b2
[CI] Auto-commit changed files from 'node scripts/precommit_hook.js -…
kibanamachine 0d33bca
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine 72ed819
fix serverless tests
js-jankisalvi 9972f69
remove skiploading flag
js-jankisalvi 6ec2f43
[CI] Auto-commit changed files from 'node scripts/precommit_hook.js -…
kibanamachine e5393ab
removed unnecessary changes
js-jankisalvi 521b5f1
add retry to handle loading indicator timeout
js-jankisalvi 271f5d8
Merge branch 'main' into hide-lens-actions-serverless
js-jankisalvi a68df43
Merge remote-tracking branch 'upstream/main' into hide-lens-actions-s…
js-jankisalvi 0b9f944
update config to interact with saved objects
js-jankisalvi 83da2f6
Merge remote-tracking branch 'upstream/main' into hide-lens-actions-s…
js-jankisalvi fb9a42c
remove retry and use lens page object to add lens to dashboard
js-jankisalvi 5bae788
add encryption key to shared config
js-jankisalvi 20516f1
update cases helper api for serverless
js-jankisalvi 437e01c
[CI] Auto-commit changed files from 'node scripts/precommit_hook.js -…
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
117 changes: 117 additions & 0 deletions
117
x-pack/test_serverless/functional/test_suites/observability/cases/attachment_framework.ts
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,117 @@ | ||
/* | ||
* 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; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { expect } from 'expect'; | ||
import { FtrProviderContext } from '../../../ftr_provider_context'; | ||
|
||
export default ({ getPageObject, getService }: FtrProviderContext) => { | ||
const dashboard = getPageObject('dashboard'); | ||
const lens = getPageObject('lens'); | ||
const svlCommonNavigation = getPageObject('svlCommonNavigation'); | ||
const svlObltNavigation = getService('svlObltNavigation'); | ||
const testSubjects = getService('testSubjects'); | ||
const esArchiver = getService('esArchiver'); | ||
const kibanaServer = getService('kibanaServer'); | ||
const cases = getService('cases'); | ||
const find = getService('find'); | ||
|
||
describe('persistable attachment', () => { | ||
describe('lens visualization', () => { | ||
before(async () => { | ||
await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/logstash_functional'); | ||
await kibanaServer.importExport.load( | ||
'x-pack/test/functional/fixtures/kbn_archiver/lens/lens_basic.json' | ||
); | ||
|
||
await svlObltNavigation.navigateToLandingPage(); | ||
|
||
await svlCommonNavigation.sidenav.clickLink({ deepLinkId: 'dashboards' }); | ||
|
||
await dashboard.clickNewDashboard(); | ||
adcoelho marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
await lens.createAndAddLensFromDashboard({}); | ||
|
||
await dashboard.waitForRenderComplete(); | ||
}); | ||
|
||
after(async () => { | ||
await cases.api.deleteAllCases(); | ||
|
||
await esArchiver.unload('x-pack/test/functional/es_archives/logstash_functional'); | ||
await kibanaServer.importExport.unload( | ||
'x-pack/test/functional/fixtures/kbn_archiver/lens/lens_basic.json' | ||
); | ||
}); | ||
|
||
it('adds lens visualization to a new case', async () => { | ||
const caseTitle = 'case created in observability from my dashboard with lens visualization'; | ||
|
||
await testSubjects.click('embeddablePanelToggleMenuIcon'); | ||
await testSubjects.click('embeddablePanelMore-mainMenu'); | ||
await testSubjects.click('embeddablePanelAction-embeddable_addToNewCase'); | ||
|
||
await testSubjects.existOrFail('create-case-flyout'); | ||
|
||
await testSubjects.setValue('input', caseTitle); | ||
|
||
await testSubjects.setValue('euiMarkdownEditorTextArea', 'test description'); | ||
|
||
// verify that solution picker is not visible | ||
await testSubjects.missingOrFail('caseOwnerSelector'); | ||
|
||
await testSubjects.click('create-case-submit'); | ||
|
||
await cases.common.expectToasterToContain(`${caseTitle} has been updated`); | ||
|
||
await testSubjects.click('toaster-content-case-view-link'); | ||
|
||
if (await testSubjects.exists('appLeaveConfirmModal')) { | ||
js-jankisalvi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
await testSubjects.exists('confirmModalConfirmButton'); | ||
await testSubjects.click('confirmModalConfirmButton'); | ||
} | ||
|
||
const title = await find.byCssSelector('[data-test-subj="editable-title-header-value"]'); | ||
expect(await title.getVisibleText()).toEqual(caseTitle); | ||
|
||
await testSubjects.existOrFail('comment-persistableState-.lens'); | ||
}); | ||
|
||
it('adds lens visualization to an existing case from dashboard', async () => { | ||
const theCaseTitle = 'case already exists in observability!!'; | ||
const theCase = await cases.api.createCase({ | ||
title: theCaseTitle, | ||
description: 'This is a test case to verify existing action scenario!!', | ||
owner: 'observability', | ||
}); | ||
|
||
await svlCommonNavigation.sidenav.clickLink({ deepLinkId: 'dashboards' }); | ||
|
||
await testSubjects.click('embeddablePanelToggleMenuIcon'); | ||
await testSubjects.click('embeddablePanelMore-mainMenu'); | ||
await testSubjects.click('embeddablePanelAction-embeddable_addToExistingCase'); | ||
|
||
// verify that solution filter is not visible | ||
await testSubjects.missingOrFail('solution-filter-popover-button'); | ||
|
||
await testSubjects.click(`cases-table-row-select-${theCase.id}`); | ||
|
||
await cases.common.expectToasterToContain(`${theCaseTitle} has been updated`); | ||
await testSubjects.click('toaster-content-case-view-link'); | ||
|
||
if (await testSubjects.exists('appLeaveConfirmModal')) { | ||
await testSubjects.exists('confirmModalConfirmButton'); | ||
await testSubjects.click('confirmModalConfirmButton'); | ||
} | ||
|
||
const title = await find.byCssSelector('[data-test-subj="editable-title-header-value"]'); | ||
expect(await title.getVisibleText()).toEqual(theCaseTitle); | ||
|
||
await testSubjects.existOrFail('comment-persistableState-.lens'); | ||
}); | ||
}); | ||
}); | ||
}; |
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
51 changes: 51 additions & 0 deletions
51
x-pack/test_serverless/functional/test_suites/search/cases/attachment_framework.ts
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,51 @@ | ||
/* | ||
* 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; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { FtrProviderContext } from '../../../ftr_provider_context'; | ||
|
||
export default ({ getPageObject, getService }: FtrProviderContext) => { | ||
const testSubjects = getService('testSubjects'); | ||
const esArchiver = getService('esArchiver'); | ||
const kibanaServer = getService('kibanaServer'); | ||
const dashboard = getPageObject('dashboard'); | ||
const lens = getPageObject('lens'); | ||
const svlSearchNavigation = getService('svlSearchNavigation'); | ||
const svlCommonNavigation = getPageObject('svlCommonNavigation'); | ||
|
||
describe('persistable attachment', () => { | ||
describe('lens visualization', () => { | ||
before(async () => { | ||
await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/logstash_functional'); | ||
await kibanaServer.importExport.load( | ||
'x-pack/test/functional/fixtures/kbn_archiver/lens/lens_basic.json' | ||
); | ||
|
||
await svlSearchNavigation.navigateToLandingPage(); | ||
|
||
await svlCommonNavigation.sidenav.clickLink({ deepLinkId: 'dashboards' }); | ||
|
||
await dashboard.clickNewDashboard(); | ||
|
||
await lens.createAndAddLensFromDashboard({}); | ||
}); | ||
|
||
after(async () => { | ||
await esArchiver.unload('x-pack/test/functional/es_archives/logstash_functional'); | ||
await kibanaServer.importExport.unload( | ||
'x-pack/test/functional/fixtures/kbn_archiver/lens/lens_basic.json' | ||
); | ||
}); | ||
|
||
it('does not show actions to add lens visualization to case', async () => { | ||
await testSubjects.click('embeddablePanelToggleMenuIcon'); | ||
await testSubjects.click('embeddablePanelMore-mainMenu'); | ||
await testSubjects.missingOrFail('embeddablePanelAction-embeddable_addToNewCase'); | ||
await testSubjects.missingOrFail('embeddablePanelAction-embeddable_addToExistingCase'); | ||
}); | ||
}); | ||
}); | ||
}; |
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.
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.
I think this will slightly change the behavior of the form when going through Analytics in Classic Kibana.
There there is no
owner
and theavailableOwners
can be 1(depending on the role's permissions). This will make it not show the owner picker(your PR) vs showing the owner picker with all options disabled except one(main).It is a specific scenario so maybe it is not a problem.
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.
hmm..The only way to handle this could be to add another config variable which tells weather it is serverless or classic kibana and then put the check accordingly.
However I think it's
okay to not show owner selector picker when only one owner
because we don't show it anyway when it's a security solution dashboard and user has permission for cases in security in classic kibana.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.
Yeah but there we don't show because we are in Security Solution. The owner is defined and it is safe to assume the created case will end up inside Security Solution.
In the scenario I mentioned, we start from
Analytics
. The user has no indication of where the case will end up.(Although he can assume if he only has access to like, Observability 😄 )
I think this is minor though. Maybe double-check with @mdefazio ?
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.
I'm good with hiding this if there is only one solution available. Thanks for double checking on this. @shanisagiv1 Let me know if you're ok with hiding this solution selector (and if you would like some more context to this, happy to zoom 😉 )