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

Disable unmapped fields filter #4929

Merged
merged 11 commits into from
Dec 22, 2022
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@ All notable changes to the Wazuh app project will be documented in this file.
- Fixed pagination to SCA table [#4653](https://github.com/wazuh/wazuh-kibana-app/issues/4653)
- Fixed WAZUH_PROTOCOL param suggestion [#4849](https://github.com/wazuh/wazuh-kibana-app/pull/4849)
- Raspbian OS, Ubuntu, Amazon Linux and Amazon Linux 2 commands in the wizard deploy agent now change when a different architecture is selected [#4876](https://github.com/wazuh/wazuh-kibana-app/pull/4876) [#4880](https://github.com/wazuh/wazuh-kibana-app/pull/4880)
- Disabled unmapped fields filter in Security Events alerts table [#4929](https://github.com/wazuh/wazuh-kibana-app/pull/4929)
- Fixed vulnerabilities default last scan date formatter [#4975](https://github.com/wazuh/wazuh-kibana-app/pull/4975)


## Wazuh v4.3.10 - Kibana 7.10.2, 7.16.x, 7.17.x - Revision 4311

### Fixed
Expand Down
14 changes: 0 additions & 14 deletions public/components/common/modules/discover/discover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -264,20 +264,6 @@ export const Discover = compose(
this.indexPattern = {
...(await this.PluginPlatformServices.indexPatterns.get(AppState.getCurrentPattern())),
};
const fields: IFieldType[] = [];
Object.keys(this.indexPattern.fields).forEach((item) => {
if (isNaN(item)) {
fields.push(this.indexPattern.fields[item]);
} else if (
this.props.includeFilters &&
this.indexPattern.fields[item].name.includes(this.props.includeFilters)
) {
fields.unshift(this.indexPattern.fields[item]);
} else {
fields.push(this.indexPattern.fields[item]);
}
});
this.indexPattern.fields = fields;
}

hideCreateCustomLabel = () => {
Expand Down
15 changes: 9 additions & 6 deletions public/components/common/modules/discover/row-details.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export class RowDetails extends Component {
} else {
return 0;
};
})
})
.reduce((product, [key, value]) => {
let fullPath = addDelimiter(head, key)
return isObject(value) ?
Expand Down Expand Up @@ -175,6 +175,7 @@ export class RowDetails extends Component {
const tmpRows = itemPaths.map((item) => {
const key = isString(field) ? item : fieldsToShow[i] + "." + item; // = agent + . + id = agent.id
const value = isString(field) ? field : this.getChildFromPath(this.props.item[fieldsToShow[i]], item);
const hasFieldMapping = this.props?.indexPattern?.fields?.getByName(key)?.filterable;// if the field is mapped the filter can be added and removed
const filter = {};
filter[key] = value;
const cells: any[] = [];
Expand All @@ -185,8 +186,9 @@ export class RowDetails extends Component {
{(this.state.hover === key &&
<EuiFlexGroup style={{ height: 35 }}>
<EuiFlexItem grow={false} style={{ marginRight: 0, marginTop: 8 }}>
<EuiToolTip position="top" content={`Filter for value`}>
<EuiToolTip position="top" content={hasFieldMapping ? 'Filter for value' : 'Unindexed fields can not be searched'}>
<EuiButtonIcon
disabled={!hasFieldMapping}
onClick={() => this.props.addFilter(filter)}
iconType="magnifyWithPlus"
aria-label="Filter"
Expand All @@ -195,8 +197,9 @@ export class RowDetails extends Component {
</EuiToolTip>
</EuiFlexItem>
<EuiFlexItem grow={false} style={{ marginRight: 0, marginLeft: 0, marginTop: 8 }}>
<EuiToolTip position="top" content={`Filter out value`}>
<EuiToolTip position="top" content={hasFieldMapping ? 'Filter out value' : 'Unindexed fields can not be searched'}>
<EuiButtonIcon
disabled={!hasFieldMapping}
onClick={() => this.props.addFilterOut(filter)}
iconType="magnifyWithMinus"
aria-label="Filter"
Expand Down Expand Up @@ -229,7 +232,7 @@ export class RowDetails extends Component {
cells.push(keyCell);

const formattedValue = Array.isArray(value) ? this.renderArrayValue(value) : value.toString();

// If the field is an array of objects, show the collapse button to show the nested fields
const showCollapseButton = Array.isArray(value) && arrayContainsObjects(value);

Expand Down Expand Up @@ -271,7 +274,7 @@ export class RowDetails extends Component {
}); //map
rows = [...rows, ...tmpRows]
}//if
} //for
} //for


return rows;
Expand Down Expand Up @@ -440,7 +443,7 @@ export class RowDetails extends Component {
</ul>
);
} else {

return value.toString();
}
}
Expand Down
1 change: 1 addition & 0 deletions public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export class WazuhPlugin implements Plugin<WazuhSetup, WazuhStart, WazuhSetupPlu
}

if (!response.isWazuhDisabled) {

core.application.register({
id: `wazuh`,
title: 'Wazuh',
Expand Down