-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Move cluster check selection action next to the state * Move cluster check selection saga in dedicated saga file * Use cluster specific action name for checks selection * Add a new checksSelection slice for host checks selection * Add reducer to hosts to update checks selection * Add host checks selection saga * Use redux state in HostSettingsPage * Improve imports and faked test data * Simplify host check selection state * Add tests for current cluster checks selection saga * Extract callback functions to component functions * Add targetName prop to ChecksSelection * Rename checksSelection to hostChecksSelection * Use useCallback when passing saving function * Improve name for the new check selection emitted by the ChecksSelection component
- Loading branch information
1 parent
e59a5bf
commit 73f91dc
Showing
21 changed files
with
408 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { createAction, createSlice } from '@reduxjs/toolkit'; | ||
|
||
const initialState = { | ||
saving: false, | ||
}; | ||
|
||
export const hostChecksSelectionSlice = createSlice({ | ||
name: 'hostChecksSelection', | ||
initialState, | ||
reducers: { | ||
startSavingChecksSelection: (state) => { | ||
state.saving = true; | ||
}, | ||
stopSavingChecksSelection: (state) => { | ||
state.saving = false; | ||
}, | ||
}, | ||
}); | ||
|
||
export const HOST_CHECKS_SELECTED = 'HOST_CHECKS_SELECTED'; | ||
export const checksSelected = createAction(HOST_CHECKS_SELECTED); | ||
|
||
export const { startSavingChecksSelection, stopSavingChecksSelection } = | ||
hostChecksSelectionSlice.actions; | ||
|
||
export default hostChecksSelectionSlice.reducer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import hostChecksSelectionReducer, { | ||
startSavingChecksSelection, | ||
stopSavingChecksSelection, | ||
} from '@state/hostChecksSelection'; | ||
|
||
describe('Checks Selection reducer', () => { | ||
it('should mark a check selection as saving', () => { | ||
const initialState = { | ||
saving: false, | ||
}; | ||
|
||
const action = startSavingChecksSelection(); | ||
|
||
const expectedState = { | ||
saving: true, | ||
}; | ||
|
||
expect(hostChecksSelectionReducer(initialState, action)).toEqual( | ||
expectedState | ||
); | ||
}); | ||
|
||
it('should mark a check selection as completed', () => { | ||
const initialState = { | ||
saving: true, | ||
}; | ||
|
||
const action = stopSavingChecksSelection(); | ||
|
||
const expectedState = { | ||
saving: false, | ||
}; | ||
|
||
expect(hostChecksSelectionReducer(initialState, action)).toEqual( | ||
expectedState | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.