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

Added filters to Vulnerabilities - Inventory flyout details #3744

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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -110,6 +110,7 @@ All notable changes to the Wazuh app project will be documented in this file.
- Fixed missing settings in `Management/Configuration/Global configuration/Global/Main settings` [#3737](https://github.com/wazuh/wazuh-kibana-app/pull/3737)
- Fixed `Maximum call stack size exceeded` error exporting key-value pairs of a CDB List [#3738](https://github.com/wazuh/wazuh-kibana-app/pull/3738)
- Fixed regex lookahead and lookbehind for safari [#3741](https://github.com/wazuh/wazuh-kibana-app/pull/3741)
- Fixed Vulnerabilities Inventory flyout details filters [#3744](https://github.com/wazuh/wazuh-kibana-app/pull/3744)

## Wazuh v4.2.5 - Kibana 7.10.2, 7.11.2, 7.12.1, 7.13.4, 7.14.2 - Revision 4206

Expand Down
1 change: 0 additions & 1 deletion public/components/agents/fim/inventory.tsx
Expand Up @@ -137,7 +137,6 @@ export class Inventory extends Component {
}

onFiltersChange = (filters) => {
// this.setStoreFilters(filters);
this.setState({ filters });
}

Expand Down
32 changes: 20 additions & 12 deletions public/components/agents/vuls/inventory.tsx
Expand Up @@ -27,17 +27,18 @@ import { ICustomBadges } from '../../wz-search-bar/components';
export class Inventory extends Component {
_isMount = false;
state: {
filters: [];
isLoading: Boolean;
customBadges: ICustomBadges[];
};

props: any;

constructor(props) {
super(props);
this.state = {
isLoading: true,
customBadges: []
customBadges: [],
filters: [],
}
}

Expand All @@ -51,20 +52,28 @@ export class Inventory extends Component {
}

async loadAgent() {
if (this._isMount){
this.setState({ isLoading: false });
if (this._isMount) {
this.setState({ isLoading: false });
}
}

onFiltersChange = (filters) => {
this.setState({ filters });
}

renderTable() {
const { filters } = this.state;
return (
<div>
<InventoryTable
{...this.props}/>
<InventoryTable
{...this.props}
filters={filters}
onFiltersChange={this.onFiltersChange}
/>
</div>
)
}

loadingInventory() {
return <EuiPage>
<EuiFlexGroup>
Expand All @@ -84,10 +93,9 @@ export class Inventory extends Component {
const table = this.renderTable();

return <EuiPage>
<EuiPanel>
<EuiSpacer size={(((this.props.agent || {}).os || {}).platform || false) === 'windows' ? 's' : 'm'} />
{table}
</EuiPanel>
</EuiPage>
<EuiPanel>
{table}
</EuiPanel>
</EuiPage>
}
}
8 changes: 4 additions & 4 deletions public/components/agents/vuls/inventory/detail.tsx
Expand Up @@ -93,25 +93,25 @@ export class Details extends Component {
field: 'name',
name: 'Name',
icon: 'dot',
link: false,
link: true,
},
{
field: 'cve',
name: 'CVE',
icon: 'securitySignal',
link: false,
link: true,
},
{
field: 'version',
name: 'Version',
icon: 'package',
link: false,
link: true,
},
{
field: 'architecture',
name: 'Architecture',
icon: 'node',
link: false,
link: true,
},
{
field: 'last_full_scan',
Expand Down
6 changes: 5 additions & 1 deletion public/components/agents/vuls/inventory/table.tsx
Expand Up @@ -92,7 +92,8 @@ export class InventoryTable extends Component {
props!: {
filters: IFilter[];
agent: any;
onTotalItemsChange: Function;
items: [];
onFiltersChange: Function;
};

constructor(props) {
Expand Down Expand Up @@ -216,6 +217,7 @@ export class InventoryTable extends Component {
};

const { error } = this.state;
const { filters, onFiltersChange } = this.props;
const columns = this.columns();
const selectFields =
'select=cve,architecture,version,name,severity,cvss2_score,cvss3_score,detection_time';
Expand All @@ -231,6 +233,8 @@ export class InventoryTable extends Component {
rowProps={getRowProps}
error={error}
downloadCsv={true}
filters={filters}
onFiltersChange={onFiltersChange}
/>
);
}
Expand Down
2 changes: 2 additions & 0 deletions public/components/common/tables/table-wz-api.tsx
Expand Up @@ -31,13 +31,15 @@ export function TableWzAPI({endpoint, ...rest}){
const [totalItems, setTotalItems] = useState(0);
const [filters, setFilters] = useState([]);
const [isLoading, setIsLoading] = useState(false);
const onFiltersChange = filters => typeof rest.onFiltersChange === 'function' ? rest.onFiltersChange(filters) : null;

const onSearch = useCallback(async function(filters, pagination, sorting){
try {
const { pageIndex, pageSize } = pagination;
const { field, direction } = sorting.sort;
setIsLoading(true);
setFilters(filters);
onFiltersChange(filters);
const params = {
...filtersToObject(filters),
offset: pageIndex * pageSize,
Expand Down