-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: show msm connection info (#5458)
- update strip-literal to 2.1.0 - fixes vitest-dev/vitest#5387 (comment) - add rerender with state updates in renderWithMockStore using immer `produce`. - add `immer` as a dev dependency
- Loading branch information
1 parent
914c7f0
commit bbe685d
Showing
16 changed files
with
220 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default, msmActions } from "./slice"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { createSelector } from "@reduxjs/toolkit"; | ||
|
||
import type { RootState } from "@/app/store/root/types"; | ||
|
||
const status = (state: RootState) => state.msm.status; | ||
const running = createSelector(status, (status) => status?.running); | ||
const loading = (state: RootState) => state.msm.loading; | ||
const errors = (state: RootState) => state.msm.errors; | ||
|
||
const msmSelectors = { | ||
status, | ||
running, | ||
loading, | ||
errors, | ||
}; | ||
|
||
export default msmSelectors; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import type { PayloadAction } from "@reduxjs/toolkit"; | ||
import { createSlice } from "@reduxjs/toolkit"; | ||
|
||
import type { MsmState, MsmStatus } from "./types/base"; | ||
|
||
const initialState: MsmState = { | ||
status: null, | ||
errors: null, | ||
loading: false, | ||
loaded: false, | ||
}; | ||
|
||
const msmSlice = createSlice({ | ||
name: "msm", | ||
initialState, | ||
reducers: { | ||
fetch: { | ||
prepare: () => ({ | ||
meta: { | ||
model: "msm", | ||
method: "status", | ||
}, | ||
payload: null, | ||
}), | ||
reducer: () => {}, | ||
}, | ||
fetchSuccess(state, action: PayloadAction<MsmStatus>) { | ||
state.status = action.payload; | ||
state.loading = false; | ||
state.loaded = true; | ||
state.errors = null; | ||
}, | ||
fetchError(state, action: PayloadAction<string>) { | ||
state.errors = action.payload; | ||
state.loading = false; | ||
}, | ||
}, | ||
}); | ||
|
||
export const { actions: msmActions } = msmSlice; | ||
|
||
export default msmSlice.reducer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
export interface MsmStatus { | ||
smUrl: string | null; | ||
running: "not_connected" | "pending" | "connected"; | ||
startTime: string | null; | ||
} | ||
|
||
export interface MsmState { | ||
status: MsmStatus | null; | ||
loading: boolean; | ||
loaded: boolean; | ||
errors: string | null; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export enum MsmMeta { | ||
MODEL = "msm", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { define } from "cooky-cutter"; | ||
|
||
import { timestamp } from "./general"; | ||
|
||
import type { MsmState, MsmStatus } from "@/app/store/msm/types/base"; | ||
|
||
const msmStatus = define<MsmStatus | null>({ | ||
smUrl: "https://example.com", | ||
running: "not_connected", | ||
startTime: timestamp("Wed, 08 Jul. 2022 05:35:45"), | ||
}); | ||
|
||
export const msm = define<MsmState>({ | ||
status: msmStatus, | ||
loading: false, | ||
loaded: false, | ||
errors: null, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.