Skip to content

Commit

Permalink
Fixed pinned agent filter when unpin and change pinned agent (#6734)
Browse files Browse the repository at this point in the history
* Fixed pinned agent filter when unpin and change pinned agent

* Added CHANGELOG

* Fixed index pattern title in links of rule-info and last-alerts-stat

* Changed to index pattern id instead of index pattern title
  • Loading branch information
jbiset authored May 31, 2024
1 parent 509a58d commit c6a5172
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 6 deletions.
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

- Removed embedded discover [#6120](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6120) [#6235](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6235) [#6254](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6254) [#6285](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6285) [#6288](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6288) [#6290](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6290) [#6289](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6289) [#6286](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6286) [#6275](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6275) [#6287](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6297](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6297) [#6291](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6459](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6459) [#6434](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6434) [#6504](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6504) [#6649](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6649) [#6506](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6506) [#6537](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6537) [#6528](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6528) [#6675](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6675) [#6674](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6674) [#6558](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6558) [#6685](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6685) [#6691](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6691) [#6712](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6712)
- Removed embedded discover [#6120](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6120) [#6235](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6235) [#6254](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6254) [#6285](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6285) [#6288](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6288) [#6290](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6290) [#6289](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6289) [#6286](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6286) [#6275](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6275) [#6287](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6297](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6297) [#6291](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6459](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6459) [#6434](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6434) [#6504](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6504) [#6649](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6649) [#6506](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6506) [#6537](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6537) [#6528](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6528) [#6675](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6675) [#6674](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6674) [#6558](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6558) [#6685](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6685) [#6691](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6691) [#6712](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6712) [#6734](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6734)
- Allow editing groups for an agent from Endpoints Summary [#6250](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6250)
- Change how the configuration is managed in the backend side [#6337](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6337) [#6519](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6519) [#6573](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6573)
- Change the view of API is down and check connection to Server APIs application [#6337](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6337)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,9 @@ export function useDataSource<
);

if (pinnedAgentFilter.length) {
dataSourceFilterManager.removeFilter(pinnedAgentFilter[0]);
dataSourceFilterManager.removeFilterByControlledBy(
PinnedAgentManager.FILTER_CONTROLLED_PINNED_AGENT_KEY,
);
}
if (pinnedAgentManager.isPinnedAgent()) {
const pinnedAgent = PatternDataSourceFilterManager.getPinnedAgentFilter(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,14 @@ import { UI_ERROR_SEVERITIES } from '../../../../../../react-services/error-orch
import { UI_LOGGER_LEVELS } from '../../../../../../../common/constants';
import { TableWzAPI } from '../../../../../../components/common/tables';
import { getErrorOrchestrator } from '../../../../../../react-services/common-services';
import { getCore } from '../../../../../../kibana-services';
import {
getCore,
getDataPlugin,
getWazuhCorePlugin,
} from '../../../../../../kibana-services';
import { threatHunting } from '../../../../../../utils/applications';
import { euiThemeVars } from '@osd/ui-shared-deps/theme';
import { AppState } from '../../../../../../react-services';

export default class WzRuleInfo extends Component {
constructor(props) {
Expand All @@ -52,6 +57,7 @@ export default class WzRuleInfo extends Component {
mitreIds: [],
currentRuleInfo: {},
isLoading: true,
currentIndexPattern: '',
};
this.resourcesHandler = new ResourcesHandler(ResourcesConstants.RULES);

Expand Down Expand Up @@ -159,10 +165,16 @@ export default class WzRuleInfo extends Component {
document.body.scrollTop = 0; // For Safari
document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera

const currentIndexPattern = await getDataPlugin().indexPatterns.get(
AppState.getCurrentPattern() ||
getWazuhCorePlugin().configuration.getSettingValue('pattern'),
);

this.setState({
currentRuleId: this.props.item,
isLoading: true,
mitreLoading: true,
currentIndexPattern: currentIndexPattern.id,
});
}

Expand Down Expand Up @@ -755,7 +767,7 @@ export default class WzRuleInfo extends Component {
iconType='popout'
aria-label='popout'
href={getCore().application.getUrlForApp(threatHunting.id, {
path: `#/overview/?tab=general&tabView=panels&_g=(filters:!(('$state':(store:appState),meta:(alias:!n,disabled:!f,index:'wazuh-alerts-*',key:rule.id,negate:!f,params:(query:'${id}'),type:phrase),query:(match_phrase:(rule.id:'${id}')))),query:(language:kuery,query:''))`,
path: `#/overview/?tab=general&tabView=panels&_g=(filters:!(('$state':(store:appState),meta:(alias:!n,disabled:!f,index:'${this.state.currentIndexPattern}',key:rule.id,negate:!f,params:(query:'${id}'),type:phrase),query:(match_phrase:(rule.id:'${id}')))),query:(language:kuery,query:''))`,
})}
target='_blank'
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const getLast24HoursAlerts = async (
field: isCluster ? 'cluster.name' : 'manager.name',
name: clusterValue,
},
indexPatternName: currentIndexPattern.title,
indexPatternName: currentIndexPattern.id,
};
} catch (error) {
return Promise.reject(error);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export function LastAlertsStat({ severity }: { severity: string }) {
cluster.name
}),type:phrase),query:(match_phrase:(${cluster.field}:${
cluster.name
}))),('$state':(store:globalState),meta:(alias:!n,disabled:!f,index:'wazuh-alerts-*',key:rule.level,negate:!f,params:(gte:${
}))),('$state':(store:globalState),meta:(alias:!n,disabled:!f,index:'${indexPatternName}',key:rule.level,negate:!f,params:(gte:${
severityLabel[severity].ruleLevelRange.minRuleLevel
},lte:${
severityLabel[severity].ruleLevelRange.maxRuleLevel || '!n'
Expand Down

0 comments on commit c6a5172

Please sign in to comment.