Skip to content

Commit

Permalink
feat: create slices for meshery ui
Browse files Browse the repository at this point in the history
Signed-off-by: Antonette Caldwell <[email protected]>
  • Loading branch information
nebula-aac committed Dec 14, 2024
1 parent 12bded0 commit 45ddea3
Show file tree
Hide file tree
Showing 56 changed files with 1,790 additions and 9 deletions.
18 changes: 10 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
48 changes: 48 additions & 0 deletions src/redux-toolkit/slices/anonymousPerfResultsSlice.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { createSlice, PayloadAction } from '@reduxjs/toolkit';
import type { MesheryRootState } from '../store';
// State interface
export interface AnonymousPerfResultsState {
[key: string]: any;

Check failure on line 5 in src/redux-toolkit/slices/anonymousPerfResultsSlice.ts

View workflow job for this annotation

GitHub Actions / lint (16)

Unexpected any. Specify a different type

Check failure on line 5 in src/redux-toolkit/slices/anonymousPerfResultsSlice.ts

View workflow job for this annotation

GitHub Actions / lint (18)

Unexpected any. Specify a different type

Check failure on line 5 in src/redux-toolkit/slices/anonymousPerfResultsSlice.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unexpected any. Specify a different type
}
// Initial state
const initialState: AnonymousPerfResultsState = true;
// Slice
const anonymousPerfResultsSlice = createSlice({
name: 'anonymousPerfResults',
initialState,
reducers: {
setAnonymousPerfResults: (state, action: PayloadAction<AnonymousPerfResultsState>) => {
return action.payload;
},
updateResultsSelection: (state: AnonymousPerfResultsState, action: PayloadAction<any>) => {

Check failure on line 17 in src/redux-toolkit/slices/anonymousPerfResultsSlice.ts

View workflow job for this annotation

GitHub Actions / lint (16)

'action' is defined but never used

Check failure on line 17 in src/redux-toolkit/slices/anonymousPerfResultsSlice.ts

View workflow job for this annotation

GitHub Actions / lint (16)

Unexpected any. Specify a different type

Check failure on line 17 in src/redux-toolkit/slices/anonymousPerfResultsSlice.ts

View workflow job for this annotation

GitHub Actions / lint (18)

'action' is defined but never used

Check failure on line 17 in src/redux-toolkit/slices/anonymousPerfResultsSlice.ts

View workflow job for this annotation

GitHub Actions / lint (18)

Unexpected any. Specify a different type

Check failure on line 17 in src/redux-toolkit/slices/anonymousPerfResultsSlice.ts

View workflow job for this annotation

GitHub Actions / lint (20)

'action' is defined but never used

Check failure on line 17 in src/redux-toolkit/slices/anonymousPerfResultsSlice.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unexpected any. Specify a different type
// TODO: Implement reducer logic for UPDATE_RESULTS_SELECTION
return state;
},
clearResultsSelection: (state: AnonymousPerfResultsState, action: PayloadAction<any>) => {

Check failure on line 21 in src/redux-toolkit/slices/anonymousPerfResultsSlice.ts

View workflow job for this annotation

GitHub Actions / lint (16)

'action' is defined but never used

Check failure on line 21 in src/redux-toolkit/slices/anonymousPerfResultsSlice.ts

View workflow job for this annotation

GitHub Actions / lint (16)

Unexpected any. Specify a different type

Check failure on line 21 in src/redux-toolkit/slices/anonymousPerfResultsSlice.ts

View workflow job for this annotation

GitHub Actions / lint (18)

'action' is defined but never used

Check failure on line 21 in src/redux-toolkit/slices/anonymousPerfResultsSlice.ts

View workflow job for this annotation

GitHub Actions / lint (18)

Unexpected any. Specify a different type

Check failure on line 21 in src/redux-toolkit/slices/anonymousPerfResultsSlice.ts

View workflow job for this annotation

GitHub Actions / lint (20)

'action' is defined but never used

Check failure on line 21 in src/redux-toolkit/slices/anonymousPerfResultsSlice.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unexpected any. Specify a different type
// TODO: Implement reducer logic for CLEAR_RESULTS_SELECTION
return state;
},
updateAnonymousUsageStats: (state: AnonymousPerfResultsState, action: PayloadAction<any>) => {

Check failure on line 25 in src/redux-toolkit/slices/anonymousPerfResultsSlice.ts

View workflow job for this annotation

GitHub Actions / lint (16)

'action' is defined but never used

Check failure on line 25 in src/redux-toolkit/slices/anonymousPerfResultsSlice.ts

View workflow job for this annotation

GitHub Actions / lint (16)

Unexpected any. Specify a different type

Check failure on line 25 in src/redux-toolkit/slices/anonymousPerfResultsSlice.ts

View workflow job for this annotation

GitHub Actions / lint (18)

'action' is defined but never used

Check failure on line 25 in src/redux-toolkit/slices/anonymousPerfResultsSlice.ts

View workflow job for this annotation

GitHub Actions / lint (18)

Unexpected any. Specify a different type

Check failure on line 25 in src/redux-toolkit/slices/anonymousPerfResultsSlice.ts

View workflow job for this annotation

GitHub Actions / lint (20)

'action' is defined but never used

Check failure on line 25 in src/redux-toolkit/slices/anonymousPerfResultsSlice.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unexpected any. Specify a different type
// TODO: Implement reducer logic for UPDATE_ANONYMOUS_USAGE_STATS
return state;
},
updateAnonymousPerformanceResults: (
state: AnonymousPerfResultsState,
action: PayloadAction<any>

Check failure on line 31 in src/redux-toolkit/slices/anonymousPerfResultsSlice.ts

View workflow job for this annotation

GitHub Actions / lint (16)

'action' is defined but never used

Check failure on line 31 in src/redux-toolkit/slices/anonymousPerfResultsSlice.ts

View workflow job for this annotation

GitHub Actions / lint (16)

Unexpected any. Specify a different type

Check failure on line 31 in src/redux-toolkit/slices/anonymousPerfResultsSlice.ts

View workflow job for this annotation

GitHub Actions / lint (18)

'action' is defined but never used

Check failure on line 31 in src/redux-toolkit/slices/anonymousPerfResultsSlice.ts

View workflow job for this annotation

GitHub Actions / lint (18)

Unexpected any. Specify a different type

Check failure on line 31 in src/redux-toolkit/slices/anonymousPerfResultsSlice.ts

View workflow job for this annotation

GitHub Actions / lint (20)

'action' is defined but never used

Check failure on line 31 in src/redux-toolkit/slices/anonymousPerfResultsSlice.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unexpected any. Specify a different type
) => {
// 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;
38 changes: 38 additions & 0 deletions src/redux-toolkit/slices/anonymousUsageStatsSlice.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { createSlice, PayloadAction } from '@reduxjs/toolkit';
import type { MesheryRootState } from '../store';
// State interface
export interface AnonymousUsageStatsState {
[key: string]: any;

Check failure on line 5 in src/redux-toolkit/slices/anonymousUsageStatsSlice.ts

View workflow job for this annotation

GitHub Actions / lint (16)

Unexpected any. Specify a different type

Check failure on line 5 in src/redux-toolkit/slices/anonymousUsageStatsSlice.ts

View workflow job for this annotation

GitHub Actions / lint (18)

Unexpected any. Specify a different type

Check failure on line 5 in src/redux-toolkit/slices/anonymousUsageStatsSlice.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unexpected any. Specify a different type
}
// Initial state
const initialState: AnonymousUsageStatsState = true;
// Slice
const anonymousUsageStatsSlice = createSlice({
name: 'anonymousUsageStats',
initialState,
reducers: {
setAnonymousUsageStats: (state, action: PayloadAction<AnonymousUsageStatsState>) => {
return action.payload;
},
updateAnonymousUsageStats: (state: AnonymousUsageStatsState, action: PayloadAction<any>) => {
// TODO: Implement reducer logic for UPDATE_ANONYMOUS_USAGE_STATS
return state;
},
updateAnonymousPerformanceResults: (
state: AnonymousUsageStatsState,
action: PayloadAction<any>
) => {
// TODO: Implement reducer logic for UPDATE_ANONYMOUS_PERFORMANCE_RESULTS
return state;
}
}
});
// Actions
export const {
setAnonymousUsageStats,
updateAnonymousUsageStats,
updateAnonymousPerformanceResults
} = anonymousUsageStatsSlice.actions;
// Selectors
export const selectAnonymousUsageStats = (state: MesheryRootState) => state.anonymousUsageStats;
export default anonymousUsageStatsSlice.reducer;
23 changes: 23 additions & 0 deletions src/redux-toolkit/slices/cSlice.ts
Original file line number Diff line number Diff line change
@@ -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<CState>) => {
return action.payload;
}
}
});
// Actions
export const { setC } = cSlice.actions;
// Selectors
export const selectC = (state: MesheryRootState) => state.c;
export default cSlice.reducer;
28 changes: 28 additions & 0 deletions src/redux-toolkit/slices/capabilitiesRegistrySlice.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { createSlice, PayloadAction } from '@reduxjs/toolkit';
import type { MesheryRootState } from '../store';
// State interface
export interface CapabilitiesRegistryState {
[key: string]: any;
}
// Initial state
const initialState: CapabilitiesRegistryState = null;
// Slice
const capabilitiesRegistrySlice = createSlice({
name: 'capabilitiesRegistry',
initialState,
reducers: {
setCapabilitiesRegistry: (state, action: PayloadAction<CapabilitiesRegistryState>) => {
return action.payload;
},
updateCapabilityRegistry: (state: CapabilitiesRegistryState, action: PayloadAction<any>) => {
// 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;
27 changes: 27 additions & 0 deletions src/redux-toolkit/slices/catalogVisibilitySlice.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { createSlice, PayloadAction } from '@reduxjs/toolkit';
import type { MesheryRootState } from '../store';
// State interface
export interface CatalogVisibilityState {
[key: string]: any;
}
// Initial state
const initialState: CatalogVisibilityState = true;
// Slice
const catalogVisibilitySlice = createSlice({
name: 'catalogVisibility',
initialState,
reducers: {
setCatalogVisibility: (state, action: PayloadAction<CatalogVisibilityState>) => {
return action.payload;
},
setCatalogContent: (state: CatalogVisibilityState, action: PayloadAction<any>) => {
// 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;
41 changes: 41 additions & 0 deletions src/redux-toolkit/slices/connectionMetadataStateSlice.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { createSlice, PayloadAction } from '@reduxjs/toolkit';
import type { MesheryRootState } from '../store';
// State interface
export interface ConnectionMetadataStateState {
[key: string]: any;
}
// Initial state
const initialState: ConnectionMetadataStateState = null;
// Slice
const connectionMetadataStateSlice = createSlice({
name: 'connectionMetadataState',
initialState,
reducers: {
setConnectionMetadataState: (state, action: PayloadAction<ConnectionMetadataStateState>) => {
return action.payload;
},
updateLoadTestData: (state: ConnectionMetadataStateState, action: PayloadAction<any>) => {
// TODO: Implement reducer logic for UPDATE_LOAD_TEST_DATA
return state;
},
setControllerState: (state: ConnectionMetadataStateState, action: PayloadAction<any>) => {
// TODO: Implement reducer logic for SET_CONTROLLER_STATE
return state;
},
setConnectionMetadata: (state: ConnectionMetadataStateState, action: PayloadAction<any>) => {
// 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;
27 changes: 27 additions & 0 deletions src/redux-toolkit/slices/controllerStateSlice.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { createSlice, PayloadAction } from '@reduxjs/toolkit';
import type { MesheryRootState } from '../store';
// State interface
export interface ControllerStateState {
[key: string]: any;
}
// Initial state
const initialState: ControllerStateState = null;
// Slice
const controllerStateSlice = createSlice({
name: 'controllerState',
initialState,
reducers: {
setControllerState: (state, action: PayloadAction<ControllerStateState>) => {
return action.payload;
},
setControllerState: (state: ControllerStateState, action: PayloadAction<any>) => {
// TODO: Implement reducer logic for SET_CONTROLLER_STATE
return state;
}
}
});
// Actions
export const { setControllerState, setControllerState1 } = controllerStateSlice.actions;
// Selectors
export const selectControllerState = (state: MesheryRootState) => state.controllerState;
export default controllerStateSlice.reducer;
23 changes: 23 additions & 0 deletions src/redux-toolkit/slices/eventsSlice.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { createSlice, PayloadAction } from '@reduxjs/toolkit';
import type { MesheryRootState } from '../store';
// State interface
export interface EventsState {
[key: string]: any;
}
// Initial state
const initialState: EventsState = [];
// Slice
const eventsSlice = createSlice({
name: 'events',
initialState,
reducers: {
setEvents: (state, action: PayloadAction<EventsState>) => {
return action.payload;
}
}
});
// Actions
export const { setEvents } = eventsSlice.actions;
// Selectors
export const selectEvents = (state: MesheryRootState) => state.events;
export default eventsSlice.reducer;
27 changes: 27 additions & 0 deletions src/redux-toolkit/slices/extensionTypeSlice.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { createSlice, PayloadAction } from '@reduxjs/toolkit';
import type { MesheryRootState } from '../store';
// State interface
export interface ExtensionTypeState {
[key: string]: any;
}
// Initial state
const initialState: ExtensionTypeState = '';
// Slice
const extensionTypeSlice = createSlice({
name: 'extensionType',
initialState,
reducers: {
setExtensionType: (state, action: PayloadAction<ExtensionTypeState>) => {
return action.payload;
},
updateExtensionType: (state: ExtensionTypeState, action: PayloadAction<any>) => {
// TODO: Implement reducer logic for UPDATE_EXTENSION_TYPE
return state;
}
}
});
// Actions
export const { setExtensionType, updateExtensionType } = extensionTypeSlice.actions;
// Selectors
export const selectExtensionType = (state: MesheryRootState) => state.extensionType;
export default extensionTypeSlice.reducer;
27 changes: 27 additions & 0 deletions src/redux-toolkit/slices/genSlice.ts
Original file line number Diff line number Diff line change
@@ -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<GenState>) => {
return action.payload;
},
updateLoadGenConfig: (state: GenState, action: PayloadAction<any>) => {
// 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;
Loading

0 comments on commit 45ddea3

Please sign in to comment.