-
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.
[Cloud Security Posture][CNVM] UI Fixes/Enhancements (#155473)
### Summary This PR addresses Fixes and Enhancements for Cloud Native Vulnerability Management, such as: - Added Billing usage Callout - Fixed Badges Inconsistency between the Table and the Flyout - Added support for custom placeholder in the Search Bar - Added Filter In/Out option in the Table - Fixed Published Date was always showing today's date - Added filter to the table to filter out inconsistent data - Improved types in the `useLatestVulnerabilities` hook - Cleaned the Fix version column when there were no fixes available - Changed score to always display in decimals for consistency - Reduced vulnerability column default width (still resizable) ### Screenshots Billing usage Callout ![image](https://user-images.githubusercontent.com/19270322/233539949-558763f7-f71d-4bfd-b536-7f9f0eba61d9.png) Filters ![image](https://user-images.githubusercontent.com/19270322/233540869-aacfd6d6-d849-41c5-840e-2b27c8d7fe7f.png) Filter In ![image](https://user-images.githubusercontent.com/19270322/233540893-2a33cc12-7471-49ef-80aa-71981450923d.png) Filter Out ![image](https://user-images.githubusercontent.com/19270322/233541035-eb428676-b2e6-41a4-9728-1ac60ce67924.png) Flyout ![image](https://user-images.githubusercontent.com/19270322/233541145-88f9df1a-1f79-4ed8-aca8-bd9ef1158378.png) Score always in decimals ![image](https://user-images.githubusercontent.com/19270322/233541375-7e06ca18-d129-44f6-bc0f-3c5383393db6.png)
- Loading branch information
Showing
12 changed files
with
291 additions
and
33 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
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
24 changes: 24 additions & 0 deletions
24
x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/translations.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,24 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { i18n } from '@kbn/i18n'; | ||
|
||
export const FILTER_IN = i18n.translate('xpack.csp.vulnerabilities.table.filterIn', { | ||
defaultMessage: 'Filter in', | ||
}); | ||
export const FILTER_OUT = i18n.translate('xpack.csp.vulnerabilities.table.filterOut', { | ||
defaultMessage: 'Filter out', | ||
}); | ||
export const SEARCH_BAR_PLACEHOLDER = i18n.translate( | ||
'xpack.csp.vulnerabilities.searchBar.placeholder', | ||
{ | ||
defaultMessage: 'Search vulnerabilities (eg. vulnerability.severity : "CRITICAL" )', | ||
} | ||
); | ||
export const VULNERABILITIES = i18n.translate('xpack.csp.vulnerabilities', { | ||
defaultMessage: 'Vulnerabilities', | ||
}); |
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
65 changes: 65 additions & 0 deletions
65
x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/utils/get_filters.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,65 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { | ||
type Filter, | ||
buildFilter, | ||
FILTERS, | ||
FilterStateStore, | ||
compareFilters, | ||
FilterCompareOptions, | ||
} from '@kbn/es-query'; | ||
import type { Serializable } from '@kbn/utility-types'; | ||
import type { FindingsBaseProps } from '../../../common/types'; | ||
|
||
const compareOptions: FilterCompareOptions = { | ||
negate: false, | ||
}; | ||
|
||
/** | ||
* adds a new filter to a new filters array | ||
* removes existing filter if negated filter is added | ||
* | ||
* @returns {Filter[]} a new array of filters to be added back to filterManager | ||
*/ | ||
export const getFilters = ({ | ||
filters: existingFilters, | ||
dataView, | ||
field, | ||
value, | ||
negate, | ||
}: { | ||
filters: Filter[]; | ||
dataView: FindingsBaseProps['dataView']; | ||
field: string; | ||
value: Serializable; | ||
negate: boolean; | ||
}): Filter[] => { | ||
const dataViewField = dataView.fields.find((f) => f.spec.name === field); | ||
if (!dataViewField) return existingFilters; | ||
|
||
const phraseFilter = buildFilter( | ||
dataView, | ||
dataViewField, | ||
FILTERS.PHRASE, | ||
negate, | ||
false, | ||
value, | ||
null, | ||
FilterStateStore.APP_STATE | ||
); | ||
|
||
const nextFilters = [ | ||
...existingFilters.filter( | ||
// Exclude existing filters that match the newly added 'phraseFilter' | ||
(filter) => !compareFilters(filter, phraseFilter, compareOptions) | ||
), | ||
phraseFilter, | ||
]; | ||
|
||
return nextFilters; | ||
}; |
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.