-
Notifications
You must be signed in to change notification settings - Fork 186
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change new vulnerabilities inventory table (#6047)
* Add data grid hook * Add doc viewer component and hook * Add ui utils components * Add new vuls inventory component * Add vuls inventory in module rendering * Add full height container * Add inventory table columns * Remove columns fields filter by keyword type
- Loading branch information
Showing
11 changed files
with
751 additions
and
4 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
4 changes: 4 additions & 0 deletions
4
...ns/main/public/components/overview/vulnerabilities/common/components/loading_spinner.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,4 @@ | ||
.discoverNoResults { | ||
display: flex; | ||
align-items: center; | ||
} |
21 changes: 21 additions & 0 deletions
21
...ins/main/public/components/overview/vulnerabilities/common/components/loading_spinner.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,21 @@ | ||
import './loading_spinner.scss'; | ||
import React from 'react'; | ||
import { EuiTitle, EuiPanel, EuiEmptyPrompt, EuiLoadingSpinner } from '@elastic/eui'; | ||
import { FormattedMessage } from '@osd/i18n/react'; | ||
|
||
export function LoadingSpinner() { | ||
return ( | ||
<EuiPanel hasBorder={false} hasShadow={false} color="transparent" className="discoverNoResults"> | ||
<EuiEmptyPrompt | ||
icon={<EuiLoadingSpinner data-test-subj="loadingSpinner" size="xl" />} | ||
title={ | ||
<EuiTitle size="s" data-test-subj="loadingSpinnerText"> | ||
<h2> | ||
<FormattedMessage id="discover.searchingTitle" defaultMessage="Searching" /> | ||
</h2> | ||
</EuiTitle> | ||
} | ||
/> | ||
</EuiPanel> | ||
); | ||
} |
198 changes: 198 additions & 0 deletions
198
plugins/main/public/components/overview/vulnerabilities/common/components/no_results.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,198 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
* | ||
* Any modifications Copyright OpenSearch Contributors. See | ||
* GitHub history for details. | ||
*/ | ||
|
||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import React, { Fragment } from 'react'; | ||
import { FormattedMessage, I18nProvider } from '@osd/i18n/react'; | ||
|
||
import { | ||
EuiCallOut, | ||
EuiCode, | ||
EuiDescriptionList, | ||
EuiLink, | ||
EuiPanel, | ||
EuiSpacer, | ||
EuiText, | ||
} from '@elastic/eui'; | ||
|
||
interface Props { | ||
timeFieldName?: string; | ||
queryLanguage?: string; | ||
} | ||
|
||
export const DiscoverNoResults = ({ timeFieldName, queryLanguage }: Props) => { | ||
let timeFieldMessage; | ||
|
||
if (timeFieldName) { | ||
timeFieldMessage = ( | ||
<Fragment> | ||
<EuiSpacer size="xl" /> | ||
|
||
<EuiText> | ||
<h2 data-test-subj="discoverNoResultsTimefilter"> | ||
<FormattedMessage | ||
id="discover.noResults.expandYourTimeRangeTitle" | ||
defaultMessage="Expand your time range" | ||
/> | ||
</h2> | ||
|
||
<p> | ||
<FormattedMessage | ||
id="discover.noResults.queryMayNotMatchTitle" | ||
defaultMessage="One or more of the indices you’re looking at contains a date field. Your query may | ||
not match anything in the current time range, or there may not be any data at all in | ||
the currently selected time range. You can try changing the time range to one which contains data." | ||
/> | ||
</p> | ||
</EuiText> | ||
</Fragment> | ||
); | ||
} | ||
|
||
let luceneQueryMessage; | ||
|
||
if (queryLanguage === 'lucene') { | ||
const searchExamples = [ | ||
{ | ||
description: <EuiCode>200</EuiCode>, | ||
title: ( | ||
<EuiText> | ||
<strong> | ||
<FormattedMessage | ||
id="discover.noResults.searchExamples.anyField200StatusCodeExampleTitle" | ||
defaultMessage="Find requests that contain the number 200, in any field" | ||
/> | ||
</strong> | ||
</EuiText> | ||
), | ||
}, | ||
{ | ||
description: <EuiCode>status:200</EuiCode>, | ||
title: ( | ||
<EuiText> | ||
<strong> | ||
<FormattedMessage | ||
id="discover.noResults.searchExamples.statusField200StatusCodeExampleTitle" | ||
defaultMessage="Find 200 in the status field" | ||
/> | ||
</strong> | ||
</EuiText> | ||
), | ||
}, | ||
{ | ||
description: <EuiCode>status:[400 TO 499]</EuiCode>, | ||
title: ( | ||
<EuiText> | ||
<strong> | ||
<FormattedMessage | ||
id="discover.noResults.searchExamples.400to499StatusCodeExampleTitle" | ||
defaultMessage="Find all status codes between 400-499" | ||
/> | ||
</strong> | ||
</EuiText> | ||
), | ||
}, | ||
{ | ||
description: <EuiCode>status:[400 TO 499] AND extension:PHP</EuiCode>, | ||
title: ( | ||
<EuiText> | ||
<strong> | ||
<FormattedMessage | ||
id="discover.noResults.searchExamples.400to499StatusCodeWithPhpExtensionExampleTitle" | ||
defaultMessage="Find status codes 400-499 with the extension php" | ||
/> | ||
</strong> | ||
</EuiText> | ||
), | ||
}, | ||
{ | ||
description: <EuiCode>status:[400 TO 499] AND (extension:php OR extension:html)</EuiCode>, | ||
title: ( | ||
<EuiText> | ||
<strong> | ||
<FormattedMessage | ||
id="discover.noResults.searchExamples.400to499StatusCodeWithPhpOrHtmlExtensionExampleTitle" | ||
defaultMessage="Find status codes 400-499 with the extension php or html" | ||
/> | ||
</strong> | ||
</EuiText> | ||
), | ||
}, | ||
]; | ||
|
||
luceneQueryMessage = ( | ||
<Fragment> | ||
<EuiSpacer size="xl" /> | ||
|
||
<EuiText> | ||
<h3> | ||
<FormattedMessage | ||
id="discover.noResults.searchExamples.refineYourQueryTitle" | ||
defaultMessage="Refine your query" | ||
/> | ||
</h3> | ||
|
||
<p> | ||
<FormattedMessage | ||
id="discover.noResults.searchExamples.howTosearchForWebServerLogsDescription" | ||
defaultMessage="The search bar at the top uses OpenSearch’s support for Lucene {queryStringSyntaxLink}. | ||
Here are some examples of how you can search for web server logs that have been parsed into a few fields." | ||
/> | ||
</p> | ||
</EuiText> | ||
|
||
<EuiSpacer size="m" /> | ||
|
||
<EuiDescriptionList type="column" listItems={searchExamples} /> | ||
|
||
<EuiSpacer size="xl" /> | ||
</Fragment> | ||
); | ||
} | ||
|
||
return ( | ||
<I18nProvider> | ||
<EuiPanel hasBorder={false} hasShadow={false} color="transparent"> | ||
<EuiCallOut | ||
title={ | ||
<FormattedMessage | ||
id="discover.noResults.searchExamples.noResultsMatchSearchCriteriaTitle" | ||
defaultMessage="No results match your search criteria" | ||
/> | ||
} | ||
color="warning" | ||
iconType="help" | ||
data-test-subj="discoverNoResults" | ||
/> | ||
{timeFieldMessage} | ||
{luceneQueryMessage} | ||
</EuiPanel> | ||
</I18nProvider> | ||
); | ||
}; |
2 changes: 1 addition & 1 deletion
2
plugins/main/public/components/overview/vulnerabilities/common/constants.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 |
---|---|---|
@@ -1 +1 @@ | ||
export const VULNERABILITIES_INDEX_PATTERN_ID = 'wazuh-inventory-cve' | ||
export const VULNERABILITIES_INDEX_PATTERN_ID = 'wazuh-states-vulnerabilities'; |
40 changes: 40 additions & 0 deletions
40
plugins/main/public/components/overview/vulnerabilities/dashboards/inventory/config/index.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,40 @@ | ||
import { EuiDataGridColumn } from "@elastic/eui"; | ||
|
||
export const inventoryTableDefaultColumns: EuiDataGridColumn[] = [ | ||
{ | ||
id: '@timestamp', | ||
displayAsText: 'Timestamp', | ||
}, | ||
{ | ||
id: 'package.name', | ||
displayAsText: 'Name', | ||
}, | ||
{ | ||
id: 'package.version', | ||
displayAsText: 'Version', | ||
}, | ||
{ | ||
id: 'package.architecture', | ||
displayAsText: 'Architecture', | ||
}, | ||
{ | ||
id: 'vulnerability.severity', | ||
displayAsText: 'Severity', | ||
}, | ||
{ | ||
id: 'vulnerability.id', | ||
displayAsText: 'Id', | ||
}, | ||
{ | ||
id: 'vulnerability.score.version', | ||
displayAsText: 'Score version', | ||
}, | ||
{ | ||
id: 'vulnerability.score.base', | ||
displayAsText: 'Score', | ||
}, | ||
{ | ||
id: 'event.created', | ||
displayAsText: 'Detected time', | ||
} | ||
] |
8 changes: 8 additions & 0 deletions
8
plugins/main/public/components/overview/vulnerabilities/dashboards/inventory/inventory.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,8 @@ | ||
.vulsInventoryContainer { | ||
height: calc(100vh - 104px); | ||
} | ||
|
||
|
||
.headerIsExpanded .vulsInventoryContainer { | ||
height: calc(100vh - 153px); | ||
} |
Oops, something went wrong.