Skip to content
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

Change new vulnerabilities inventory table #6047

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ export const ModulesDefaults = {
EventsTab,
],
buttons: ['settings'],
availableFor: ['manager', 'agent'],
availableFor: ['manager'],
},
mitre: {
init: 'dashboard',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.discoverNoResults {
display: flex;
align-items: center;
}
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>
);
}
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&rsquo;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&rsquo;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>
);
};
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';
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',
}
]
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);
}
Loading
Loading