-
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
Account Management: Create API keys #82005
Closed
Closed
Changes from 9 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
bbea19f
Account Management: Create API keys
thomheymann fc4dce5
Apply suggestions from code review
thomheymann 19e0380
Added suggestions from code review
thomheymann 1fc64ab
Apply suggestions from code review
thomheymann cbdb663
Merge remote-tracking branch 'origin/security/create-api-key' into se…
thomheymann ad3907e
Updated lock file and create route handler
thomheymann d1906c1
Fixed test failures
thomheymann e5e2d76
Fixed unit test and prettier errors
thomheymann 8a7705e
Merge remote-tracking branch 'origin/master' into security/create-api…
thomheymann 5bb6813
Merge remote-tracking branch 'origin/master' into security/create-api…
thomheymann 325a21c
Added suggestions from code review
thomheymann ef4b6e4
Fixed types in tests
thomheymann 37c5f8c
Merge remote-tracking branch 'origin/master' into security/create-api…
thomheymann 6dd9fa1
Fix test failure
thomheymann 4f50010
Added e2e tests
thomheymann d6d3c0c
Merge remote-tracking branch 'origin/master' into security/create-api…
thomheymann dad4664
Fix linting errors
thomheymann aeb0662
Added link to account management
thomheymann fe64fd9
Fixed translations
thomheymann 9f36566
Merge remote-tracking branch 'origin/master' into security/create-api…
thomheymann eec51bf
Merge remote-tracking branch 'origin/master' into security/create-api…
thomheymann 16848fb
Remove unused eslint disable
thomheymann 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
33 changes: 33 additions & 0 deletions
33
.../plugins/security/public/account_management/account_details_page/account_details_page.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,33 @@ | ||
/* | ||
* 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 React, { FunctionComponent } from 'react'; | ||
import { ChangePassword } from './change_password'; | ||
import { PersonalInfo } from './personal_info'; | ||
import { AuthenticatedUser } from '../../../common/model'; | ||
import { UserAPIClient } from '../../management'; | ||
import { useKibana } from '../../../../../../src/plugins/kibana_react/public'; | ||
import { NotificationsSetup } from '../../../../../../src/core/public'; | ||
|
||
export interface AccountDetailsPageProps { | ||
user: AuthenticatedUser; | ||
notifications: NotificationsSetup; | ||
} | ||
|
||
export const AccountDetailsPage: FunctionComponent<AccountDetailsPageProps> = ({ | ||
user, | ||
notifications, | ||
}) => { | ||
const { services } = useKibana(); | ||
const userAPIClient = new UserAPIClient(services.http!); | ||
|
||
return ( | ||
<> | ||
<PersonalInfo user={user} /> | ||
<ChangePassword user={user} userAPIClient={userAPIClient} notifications={notifications} /> | ||
</> | ||
); | ||
}; |
File renamed without changes.
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
74 changes: 0 additions & 74 deletions
74
x-pack/plugins/security/public/account_management/account_management_app.test.ts
This file was deleted.
Oops, something went wrong.
65 changes: 65 additions & 0 deletions
65
x-pack/plugins/security/public/account_management/account_management_app.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,65 @@ | ||
/* | ||
* 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 ReactDOM from 'react-dom'; | ||
import { act, screen, fireEvent } from '@testing-library/react'; | ||
import { AppMount, AppNavLinkStatus, ScopedHistory } from '../../../../../src/core/public'; | ||
import { coreMock } from '../../../../../src/core/public/mocks'; | ||
import { mockAuthenticatedUser } from '../../common/model/authenticated_user.mock'; | ||
import { securityMock } from '../mocks'; | ||
import { accountManagementApp } from './account_management_app'; | ||
import { createMemoryHistory } from 'history'; | ||
|
||
describe('accountManagementApp', () => { | ||
it('registers application', () => { | ||
const { application, getStartServices } = coreMock.createSetup(); | ||
const { authc } = securityMock.createSetup(); | ||
accountManagementApp.create({ application, getStartServices, authc }); | ||
expect(application.register).toHaveBeenLastCalledWith({ | ||
id: 'security_account', | ||
appRoute: '/security/account', | ||
navLinkStatus: AppNavLinkStatus.hidden, | ||
title: 'Account Management', | ||
mount: expect.any(Function), | ||
}); | ||
}); | ||
|
||
it('renders application and sets breadcrumbs', async () => { | ||
const { application, getStartServices } = coreMock.createSetup(); | ||
const coreStartMock = coreMock.createStart(); | ||
getStartServices.mockResolvedValue([coreStartMock, {}, {}]); | ||
const { authc } = securityMock.createSetup(); | ||
authc.getCurrentUser.mockResolvedValue( | ||
mockAuthenticatedUser({ username: 'some-user', full_name: undefined }) | ||
); | ||
accountManagementApp.create({ application, getStartServices, authc }); | ||
const [[{ mount }]] = application.register.mock.calls; | ||
const element = document.body.appendChild(document.createElement('div')); | ||
|
||
await act(async () => { | ||
await (mount as AppMount)({ | ||
element, | ||
appBasePath: '', | ||
onAppLeave: jest.fn(), | ||
setHeaderActionMenu: jest.fn(), | ||
history: (createMemoryHistory() as unknown) as ScopedHistory, | ||
}); | ||
}); | ||
expect(coreStartMock.chrome.setBreadcrumbs).toHaveBeenLastCalledWith([ | ||
expect.objectContaining({ text: 'Account Management' }), | ||
]); | ||
|
||
fireEvent.click(screen.getByRole('tab', { name: 'API Keys' })); | ||
expect(coreStartMock.chrome.setBreadcrumbs).toHaveBeenLastCalledWith([ | ||
expect.objectContaining({ text: 'Account Management' }), | ||
expect.objectContaining({ text: 'API Keys' }), | ||
]); | ||
|
||
// Need to cleanup manually since `mount` renders the app straight to the DOM | ||
ReactDOM.unmountComponentAtNode(element); | ||
document.body.removeChild(element); | ||
}); | ||
}); |
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.
@streamich any concerns with updating
react-use
from13.27
to15.3
?