-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[ENDPOINT] First version of the trusted apps list. #76304
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
Merged
Merged
Changes from all commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
599a463
First version of the trusted apps list.
efreeti 87766b0
Added proper visualisation of OS and Date Created columns.
efreeti 97a6f41
Small change in naming in middleware.
efreeti 29bedc8
Renamed function to avoid naming confusion.
efreeti 1ce8da6
Migrated to usage of selectors and memo in list component.
efreeti 221ebc2
Added explicit return types.
efreeti 96840cd
Changed to use server schema for service parameter.
efreeti caabfb9
Removed some over generalisation in types.
efreeti 277b511
Renamed types and properties related to trusted apps page state.
efreeti 223e14e
Renamed types and properties related to trusted apps page state.
efreeti 0e6e1af
Renamed the action type to be namespaced to trusted apps.
efreeti d50f8fd
Merged the exports and declarations in reducer and used constants for…
efreeti bed5985
Memoization of pagination data structure.
efreeti 792a1a2
Used a shared constant for REST API path.
efreeti 567e845
Improvements and consistency on pagination across tabs.
efreeti b2e581d
Added a bit more typing and used Partial<>
efreeti f845f25
Made constants readonly and added some useMemo usages.
efreeti 00417a7
Fixed extracting page index from URI.
efreeti 5740a5d
Fixed the case of infinite refreshes when there is loading failure (n…
efreeti 509e868
Resetting state to initial when we navigate away from trusted apps list.
efreeti 102c580
Fixed mapping page index to the table pagination.
efreeti 7072df7
Changed to using AppAction in reducer.
efreeti 7e998f3
Made ServerApiError a default error type for data binding.
efreeti c624cc7
Renamed all types related to data binding to resource state.
efreeti 32453cf
Created index file for state types.
efreeti 01c67c4
Fixed parameter extracting code to meet expectations of endpoints lis…
efreeti 865ff05
Updated snapshot.
efreeti 28c1b5d
Changed middleware to only use selectors.
efreeti 4071f54
Added tests for routing.
efreeti 0f05756
Added documentation to the types in async resource state module.
efreeti ecb90f3
Added tests for async resource state module.
efreeti ec3e21f
Added tests for store selectors.
efreeti 0f07f06
Added tests for reducer.
efreeti 99ea3a7
Moved around imports.
efreeti cf6bd89
Added tests for the middleware.
efreeti fa58f55
Added list component tests.
efreeti 2787e97
Removed a redundant function.
efreeti 45debb2
Commiting snapshots.
efreeti 944751d
Merge branch 'master' of https://github.com/elastic/kibana into btsym…
efreeti 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 hidden or 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 hidden or 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 hidden or 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
111 changes: 111 additions & 0 deletions
111
x-pack/plugins/security_solution/public/management/common/routing.test.ts
This file contains hidden or 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,111 @@ | ||
| /* | ||
| * 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 { extractListPaginationParams, getTrustedAppsListPath } from './routing'; | ||
| import { MANAGEMENT_DEFAULT_PAGE, MANAGEMENT_DEFAULT_PAGE_SIZE } from './constants'; | ||
|
|
||
| describe('routing', () => { | ||
| describe('extractListPaginationParams()', () => { | ||
| it('extracts default page index when not provided', () => { | ||
| expect(extractListPaginationParams({}).page_index).toBe(MANAGEMENT_DEFAULT_PAGE); | ||
| }); | ||
|
|
||
| it('extracts default page index when too small value provided', () => { | ||
| expect(extractListPaginationParams({ page_index: '-1' }).page_index).toBe( | ||
| MANAGEMENT_DEFAULT_PAGE | ||
| ); | ||
| }); | ||
|
|
||
| it('extracts default page index when not a number provided', () => { | ||
| expect(extractListPaginationParams({ page_index: 'a' }).page_index).toBe( | ||
| MANAGEMENT_DEFAULT_PAGE | ||
| ); | ||
| }); | ||
|
|
||
| it('extracts only last page index when multiple values provided', () => { | ||
| expect(extractListPaginationParams({ page_index: ['1', '2'] }).page_index).toBe(2); | ||
| }); | ||
|
|
||
| it('extracts proper page index when single valid value provided', () => { | ||
| expect(extractListPaginationParams({ page_index: '2' }).page_index).toBe(2); | ||
| }); | ||
|
|
||
| it('extracts default page size when not provided', () => { | ||
| expect(extractListPaginationParams({}).page_size).toBe(MANAGEMENT_DEFAULT_PAGE_SIZE); | ||
| }); | ||
|
|
||
| it('extracts default page size when invalid option provided', () => { | ||
| expect(extractListPaginationParams({ page_size: '25' }).page_size).toBe( | ||
| MANAGEMENT_DEFAULT_PAGE_SIZE | ||
| ); | ||
| }); | ||
|
|
||
| it('extracts default page size when not a number provided', () => { | ||
| expect(extractListPaginationParams({ page_size: 'a' }).page_size).toBe( | ||
| MANAGEMENT_DEFAULT_PAGE_SIZE | ||
| ); | ||
| }); | ||
|
|
||
| it('extracts only last page size when multiple values provided', () => { | ||
| expect(extractListPaginationParams({ page_size: ['10', '20'] }).page_size).toBe(20); | ||
| }); | ||
|
|
||
| it('extracts proper page size when single valid value provided', () => { | ||
| expect(extractListPaginationParams({ page_size: '20' }).page_size).toBe(20); | ||
| }); | ||
| }); | ||
|
|
||
| describe('getTrustedAppsListPath()', () => { | ||
| it('builds proper path when no parameters provided', () => { | ||
| expect(getTrustedAppsListPath()).toEqual('/trusted_apps'); | ||
| }); | ||
|
|
||
| it('builds proper path when empty parameters provided', () => { | ||
| expect(getTrustedAppsListPath({})).toEqual('/trusted_apps'); | ||
| }); | ||
|
|
||
| it('builds proper path when no page index provided', () => { | ||
| expect(getTrustedAppsListPath({ page_size: 20 })).toEqual('/trusted_apps?page_size=20'); | ||
| }); | ||
|
|
||
| it('builds proper path when no page size provided', () => { | ||
| expect(getTrustedAppsListPath({ page_index: 2 })).toEqual('/trusted_apps?page_index=2'); | ||
| }); | ||
|
|
||
| it('builds proper path when both page index and size provided', () => { | ||
| expect(getTrustedAppsListPath({ page_index: 2, page_size: 20 })).toEqual( | ||
| '/trusted_apps?page_index=2&page_size=20' | ||
| ); | ||
| }); | ||
|
|
||
| it('builds proper path when page index is equal to default', () => { | ||
| const path = getTrustedAppsListPath({ | ||
| page_index: MANAGEMENT_DEFAULT_PAGE, | ||
| page_size: 20, | ||
| }); | ||
|
|
||
| expect(path).toEqual('/trusted_apps?page_size=20'); | ||
| }); | ||
|
|
||
| it('builds proper path when page size is equal to default', () => { | ||
| const path = getTrustedAppsListPath({ | ||
| page_index: 2, | ||
| page_size: MANAGEMENT_DEFAULT_PAGE_SIZE, | ||
| }); | ||
|
|
||
| expect(path).toEqual('/trusted_apps?page_index=2'); | ||
| }); | ||
|
|
||
| it('builds proper path when both page index and size are equal to default', () => { | ||
| const path = getTrustedAppsListPath({ | ||
| page_index: MANAGEMENT_DEFAULT_PAGE, | ||
| page_size: MANAGEMENT_DEFAULT_PAGE_SIZE, | ||
| }); | ||
|
|
||
| expect(path).toEqual('/trusted_apps'); | ||
| }); | ||
| }); | ||
| }); |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
26 changes: 26 additions & 0 deletions
26
x-pack/plugins/security_solution/public/management/pages/trusted_apps/service/index.ts
This file contains hidden or 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,26 @@ | ||
| /* | ||
| * 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 { HttpStart } from 'kibana/public'; | ||
| import { TRUSTED_APPS_LIST_API } from '../../../../../common/endpoint/constants'; | ||
| import { | ||
| GetTrustedListAppsResponse, | ||
|
Contributor
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. 😳 I'll correct this. Should have been |
||
| GetTrustedAppsListRequest, | ||
| } from '../../../../../common/endpoint/types/trusted_apps'; | ||
|
|
||
| export interface TrustedAppsService { | ||
efreeti marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| getTrustedAppsList(request: GetTrustedAppsListRequest): Promise<GetTrustedListAppsResponse>; | ||
| } | ||
|
|
||
| export class TrustedAppsHttpService implements TrustedAppsService { | ||
| constructor(private http: HttpStart) {} | ||
|
|
||
| async getTrustedAppsList(request: GetTrustedAppsListRequest) { | ||
| return this.http.get<GetTrustedListAppsResponse>(TRUSTED_APPS_LIST_API, { | ||
| query: request, | ||
| }); | ||
| } | ||
| } | ||
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.
Uh oh!
There was an error while loading. Please reload this page.