forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce Access Agreement UI. (elastic#63563)
Co-authored-by: Ryan Keairns <contactryank@gmail.com>
- Loading branch information
1 parent
4a04adf
commit 36b4864
Showing
43 changed files
with
1,297 additions
and
100 deletions.
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
30 changes: 30 additions & 0 deletions
30
.../public/authentication/access_agreement/__snapshots__/access_agreement_page.test.tsx.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
21 changes: 21 additions & 0 deletions
21
x-pack/plugins/security/public/authentication/access_agreement/_access_agreement_page.scss
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,21 @@ | ||
.secAccessAgreementPage .secAuthenticationStatePage__content { | ||
max-width: 600px; | ||
} | ||
|
||
.secAccessAgreementPage__textWrapper { | ||
overflow-y: hidden; | ||
} | ||
|
||
.secAccessAgreementPage__text { | ||
@include euiYScrollWithShadows; | ||
max-height: 400px; | ||
padding: $euiSize $euiSizeL 0; | ||
} | ||
|
||
.secAccessAgreementPage__footer { | ||
padding: $euiSize $euiSizeL $euiSizeL; | ||
} | ||
|
||
.secAccessAgreementPage__footerInner { | ||
text-align: left; | ||
} |
1 change: 1 addition & 0 deletions
1
x-pack/plugins/security/public/authentication/access_agreement/_index.scss
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 @@ | ||
@import './access_agreement_page'; |
62 changes: 62 additions & 0 deletions
62
x-pack/plugins/security/public/authentication/access_agreement/access_agreement_app.test.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,62 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
jest.mock('./access_agreement_page'); | ||
|
||
import { AppMount, ScopedHistory } from 'src/core/public'; | ||
import { accessAgreementApp } from './access_agreement_app'; | ||
|
||
import { coreMock, scopedHistoryMock } from '../../../../../../src/core/public/mocks'; | ||
|
||
describe('accessAgreementApp', () => { | ||
it('properly registers application', () => { | ||
const coreSetupMock = coreMock.createSetup(); | ||
|
||
accessAgreementApp.create({ | ||
application: coreSetupMock.application, | ||
getStartServices: coreSetupMock.getStartServices, | ||
}); | ||
|
||
expect(coreSetupMock.application.register).toHaveBeenCalledTimes(1); | ||
|
||
const [[appRegistration]] = coreSetupMock.application.register.mock.calls; | ||
expect(appRegistration).toEqual({ | ||
id: 'security_access_agreement', | ||
chromeless: true, | ||
appRoute: '/security/access_agreement', | ||
title: 'Access Agreement', | ||
mount: expect.any(Function), | ||
}); | ||
}); | ||
|
||
it('properly renders application', async () => { | ||
const coreSetupMock = coreMock.createSetup(); | ||
const coreStartMock = coreMock.createStart(); | ||
coreSetupMock.getStartServices.mockResolvedValue([coreStartMock, {}, {}]); | ||
const containerMock = document.createElement('div'); | ||
|
||
accessAgreementApp.create({ | ||
application: coreSetupMock.application, | ||
getStartServices: coreSetupMock.getStartServices, | ||
}); | ||
|
||
const [[{ mount }]] = coreSetupMock.application.register.mock.calls; | ||
await (mount as AppMount)({ | ||
element: containerMock, | ||
appBasePath: '', | ||
onAppLeave: jest.fn(), | ||
history: (scopedHistoryMock.create() as unknown) as ScopedHistory, | ||
}); | ||
|
||
const mockRenderApp = jest.requireMock('./access_agreement_page').renderAccessAgreementPage; | ||
expect(mockRenderApp).toHaveBeenCalledTimes(1); | ||
expect(mockRenderApp).toHaveBeenCalledWith(coreStartMock.i18n, containerMock, { | ||
http: coreStartMock.http, | ||
notifications: coreStartMock.notifications, | ||
fatalErrors: coreStartMock.fatalErrors, | ||
}); | ||
}); | ||
}); |
38 changes: 38 additions & 0 deletions
38
x-pack/plugins/security/public/authentication/access_agreement/access_agreement_app.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,38 @@ | ||
/* | ||
* 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 { i18n } from '@kbn/i18n'; | ||
import { StartServicesAccessor, ApplicationSetup, AppMountParameters } from 'src/core/public'; | ||
|
||
interface CreateDeps { | ||
application: ApplicationSetup; | ||
getStartServices: StartServicesAccessor; | ||
} | ||
|
||
export const accessAgreementApp = Object.freeze({ | ||
id: 'security_access_agreement', | ||
create({ application, getStartServices }: CreateDeps) { | ||
application.register({ | ||
id: this.id, | ||
title: i18n.translate('xpack.security.accessAgreementAppTitle', { | ||
defaultMessage: 'Access Agreement', | ||
}), | ||
chromeless: true, | ||
appRoute: '/security/access_agreement', | ||
async mount({ element }: AppMountParameters) { | ||
const [[coreStart], { renderAccessAgreementPage }] = await Promise.all([ | ||
getStartServices(), | ||
import('./access_agreement_page'), | ||
]); | ||
return renderAccessAgreementPage(coreStart.i18n, element, { | ||
http: coreStart.http, | ||
notifications: coreStart.notifications, | ||
fatalErrors: coreStart.fatalErrors, | ||
}); | ||
}, | ||
}); | ||
}, | ||
}); |
Oops, something went wrong.