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

Replace search bar on Management > Groups #5445

Merged
merged 116 commits into from
Aug 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
116 commits
Select commit Hold shift + click to select a range
e9f5923
feat: add a search bar component
Desvelao Feb 16, 2023
eff5d2b
feat(search-bar): change the AQL implemenation to use the regular exp…
Desvelao Mar 1, 2023
0923569
fix(search-bar): fixes a problem hidding the suggestion popover when …
Desvelao Mar 2, 2023
83c05cf
feat(search-bar): add the ability to update the input of example
Desvelao Mar 3, 2023
0b0b451
feat(search-bar): add initial suggestions to AQL
Desvelao Mar 6, 2023
ab8a555
feat(search-bar): add target and rel attributes to the documentation
Desvelao Mar 7, 2023
8d9f746
feat(search-bar): enhancements in AQL and search bar documentation
Desvelao Mar 7, 2023
9c01c8e
feat(search-bar): Add HAQL
Desvelao Mar 7, 2023
b6f0d6d
feat(search-bar): add test to HAQL and AQL query languages
Desvelao Mar 14, 2023
22676d4
feat(search-bar): Rename HAQL query language to WQL
Desvelao Mar 15, 2023
459a932
feat(search-bar): Add more use cases to the tests of WQL query language
Desvelao Mar 15, 2023
315932a
feat(search-bar): enhance the documenation of query languages
Desvelao Mar 15, 2023
4303a1a
feat(search-bar): Add a popover title to replicate similar UI to the …
Desvelao Mar 15, 2023
5e1485c
feat(search-bar): wrap the user input with group operators when there…
Desvelao Mar 15, 2023
9983153
feat(search-bar): add implicit query mode to WQL
Desvelao Mar 16, 2023
1eaf944
feat(search-bar): set the width of the syntax options popover
Desvelao Mar 23, 2023
d9abea0
feat(search-bar): unify suggestion descriptions in WQL
Desvelao Mar 23, 2023
c221f97
feat(search-bar): add enhancements to WQL
Desvelao Apr 10, 2023
8123d6e
Merge branch '4.5' of https://github.com/wazuh/wazuh-kibana-app into …
Desvelao Apr 10, 2023
cdbbb6d
feat(search-bar): rename previousField and previousOperatorCompare in…
Desvelao Apr 10, 2023
c300fa3
fix(tests): update snapshot
Desvelao Apr 11, 2023
ef85c54
fix(search-bar): fix documentation link for WQL
Desvelao Apr 11, 2023
17053c0
fix(search-bar): remove example usage of SearchBar component in Agents
Desvelao Apr 11, 2023
cfbf19b
fix(search-bar): fix an error using the value suggestions in WQL
Desvelao Apr 12, 2023
b4359ce
Merge branch '4.5' into feat/4312-poc-search-bar-component-multiple-q…
Desvelao Apr 20, 2023
8438cd8
Merge branch '4.5' into feat/4312-poc-search-bar-component-multiple-q…
Desvelao Apr 20, 2023
57d11d6
feat(search-bar): add search function suggestion when the input is empty
Desvelao Apr 25, 2023
ce4bc92
fix(search-bar): ensure the query language output changed to trigger …
Desvelao Apr 25, 2023
b547d98
feat(search-bar): allow the API query output can be redone when the s…
Desvelao Apr 27, 2023
a3c3681
feat(search-bar): enhance the validation of value token in WQL
Desvelao Apr 27, 2023
1b390be
feat(search-bar): enhance search bar and WQL
Desvelao May 12, 2023
1e42463
feat(search-bar): replace search bar in TableWzAPI
Desvelao May 15, 2023
78b23e7
feat(vulnerabilities): change filter by severity tooltip
Desvelao May 15, 2023
2b7ddb9
fix(test): update test and snapthost
Desvelao May 15, 2023
8f4b083
feat(search-bar): replace search bar and table component on Managemen…
Desvelao May 15, 2023
b5b0c05
fix(test): update snapshot
Desvelao May 15, 2023
0c8e9a8
Merge branch 'feat/4312-search-bar-replace-tablewzapi' of https://git…
Desvelao May 15, 2023
47255d6
feat(table-wz-api): add field selection to the TableWzAPI component
Desvelao May 17, 2023
06893ad
feat(search-bar): enhace search bar and WQL
Desvelao May 17, 2023
4f163dc
Merge branch 'feat/4312-poc-search-bar-component-multiple-query-langu…
Desvelao May 17, 2023
3d7e0d1
feat(table-wz-api): Adapt TableWzAPI usage to the recent changes when
Desvelao May 17, 2023
7a7cb43
fix(test): fixed test and update snapshot
Desvelao May 17, 2023
1a198e8
fix(table-wz-api): minor fixes on TableWzAPI usage
Desvelao May 17, 2023
1a67951
fix: fixed prop type
Desvelao May 17, 2023
31b2d21
Merge branch 'feat/4312-search-bar-replace-tablewzapi' of https://git…
Desvelao May 17, 2023
feae66c
fix: adapt search bar parameters on Management/Groups tables
Desvelao May 18, 2023
6257a7f
fix: fix search term field on TableWzAPI for composed column
Desvelao May 18, 2023
f64749c
fix(table-wz-api): enhance TableWithSearchBar types and fix error HTM…
Desvelao May 19, 2023
d774a48
fix: enhance search bar and WQL types
Desvelao May 19, 2023
b18c570
Merge branch 'feat/4312-poc-search-bar-component-multiple-query-langu…
Desvelao May 19, 2023
76b4bf2
Merge branch 'feat/4312-search-bar-replace-tablewzapi' of https://git…
Desvelao May 19, 2023
4a7e282
Merge branch '4.5' of https://github.com/wazuh/wazuh-kibana-app into …
Desvelao May 22, 2023
0c854b4
Merge branch 'feat/4312-poc-search-bar-component-multiple-query-langu…
Desvelao May 22, 2023
a0cad35
Merge branch 'feat/4312-search-bar-replace-tablewzapi' of https://git…
Desvelao May 22, 2023
144f9a6
Merge branch '4.6.0' of https://github.com/wazuh/wazuh-kibana-app int…
Desvelao Jun 26, 2023
c800050
Merge branch 'feat/4312-poc-search-bar-component-multiple-query-langu…
Desvelao Jun 26, 2023
ae5bade
Merge branch '4.6.0' of https://github.com/wazuh/wazuh-kibana-app int…
Desvelao Jun 26, 2023
7786590
Merge branch 'feat/4312-poc-search-bar-component-multiple-query-langu…
Desvelao Jun 26, 2023
2503edd
Merge branch '4.6.0' of https://github.com/wazuh/wazuh-kibana-app int…
Desvelao Jul 25, 2023
c385b73
Merge branch '4.6.0' of https://github.com/wazuh/wazuh-kibana-app int…
Desvelao Jul 25, 2023
b31e5f5
fix: test snapshot
Desvelao Jul 25, 2023
0cf2d18
fix: remove duplicated search bar
Desvelao Jul 25, 2023
1a870bf
Merge branch '4.6.0' of https://github.com/wazuh/wazuh-kibana-app int…
Desvelao Jul 25, 2023
9059c5a
move: move search bar
Desvelao Jul 25, 2023
4c6c38d
feat: add the distinct values for the search bar suggestions in some
Desvelao Jul 31, 2023
0cfe1d5
fix: remove exact validation for the token value due to performance p…
Desvelao Aug 1, 2023
13d2be4
Merge branch 'feat/4312-poc-search-bar-component-multiple-query-langu…
Desvelao Aug 1, 2023
3502d0b
fix: fix token value validation
Desvelao Aug 1, 2023
76a4feb
Merge branch 'feat/4312-poc-search-bar-component-multiple-query-langu…
Desvelao Aug 1, 2023
9cd70af
Merge branch 'feat/4312-search-bar-replace-tablewzapi' of https://git…
Desvelao Aug 1, 2023
d87abf4
fix: add suggestions for the search bar related to Management > Group…
Desvelao Aug 2, 2023
0696698
fix: fix Management > Rules search bar filters
Desvelao Aug 2, 2023
e1efeab
Merge branch 'feat/4312-search-bar-replace-tablewzapi' of https://git…
Desvelao Aug 2, 2023
bc26f9a
fix: update the link to the documentation of WQL
Desvelao Aug 2, 2023
cd89aa5
fix(search-bar): use value of value token as the value used to get th…
Desvelao Aug 2, 2023
64a057b
Merge branch 'feat/4312-poc-search-bar-component-multiple-query-langu…
Desvelao Aug 2, 2023
a06df12
Merge branch 'feat/4312-poc-search-bar-component-multiple-query-langu…
Desvelao Aug 2, 2023
d961094
fix(search-bar): fix a problem extracting value for value tokens wrap…
Desvelao Aug 3, 2023
6e24bc3
Merge branch 'feat/4312-poc-search-bar-component-multiple-query-langu…
Desvelao Aug 3, 2023
b388a2e
Merge branch 'feat/4312-poc-search-bar-component-multiple-query-langu…
Desvelao Aug 3, 2023
3831bee
fix(search-bar): update test snapshot
Desvelao Aug 3, 2023
ed9ca08
Merge branch 'feat/4312-search-bar-replace-tablewzapi' of https://git…
Desvelao Aug 3, 2023
449eeee
fix(table-wz-api): avoid the double toast message when there is an er…
Desvelao Aug 4, 2023
579d30f
fix(search-bar): add validation for value token in WQL
Desvelao Aug 4, 2023
2df66f6
Merge branch 'feat/4312-poc-search-bar-component-multiple-query-langu…
Desvelao Aug 4, 2023
c9bbc1b
Merge branch 'feat/4312-search-bar-replace-tablewzapi' of https://git…
Desvelao Aug 4, 2023
f8b0044
fix(search-bar): value token in message related to this is invalid
Desvelao Aug 7, 2023
8660ddd
Merge branch 'feat/4312-poc-search-bar-component-multiple-query-langu…
Desvelao Aug 7, 2023
40d1e75
Merge branch 'feat/4312-poc-search-bar-component-multiple-query-langu…
Desvelao Aug 7, 2023
885ad45
fix(search-bar): fix error related to details.program_name suggestion…
Desvelao Aug 8, 2023
eee2bb6
feat(search-bar): add constant to define the count of distinct values…
Desvelao Aug 8, 2023
0e12864
Merge branch 'feat/4312-search-bar-replace-tablewzapi' of https://git…
Desvelao Aug 8, 2023
94f3edb
feat(search-bar): use constant to define the count of distinct values…
Desvelao Aug 8, 2023
dc9e55b
fix(search-bar): fix value suggestions in the Decoders section
Desvelao Aug 8, 2023
0b451ed
fix: add comment to constant
Desvelao Aug 8, 2023
736d958
workaround(search-bar): add a filter to the value suggestions in WQL
Desvelao Aug 8, 2023
b1fb357
Merge branch 'feat/4312-search-bar-replace-tablewzapi' of https://git…
Desvelao Aug 8, 2023
2f241b3
Merge branch '4.6.0' of https://github.com/wazuh/wazuh-kibana-app int…
Desvelao Aug 9, 2023
3e1b919
changelog: add entry
Desvelao Aug 9, 2023
d15889a
changelog: add entry
Desvelao Aug 9, 2023
2a2a494
Merge branch '4.6.0' of https://github.com/wazuh/wazuh-kibana-app int…
Desvelao Aug 9, 2023
c0e2d94
Merge branch 'feat/4312-search-bar-replace-tablewzapi' of https://git…
Desvelao Aug 9, 2023
bb9bfcd
changelog: add entry
Desvelao Aug 9, 2023
9e121ad
fix(wql): add whitespace before closing grouping operator ) when usin…
Desvelao Aug 9, 2023
8ed6ae4
feat(search-bar): add a debounce time to update the search bar state
Desvelao Aug 10, 2023
a2abff5
fix(search-bar): fix prop type error related to EuiSuggestItem
Desvelao Aug 9, 2023
891f86c
Merge branch 'feat/4312-search-bar-replace-tablewzapi' of https://git…
Desvelao Aug 10, 2023
99aa426
fix(search-bar-wql): problem related to execute the search before the…
Desvelao Aug 10, 2023
22f7124
Merge branch 'feat/4312-search-bar-replace-tablewzapi' of https://git…
Desvelao Aug 10, 2023
4ff2653
fix(search-bar-wql): remove unnued parameter in function
Desvelao Aug 10, 2023
673552e
Merge branch 'feat/4312-search-bar-replace-tablewzapi' of https://git…
Desvelao Aug 10, 2023
a320b78
fix(search-bar): fix tests
Desvelao Aug 10, 2023
df8a8d3
fix(search-bar): suggestions in Modules > Vulenerabilities > Inventory
Desvelao Aug 10, 2023
12b4378
Merge branch 'feat/4312-search-bar-replace-tablewzapi' of https://git…
Desvelao Aug 10, 2023
acf37cf
fix(serach-bar): search term that doesn't define the value for os.name
Desvelao Aug 10, 2023
945578f
Merge branch '4.6.0' of https://github.com/wazuh/wazuh-kibana-app int…
Desvelao Aug 11, 2023
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
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ All notable changes to the Wazuh app project will be documented in this file.
- Changed the query to search for an agent in `management/configuration`. [#5485](https://github.com/wazuh/wazuh-kibana-app/pull/5485)
- Changed the search bar in management/log to the one used in the rest of the app. [#5476](https://github.com/wazuh/wazuh-kibana-app/pull/5476)
- Changed the design of the wizard to add agents. [#5457](https://github.com/wazuh/wazuh-kibana-app/pull/5457)
- Changed the search bar in Management (Rules, Decoders, CDB List) and Modules (Vulnerabilities > Inventory, Security Configuration Assessment > Inventory > {Policy ID} > Checks, MITRE ATT&CK > Intelligence > {Resource}, Integrity monitoring > Inventory > Files, Integrity monitoring > Inventory > Registry), Agent Inventory data [#5363](https://github.com/wazuh/wazuh-kibana-app/pull/5363) [#5442](https://github.com/wazuh/wazuh-kibana-app/pull/5442) [#5443](https://github.com/wazuh/wazuh-kibana-app/pull/5443) [#5444](https://github.com/wazuh/wazuh-kibana-app/pull/5444)
- Changed the search bar in Management (Rules, Decoders, CDB List, Groups) and Modules (Vulnerabilities > Inventory, Security Configuration Assessment > Inventory > {Policy ID} > Checks, MITRE ATT&CK > Intelligence > {Resource}, Integrity monitoring > Inventory > Files, Integrity monitoring > Inventory > Registry), Agent Inventory data [#5363](https://github.com/wazuh/wazuh-kibana-app/pull/5363) [#5442](https://github.com/wazuh/wazuh-kibana-app/pull/5442) [#5443](https://github.com/wazuh/wazuh-kibana-app/pull/5443) [#5444](https://github.com/wazuh/wazuh-kibana-app/pull/5444) [#5445](https://github.com/wazuh/wazuh-kibana-app/pull/5445)

### Fixed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,12 @@ import { EuiFlexItem, EuiButtonEmpty } from '@elastic/eui';
import { connect } from 'react-redux';

import {
updateLoadingStatus,
updateIsProcessing,
updateShowAddAgents,
updateReload,
} from '../../../../../redux/actions/groupsActions';

import exportCsv from '../../../../../react-services/wz-csv';
import GroupsHandler from './utils/groups-handler';
import { getToasts } from '../../../../../kibana-services';
import { ExportConfiguration } from '../../../../agent/components/export-configuration';
import { ReportingService } from '../../../../../react-services/reporting';
import { UI_LOGGER_LEVELS } from '../../../../../../common/constants';
import { UI_ERROR_SEVERITIES } from '../../../../../react-services/error-orchestrator/types';
import { getErrorOrchestrator } from '../../../../../react-services/common-services';

class WzGroupsActionButtonsAgents extends Component {
_isMounted = false;
Expand All @@ -38,65 +30,10 @@ class WzGroupsActionButtonsAgents extends Component {
super(props);
this.reportingService = new ReportingService();

this.state = {
generatingCsv: false,
isPopoverOpen: false,
newGroupName: '',
};
this.exportCsv = exportCsv;

this.groupsHandler = GroupsHandler;
this.refreshTimeoutId = null;
}

componentDidMount() {
this._isMounted = true;
if (this._isMounted) this.bindEnterToInput();
}

componentDidUpdate() {
this.bindEnterToInput();
}

componentWillUnmount() {
this._isMounted = false;
}

/**
* Refresh the items
*/
async refresh() {
try {
this.props.updateReload();
this.props.updateIsProcessing(true);
this.onRefreshLoading();
} catch (error) {
const options = {
context: `${WzGroupsActionButtonsAgents.name}.refresh`,
level: UI_LOGGER_LEVELS.ERROR,
severity: UI_ERROR_SEVERITIES.BUSINESS,
store: true,
error: {
error: error,
message: error.message || error,
title: error.message || error,
},
};
getErrorOrchestrator().handleError(options);
}
}

onRefreshLoading() {
clearInterval(this.refreshTimeoutId);

this.props.updateLoadingStatus(true);
this.refreshTimeoutId = setInterval(() => {
if (!this.props.state.isProcessing) {
this.props.updateLoadingStatus(false);
clearInterval(this.refreshTimeoutId);
}
}, 100);
}

showManageAgents() {
const { itemDetail } = this.props.state;
Expand All @@ -105,117 +42,6 @@ class WzGroupsActionButtonsAgents extends Component {
this.props.updateShowAddAgents(true);
}

closePopover() {
this.setState({
isPopoverOpen: false,
msg: false,
newGroupName: '',
});
}

clearGroupName() {
this.setState({
newGroupName: '',
});
}

onChangeNewGroupName = (e) => {
this.setState({
newGroupName: e.target.value,
});
};

/**
* Looking for the input element to bind the keypress event, once the input is found the interval is clear
*/
bindEnterToInput() {
try {
const interval = setInterval(async () => {
const input = document.getElementsByClassName('groupNameInput');
if (input.length) {
const i = input[0];
if (!i.onkeypress) {
i.onkeypress = async (e) => {
if (e.which === 13) {
await this.createGroup();
}
};
}
clearInterval(interval);
}
}, 150);
} catch (error) {
const options = {
context: `${WzGroupsActionButtonsAgents.name}.bindEnterToInput`,
level: UI_LOGGER_LEVELS.ERROR,
severity: UI_ERROR_SEVERITIES.BUSINESS,
store: true,
error: {
error: error,
message: error.message || error,
title: error.message || error,
},
};
getErrorOrchestrator().handleError(options);
}
}

async createGroup() {
try {
this.props.updateLoadingStatus(true);
await this.groupsHandler.saveGroup(this.state.newGroupName);
this.showToast('success', 'Success', 'The group has been created successfully', 2000);
this.clearGroupName();

this.props.updateIsProcessing(true);
this.props.updateLoadingStatus(false);
this.closePopover();
} catch (error) {
this.props.updateLoadingStatus(false);
throw new Error(error);
}
}

/**
* Generates a CSV
*/
async generateCsv() {
try {
this.setState({ generatingCsv: true });
const { section, filters } = this.props.state; //TODO get filters from the search bar from the REDUX store
await this.exportCsv(`/groups/${this.props.state.itemDetail.name}/agents`, filters, 'Groups');
this.showToast(
'success',
'Success',
'CSV. Your download should begin automatically...',
2000
);
} catch (error) {
const options = {
context: `${WzGroupsActionButtonsAgents.name}.generateCsv`,
level: UI_LOGGER_LEVELS.ERROR,
severity: UI_ERROR_SEVERITIES.BUSINESS,
store: true,
error: {
error: error,
message: error.message || error,
title: `Error when exporting the CSV file: ${error.message || error}`,
},
};
getErrorOrchestrator().handleError(options);
}
this.setState({ generatingCsv: false });
}

showToast = (color, title, text, time) => {
getToasts().add({
color: color,
title: title,
text: text,
toastLifeTimeMs: time,
});
};

render() {
// Add new group button
const manageAgentsButton = (
Expand All @@ -237,30 +63,11 @@ class WzGroupsActionButtonsAgents extends Component {
type="group"
/>
);
// Export button
const exportCSVButton = (
<EuiButtonEmpty
iconType="exportAction"
onClick={async () => await this.generateCsv()}
isLoading={this.state.generatingCsv}
>
Export formatted
</EuiButtonEmpty>
);

// Refresh
const refreshButton = (
<EuiButtonEmpty iconType="refresh" onClick={async () => await this.refresh()}>
Refresh
</EuiButtonEmpty>
);

return (
<Fragment>
<EuiFlexItem grow={false}>{manageAgentsButton}</EuiFlexItem>
<EuiFlexItem grow={false}>{exportPDFButton}</EuiFlexItem>
<EuiFlexItem grow={false}>{exportCSVButton}</EuiFlexItem>
<EuiFlexItem grow={false}>{refreshButton}</EuiFlexItem>
</Fragment>
);
}
Expand All @@ -274,10 +81,7 @@ const mapStateToProps = (state) => {

const mapDispatchToProps = (dispatch) => {
return {
updateLoadingStatus: (status) => dispatch(updateLoadingStatus(status)),
updateIsProcessing: (isProcessing) => dispatch(updateIsProcessing(isProcessing)),
updateShowAddAgents: (showAddAgents) => dispatch(updateShowAddAgents(showAddAgents)),
updateReload: () => dispatch(updateReload()),
};
};

Expand Down
Loading
Loading