diff --git a/package-lock.json b/package-lock.json index 0034a390..632a5233 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,7 +16,7 @@ "@commitlint/cli": "^17.7.2", "@commitlint/config-conventional": "^17.7.0", "@mui/icons-material": "^5.15.11", - "@reduxjs/toolkit": "^2.2.5", + "@reduxjs/toolkit": "*", "@testing-library/react": "^14.1.2", "@types/jest": "^29.5.11", "@types/lodash": "^4.17.7", @@ -54,6 +54,7 @@ "@emotion/react": "^11.11.3", "@emotion/styled": "^11.11.0", "@mui/material": "^5.15.11", + "@reduxjs/toolkit": "^2.5.0", "@types/mui-datatables": "*", "@xstate/react": "^4.1.1", "lodash": "^4.17.21", @@ -2645,10 +2646,11 @@ "dev": true }, "node_modules/@reduxjs/toolkit": { - "version": "2.2.5", - "resolved": "https://registry.npmjs.org/@reduxjs/toolkit/-/toolkit-2.2.5.tgz", - "integrity": "sha512-aeFA/s5NCG7NoJe/MhmwREJxRkDs0ZaSqt0MxhWUrwCf1UQXpwR87RROJEql0uAkLI6U7snBOYOcKw83ew3FPg==", + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@reduxjs/toolkit/-/toolkit-2.5.0.tgz", + "integrity": "sha512-awNe2oTodsZ6LmRqmkFhtb/KH03hUhxOamEQy411m3Njj3BbFvoBovxo4Q1cBWnV1ErprVj9MlF0UPXkng0eyg==", "dev": true, + "license": "MIT", "dependencies": { "immer": "^10.0.3", "redux": "^5.0.1", @@ -2656,7 +2658,7 @@ "reselect": "^5.1.0" }, "peerDependencies": { - "react": "^16.9.0 || ^17.0.0 || ^18", + "react": "^16.9.0 || ^17.0.0 || ^18 || ^19", "react-redux": "^7.2.1 || ^8.1.3 || ^9.0.0" }, "peerDependenciesMeta": { @@ -16064,9 +16066,9 @@ "dev": true }, "@reduxjs/toolkit": { - "version": "2.2.5", - "resolved": "https://registry.npmjs.org/@reduxjs/toolkit/-/toolkit-2.2.5.tgz", - "integrity": "sha512-aeFA/s5NCG7NoJe/MhmwREJxRkDs0ZaSqt0MxhWUrwCf1UQXpwR87RROJEql0uAkLI6U7snBOYOcKw83ew3FPg==", + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@reduxjs/toolkit/-/toolkit-2.5.0.tgz", + "integrity": "sha512-awNe2oTodsZ6LmRqmkFhtb/KH03hUhxOamEQy411m3Njj3BbFvoBovxo4Q1cBWnV1ErprVj9MlF0UPXkng0eyg==", "dev": true, "requires": { "immer": "^10.0.3", diff --git a/package.json b/package.json index 04cee394..a0a04654 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "@commitlint/cli": "^17.7.2", "@commitlint/config-conventional": "^17.7.0", "@mui/icons-material": "^5.15.11", - "@reduxjs/toolkit": "^2.2.5", + "@reduxjs/toolkit": "*", "@testing-library/react": "^14.1.2", "@types/jest": "^29.5.11", "@types/lodash": "^4.17.7", @@ -81,6 +81,7 @@ "@emotion/react": "^11.11.3", "@emotion/styled": "^11.11.0", "@mui/material": "^5.15.11", + "@reduxjs/toolkit": "^2.5.0", "@types/mui-datatables": "*", "@xstate/react": "^4.1.1", "lodash": "^4.17.21", diff --git a/src/redux-toolkit/slices/anonymousPerfResultsSlice.ts b/src/redux-toolkit/slices/anonymousPerfResultsSlice.ts new file mode 100644 index 00000000..73de5860 --- /dev/null +++ b/src/redux-toolkit/slices/anonymousPerfResultsSlice.ts @@ -0,0 +1,49 @@ +import { createSlice, PayloadAction } from '@reduxjs/toolkit'; +import type { MesheryRootState } from '../store'; +export interface AnonymousPerfResultsState { + value: boolean; +} + +const initialState: AnonymousPerfResultsState = { value: false }; + +const anonymousPerfResultsSlice = createSlice({ + name: 'anonymousPerfResults', + initialState, + reducers: { + setAnonymousPerfResults: (state, action: PayloadAction) => { + return action.payload; + }, + updateResultsSelection: (state: AnonymousPerfResultsState, action: PayloadAction) => { + // TODO: Implement reducer logic for UPDATE_RESULTS_SELECTION + return state; + }, + clearResultsSelection: (state: AnonymousPerfResultsState, action: PayloadAction) => { + // TODO: Implement reducer logic for CLEAR_RESULTS_SELECTION + return state; + }, + updateAnonymousUsageStats: (state: AnonymousPerfResultsState, action: PayloadAction) => { + // TODO: Implement reducer logic for UPDATE_ANONYMOUS_USAGE_STATS + return state; + }, + updateAnonymousPerformanceResults: ( + state: AnonymousPerfResultsState, + action: PayloadAction + ) => { + // TODO: Implement reducer logic for UPDATE_ANONYMOUS_PERFORMANCE_RESULTS + return state; + } + } +}); + +// Actions +export const { + setAnonymousPerfResults, + updateResultsSelection, + clearResultsSelection, + updateAnonymousUsageStats, + updateAnonymousPerformanceResults +} = anonymousPerfResultsSlice.actions; + +// Selectors +export const selectAnonymousPerfResults = (state: MesheryRootState) => state.anonymousPerfResults; +export default anonymousPerfResultsSlice.reducer; diff --git a/src/redux-toolkit/slices/anonymousUsageStatsSlice.ts b/src/redux-toolkit/slices/anonymousUsageStatsSlice.ts new file mode 100644 index 00000000..4959f2e6 --- /dev/null +++ b/src/redux-toolkit/slices/anonymousUsageStatsSlice.ts @@ -0,0 +1,45 @@ +import { createSlice, PayloadAction } from '@reduxjs/toolkit'; +import type { MesheryReduxAppDispatch, MesheryRootState } from '../store'; + +export interface AnonymousUsageStatsState { + value: boolean; +} + +const initialState: AnonymousUsageStatsState = { value: false }; + +const anonymousUsageStatsSlice = createSlice({ + name: 'anonymousUsageStats', + initialState, + reducers: { + setAnonymousUsageStats: (state, action: PayloadAction) => { + return action.payload; + }, + updateAnonymousUsageStats: (state: AnonymousUsageStatsState, action: PayloadAction) => { + // TODO: Implement reducer logic for UPDATE_ANONYMOUS_USAGE_STATS + return state; + }, + updateAnonymousPerformanceResults: ( + state: AnonymousUsageStatsState, + action: PayloadAction + ) => { + // TODO: Implement reducer logic for UPDATE_ANONYMOUS_PERFORMANCE_RESULTS + return state; + } + } +}); +// Actions +export const { + setAnonymousUsageStats, + // updateAnonymousUsageStats, + updateAnonymousPerformanceResults +} = anonymousUsageStatsSlice.actions; + +// Thunk action creator +export const updateAnonymousUsageStats = + (payload: AnonymousUsageStatsState) => (dispatch: MesheryReduxAppDispatch) => { + dispatch(setAnonymousUsageStats(payload)); + }; + +// Selectors +export const selectAnonymousUsageStats = (state: MesheryRootState) => state.anonymousUsageStats; +export default anonymousUsageStatsSlice.reducer; diff --git a/src/redux-toolkit/slices/cSlice.ts b/src/redux-toolkit/slices/cSlice.ts new file mode 100644 index 00000000..c0a994ba --- /dev/null +++ b/src/redux-toolkit/slices/cSlice.ts @@ -0,0 +1,23 @@ +import { createSlice, PayloadAction } from '@reduxjs/toolkit'; +import type { MesheryRootState } from '../store'; +// State interface +export interface CState { + [key: string]: any; +} +// Initial state +const initialState: CState = 0; +// Slice +const cSlice = createSlice({ + name: 'c', + initialState, + reducers: { + setC: (state, action: PayloadAction) => { + return action.payload; + } + } +}); +// Actions +export const { setC } = cSlice.actions; +// Selectors +export const selectC = (state: MesheryRootState) => state.c; +export default cSlice.reducer; diff --git a/src/redux-toolkit/slices/capabilitiesRegistrySlice.ts b/src/redux-toolkit/slices/capabilitiesRegistrySlice.ts new file mode 100644 index 00000000..ca1f9309 --- /dev/null +++ b/src/redux-toolkit/slices/capabilitiesRegistrySlice.ts @@ -0,0 +1,30 @@ +import { createSlice, PayloadAction } from '@reduxjs/toolkit'; +import type { MesheryRootState } from '../store'; + +export interface CapabilitiesRegistryState { + value: any; +} + +const initialState: CapabilitiesRegistryState = { value: null }; + +const capabilitiesRegistrySlice = createSlice({ + name: 'capabilitiesRegistry', + initialState, + reducers: { + setCapabilitiesRegistry: (state, action: PayloadAction) => { + return action.payload; + }, + updateCapabilityRegistry: (state: CapabilitiesRegistryState, action: PayloadAction) => { + // TODO: Implement reducer logic for UPDATE_CAPABILITY_REGISTRY + return state; + } + } +}); + +// Actions +export const { setCapabilitiesRegistry, updateCapabilityRegistry } = + capabilitiesRegistrySlice.actions; + +// Selectors +export const selectCapabilitiesRegistry = (state: MesheryRootState) => state.capabilitiesRegistry; +export default capabilitiesRegistrySlice.reducer; diff --git a/src/redux-toolkit/slices/catalogVisibilitySlice.ts b/src/redux-toolkit/slices/catalogVisibilitySlice.ts new file mode 100644 index 00000000..2c7948b5 --- /dev/null +++ b/src/redux-toolkit/slices/catalogVisibilitySlice.ts @@ -0,0 +1,28 @@ +import { createSlice, PayloadAction } from '@reduxjs/toolkit'; +import type { MesheryRootState } from '../store'; +export interface CatalogVisibilityState { + value: boolean; +} + +const initialState: CatalogVisibilityState = { value: false }; + +const catalogVisibilitySlice = createSlice({ + name: 'catalogVisibility', + initialState, + reducers: { + setCatalogVisibility: (state, action: PayloadAction) => { + return action.payload; + }, + setCatalogContent: (state: CatalogVisibilityState, action: PayloadAction) => { + // TODO: Implement reducer logic for SET_CATALOG_CONTENT + return state; + } + } +}); + +// Actions +export const { setCatalogVisibility, setCatalogContent } = catalogVisibilitySlice.actions; + +// Selectors +export const selectCatalogVisibility = (state: MesheryRootState) => state.catalogVisibility; +export default catalogVisibilitySlice.reducer; diff --git a/src/redux-toolkit/slices/connectionMetadataStateSlice.ts b/src/redux-toolkit/slices/connectionMetadataStateSlice.ts new file mode 100644 index 00000000..b42aba93 --- /dev/null +++ b/src/redux-toolkit/slices/connectionMetadataStateSlice.ts @@ -0,0 +1,43 @@ +import { createSlice, PayloadAction } from '@reduxjs/toolkit'; +import type { MesheryRootState } from '../store'; + +export interface ConnectionMetadataStateState { + value: any; +} + +const initialState: ConnectionMetadataStateState = { value: null }; + +const connectionMetadataStateSlice = createSlice({ + name: 'connectionMetadataState', + initialState, + reducers: { + setConnectionMetadataState: (state, action: PayloadAction) => { + return action.payload; + }, + updateLoadTestData: (state: ConnectionMetadataStateState, action: PayloadAction) => { + // TODO: Implement reducer logic for UPDATE_LOAD_TEST_DATA + return state; + }, + setControllerState: (state: ConnectionMetadataStateState, action: PayloadAction) => { + // TODO: Implement reducer logic for SET_CONTROLLER_STATE + return state; + }, + setConnectionMetadata: (state: ConnectionMetadataStateState, action: PayloadAction) => { + // TODO: Implement reducer logic for SET_CONNECTION_METADATA + return state; + } + } +}); + +// Actions +export const { + setConnectionMetadataState, + updateLoadTestData, + setControllerState, + setConnectionMetadata +} = connectionMetadataStateSlice.actions; + +// Selectors +export const selectConnectionMetadataState = (state: MesheryRootState) => + state.connectionMetadataState; +export default connectionMetadataStateSlice.reducer; diff --git a/src/redux-toolkit/slices/controllerStateSlice.ts b/src/redux-toolkit/slices/controllerStateSlice.ts new file mode 100644 index 00000000..7be47f39 --- /dev/null +++ b/src/redux-toolkit/slices/controllerStateSlice.ts @@ -0,0 +1,30 @@ +import { createSlice, PayloadAction } from '@reduxjs/toolkit'; +import type { MesheryRootState } from '../store'; +export interface ControllerStateState { + value: any; +} + +const initialState: ControllerStateState = { value: null }; + +const controllerStateSlice = createSlice({ + name: 'controllerState', + initialState, + reducers: { + setControllerState: (state, action: PayloadAction) => { + return action.payload; + } + /* + setControllerState: (state: ControllerStateState, action: PayloadAction) => { + // TODO: Implement reducer logic for SET_CONTROLLER_STATE + return state; + } + */ + } +}); + +// Actions +export const { setControllerState } = controllerStateSlice.actions; + +// Selectors +export const selectControllerState = (state: MesheryRootState) => state.controllerState; +export default controllerStateSlice.reducer; diff --git a/src/redux-toolkit/slices/eventsSlice.ts b/src/redux-toolkit/slices/eventsSlice.ts new file mode 100644 index 00000000..ec61c997 --- /dev/null +++ b/src/redux-toolkit/slices/eventsSlice.ts @@ -0,0 +1,25 @@ +import { createSlice, PayloadAction } from '@reduxjs/toolkit'; +import type { MesheryRootState } from '../store'; + +export interface EventsState { + items: any[]; +} + +const initialState: EventsState = { items: [] }; + +const eventsSlice = createSlice({ + name: 'events', + initialState, + reducers: { + setEvents: (state, action: PayloadAction) => { + return action.payload; + } + } +}); + +// Actions +export const { setEvents } = eventsSlice.actions; + +// Selectors +export const selectEvents = (state: MesheryRootState) => state.events; +export default eventsSlice.reducer; diff --git a/src/redux-toolkit/slices/extensionTypeSlice.ts b/src/redux-toolkit/slices/extensionTypeSlice.ts new file mode 100644 index 00000000..183bba44 --- /dev/null +++ b/src/redux-toolkit/slices/extensionTypeSlice.ts @@ -0,0 +1,35 @@ +import { createSlice, PayloadAction } from '@reduxjs/toolkit'; +import type { MesheryReduxAppDispatch, MesheryRootState } from '../store'; + +export interface ExtensionTypeState { + value: string; +} + +const initialState: ExtensionTypeState = { value: '' }; + +const extensionTypeSlice = createSlice({ + name: 'extensionType', + initialState, + reducers: { + setExtensionType: (state, action: PayloadAction) => { + return action.payload; + }, + updateExtensionType: (state: ExtensionTypeState, action: PayloadAction) => { + // TODO: Implement reducer logic for UPDATE_EXTENSION_TYPE + return state; + } + } +}); + +// Actions +export const { setExtensionType } = extensionTypeSlice.actions; + +// Thunk action creator +export const updateExtensionType = + (payload: ExtensionTypeState) => (dispatch: MesheryReduxAppDispatch) => { + dispatch(setExtensionType(payload)); + }; + +// Selectors +export const selectExtensionType = (state: MesheryRootState) => state.extensionType; +export default extensionTypeSlice.reducer; diff --git a/src/redux-toolkit/slices/genSlice.ts b/src/redux-toolkit/slices/genSlice.ts new file mode 100644 index 00000000..1d096814 --- /dev/null +++ b/src/redux-toolkit/slices/genSlice.ts @@ -0,0 +1,27 @@ +import { createSlice, PayloadAction } from '@reduxjs/toolkit'; +import type { MesheryRootState } from '../store'; +// State interface +export interface GenState { + [key: string]: any; +} +// Initial state +const initialState: GenState = 'fortio'; +// Slice +const genSlice = createSlice({ + name: 'gen', + initialState, + reducers: { + setGen: (state, action: PayloadAction) => { + return action.payload; + }, + updateLoadGenConfig: (state: GenState, action: PayloadAction) => { + // TODO: Implement reducer logic for UPDATE_LOAD_GEN_CONFIG + return state; + } + } +}); +// Actions +export const { setGen, updateLoadGenConfig } = genSlice.actions; +// Selectors +export const selectGen = (state: MesheryRootState) => state.gen; +export default genSlice.reducer; diff --git a/src/redux-toolkit/slices/grafanaAPIKeySlice.ts b/src/redux-toolkit/slices/grafanaAPIKeySlice.ts new file mode 100644 index 00000000..a74bcb41 --- /dev/null +++ b/src/redux-toolkit/slices/grafanaAPIKeySlice.ts @@ -0,0 +1,27 @@ +import { createSlice, PayloadAction } from '@reduxjs/toolkit'; +import type { MesheryRootState } from '../store'; +// State interface +export interface GrafanaAPIKeyState { + [key: string]: any; +} +// Initial state +const initialState: GrafanaAPIKeyState = ''; +// Slice +const grafanaAPIKeySlice = createSlice({ + name: 'grafanaAPIKey', + initialState, + reducers: { + setGrafanaAPIKey: (state, action: PayloadAction) => { + return action.payload; + }, + updateGrafanaConfig: (state: GrafanaAPIKeyState, action: PayloadAction) => { + // TODO: Implement reducer logic for UPDATE_GRAFANA_CONFIG + return state; + } + } +}); +// Actions +export const { setGrafanaAPIKey, updateGrafanaConfig } = grafanaAPIKeySlice.actions; +// Selectors +export const selectGrafanaAPIKey = (state: MesheryRootState) => state.grafanaAPIKey; +export default grafanaAPIKeySlice.reducer; diff --git a/src/redux-toolkit/slices/grafanaBoardSearchSlice.ts b/src/redux-toolkit/slices/grafanaBoardSearchSlice.ts new file mode 100644 index 00000000..c1c34e88 --- /dev/null +++ b/src/redux-toolkit/slices/grafanaBoardSearchSlice.ts @@ -0,0 +1,32 @@ +import { createSlice, PayloadAction } from '@reduxjs/toolkit'; +import type { MesheryRootState } from '../store'; +// State interface +export interface GrafanaBoardSearchState { + [key: string]: any; +} +// Initial state +const initialState: GrafanaBoardSearchState = ''; +// Slice +const grafanaBoardSearchSlice = createSlice({ + name: 'grafanaBoardSearch', + initialState, + reducers: { + setGrafanaBoardSearch: (state, action: PayloadAction) => { + return action.payload; + }, + updateGrafanaConfig: (state: GrafanaBoardSearchState, action: PayloadAction) => { + // TODO: Implement reducer logic for UPDATE_GRAFANA_CONFIG + return state; + }, + updateStaticBoardConfig: (state: GrafanaBoardSearchState, action: PayloadAction) => { + // TODO: Implement reducer logic for UPDATE_STATIC_BOARD_CONFIG + return state; + } + } +}); +// Actions +export const { setGrafanaBoardSearch, updateGrafanaConfig, updateStaticBoardConfig } = + grafanaBoardSearchSlice.actions; +// Selectors +export const selectGrafanaBoardSearch = (state: MesheryRootState) => state.grafanaBoardSearch; +export default grafanaBoardSearchSlice.reducer; diff --git a/src/redux-toolkit/slices/grafanaBoardsSlice.ts b/src/redux-toolkit/slices/grafanaBoardsSlice.ts new file mode 100644 index 00000000..7959d700 --- /dev/null +++ b/src/redux-toolkit/slices/grafanaBoardsSlice.ts @@ -0,0 +1,34 @@ +import { createSlice, PayloadAction } from '@reduxjs/toolkit'; +import type { MesheryRootState } from '../store'; + +export interface GrafanaBoardsState { + [key: string]: any; +} + +const initialState: GrafanaBoardsState = []; + +const grafanaBoardsSlice = createSlice({ + name: 'grafanaBoards', + initialState, + reducers: { + setGrafanaBoards: (state, action: PayloadAction) => { + return action.payload; + }, + updateGrafanaConfig: (state: GrafanaBoardsState, action: PayloadAction) => { + // TODO: Implement reducer logic for UPDATE_GRAFANA_CONFIG + return state; + }, + updateStaticBoardConfig: (state: GrafanaBoardsState, action: PayloadAction) => { + // TODO: Implement reducer logic for UPDATE_STATIC_BOARD_CONFIG + return state; + } + } +}); + +// Actions +export const { setGrafanaBoards, updateGrafanaConfig, updateStaticBoardConfig } = + grafanaBoardsSlice.actions; + +// Selectors +export const selectGrafanaBoards = (state: MesheryRootState) => state.grafanaBoards; +export default grafanaBoardsSlice.reducer; diff --git a/src/redux-toolkit/slices/grafanaSlice.ts b/src/redux-toolkit/slices/grafanaSlice.ts new file mode 100644 index 00000000..6b76d116 --- /dev/null +++ b/src/redux-toolkit/slices/grafanaSlice.ts @@ -0,0 +1,34 @@ +import { createSlice, PayloadAction } from '@reduxjs/toolkit'; +import type { MesheryReduxAppDispatch, MesheryRootState } from '../store'; + +export interface GrafanaState { + [key: string]: any; +} + +const initialState: GrafanaState = []; + +const grafanaSlice = createSlice({ + name: 'grafana', + initialState, + reducers: { + setGrafana: (state, action: PayloadAction) => { + return action.payload; + }, + updateGrafanaConfig: (state: GrafanaState, action: PayloadAction) => { + // TODO: Implement reducer logic for UPDATE_GRAFANA_CONFIG + return state; + } + } +}); + +// Actions +export const { setGrafana, updateGrafanaConfig } = grafanaSlice.actions; + +// Thunk action creator +export const updateGrafana = (payload: GrafanaState) => (dispatch: MesheryReduxAppDispatch) => { + dispatch(setGrafana(payload)); +}; + +// Selectors +export const selectGrafana = (state: MesheryRootState) => state.grafana; +export default grafanaSlice.reducer; diff --git a/src/redux-toolkit/slices/grafanaURLSlice.ts b/src/redux-toolkit/slices/grafanaURLSlice.ts new file mode 100644 index 00000000..7066d480 --- /dev/null +++ b/src/redux-toolkit/slices/grafanaURLSlice.ts @@ -0,0 +1,29 @@ +import { createSlice, PayloadAction } from '@reduxjs/toolkit'; +import type { MesheryRootState } from '../store'; + +export interface GrafanaURLState { + [key: string]: any; +} + +const initialState: GrafanaURLState = ''; + +const grafanaURLSlice = createSlice({ + name: 'grafanaURL', + initialState, + reducers: { + setGrafanaURL: (state, action: PayloadAction) => { + return action.payload; + }, + updateGrafanaConfig: (state: GrafanaURLState, action: PayloadAction) => { + // TODO: Implement reducer logic for UPDATE_GRAFANA_CONFIG + return state; + } + } +}); + +// Actions +export const { setGrafanaURL, updateGrafanaConfig } = grafanaURLSlice.actions; + +// Selectors +export const selectGrafanaURL = (state: MesheryRootState) => state.grafanaURL; +export default grafanaURLSlice.reducer; diff --git a/src/redux-toolkit/slices/isBetaSlice.ts b/src/redux-toolkit/slices/isBetaSlice.ts new file mode 100644 index 00000000..a0ebd484 --- /dev/null +++ b/src/redux-toolkit/slices/isBetaSlice.ts @@ -0,0 +1,29 @@ +import { createSlice, PayloadAction } from '@reduxjs/toolkit'; +import type { MesheryRootState } from '../store'; + +export interface IsBetaState { + [key: string]: any; +} + +const initialState: IsBetaState = false; + +const isBetaSlice = createSlice({ + name: 'isBeta', + initialState, + reducers: { + setIsBeta: (state, action: PayloadAction) => { + return action.payload; + }, + updateBetaBadge: (state: IsBetaState, action: PayloadAction) => { + // TODO: Implement reducer logic for UPDATE_BETA_BADGE + return state; + } + } +}); + +// Actions +export const { setIsBeta, updateBetaBadge } = isBetaSlice.actions; + +// Selectors +export const selectIsBeta = (state: MesheryRootState) => state.isBeta; +export default isBetaSlice.reducer; diff --git a/src/redux-toolkit/slices/isDrawerCollapsedSlice.ts b/src/redux-toolkit/slices/isDrawerCollapsedSlice.ts new file mode 100644 index 00000000..dfbd4a1c --- /dev/null +++ b/src/redux-toolkit/slices/isDrawerCollapsedSlice.ts @@ -0,0 +1,29 @@ +import { createSlice, PayloadAction } from '@reduxjs/toolkit'; +import type { MesheryRootState } from '../store'; + +export interface IsDrawerCollapsedState { + [key: string]: any; +} + +const initialState: IsDrawerCollapsedState = false; + +const isDrawerCollapsedSlice = createSlice({ + name: 'isDrawerCollapsed', + initialState, + reducers: { + setIsDrawerCollapsed: (state, action: PayloadAction) => { + return action.payload; + }, + toogleDrawer: (state: IsDrawerCollapsedState, action: PayloadAction) => { + // TODO: Implement reducer logic for TOOGLE_DRAWER + return state; + } + } +}); + +// Actions +export const { setIsDrawerCollapsed, toogleDrawer } = isDrawerCollapsedSlice.actions; + +// Selectors +export const selectIsDrawerCollapsed = (state: MesheryRootState) => state.isDrawerCollapsed; +export default isDrawerCollapsedSlice.reducer; diff --git a/src/redux-toolkit/slices/k8sConfigSlice.ts b/src/redux-toolkit/slices/k8sConfigSlice.ts new file mode 100644 index 00000000..d1e4e2cd --- /dev/null +++ b/src/redux-toolkit/slices/k8sConfigSlice.ts @@ -0,0 +1,61 @@ +import { createSlice, PayloadAction } from '@reduxjs/toolkit'; +import type { MesheryReduxAppDispatch, MesheryRootState } from '../store'; + +export interface K8sConfigState { + [key: string]: any; +} + +const initialState: K8sConfigState = []; + +const k8sConfigSlice = createSlice({ + name: 'k8sConfig', + initialState, + reducers: { + setK8sConfig: (state, action: PayloadAction) => { + return action.payload; + }, + updateClusterConfig: (state: K8sConfigState, action: PayloadAction) => { + // TODO: Implement reducer logic for UPDATE_CLUSTER_CONFIG + return state; + }, + setK8sContext: (state: K8sConfigState, action: PayloadAction) => { + // TODO: Implement reducer logic for SET_K8S_CONTEXT + return state; + }, + updateGrafanaConfig: (state: K8sConfigState, action: PayloadAction) => { + // TODO: Implement reducer logic for UPDATE_GRAFANA_CONFIG + return state; + }, + updatePrometheusConfig: (state: K8sConfigState, action: PayloadAction) => { + // TODO: Implement reducer logic for UPDATE_PROMETHEUS_CONFIG + return state; + }, + updateStaticBoardConfig: (state: K8sConfigState, action: PayloadAction) => { + // TODO: Implement reducer logic for UPDATE_STATIC_BOARD_CONFIG + return state; + }, + updateLoadGenConfig: (state: K8sConfigState, action: PayloadAction) => { + // TODO: Implement reducer logic for UPDATE_LOAD_GEN_CONFIG + return state; + } + } +}); + +export const { + setK8sConfig, + updateClusterConfig, + setK8sContext, + updateGrafanaConfig, + updatePrometheusConfig, + updateStaticBoardConfig, + updateLoadGenConfig +} = k8sConfigSlice.actions; + +// Thunk action creator +export const updateK8sConfig = (payload: K8sConfigState) => (dispatch: MesheryReduxAppDispatch) => { + dispatch(setK8sConfig(payload)); +}; + +// Selectors +export const selectK8sConfig = (state: MesheryRootState) => state.k8sConfig; +export default k8sConfigSlice.reducer; diff --git a/src/redux-toolkit/slices/keysSlice.ts b/src/redux-toolkit/slices/keysSlice.ts new file mode 100644 index 00000000..881fea5f --- /dev/null +++ b/src/redux-toolkit/slices/keysSlice.ts @@ -0,0 +1,36 @@ +import { createSlice, PayloadAction } from '@reduxjs/toolkit'; +import type { MesheryReduxAppDispatch, MesheryRootState } from '../store'; + +export interface KeysState { + [key: string]: any; +} + +const initialState: KeysState = null; + +const keysSlice = createSlice({ + name: 'keys', + initialState, + reducers: { + /* + setKeys: (state, action: PayloadAction) => { + return action.payload; + }, + */ + setKeys: (state: KeysState, action: PayloadAction) => { + // TODO: Implement reducer logic for SET_KEYS + return state; + } + } +}); + +// Actions +export const { setKeys } = keysSlice.actions; + +// Thunk action creator +export const updateKeys = (payload: KeysState) => (dispatch: MesheryReduxAppDispatch) => { + dispatch(setKeys(payload)); +}; + +// Selectors +export const selectKeys = (state: MesheryRootState) => state.keys; +export default keysSlice.reducer; diff --git a/src/redux-toolkit/slices/loadTestPrefSlice.ts b/src/redux-toolkit/slices/loadTestPrefSlice.ts new file mode 100644 index 00000000..1f761427 --- /dev/null +++ b/src/redux-toolkit/slices/loadTestPrefSlice.ts @@ -0,0 +1,46 @@ +import { createSlice, PayloadAction } from '@reduxjs/toolkit'; +import type { MesheryReduxAppDispatch, MesheryRootState } from '../store'; + +export interface LoadTestPrefState { + [key: string]: any; +} + +const initialState: LoadTestPrefState = { + qps: 0, + t: '30s', + c: 0, + gen: 'fortio', + ts: new Date() +}; + +const loadTestPrefSlice = createSlice({ + name: 'loadTestPref', + initialState, + reducers: { + setLoadTestPref: (state, action: PayloadAction) => { + return action.payload; + }, + updateLoadTestData: (state: LoadTestPrefState, action: PayloadAction) => { + // TODO: Implement reducer logic for UPDATE_LOAD_TEST_DATA + return state; + }, + updateLoadGenConfig: (state: LoadTestPrefState, action: PayloadAction) => { + // TODO: Implement reducer logic for UPDATE_LOAD_GEN_CONFIG + return state; + } + } +}); + +// Actions +export const { setLoadTestPref, updateLoadTestData, updateLoadGenConfig } = + loadTestPrefSlice.actions; + +// Thunk action creator +export const updateLoadTestPref = + (payload: LoadTestPrefState) => (dispatch: MesheryReduxAppDispatch) => { + dispatch(setLoadTestPref(payload)); + }; + +// Selectors +export const selectLoadTestPref = (state: MesheryRootState) => state.loadTestPref; +export default loadTestPrefSlice.reducer; diff --git a/src/redux-toolkit/slices/loadTestSlice.ts b/src/redux-toolkit/slices/loadTestSlice.ts new file mode 100644 index 00000000..27a09008 --- /dev/null +++ b/src/redux-toolkit/slices/loadTestSlice.ts @@ -0,0 +1,52 @@ +import { createSlice, PayloadAction } from '@reduxjs/toolkit'; +import type { MesheryReduxAppDispatch, MesheryRootState } from '../store'; + +export interface LoadTestState { + testName: string; + meshName: string; + url: string; + qps: number; + c: number; + t: string; + result: {}; +} + +const initialState: LoadTestState = { + testName: '', + meshName: '', + url: '', + qps: 0, + c: 0, + t: '30s', + result: {} +}; + +const loadTestSlice = createSlice({ + name: 'loadTest', + initialState, + reducers: { + setLoadTest: (state, action: PayloadAction) => { + return action.payload; + }, + updateLoadTestData: (state: LoadTestState, action: PayloadAction) => { + // TODO: Implement reducer logic for UPDATE_LOAD_TEST_DATA + return state; + }, + updateLoadGenConfig: (state: LoadTestState, action: PayloadAction) => { + // TODO: Implement reducer logic for UPDATE_LOAD_GEN_CONFIG + return state; + } + } +}); + +// Actions +export const { setLoadTest, updateLoadTestData, updateLoadGenConfig } = loadTestSlice.actions; + +// Thunk action creator +export const updateLoadTest = (payload: LoadTestState) => (dispatch: MesheryReduxAppDispatch) => { + dispatch(setLoadTest(payload)); +}; + +// Selectors +export const selectLoadTest = (state: MesheryRootState) => state.loadTest; +export default loadTestSlice.reducer; diff --git a/src/redux-toolkit/slices/meshAdaptersSlice.ts b/src/redux-toolkit/slices/meshAdaptersSlice.ts new file mode 100644 index 00000000..04623cd2 --- /dev/null +++ b/src/redux-toolkit/slices/meshAdaptersSlice.ts @@ -0,0 +1,33 @@ +import { createSlice, PayloadAction } from '@reduxjs/toolkit'; +import type { MesheryRootState } from '../store'; + +export interface MeshAdaptersState { + items: any[]; +} + +const initialState: MeshAdaptersState = { items: [] }; + +const meshAdaptersSlice = createSlice({ + name: 'meshAdapters', + initialState, + reducers: { + setMeshAdapters: (state, action: PayloadAction) => { + return action.payload; + }, + updateAdaptersInfo: (state: MeshAdaptersState, action: PayloadAction) => { + // TODO: Implement reducer logic for UPDATE_ADAPTERS_INFO + return state; + }, + setAdapter: (state: MeshAdaptersState, action: PayloadAction) => { + // TODO: Implement reducer logic for SET_ADAPTER + return state; + } + } +}); + +// Actions +export const { setMeshAdapters, updateAdaptersInfo, setAdapter } = meshAdaptersSlice.actions; + +// Selectors +export const selectMeshAdapters = (state: MesheryRootState) => state.meshAdapters; +export default meshAdaptersSlice.reducer; diff --git a/src/redux-toolkit/slices/meshAdapterstsSlice.ts b/src/redux-toolkit/slices/meshAdapterstsSlice.ts new file mode 100644 index 00000000..2d510530 --- /dev/null +++ b/src/redux-toolkit/slices/meshAdapterstsSlice.ts @@ -0,0 +1,33 @@ +import { createSlice, PayloadAction } from '@reduxjs/toolkit'; +import type { MesheryRootState } from '../store'; + +export interface MeshAdapterstsState { + value: Date; +} + +const initialState: MeshAdapterstsState = { value: new Date() }; + +const meshAdapterstsSlice = createSlice({ + name: 'meshAdaptersts', + initialState, + reducers: { + setMeshAdaptersts: (state, action: PayloadAction) => { + return action.payload; + }, + updateAdaptersInfo: (state: MeshAdapterstsState, action: PayloadAction) => { + // TODO: Implement reducer logic for UPDATE_ADAPTERS_INFO + return state; + }, + setAdapter: (state: MeshAdapterstsState, action: PayloadAction) => { + // TODO: Implement reducer logic for SET_ADAPTER + return state; + } + } +}); + +// Actions +export const { setMeshAdaptersts, updateAdaptersInfo, setAdapter } = meshAdapterstsSlice.actions; + +// Selectors +export const selectMeshAdaptersts = (state: MesheryRootState) => state.meshAdaptersts; +export default meshAdapterstsSlice.reducer; diff --git a/src/redux-toolkit/slices/meshNameSlice.ts b/src/redux-toolkit/slices/meshNameSlice.ts new file mode 100644 index 00000000..c257b151 --- /dev/null +++ b/src/redux-toolkit/slices/meshNameSlice.ts @@ -0,0 +1,23 @@ +import { createSlice, PayloadAction } from '@reduxjs/toolkit'; +import type { MesheryRootState } from '../store'; +// State interface +export interface MeshNameState { + [key: string]: any; +} +// Initial state +const initialState: MeshNameState = ''; +// Slice +const meshNameSlice = createSlice({ + name: 'meshName', + initialState, + reducers: { + setMeshName: (state, action: PayloadAction) => { + return action.payload; + } + } +}); +// Actions +export const { setMeshName } = meshNameSlice.actions; +// Selectors +export const selectMeshName = (state: MesheryRootState) => state.meshName; +export default meshNameSlice.reducer; diff --git a/src/redux-toolkit/slices/meshSyncStateSlice.ts b/src/redux-toolkit/slices/meshSyncStateSlice.ts new file mode 100644 index 00000000..54964b20 --- /dev/null +++ b/src/redux-toolkit/slices/meshSyncStateSlice.ts @@ -0,0 +1,34 @@ +import { createSlice, PayloadAction } from '@reduxjs/toolkit'; +import type { MesheryRootState } from '../store'; + +export interface MeshSyncStateState { + value: any; +} + +const initialState: MeshSyncStateState = { value: null }; + +const meshSyncStateSlice = createSlice({ + name: 'meshSyncState', + initialState, + reducers: { + setMeshSyncState: (state, action: PayloadAction) => { + return action.payload; + }, + setControllerState: (state: MeshSyncStateState, action: PayloadAction) => { + // TODO: Implement reducer logic for SET_CONTROLLER_STATE + return state; + }, + setMeshsyncSubscription: (state: MeshSyncStateState, action: PayloadAction) => { + // TODO: Implement reducer logic for SET_MESHSYNC_SUBSCRIPTION + return state; + } + } +}); + +// Actions +export const { setMeshSyncState, setControllerState, setMeshsyncSubscription } = + meshSyncStateSlice.actions; + +// Selectors +export const selectMeshSyncState = (state: MesheryRootState) => state.meshSyncState; +export default meshSyncStateSlice.reducer; diff --git a/src/redux-toolkit/slices/notificationCenterSlice.ts b/src/redux-toolkit/slices/notificationCenterSlice.ts new file mode 100644 index 00000000..138f1d94 --- /dev/null +++ b/src/redux-toolkit/slices/notificationCenterSlice.ts @@ -0,0 +1,35 @@ +import { createSlice, PayloadAction } from '@reduxjs/toolkit'; +import type { MesheryReduxAppDispatch, MesheryRootState } from '../store'; + +export interface NotificationCenterState { + openEventId: any; + showFullNotificationCenter: boolean; +} + +const initialState: NotificationCenterState = { + openEventId: null, + showFullNotificationCenter: false +}; + +const notificationCenterSlice = createSlice({ + name: 'notificationCenter', + initialState, + reducers: { + setNotificationCenter: (state, action: PayloadAction) => { + return action.payload; + } + } +}); + +// Actions +export const { setNotificationCenter } = notificationCenterSlice.actions; + +// Thunk action creator +export const updateNotificationCenter = + (payload: NotificationCenterState) => (dispatch: MesheryReduxAppDispatch) => { + dispatch(setNotificationCenter(payload)); + }; + +// Selectors +export const selectNotificationCenter = (state: MesheryRootState) => state.notificationCenter; +export default notificationCenterSlice.reducer; diff --git a/src/redux-toolkit/slices/openEventIdSlice.ts b/src/redux-toolkit/slices/openEventIdSlice.ts new file mode 100644 index 00000000..ec01c21d --- /dev/null +++ b/src/redux-toolkit/slices/openEventIdSlice.ts @@ -0,0 +1,25 @@ +import { createSlice, PayloadAction } from '@reduxjs/toolkit'; +import type { MesheryRootState } from '../store'; + +export interface OpenEventIdState { + [key: string]: any; +} + +const initialState: OpenEventIdState = null; + +const openEventIdSlice = createSlice({ + name: 'openEventId', + initialState, + reducers: { + setOpenEventId: (state, action: PayloadAction) => { + return action.payload; + } + } +}); + +// Actions +export const { setOpenEventId } = openEventIdSlice.actions; + +// Selectors +export const selectOpenEventId = (state: MesheryRootState) => state.openEventId; +export default openEventIdSlice.reducer; diff --git a/src/redux-toolkit/slices/operatorStateSlice.ts b/src/redux-toolkit/slices/operatorStateSlice.ts new file mode 100644 index 00000000..98fc65c6 --- /dev/null +++ b/src/redux-toolkit/slices/operatorStateSlice.ts @@ -0,0 +1,34 @@ +import { createSlice, PayloadAction } from '@reduxjs/toolkit'; +import type { MesheryRootState } from '../store'; + +export interface OperatorStateState { + value: any; +} + +const initialState: OperatorStateState = { value: null }; + +const operatorStateSlice = createSlice({ + name: 'operatorState', + initialState, + reducers: { + setOperatorState: (state, action: PayloadAction) => { + return action.payload; + }, + setOperatorSubscription: (state: OperatorStateState, action: PayloadAction) => { + // TODO: Implement reducer logic for SET_OPERATOR_SUBSCRIPTION + return state; + }, + setControllerState: (state: OperatorStateState, action: PayloadAction) => { + // TODO: Implement reducer logic for SET_CONTROLLER_STATE + return state; + } + } +}); + +// Actions +export const { setOperatorState, setOperatorSubscription, setControllerState } = + operatorStateSlice.actions; + +// Selectors +export const selectOperatorState = (state: MesheryRootState) => state.operatorState; +export default operatorStateSlice.reducer; diff --git a/src/redux-toolkit/slices/organizationSlice.ts b/src/redux-toolkit/slices/organizationSlice.ts new file mode 100644 index 00000000..3fd47add --- /dev/null +++ b/src/redux-toolkit/slices/organizationSlice.ts @@ -0,0 +1,30 @@ +import { createSlice, PayloadAction } from '@reduxjs/toolkit'; +import type { MesheryRootState } from '../store'; +export interface OrganizationState { + value: any; +} + +const initialState: OrganizationState = { value: null }; + +const organizationSlice = createSlice({ + name: 'organization', + initialState, + reducers: { + /* + setOrganization: (state, action: PayloadAction) => { + return action.payload; + }, + */ + setOrganization: (state: OrganizationState, action: PayloadAction) => { + // TODO: Implement reducer logic for SET_ORGANIZATION + return state; + } + } +}); + +// Actions +export const { setOrganization } = organizationSlice.actions; + +// Selectors +export const selectOrganization = (state: MesheryRootState) => state.organization; +export default organizationSlice.reducer; diff --git a/src/redux-toolkit/slices/pageSlice.ts b/src/redux-toolkit/slices/pageSlice.ts new file mode 100644 index 00000000..4761ff5a --- /dev/null +++ b/src/redux-toolkit/slices/pageSlice.ts @@ -0,0 +1,39 @@ +import { createSlice, PayloadAction } from '@reduxjs/toolkit'; +import type { MesheryReduxAppDispatch, MesheryRootState } from '../store'; + +export interface PageState { + path: string; + title: string; + isBeta: boolean; +} + +const initialState: PageState = { + path: '', + title: '', + isBeta: false +}; + +const pageSlice = createSlice({ + name: 'page', + initialState, + reducers: { + setPage: (state, action: PayloadAction) => { + return action.payload; + }, + updatePage: (state: PageState, action: PayloadAction) => { + // TODO: Implement reducer logic for UPDATE_PAGE + return state; + } + } +}); + +export const { setPage } = pageSlice.actions; + +// Thunk action creator +export const updatePage = (payload: PageState) => (dispatch: MesheryReduxAppDispatch) => { + dispatch(setPage(payload)); +}; + +// Selectors +export const selectPage = (state: MesheryRootState) => state.page; +export default pageSlice.reducer; diff --git a/src/redux-toolkit/slices/pathSlice.ts b/src/redux-toolkit/slices/pathSlice.ts new file mode 100644 index 00000000..4f1b7ed8 --- /dev/null +++ b/src/redux-toolkit/slices/pathSlice.ts @@ -0,0 +1,23 @@ +import { createSlice, PayloadAction } from '@reduxjs/toolkit'; +import type { MesheryRootState } from '../store'; +// State interface +export interface PathState { + [key: string]: any; +} +// Initial state +const initialState: PathState = ''; +// Slice +const pathSlice = createSlice({ + name: 'path', + initialState, + reducers: { + setPath: (state, action: PayloadAction) => { + return action.payload; + } + } +}); +// Actions +export const { setPath } = pathSlice.actions; +// Selectors +export const selectPath = (state: MesheryRootState) => state.path; +export default pathSlice.reducer; diff --git a/src/redux-toolkit/slices/prometheusSlice.ts b/src/redux-toolkit/slices/prometheusSlice.ts new file mode 100644 index 00000000..9483eb18 --- /dev/null +++ b/src/redux-toolkit/slices/prometheusSlice.ts @@ -0,0 +1,41 @@ +import { createSlice, PayloadAction } from '@reduxjs/toolkit'; +import type { MesheryReduxAppDispatch, MesheryRootState } from '../store'; + +export interface PrometheusState { + prometheusURL: string; + selectedPrometheusBoardsConfigs: any[]; + ts: Date; +} + +const initialState: PrometheusState = { + prometheusURL: '', + selectedPrometheusBoardsConfigs: [], + ts: new Date() +}; + +const prometheusSlice = createSlice({ + name: 'prometheus', + initialState, + reducers: { + setPrometheus: (state, action: PayloadAction) => { + return action.payload; + }, + updatePrometheusConfig: (state: PrometheusState, action: PayloadAction) => { + // TODO: Implement reducer logic for UPDATE_PROMETHEUS_CONFIG + return state; + } + } +}); + +// Actions +export const { setPrometheus, updatePrometheusConfig } = prometheusSlice.actions; + +// Thunk action creator +export const updatePrometheus = + (payload: PrometheusState) => (dispatch: MesheryReduxAppDispatch) => { + dispatch(setPrometheus(payload)); + }; + +// Selectors +export const selectPrometheus = (state: MesheryRootState) => state.prometheus; +export default prometheusSlice.reducer; diff --git a/src/redux-toolkit/slices/prometheusURLSlice.ts b/src/redux-toolkit/slices/prometheusURLSlice.ts new file mode 100644 index 00000000..b4980001 --- /dev/null +++ b/src/redux-toolkit/slices/prometheusURLSlice.ts @@ -0,0 +1,27 @@ +import { createSlice, PayloadAction } from '@reduxjs/toolkit'; +import type { MesheryRootState } from '../store'; +// State interface +export interface PrometheusURLState { + [key: string]: any; +} +// Initial state +const initialState: PrometheusURLState = ''; +// Slice +const prometheusURLSlice = createSlice({ + name: 'prometheusURL', + initialState, + reducers: { + setPrometheusURL: (state, action: PayloadAction) => { + return action.payload; + }, + updatePrometheusConfig: (state: PrometheusURLState, action: PayloadAction) => { + // TODO: Implement reducer logic for UPDATE_PROMETHEUS_CONFIG + return state; + } + } +}); +// Actions +export const { setPrometheusURL, updatePrometheusConfig } = prometheusURLSlice.actions; +// Selectors +export const selectPrometheusURL = (state: MesheryRootState) => state.prometheusURL; +export default prometheusURLSlice.reducer; diff --git a/src/redux-toolkit/slices/qpsSlice.ts b/src/redux-toolkit/slices/qpsSlice.ts new file mode 100644 index 00000000..2a0fd8a8 --- /dev/null +++ b/src/redux-toolkit/slices/qpsSlice.ts @@ -0,0 +1,23 @@ +import { createSlice, PayloadAction } from '@reduxjs/toolkit'; +import type { MesheryRootState } from '../store'; +// State interface +export interface QpsState { + [key: string]: any; +} +// Initial state +const initialState: QpsState = 0; +// Slice +const qpsSlice = createSlice({ + name: 'qps', + initialState, + reducers: { + setQps: (state, action: PayloadAction) => { + return action.payload; + } + } +}); +// Actions +export const { setQps } = qpsSlice.actions; +// Selectors +export const selectQps = (state: MesheryRootState) => state.qps; +export default qpsSlice.reducer; diff --git a/src/redux-toolkit/slices/resultSlice.ts b/src/redux-toolkit/slices/resultSlice.ts new file mode 100644 index 00000000..8af67ea0 --- /dev/null +++ b/src/redux-toolkit/slices/resultSlice.ts @@ -0,0 +1,23 @@ +import { createSlice, PayloadAction } from '@reduxjs/toolkit'; +import type { MesheryRootState } from '../store'; +// State interface +export interface ResultState { + [key: string]: any; +} +// Initial state +const initialState: ResultState = {}; +// Slice +const resultSlice = createSlice({ + name: 'result', + initialState, + reducers: { + setResult: (state, action: PayloadAction) => { + return action.payload; + } + } +}); +// Actions +export const { setResult } = resultSlice.actions; +// Selectors +export const selectResult = (state: MesheryRootState) => state.result; +export default resultSlice.reducer; diff --git a/src/redux-toolkit/slices/resultsSlice.ts b/src/redux-toolkit/slices/resultsSlice.ts new file mode 100644 index 00000000..98b2b0c6 --- /dev/null +++ b/src/redux-toolkit/slices/resultsSlice.ts @@ -0,0 +1,51 @@ +import { createSlice, PayloadAction } from '@reduxjs/toolkit'; +import type { MesheryReduxAppDispatch, MesheryRootState } from '../store'; + +export interface ResultsState { + startKey: string; + results: any[]; +} + +const initialState: ResultsState = { + startKey: '', + results: [] +}; + +const resultsSlice = createSlice({ + name: 'results', + initialState, + reducers: { + setResults: (state, action: PayloadAction) => { + return action.payload; + }, + updateResultsSelection: (state: ResultsState, action: PayloadAction) => { + // TODO: Implement reducer logic for UPDATE_RESULTS_SELECTION + return state; + }, + clearResultsSelection: (state: ResultsState, action: PayloadAction) => { + // TODO: Implement reducer logic for CLEAR_RESULTS_SELECTION + return state; + }, + updateAnonymousPerformanceResults: (state: ResultsState, action: PayloadAction) => { + // TODO: Implement reducer logic for UPDATE_ANONYMOUS_PERFORMANCE_RESULTS + return state; + } + } +}); + +// Actions +export const { + setResults, + updateResultsSelection, + clearResultsSelection, + updateAnonymousPerformanceResults +} = resultsSlice.actions; + +// Thunk action creator +export const updateResults = (payload: ResultsState) => (dispatch: MesheryReduxAppDispatch) => { + dispatch(setResults(payload)); +}; + +// Selectors +export const selectResults = (state: MesheryRootState) => state.results; +export default resultsSlice.reducer; diff --git a/src/redux-toolkit/slices/results_selectionSlice.ts b/src/redux-toolkit/slices/results_selectionSlice.ts new file mode 100644 index 00000000..79f50012 --- /dev/null +++ b/src/redux-toolkit/slices/results_selectionSlice.ts @@ -0,0 +1,43 @@ +import { createSlice, PayloadAction } from '@reduxjs/toolkit'; +import type { MesheryRootState } from '../store'; +// State interface +export interface Results_selectionState { + [key: string]: any; +} +// Initial state +const initialState: Results_selectionState = {}; +// Slice +const results_selectionSlice = createSlice({ + name: 'results_selection', + initialState, + reducers: { + setResults_selection: (state, action: PayloadAction) => { + return action.payload; + }, + updateResultsSelection: (state: Results_selectionState, action: PayloadAction) => { + // TODO: Implement reducer logic for UPDATE_RESULTS_SELECTION + return state; + }, + clearResultsSelection: (state: Results_selectionState, action: PayloadAction) => { + // TODO: Implement reducer logic for CLEAR_RESULTS_SELECTION + return state; + }, + updateAnonymousPerformanceResults: ( + state: Results_selectionState, + action: PayloadAction + ) => { + // TODO: Implement reducer logic for UPDATE_ANONYMOUS_PERFORMANCE_RESULTS + return state; + } + } +}); +// Actions +export const { + setResults_selection, + updateResultsSelection, + clearResultsSelection, + updateAnonymousPerformanceResults +} = results_selectionSlice.actions; +// Selectors +export const selectResults_selection = (state: MesheryRootState) => state.results_selection; +export default results_selectionSlice.reducer; diff --git a/src/redux-toolkit/slices/selectedAdapterSlice.ts b/src/redux-toolkit/slices/selectedAdapterSlice.ts new file mode 100644 index 00000000..ffe53d9f --- /dev/null +++ b/src/redux-toolkit/slices/selectedAdapterSlice.ts @@ -0,0 +1,27 @@ +import { createSlice, PayloadAction } from '@reduxjs/toolkit'; +import type { MesheryRootState } from '../store'; +// State interface +export interface SelectedAdapterState { + [key: string]: any; +} +// Initial state +const initialState: SelectedAdapterState = ''; +// Slice +const selectedAdapterSlice = createSlice({ + name: 'selectedAdapter', + initialState, + reducers: { + setSelectedAdapter: (state, action: PayloadAction) => { + return action.payload; + }, + setAdapter: (state: SelectedAdapterState, action: PayloadAction) => { + // TODO: Implement reducer logic for SET_ADAPTER + return state; + } + } +}); +// Actions +export const { setSelectedAdapter, setAdapter } = selectedAdapterSlice.actions; +// Selectors +export const selectSelectedAdapter = (state: MesheryRootState) => state.selectedAdapter; +export default selectedAdapterSlice.reducer; diff --git a/src/redux-toolkit/slices/selectedBoardsConfigsSlice.ts b/src/redux-toolkit/slices/selectedBoardsConfigsSlice.ts new file mode 100644 index 00000000..1d3ee33a --- /dev/null +++ b/src/redux-toolkit/slices/selectedBoardsConfigsSlice.ts @@ -0,0 +1,50 @@ +import { createSlice, PayloadAction } from '@reduxjs/toolkit'; +import type { MesheryRootState } from '../store'; +// State interface +export interface SelectedBoardsConfigsState { + [key: string]: any; +} +// Initial state +const initialState: SelectedBoardsConfigsState = []; +// Slice +const selectedBoardsConfigsSlice = createSlice({ + name: 'selectedBoardsConfigs', + initialState, + reducers: { + setSelectedBoardsConfigs: (state, action: PayloadAction) => { + return action.payload; + }, + updateClusterConfig: (state: SelectedBoardsConfigsState, action: PayloadAction) => { + // TODO: Implement reducer logic for UPDATE_CLUSTER_CONFIG + return state; + }, + updateGrafanaConfig: (state: SelectedBoardsConfigsState, action: PayloadAction) => { + // TODO: Implement reducer logic for UPDATE_GRAFANA_CONFIG + return state; + }, + updatePrometheusConfig: (state: SelectedBoardsConfigsState, action: PayloadAction) => { + // TODO: Implement reducer logic for UPDATE_PROMETHEUS_CONFIG + return state; + }, + updateStaticBoardConfig: (state: SelectedBoardsConfigsState, action: PayloadAction) => { + // TODO: Implement reducer logic for UPDATE_STATIC_BOARD_CONFIG + return state; + }, + updateLoadGenConfig: (state: SelectedBoardsConfigsState, action: PayloadAction) => { + // TODO: Implement reducer logic for UPDATE_LOAD_GEN_CONFIG + return state; + } + } +}); +// Actions +export const { + setSelectedBoardsConfigs, + updateClusterConfig, + updateGrafanaConfig, + updatePrometheusConfig, + updateStaticBoardConfig, + updateLoadGenConfig +} = selectedBoardsConfigsSlice.actions; +// Selectors +export const selectSelectedBoardsConfigs = (state: MesheryRootState) => state.selectedBoardsConfigs; +export default selectedBoardsConfigsSlice.reducer; diff --git a/src/redux-toolkit/slices/selectedK8sContextsSlice.ts b/src/redux-toolkit/slices/selectedK8sContextsSlice.ts new file mode 100644 index 00000000..1a7d3804 --- /dev/null +++ b/src/redux-toolkit/slices/selectedK8sContextsSlice.ts @@ -0,0 +1,28 @@ +import { createSlice, PayloadAction } from '@reduxjs/toolkit'; +import type { MesheryRootState } from '../store'; + +export interface SelectedK8sContextsState { + [key: string]: any; +} + +const initialState: SelectedK8sContextsState = ['all']; +// Slice +const selectedK8sContextsSlice = createSlice({ + name: 'selectedK8sContexts', + initialState, + reducers: { + setSelectedK8sContexts: (state, action: PayloadAction) => { + return action.payload; + }, + setK8sContext: (state: SelectedK8sContextsState, action: PayloadAction) => { + // TODO: Implement reducer logic for SET_K8S_CONTEXT + return state; + } + } +}); + +export const { setSelectedK8sContexts, setK8sContext } = selectedK8sContextsSlice.actions; + +// Selectors +export const selectSelectedK8sContexts = (state: MesheryRootState) => state.selectedK8sContexts; +export default selectedK8sContextsSlice.reducer; diff --git a/src/redux-toolkit/slices/selectedPrometheusBoardsConfigsSlice.ts b/src/redux-toolkit/slices/selectedPrometheusBoardsConfigsSlice.ts new file mode 100644 index 00000000..a98279df --- /dev/null +++ b/src/redux-toolkit/slices/selectedPrometheusBoardsConfigsSlice.ts @@ -0,0 +1,70 @@ +import { createSlice, PayloadAction } from '@reduxjs/toolkit'; +import type { MesheryRootState } from '../store'; + +export interface SelectedPrometheusBoardsConfigsState { + [key: string]: any; +} + +const initialState: SelectedPrometheusBoardsConfigsState = []; + +const selectedPrometheusBoardsConfigsSlice = createSlice({ + name: 'selectedPrometheusBoardsConfigs', + initialState, + reducers: { + setSelectedPrometheusBoardsConfigs: ( + state, + action: PayloadAction + ) => { + return action.payload; + }, + updateClusterConfig: ( + state: SelectedPrometheusBoardsConfigsState, + action: PayloadAction + ) => { + // TODO: Implement reducer logic for UPDATE_CLUSTER_CONFIG + return state; + }, + updateGrafanaConfig: ( + state: SelectedPrometheusBoardsConfigsState, + action: PayloadAction + ) => { + // TODO: Implement reducer logic for UPDATE_GRAFANA_CONFIG + return state; + }, + updatePrometheusConfig: ( + state: SelectedPrometheusBoardsConfigsState, + action: PayloadAction + ) => { + // TODO: Implement reducer logic for UPDATE_PROMETHEUS_CONFIG + return state; + }, + updateStaticBoardConfig: ( + state: SelectedPrometheusBoardsConfigsState, + action: PayloadAction + ) => { + // TODO: Implement reducer logic for UPDATE_STATIC_BOARD_CONFIG + return state; + }, + updateLoadGenConfig: ( + state: SelectedPrometheusBoardsConfigsState, + action: PayloadAction + ) => { + // TODO: Implement reducer logic for UPDATE_LOAD_GEN_CONFIG + return state; + } + } +}); + +export const { + setSelectedPrometheusBoardsConfigs, + updateClusterConfig, + updateGrafanaConfig, + updatePrometheusConfig, + updateStaticBoardConfig, + updateLoadGenConfig +} = selectedPrometheusBoardsConfigsSlice.actions; + +// Selectors +export const selectSelectedPrometheusBoardsConfigs = (state: MesheryRootState) => + state.selectedPrometheusBoardsConfigs; +export default selectedPrometheusBoardsConfigsSlice.reducer; diff --git a/src/redux-toolkit/slices/showFullNotificationCenterSlice.ts b/src/redux-toolkit/slices/showFullNotificationCenterSlice.ts new file mode 100644 index 00000000..f0ca8218 --- /dev/null +++ b/src/redux-toolkit/slices/showFullNotificationCenterSlice.ts @@ -0,0 +1,27 @@ +import { createSlice, PayloadAction } from '@reduxjs/toolkit'; +import type { MesheryRootState } from '../store'; +// State interface +export interface ShowFullNotificationCenterState { + [key: string]: any; +} +// Initial state +const initialState: ShowFullNotificationCenterState = false; +// Slice +const showFullNotificationCenterSlice = createSlice({ + name: 'showFullNotificationCenter', + initialState, + reducers: { + setShowFullNotificationCenter: ( + state, + action: PayloadAction + ) => { + return action.payload; + } + } +}); +// Actions +export const { setShowFullNotificationCenter } = showFullNotificationCenterSlice.actions; +// Selectors +export const selectShowFullNotificationCenter = (state: MesheryRootState) => + state.showFullNotificationCenter; +export default showFullNotificationCenterSlice.reducer; diff --git a/src/redux-toolkit/slices/showProgressSlice.ts b/src/redux-toolkit/slices/showProgressSlice.ts new file mode 100644 index 00000000..cfb41271 --- /dev/null +++ b/src/redux-toolkit/slices/showProgressSlice.ts @@ -0,0 +1,27 @@ +import { createSlice, PayloadAction } from '@reduxjs/toolkit'; +import type { MesheryRootState } from '../store'; +// State interface +export interface ShowProgressState { + [key: string]: any; +} +// Initial state +const initialState: ShowProgressState = false; +// Slice +const showProgressSlice = createSlice({ + name: 'showProgress', + initialState, + reducers: { + setShowProgress: (state, action: PayloadAction) => { + return action.payload; + }, + updateProgress: (state: ShowProgressState, action: PayloadAction) => { + // TODO: Implement reducer logic for UPDATE_PROGRESS + return state; + } + } +}); +// Actions +export const { setShowProgress, updateProgress } = showProgressSlice.actions; +// Selectors +export const selectShowProgress = (state: MesheryRootState) => state.showProgress; +export default showProgressSlice.reducer; diff --git a/src/redux-toolkit/slices/startKeySlice.ts b/src/redux-toolkit/slices/startKeySlice.ts new file mode 100644 index 00000000..e0eb5bcc --- /dev/null +++ b/src/redux-toolkit/slices/startKeySlice.ts @@ -0,0 +1,23 @@ +import { createSlice, PayloadAction } from '@reduxjs/toolkit'; +import type { MesheryRootState } from '../store'; +// State interface +export interface StartKeyState { + [key: string]: any; +} +// Initial state +const initialState: StartKeyState = ''; +// Slice +const startKeySlice = createSlice({ + name: 'startKey', + initialState, + reducers: { + setStartKey: (state, action: PayloadAction) => { + return action.payload; + } + } +}); +// Actions +export const { setStartKey } = startKeySlice.actions; +// Selectors +export const selectStartKey = (state: MesheryRootState) => state.startKey; +export default startKeySlice.reducer; diff --git a/src/redux-toolkit/slices/staticPrometheusBoardConfigSlice.ts b/src/redux-toolkit/slices/staticPrometheusBoardConfigSlice.ts new file mode 100644 index 00000000..1dd79248 --- /dev/null +++ b/src/redux-toolkit/slices/staticPrometheusBoardConfigSlice.ts @@ -0,0 +1,66 @@ +import { createSlice, PayloadAction } from '@reduxjs/toolkit'; +import type { MesheryReduxAppDispatch, MesheryRootState } from '../store'; + +export interface StaticPrometheusBoardConfigState {} + +const initialState: StaticPrometheusBoardConfigState = {}; + +const staticPrometheusBoardConfigSlice = createSlice({ + name: 'staticPrometheusBoardConfig', + initialState, + reducers: { + setStaticPrometheusBoardConfig: ( + state, + action: PayloadAction + ) => { + return action.payload; + }, + updateClusterConfig: (state: StaticPrometheusBoardConfigState, action: PayloadAction) => { + // TODO: Implement reducer logic for UPDATE_CLUSTER_CONFIG + return state; + }, + updateGrafanaConfig: (state: StaticPrometheusBoardConfigState, action: PayloadAction) => { + // TODO: Implement reducer logic for UPDATE_GRAFANA_CONFIG + return state; + }, + updatePrometheusConfig: ( + state: StaticPrometheusBoardConfigState, + action: PayloadAction + ) => { + // TODO: Implement reducer logic for UPDATE_PROMETHEUS_CONFIG + return state; + }, + updateStaticBoardConfig: ( + state: StaticPrometheusBoardConfigState, + action: PayloadAction + ) => { + // TODO: Implement reducer logic for UPDATE_STATIC_BOARD_CONFIG + return state; + }, + updateLoadGenConfig: (state: StaticPrometheusBoardConfigState, action: PayloadAction) => { + // TODO: Implement reducer logic for UPDATE_LOAD_GEN_CONFIG + return state; + } + } +}); + +// Actions +export const { + setStaticPrometheusBoardConfig, + updateClusterConfig, + updateGrafanaConfig, + updatePrometheusConfig, + updateStaticBoardConfig, + updateLoadGenConfig +} = staticPrometheusBoardConfigSlice.actions; + +// Thunk action creator +export const updateStaticPrometheusBoardConfig = + (payload: StaticPrometheusBoardConfigState) => (dispatch: MesheryReduxAppDispatch) => { + dispatch(setStaticPrometheusBoardConfig(payload)); + }; + +// Selectors +export const selectStaticPrometheusBoardConfig = (state: MesheryRootState) => + state.staticPrometheusBoardConfig; +export default staticPrometheusBoardConfigSlice.reducer; diff --git a/src/redux-toolkit/slices/tSlice.ts b/src/redux-toolkit/slices/tSlice.ts new file mode 100644 index 00000000..b7818a79 --- /dev/null +++ b/src/redux-toolkit/slices/tSlice.ts @@ -0,0 +1,23 @@ +import { createSlice, PayloadAction } from '@reduxjs/toolkit'; +import type { MesheryRootState } from '../store'; +// State interface +export interface TState { + [key: string]: any; +} +// Initial state +const initialState: TState = '30s'; +// Slice +const tSlice = createSlice({ + name: 't', + initialState, + reducers: { + setT: (state, action: PayloadAction) => { + return action.payload; + } + } +}); +// Actions +export const { setT } = tSlice.actions; +// Selectors +export const selectT = (state: MesheryRootState) => state.t; +export default tSlice.reducer; diff --git a/src/redux-toolkit/slices/telemetryURLsSlice.ts b/src/redux-toolkit/slices/telemetryURLsSlice.ts new file mode 100644 index 00000000..48cb1789 --- /dev/null +++ b/src/redux-toolkit/slices/telemetryURLsSlice.ts @@ -0,0 +1,39 @@ +import { createSlice, PayloadAction } from '@reduxjs/toolkit'; +import type { MesheryReduxAppDispatch, MesheryRootState } from '../store'; + +export interface TelemetryURLsState { + grafana: any[]; + prometheus: any[]; +} + +const initialState: TelemetryURLsState = { + grafana: [], + prometheus: [] +}; + +const telemetryURLsSlice = createSlice({ + name: 'telemetryURLs', + initialState, + reducers: { + setTelemetryURLs: (state, action: PayloadAction) => { + return action.payload; + }, + updateTelemetryUrls: (state: TelemetryURLsState, action: PayloadAction) => { + // TODO: Implement reducer logic for UPDATE_TELEMETRY_URLS + return state; + } + } +}); + +// Actions +export const { setTelemetryURLs, updateTelemetryUrls } = telemetryURLsSlice.actions; + +// Thunk action creator +export const updateTelemetryURLs = + (payload: TelemetryURLsState) => (dispatch: MesheryReduxAppDispatch) => { + dispatch(setTelemetryURLs(payload)); + }; + +// Selectors +export const selectTelemetryURLs = (state: MesheryRootState) => state.telemetryURLs; +export default telemetryURLsSlice.reducer; diff --git a/src/redux-toolkit/slices/testNameSlice.ts b/src/redux-toolkit/slices/testNameSlice.ts new file mode 100644 index 00000000..01c24611 --- /dev/null +++ b/src/redux-toolkit/slices/testNameSlice.ts @@ -0,0 +1,27 @@ +import { createSlice, PayloadAction } from '@reduxjs/toolkit'; +import type { MesheryRootState } from '../store'; +// State interface +export interface TestNameState { + [key: string]: any; +} +// Initial state +const initialState: TestNameState = ''; +// Slice +const testNameSlice = createSlice({ + name: 'testName', + initialState, + reducers: { + setTestName: (state, action: PayloadAction) => { + return action.payload; + }, + updateLoadTestData: (state: TestNameState, action: PayloadAction) => { + // TODO: Implement reducer logic for UPDATE_LOAD_TEST_DATA + return state; + } + } +}); +// Actions +export const { setTestName, updateLoadTestData } = testNameSlice.actions; +// Selectors +export const selectTestName = (state: MesheryRootState) => state.testName; +export default testNameSlice.reducer; diff --git a/src/redux-toolkit/slices/titleSlice.ts b/src/redux-toolkit/slices/titleSlice.ts new file mode 100644 index 00000000..9331977d --- /dev/null +++ b/src/redux-toolkit/slices/titleSlice.ts @@ -0,0 +1,27 @@ +import { createSlice, PayloadAction } from '@reduxjs/toolkit'; +import type { MesheryRootState } from '../store'; +// State interface +export interface TitleState { + [key: string]: any; +} +// Initial state +const initialState: TitleState = ''; +// Slice +const titleSlice = createSlice({ + name: 'title', + initialState, + reducers: { + setTitle: (state, action: PayloadAction) => { + return action.payload; + }, + updateTitle: (state: TitleState, action: PayloadAction) => { + // TODO: Implement reducer logic for UPDATE_TITLE + return state; + } + } +}); +// Actions +export const { setTitle, updateTitle } = titleSlice.actions; +// Selectors +export const selectTitle = (state: MesheryRootState) => state.title; +export default titleSlice.reducer; diff --git a/src/redux-toolkit/slices/tsSlice.ts b/src/redux-toolkit/slices/tsSlice.ts new file mode 100644 index 00000000..2bcbbdcd --- /dev/null +++ b/src/redux-toolkit/slices/tsSlice.ts @@ -0,0 +1,23 @@ +import { createSlice, PayloadAction } from '@reduxjs/toolkit'; +import type { MesheryRootState } from '../store'; +// State interface +export interface TsState { + [key: string]: any; +} +// Initial state +const initialState: TsState = new Date(-8640000000000000); +// Slice +const tsSlice = createSlice({ + name: 'ts', + initialState, + reducers: { + setTs: (state, action: PayloadAction) => { + return action.payload; + } + } +}); +// Actions +export const { setTs } = tsSlice.actions; +// Selectors +export const selectTs = (state: MesheryRootState) => state.ts; +export default tsSlice.reducer; diff --git a/src/redux-toolkit/slices/urlSlice.ts b/src/redux-toolkit/slices/urlSlice.ts new file mode 100644 index 00000000..9fc28624 --- /dev/null +++ b/src/redux-toolkit/slices/urlSlice.ts @@ -0,0 +1,23 @@ +import { createSlice, PayloadAction } from '@reduxjs/toolkit'; +import type { MesheryRootState } from '../store'; +// State interface +export interface UrlState { + [key: string]: any; +} +// Initial state +const initialState: UrlState = ''; +// Slice +const urlSlice = createSlice({ + name: 'url', + initialState, + reducers: { + setUrl: (state, action: PayloadAction) => { + return action.payload; + } + } +}); +// Actions +export const { setUrl } = urlSlice.actions; +// Selectors +export const selectUrl = (state: MesheryRootState) => state.url; +export default urlSlice.reducer; diff --git a/src/redux-toolkit/slices/userSlice.ts b/src/redux-toolkit/slices/userSlice.ts new file mode 100644 index 00000000..43c2d569 --- /dev/null +++ b/src/redux-toolkit/slices/userSlice.ts @@ -0,0 +1,31 @@ +import { createSlice, PayloadAction } from '@reduxjs/toolkit'; +import type { MesheryReduxAppDispatch, MesheryRootState } from '../store'; + +export interface UserState {} + +const initialState: UserState = {}; + +const userSlice = createSlice({ + name: 'user', + initialState, + reducers: { + setUser: (state, action: PayloadAction) => { + return action.payload; + }, + updateUser: (state: UserState, action: PayloadAction) => { + // TODO: Implement reducer logic for UPDATE_USER + return state; + } + } +}); + +export const { setUser } = userSlice.actions; + +// Thunk action creator +export const updateUser = (payload: UserState) => (dispatch: MesheryReduxAppDispatch) => { + dispatch(setUser(payload)); +}; + +// Selectors +export const selectUser = (state: MesheryRootState) => state.user; +export default userSlice.reducer; diff --git a/src/redux-toolkit/slices/workspaceSlice.ts b/src/redux-toolkit/slices/workspaceSlice.ts new file mode 100644 index 00000000..c096e2d7 --- /dev/null +++ b/src/redux-toolkit/slices/workspaceSlice.ts @@ -0,0 +1,35 @@ +import { createSlice, PayloadAction } from '@reduxjs/toolkit'; +import type { MesheryReduxAppDispatch, MesheryRootState } from '../store'; + +export interface WorkspaceState { + value: any; +} + +const initialState: WorkspaceState = { value: null }; + +const workspaceSlice = createSlice({ + name: 'workspace', + initialState, + reducers: { + setWorkspace: (state, action: PayloadAction) => { + return action.payload; + } + /* + setWorkspace: (state: WorkspaceState, action: PayloadAction) => { + // TODO: Implement reducer logic for SET_WORKSPACE + return state; + } + */ + } +}); + +export const { setWorkspace } = workspaceSlice.actions; + +// Thunk action creator +export const updateWorkspace = (payload: WorkspaceState) => (dispatch: MesheryReduxAppDispatch) => { + dispatch(setWorkspace(payload)); +}; + +// Selectors +export const selectWorkspace = (state: MesheryRootState) => state.workspace; +export default workspaceSlice.reducer; diff --git a/src/redux-toolkit/store.ts b/src/redux-toolkit/store.ts new file mode 100644 index 00000000..dff8a67c --- /dev/null +++ b/src/redux-toolkit/store.ts @@ -0,0 +1,120 @@ +import { configureStore } from '@reduxjs/toolkit'; +import anonymousPerfResultsReducer from './slices/anonymousPerfResultsSlice'; +import anonymousUsageStatsReducer from './slices/anonymousUsageStatsSlice'; +import cReducer from './slices/cSlice'; +import capabilitiesRegistryReducer from './slices/capabilitiesRegistrySlice'; +import catalogVisibilityReducer from './slices/catalogVisibilitySlice'; +import connectionMetadataStateReducer from './slices/connectionMetadataStateSlice'; +import controllerStateReducer from './slices/controllerStateSlice'; +import eventsReducer from './slices/eventsSlice'; +import extensionTypeReducer from './slices/extensionTypeSlice'; +import genReducer from './slices/genSlice'; +import grafanaAPIKeyReducer from './slices/grafanaAPIKeySlice'; +import grafanaBoardSearchReducer from './slices/grafanaBoardSearchSlice'; +import grafanaBoardsReducer from './slices/grafanaBoardsSlice'; +import grafanaReducer from './slices/grafanaSlice'; +import grafanaURLReducer from './slices/grafanaURLSlice'; +import isBetaReducer from './slices/isBetaSlice'; +import isDrawerCollapsedReducer from './slices/isDrawerCollapsedSlice'; +import k8sConfigReducer from './slices/k8sConfigSlice'; +import keysReducer from './slices/keysSlice'; +import loadTestPrefReducer from './slices/loadTestPrefSlice'; +import loadTestReducer from './slices/loadTestSlice'; +import meshAdaptersReducer from './slices/meshAdaptersSlice'; +import meshAdapterstsReducer from './slices/meshAdapterstsSlice'; +import meshNameReducer from './slices/meshNameSlice'; +import meshSyncStateReducer from './slices/meshSyncStateSlice'; +import notificationCenterReducer from './slices/notificationCenterSlice'; +import openEventIdReducer from './slices/openEventIdSlice'; +import operatorStateReducer from './slices/operatorStateSlice'; +import organizationReducer from './slices/organizationSlice'; +import pageReducer from './slices/pageSlice'; +import pathReducer from './slices/pathSlice'; +import prometheusReducer from './slices/prometheusSlice'; +import prometheusURLReducer from './slices/prometheusURLSlice'; +import qpsReducer from './slices/qpsSlice'; +import resultReducer from './slices/resultSlice'; +import resultsReducer from './slices/resultsSlice'; +import results_selectionReducer from './slices/results_selectionSlice'; +import selectedAdapterReducer from './slices/selectedAdapterSlice'; +import selectedBoardsConfigsReducer from './slices/selectedBoardsConfigsSlice'; +import selectedK8sContextsReducer from './slices/selectedK8sContextsSlice'; +import selectedPrometheusBoardsConfigsReducer from './slices/selectedPrometheusBoardsConfigsSlice'; +import showFullNotificationCenterReducer from './slices/showFullNotificationCenterSlice'; +import showProgressReducer from './slices/showProgressSlice'; +import startKeyReducer from './slices/startKeySlice'; +import staticPrometheusBoardConfigReducer from './slices/staticPrometheusBoardConfigSlice'; +import tReducer from './slices/tSlice'; +import telemetryURLsReducer from './slices/telemetryURLsSlice'; +import testNameReducer from './slices/testNameSlice'; +import titleReducer from './slices/titleSlice'; +import tsReducer from './slices/tsSlice'; +import urlReducer from './slices/urlSlice'; +import userReducer from './slices/userSlice'; +import workspaceReducer from './slices/workspaceSlice'; + +export const mesheryReduxStore = configureStore({ + reducer: { + page: pageReducer, + user: userReducer, + k8sConfig: k8sConfigReducer, + selectedK8sContexts: selectedK8sContextsReducer, + loadTest: loadTestReducer, + loadTestPref: loadTestPrefReducer, + meshAdapters: meshAdaptersReducer, + meshAdaptersts: meshAdapterstsReducer, + results: resultsReducer, + results_selection: results_selectionReducer, + grafana: grafanaReducer, + prometheus: prometheusReducer, + staticPrometheusBoardConfig: staticPrometheusBoardConfigReducer, + anonymousUsageStats: anonymousUsageStatsReducer, + anonymousPerfResults: anonymousPerfResultsReducer, + showProgress: showProgressReducer, + isDrawerCollapsed: isDrawerCollapsedReducer, + selectedAdapter: selectedAdapterReducer, + events: eventsReducer, + notificationCenter: notificationCenterReducer, + catalogVisibility: catalogVisibilityReducer, + extensionType: extensionTypeReducer, + capabilitiesRegistry: capabilitiesRegistryReducer, + telemetryURLs: telemetryURLsReducer, + operatorState: operatorStateReducer, + controllerState: controllerStateReducer, + meshSyncState: meshSyncStateReducer, + connectionMetadataState: connectionMetadataStateReducer, + organization: organizationReducer, + workspace: workspaceReducer, + keys: keysReducer, + path: pathReducer, + title: titleReducer, + isBeta: isBetaReducer, + testName: testNameReducer, + meshName: meshNameReducer, + url: urlReducer, + qps: qpsReducer, + c: cReducer, + t: tReducer, + result: resultReducer, + gen: genReducer, + ts: tsReducer, + startKey: startKeyReducer, + grafanaURL: grafanaURLReducer, + grafanaAPIKey: grafanaAPIKeyReducer, + grafanaBoardSearch: grafanaBoardSearchReducer, + grafanaBoards: grafanaBoardsReducer, + selectedBoardsConfigs: selectedBoardsConfigsReducer, + prometheusURL: prometheusURLReducer, + selectedPrometheusBoardsConfigs: selectedPrometheusBoardsConfigsReducer, + openEventId: openEventIdReducer, + showFullNotificationCenter: showFullNotificationCenterReducer + }, + middleware: (getDefaultMiddleware) => + getDefaultMiddleware({ + serializableCheck: false, + immutableCheck: false + }) +}); + +export type MesheryRootState = ReturnType; +export type MesheryReduxAppDispatch = typeof mesheryReduxStore.dispatch;