Skip to content

Commit

Permalink
Fix flyout date (#3114)
Browse files Browse the repository at this point in the history
* Fix flyout date change also main date

* Update changelog
  • Loading branch information
pablomarga authored Apr 5, 2021
1 parent ffed103 commit 5454a8b
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@ All notable changes to the Wazuh app project will be documented in this file.
- Fixed missing `pending` status suggestion for agents [#3095](https://github.com/wazuh/wazuh-kibana-app/pull/3095)
- Index pattern setting not used for choosing from existing patterns [#3097](https://github.com/wazuh/wazuh-kibana-app/pull/3097)
- Fix space character missing on deployment command if UDP is configured [#3108](https://github.com/wazuh/wazuh-kibana-app/pull/3108)
- Flyout date filter also changes main date filter [#3114](https://github.com/wazuh/wazuh-kibana-app/pull/3114)
- Fixed name for "TCP sessions" visualization and average metric is now a sum [#3118](https://github.com/wazuh/wazuh-kibana-app/pull/3118)

## Wazuh v4.1.4 - Kibana 7.10.0 , 7.10.2 - Revision 4105

- Adapt for Wazuh 4.1.4


## Wazuh v4.1.4 - Kibana 7.10.0 , 7.10.2 - Revision 4105

- Adapt for Wazuh 4.1.4
Expand Down
3 changes: 2 additions & 1 deletion public/components/common/hocs/withKibanaContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ interface withKibanaContextProps {
indexPattern?: IIndexPattern
filterManager?: FilterManager
query?: Query
timeFilter?: TimeRange
}

export interface withKibanaContextExtendsProps {
Expand All @@ -36,7 +37,7 @@ export const withKibanaContext = <T extends object>(Component:React.FunctionComp
const indexPattern = props.indexPattern ? props.indexPattern : useIndexPattern();
const filterManager = props.filterManager ? props.filterManager : useFilterManager();
const [query, setQuery] = props.query ? useState(props.query) : useQueryManager();
const { timeFilter, timeHistory, setTimeFilter } = useTimeFilter();
const { timeFilter, timeHistory, setTimeFilter } = props.timeFilter ? props.timeFilter : useTimeFilter();
return <Component {...props}
indexPattern={indexPattern}
filterManager={filterManager}
Expand Down
2 changes: 1 addition & 1 deletion public/components/common/hooks/use-time-filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ export function useTimeFilter() {
return () => { subscription.unsubscribe(); }
}, []);
return { timeFilter, setTimeFilter: timefilter.setTime, timeHistory };
}
}
18 changes: 11 additions & 7 deletions public/components/common/modules/discover/discover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ export const Discover = compose(
requestOffset: 0,
itemIdToExpandedRowMap: {},
dateRange: this.timefilter.getTime(),
dateRangeHistory: this.timefilter._history,
query: props.query || { language: "kuery", query: "" },
elasticQuery: {},
columns: [],
Expand Down Expand Up @@ -289,7 +290,7 @@ export const Discover = compose(

const filters = this.props.shareFilterManager ? this.props.shareFilterManager.filters : [];
const previousFilters = this.KibanaServices && this.KibanaServices.query.filterManager.filters ? this.KibanaServices.query.filterManager.filters : [];

const elasticQuery =
buildEsQuery(
undefined,
Expand All @@ -303,8 +304,8 @@ export const Discover = compose(
const range = {
range: {
timestamp: {
gte: dateParse(this.timefilter.getTime().from),
lte: dateParse(this.timefilter.getTime().to),
gte: dateParse(this.state.dateRange.from),
lte: dateParse(this.state.dateRange.to),
format: 'epoch_millis'
}
}
Expand Down Expand Up @@ -408,7 +409,7 @@ export const Discover = compose(
let width = false;
let link = false;
const arrayCompilance = ["rule.pci_dss", "rule.gdpr", "rule.nist_800_53", "rule.tsc", "rule.hipaa"];

if(item === 'agent.id') {
link = (ev,x) => {AppNavigate.navigateToModule(ev,'agents', {"tab": "welcome", "agent": x } )};
width = '8%';
Expand Down Expand Up @@ -507,7 +508,7 @@ export const Discover = compose(

/**
* Adds a new negated filter with format { "filter_key" : "filter_value" }, e.g. {"agent.id": "001"}
* @param filter
* @param filter
*/
addFilterOut(filter) {
const filterManager = this.props.shareFilterManager;
Expand All @@ -525,7 +526,7 @@ export const Discover = compose(

/**
* Adds a new filter with format { "filter_key" : "filter_value" }, e.g. {"agent.id": "001"}
* @param filter
* @param filter
*/
addFilter(filter) {
const filterManager = this.props.shareFilterManager;
Expand Down Expand Up @@ -553,7 +554,7 @@ export const Discover = compose(
closeMitreFlyout = () => {
this.setState({showMitreFlyout: false});
}

onMitreChangeFlyout = (showMitreFlyout: boolean) => {
this.setState({ showMitreFlyout });
}
Expand Down Expand Up @@ -612,6 +613,9 @@ export const Discover = compose(
{this.props.kbnSearchBar && <KbnSearchBar
indexPattern={this.indexPattern}
filterManager={this.props.shareFilterManager}
timeFilter={{timeFilter:this.state.dateRange,
timeHistory:this.state.dateRangeHistory,
setTimeFilter:(dateRange)=> this.setState({dateRange})}}
onQuerySubmit={this.onQuerySubmit}
onFiltersUpdated={this.onFiltersUpdated}
query={query} />
Expand Down

0 comments on commit 5454a8b

Please sign in to comment.