Skip to content

Commit c823d77

Browse files
refactor: remove redundant comments regarding cluster mode in various components
- Eliminated comments indicating that cluster mode is always enabled in version 5.0 and above from multiple files, enhancing code clarity and maintainability. - Updated documentation and comments to reflect the current state of the code without unnecessary repetition.
1 parent 59f86d5 commit c823d77

File tree

12 files changed

+3
-21
lines changed

12 files changed

+3
-21
lines changed

plugins/main/public/components/common/data-source/pattern/pattern-data-source-filter-manager.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,15 +256,14 @@ export class PatternDataSourceFilterManager
256256
}
257257

258258
/**
259-
* Return the filter when the cluster is enabled (always enabled in v5.0+)
259+
* Return the cluster filter
260260
*/
261261
static getClusterManagerFilters(
262262
indexPatternId: string,
263263
controlledByValue: string,
264264
key?: string,
265265
): tFilter[] {
266266
const filterHandler = new FilterHandler();
267-
// Cluster mode is always enabled in v5.0+
268267
const managerFilter = filterHandler.managerQuery(
269268
AppState.getClusterInfo().cluster,
270269
key,

plugins/main/public/components/common/welcome/components/fim_events_table/lib/get_fim_alerts.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ function createFilters(agentId, indexPattern) {
4242

4343
export function getWazuhFilter() {
4444
const clusterInfo = AppState.getClusterInfo();
45-
// Always use cluster.name in v5.0+ (cluster mode by default)
4645
const wazuhFilter = {
4746
name: 'cluster.name',
4847
value: clusterInfo.cluster,

plugins/main/public/components/common/welcome/components/mitre_top/lib/get_mitre_counts.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ function createExistsFilter(indexPattern) {
5151

5252
function getWazuhFilter() {
5353
const clusterInfo = AppState.getClusterInfo();
54-
// Always use cluster.name in v5.0+ (cluster mode by default)
5554
const wazuhFilter = {
5655
name: 'cluster.name',
5756
value: clusterInfo.cluster,

plugins/main/public/components/endpoints-summary/register-agent/services/register-agent-services.tsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ export type ServerAddressOptions = {
2828
nodetype: string;
2929
};
3030

31-
3231
/**
3332
* Get the remote configuration from api
3433
*/
@@ -40,7 +39,6 @@ async function getRemoteConfiguration(nodeName: string): Promise<RemoteConfig> {
4039
};
4140

4241
try {
43-
// Always use cluster endpoints in v5.0+ (cluster mode by default)
4442
const result = await WzRequest.apiReq(
4543
'GET',
4644
`/cluster/${nodeName}/configuration/request/remote`,
@@ -79,7 +77,6 @@ async function getRemoteConfiguration(nodeName: string): Promise<RemoteConfig> {
7977
* @returns
8078
*/
8179
async function getAuthConfiguration(node: string) {
82-
// Always use cluster endpoints in v5.0+ (cluster mode by default)
8380
const authConfigUrl = `/cluster/${node}/configuration/auth/auth`;
8481
const result = await WzRequest.apiReq('GET', authConfigUrl, {});
8582
const auth = result?.data?.data?.affected_items?.[0];
@@ -111,7 +108,6 @@ async function getConnectionConfig(
111108
const nodeIp = nodeSelected?.value;
112109
if (!defaultServerAddress) {
113110
if (nodeSelected.nodetype !== 'custom') {
114-
// Always use cluster mode in v5.0+ (cluster mode by default)
115111
const remoteConfig = await getRemoteConfiguration(nodeName);
116112
return {
117113
serverAddress: nodeIp,
@@ -189,7 +185,6 @@ export const parseNodesInOptions = (
189185
export const fetchClusterNodesOptions = async (): Promise<
190186
ServerAddressOptions[]
191187
> => {
192-
// Always use cluster mode in v5.0+ (cluster mode by default)
193188
const nodes = await getNodeIPs();
194189
return parseNodesInOptions(nodes);
195190
};
@@ -211,7 +206,6 @@ export const getMasterNode = (
211206
export const getMasterConfiguration = async () => {
212207
const nodes = await fetchClusterNodesOptions();
213208
const masterNode = getMasterNode(nodes);
214-
// Always use cluster mode in v5.0+ (cluster mode by default)
215209
const remote = await getRemoteConfiguration(masterNode[0].label);
216210
const auth = await getAuthConfiguration(masterNode[0].label);
217211
return {

plugins/main/public/components/overview/compliance-table/components/requirement-flyout/requirement-flyout.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,6 @@ export const RequirementFlyout = connect(mapStateToProps)(
186186
renderBody() {
187187
const { currentRequirement } = this.props;
188188
const requirementImplicitFilter = {};
189-
// Always use cluster.name in v5.0+ (cluster mode by default)
190189
const clusterFilter = {
191190
'cluster.name': AppState.getClusterInfo().cluster,
192191
};

plugins/main/public/components/settings/api/api-table.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,6 @@ export const ApiTable = compose(withErrorBoundary)(
203203

204204
// Check the connection before set as default
205205
AppState.setClusterInfo(cluster_info);
206-
// In v5.0+ cluster is always enabled (cluster by default)
207206
AppState.setCurrentAPI(
208207
JSON.stringify({
209208
name: cluster,

plugins/main/public/controllers/management/components/management/configuration/configuration-switch.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,6 @@ class WzConfigurationSwitch extends Component {
151151

152152
updateClusterInformation = async (/** @type {string} */ context) => {
153153
try {
154-
// Always cluster in v5.0+ (cluster by default)
155154
await this.handleClusterNodes();
156155
} catch (error) {
157156
// Handle cluster errors

plugins/main/public/controllers/management/components/management/configuration/utils/wz-fetch.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,6 @@ export const makePing = async (updateWazuhNotReadyYet, tries = 30) => {
187187
*/
188188
export const fetchFile = async selectedNode => {
189189
try {
190-
// Always use cluster endpoints in v5.0+ (cluster mode by default)
191190
const data = await WzRequest.apiReq(
192191
'GET',
193192
`/cluster/${selectedNode}/configuration`,
@@ -316,7 +315,6 @@ export const restartNode = async node => {
316315

317316
export const saveConfiguration = async (selectedNode, xml) => {
318317
try {
319-
// Always use cluster mode in v5.0+ (cluster mode by default)
320318
await saveFileCluster(xml, selectedNode);
321319
} catch (error) {
322320
throw error;

plugins/main/public/controllers/management/components/management/status/status-overview.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ export class WzStatusOverview extends Component {
9292
try {
9393
this.props.updateLoadingStatus(true);
9494

95-
// In v5.0+ cluster is always enabled and running (cluster by default)
9695
const agentsCountByManagerNodes = (
9796
await this.statusHandler.clusterAgentsCount()
9897
)?.data?.data;

plugins/main/public/controllers/overview/components/last-alerts-stat/last-alerts-query.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ export const getLastAlertsQuery = (
66
maxRuleLevel?: number;
77
},
88
) => {
9-
// Always use cluster.name in v5.0+ (cluster mode by default)
109
const clusterField = 'cluster.name';
1110
return {
1211
indexPattern: currentIndexPattern,

0 commit comments

Comments
 (0)