-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Moved the DeleteTrustedAppsRequestParams to common folder to be able to use it on the client. * Added trusted app deletion API to the client service layer. * Made default data type for async resource state. * Added guard for stale state. * Added timestamp to the list data to be used to refresh list when it's modified. * Separated out base type for resource state change actions. * Added action for outdating list data. * Moved the refresh condition inside the middleware case function and added timestamping data. * Added state, actions, reducers and middleware for deletion dialog. * Added actions column and deletion action. * Added trusted app deletion dialog. * Changed to not have deletonDialog as optional in store. * Changed the store to contain the full entry in the dialog state and changed the modal message to indicate the trusted app name. * Extracted notifications component and enhanced error display. * Added success message and unified messages a bit. * Complete coverage with tests. * Removed unused variable in translations. * Fixed tests because of outdated snapshots and inproper mocking of htmlIdGenerator. * Fixed code review comments. * Fixed type error.
- Loading branch information
Showing
31 changed files
with
3,848 additions
and
339 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
44 changes: 44 additions & 0 deletions
44
x-pack/plugins/security_solution/public/management/pages/trusted_apps/service/utils.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,44 @@ | ||
/* | ||
* 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 { resolvePathVariables } from './utils'; | ||
|
||
describe('utils', () => { | ||
describe('resolvePathVariables', () => { | ||
it('should resolve defined variables', () => { | ||
expect(resolvePathVariables('/segment1/{var1}/segment2', { var1: 'value1' })).toBe( | ||
'/segment1/value1/segment2' | ||
); | ||
}); | ||
|
||
it('should not resolve undefined variables', () => { | ||
expect(resolvePathVariables('/segment1/{var1}/segment2', {})).toBe( | ||
'/segment1/{var1}/segment2' | ||
); | ||
}); | ||
|
||
it('should ignore unused variables', () => { | ||
expect(resolvePathVariables('/segment1/{var1}/segment2', { var2: 'value2' })).toBe( | ||
'/segment1/{var1}/segment2' | ||
); | ||
}); | ||
|
||
it('should replace multiple variable occurences', () => { | ||
expect(resolvePathVariables('/{var1}/segment1/{var1}', { var1: 'value1' })).toBe( | ||
'/value1/segment1/value1' | ||
); | ||
}); | ||
|
||
it('should replace multiple variables', () => { | ||
const path = resolvePathVariables('/{var1}/segment1/{var2}', { | ||
var1: 'value1', | ||
var2: 'value2', | ||
}); | ||
|
||
expect(path).toBe('/value1/segment1/value2'); | ||
}); | ||
}); | ||
}); |
10 changes: 10 additions & 0 deletions
10
x-pack/plugins/security_solution/public/management/pages/trusted_apps/service/utils.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,10 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
export const resolvePathVariables = (path: string, variables: { [K: string]: string | number }) => | ||
Object.keys(variables).reduce((acc, paramName) => { | ||
return acc.replace(new RegExp(`\{${paramName}\}`, 'g'), String(variables[paramName])); | ||
}, path); |
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
Oops, something went wrong.