Skip to content

Commit

Permalink
Create service to restart wazuh (#4365)
Browse files Browse the repository at this point in the history
* file to be added with the restart functions

* restart calls were changed to service calls

* the restarting on time sign appears

* modal while restarting added

* countDown change of location

* cleaning

* modal redesign

* model and code update

* modified delays and designs

* change text Synchronizing cluster

* Update restart-cluster-manager-callout.tsx

* Code improvements

* suggestions implemented

* polling sync add

* Code improvements

* add endpoint

* add comment

* add close button

* suggestions implemented

* add modal wazuh restarted

* delete unnecessary toast

* Set clearState on restart error

* disabled unneeded console.log

Co-authored-by: Alex Ruiz Becerra <[email protected]>
Co-authored-by: Federico Rodriguez <[email protected]>
Co-authored-by: chantal.kelm <[email protected]>
(cherry picked from commit 6598df9)
  • Loading branch information
yenienserrano committed Sep 6, 2022
1 parent 9d0f5f6 commit c8de470
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ class WzEditConfiguration extends Component {
}
}


async checkIfClusterOrManager() {
try {
// in case which enable/disable cluster configuration, update Redux Store
Expand Down
48 changes: 48 additions & 0 deletions public/redux/actions/appStateActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,4 +235,52 @@ export const updateLogtestToken = (logtestToken) => {
type: 'UPDATE_LOGTEST_TOKEN',
logtestToken: logtestToken
};
};

/**
* Update restart attempt
* @param {Number} restartAttempt
* @returns
*/
export const updateRestartAttempt = (restartAttempt) => {
return {
type: 'UPDATE_RESTART_ATTEMPT',
restartAttempt
};
};

/**
* Update sync check attempt
* @param {Number} syncCheckAttempt
* @returns
*/
export const updateSyncCheckAttempt = (syncCheckAttempt) => {
return {
type: 'UPDATE_SYNC_CHECK_ATTEMPT',
syncCheckAttempt
};
}

/**
* Update unsynchronized nodes
* @param {Array} unsynchronizedNodes
* @returns
*/
export const updateUnsynchronizedNodes = (unsynchronizedNodes) => {
return {
type: 'UPDATE_UNSYNCHRONIZED_NODES',
unsynchronizedNodes
};
};

/**
* Update status of the restarting process
* @param {string} restartStatus
* @returns
*/
export const updateRestartStatus = (restartStatus) => {
return {
type: 'UPDATE_RESTART_STATUS',
restartStatus
};
};
32 changes: 32 additions & 0 deletions public/redux/reducers/appStateReducers.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ const initialState = {
withUserLogged: false,
allowedAgents: [],
logtestToken: '',
restartAttempt: 0,
syncCheckAttempt: 0,
unsynchronizedNodes: [],
restartStatus: ''
};

const appStateReducers = (state = initialState, action) => {
Expand Down Expand Up @@ -155,6 +159,34 @@ const appStateReducers = (state = initialState, action) => {
};
}

if (action.type === 'UPDATE_RESTART_ATTEMPT') {
return {
...state,
restartAttempt: action.restartAttempt
};
}

if (action.type === 'UPDATE_SYNC_CHECK_ATTEMPT') {
return {
...state,
syncCheckAttempt: action.syncCheckAttempt
};
}

if (action.type === 'UPDATE_UNSYNCHRONIZED_NODES') {
return {
...state,
unsynchronizedNodes: action.unsynchronizedNodes
};
}

if (action.type === 'UPDATE_RESTART_STATUS') {
return {
...state,
restartStatus: action.restartStatus
};
}

return state;
};

Expand Down

0 comments on commit c8de470

Please sign in to comment.