Skip to content

Commit

Permalink
Refactor action creators to live along with slices
Browse files Browse the repository at this point in the history
  • Loading branch information
dottorblaster committed Apr 21, 2023
1 parent cf2a9b8 commit 6ed67e9
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 30 deletions.
6 changes: 0 additions & 6 deletions assets/js/state/actions/auth.js

This file was deleted.

6 changes: 0 additions & 6 deletions assets/js/state/actions/catalog.js

This file was deleted.

6 changes: 0 additions & 6 deletions assets/js/state/actions/cluster.js

This file was deleted.

12 changes: 0 additions & 12 deletions assets/js/state/actions/lastExecutions.js

This file was deleted.

7 changes: 7 additions & 0 deletions assets/js/state/catalog.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ export const catalogSlice = createSlice({
},
});

export const UPDATE_CATALOG = 'UPDATE_CATALOG';

export const updateCatalog = (env = {}) => ({
type: UPDATE_CATALOG,
payload: env,
});

export const { setCatalogLoading, setCatalogData, setCatalogError } =
catalogSlice.actions;

Expand Down
7 changes: 7 additions & 0 deletions assets/js/state/clusters.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,13 @@ export const clustersListSlice = createSlice({
},
});

export const CHECKS_SELECTED = 'CHECKS_SELECTED';

export const checksSelected = (selectedChecks, clusterID) => ({
type: CHECKS_SELECTED,
payload: { checks: selectedChecks, clusterID },
});

export const {
setClusters,
appendCluster,
Expand Down
13 changes: 13 additions & 0 deletions assets/js/state/lastExecutions.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,19 @@ export const lastExecutionsSlice = createSlice({
},
});

export const UPDATE_LAST_EXECUTION = 'UPDATE_LAST_EXECUTION';
export const EXECUTION_REQUESTED = 'EXECUTION_REQUESTED';

export const updateLastExecution = (groupID) => ({
type: UPDATE_LAST_EXECUTION,
payload: { groupID },
});

export const executionRequested = (clusterID, hosts, checks, navigate) => ({
type: EXECUTION_REQUESTED,
payload: { clusterID, hosts, checks, navigate },
});

export const {
setLastExecutionLoading,
setLastExecution,
Expand Down
File renamed without changes.
7 changes: 7 additions & 0 deletions assets/js/state/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ export const userSlice = createSlice({
},
});

export const PERFORM_LOGIN = 'PERFORM_LOGIN';

export const performLogin = ({ username, password }) => ({
type: PERFORM_LOGIN,
payload: { username, password },
});

export const { setUserAsLogged, setUser, setAuthError, setAuthInProgress } =
userSlice.actions;

Expand Down

0 comments on commit 6ed67e9

Please sign in to comment.