Skip to content

Commit 59f86d5

Browse files
refactor: remove status from cluster info and streamline API connection logic
- Eliminated the status property from the cluster_info object in the Wazuh API and related components, as cluster mode is always enabled in version 5.0 and above. - Updated the API connection logic to directly use the cluster name, enhancing clarity and maintainability.
1 parent 0067605 commit 59f86d5

File tree

3 files changed

+5
-11
lines changed

3 files changed

+5
-11
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,14 +199,14 @@ export const ApiTable = compose(withErrorBoundary)(
199199
try {
200200
await this.checkManager(APIconnection, true);
201201
const { cluster_info, id } = APIconnection;
202-
const { manager, cluster, status } = cluster_info;
202+
const { cluster } = cluster_info;
203203

204204
// Check the connection before set as default
205205
AppState.setClusterInfo(cluster_info);
206-
const clusterEnabled = status === 'disabled';
206+
// In v5.0+ cluster is always enabled (cluster by default)
207207
AppState.setCurrentAPI(
208208
JSON.stringify({
209-
name: clusterEnabled ? manager : cluster,
209+
name: cluster,
210210
id: id,
211211
}),
212212
);

plugins/main/server/controllers/wazuh-api.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,15 +157,15 @@ export class WazuhApiCtrl {
157157

158158
// If we have a valid response from the Wazuh API
159159
try {
160-
const { status, manager, node, cluster } =
160+
const { manager, node, cluster } =
161161
await context.wazuh_core.manageHosts.getRegistryDataByHost(
162162
apiHostData,
163163
{
164164
throwError: true,
165165
},
166166
);
167167

168-
api.cluster_info = { status, manager, node, cluster };
168+
api.cluster_info = { manager, node, cluster };
169169

170170
return response.ok({
171171
body: {

plugins/wazuh-core/server/services/manage-hosts.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ export interface IAPIHost {
2727
interface IAPIHostRegistry {
2828
manager: string | null;
2929
node: string | null;
30-
status: string;
3130
cluster: string;
3231
allow_run_as: API_USER_STATUS_RUN_AS;
3332
}
@@ -189,7 +188,6 @@ export class ManageHosts {
189188

190189
let manager = null,
191190
node = null,
192-
status = 'disabled',
193191
cluster = 'Disabled',
194192
allow_run_as = API_USER_STATUS_RUN_AS.UNABLE_TO_CHECK;
195193

@@ -227,9 +225,6 @@ export class ManageHosts {
227225
}
228226
}
229227

230-
// In v5.0+ cluster is always enabled (cluster by default)
231-
status = 'enabled';
232-
233228
const responseClusterLocal =
234229
await this.serverAPIClient.asInternalUser.request(
235230
'GET',
@@ -251,7 +246,6 @@ export class ManageHosts {
251246
const data = {
252247
manager,
253248
node,
254-
status,
255249
cluster,
256250
allow_run_as,
257251
};

0 commit comments

Comments
 (0)