-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
[Endpoint] Register endpoint app #53527
Merged
Merged
Changes from 12 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
7f58de3
register app, create functional test
kevinlog e1a7bf0
formatting
kevinlog 62b6c56
update tests
kevinlog e7aed9e
adjust test data for endpoint
kevinlog bdbe686
add endpoint tests for testing spaces, app enabled, disabled, etc
kevinlog d0c45e8
linting
kevinlog 6914221
add read privileges to endpoint
kevinlog 476401d
Merge branch 'master' into register-endpoint-app
elasticmachine 8b5f89f
rename variable since its used now
kevinlog 15d4a12
Merge branch 'register-endpoint-app' of github.com:kevinlog/kibana in…
kevinlog 1c9e1ad
remove deprecated context
kevinlog d95a1ea
remove unused variable
kevinlog 26021d8
fix type check
kevinlog e1112f3
correct test suite message
kevinlog 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
31 changes: 31 additions & 0 deletions
31
x-pack/plugins/endpoint/public/applications/endpoint/index.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,31 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import * as React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import { CoreStart, AppMountParameters } from 'kibana/public'; | ||
import { I18nProvider, FormattedMessage } from '@kbn/i18n/react'; | ||
|
||
/** | ||
* This module will be loaded asynchronously to reduce the bundle size of your plugin's main bundle. | ||
*/ | ||
export function renderApp(coreStart: CoreStart, { element }: AppMountParameters) { | ||
coreStart.http.get('/api/endpoint/hello-world'); | ||
|
||
ReactDOM.render(<AppRoot />, element); | ||
|
||
return () => { | ||
ReactDOM.unmountComponentAtNode(element); | ||
}; | ||
} | ||
|
||
const AppRoot = React.memo(() => ( | ||
<I18nProvider> | ||
<h1 data-test-subj="welcomeTitle"> | ||
<FormattedMessage id="xpack.endpoint.welcomeTitle" defaultMessage="Hello World" /> | ||
</h1> | ||
</I18nProvider> | ||
)); |
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
71 changes: 71 additions & 0 deletions
71
x-pack/test/functional/apps/endpoint/feature_controls/endpoint_spaces.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,71 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
import expect from '@kbn/expect'; | ||
import { FtrProviderContext } from '../../../ftr_provider_context'; | ||
|
||
export default function({ getPageObjects, getService }: FtrProviderContext) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for this test suite! 🥇 |
||
const pageObjects = getPageObjects(['common']); | ||
const spacesService = getService('spaces'); | ||
const testSubjects = getService('testSubjects'); | ||
const appsMenu = getService('appsMenu'); | ||
|
||
describe('spaces', () => { | ||
describe('space with no features disabled', () => { | ||
before(async () => { | ||
await spacesService.create({ | ||
id: 'custom_space', | ||
name: 'custom_space', | ||
disabledFeatures: [], | ||
}); | ||
}); | ||
|
||
after(async () => { | ||
await spacesService.delete('custom_space'); | ||
}); | ||
|
||
it('shows endpoint navlink', async () => { | ||
await pageObjects.common.navigateToApp('home', { | ||
basePath: '/s/custom_space', | ||
}); | ||
const navLinks = (await appsMenu.readLinks()).map( | ||
(link: Record<string, string>) => link.text | ||
); | ||
expect(navLinks).to.contain('EEndpoint'); | ||
}); | ||
|
||
it(`endpoint app shows 'Hello World'`, async () => { | ||
await pageObjects.common.navigateToApp('endpoint', { | ||
basePath: '/s/custom_space', | ||
}); | ||
await testSubjects.existOrFail('welcomeTitle'); | ||
}); | ||
}); | ||
|
||
describe('space with endpoint disabled', () => { | ||
before(async () => { | ||
await spacesService.create({ | ||
id: 'custom_space', | ||
name: 'custom_space', | ||
disabledFeatures: ['endpoint'], | ||
}); | ||
}); | ||
|
||
after(async () => { | ||
await spacesService.delete('custom_space'); | ||
}); | ||
|
||
it(`doesn't show dashboard navlink`, async () => { | ||
kevinlog marked this conversation as resolved.
Show resolved
Hide resolved
|
||
await pageObjects.common.navigateToApp('home', { | ||
basePath: '/s/custom_space', | ||
}); | ||
const navLinks = (await appsMenu.readLinks()).map( | ||
(link: Record<string, string>) => link.text | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
); | ||
expect(navLinks).not.to.contain('EEndpoint'); | ||
}); | ||
}); | ||
}); | ||
} |
13 changes: 13 additions & 0 deletions
13
x-pack/test/functional/apps/endpoint/feature_controls/index.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,13 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
import { FtrProviderContext } from '../../../ftr_provider_context'; | ||
|
||
export default function({ loadTestFile }: FtrProviderContext) { | ||
describe('feature controls', function() { | ||
this.tags('skipFirefox'); | ||
loadTestFile(require.resolve('./endpoint_spaces')); | ||
}); | ||
} |
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,14 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
import { FtrProviderContext } from '../../ftr_provider_context'; | ||
|
||
export default function({ loadTestFile }: FtrProviderContext) { | ||
describe('endpoint', function() { | ||
this.tags('ciGroup7'); | ||
|
||
loadTestFile(require.resolve('./feature_controls')); | ||
}); | ||
} |
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.
hint I see there's a
ui
capability here that indicates you may be saving something in the future. When that happens, be sure to update the saved object privileges here with the specific types you need to read and write. We're more than happy to help with this!