fix(devices-health-check): rename to device

This commit is contained in:
RadoslavDimchev 2024-03-20 07:59:44 +02:00 committed by Radoslav Dimchev
parent 37a28e3766
commit 62e3ccd6fe
6 changed files with 23 additions and 77 deletions

View File

@ -33,7 +33,7 @@ import KeyGeneration from './pages/ValidatorOnboarding/KeyGeneration/KeyGenerati
import Activation from './pages/ValidatorOnboarding/Activation/Activation' import Activation from './pages/ValidatorOnboarding/Activation/Activation'
import ConfirmRecoveryPhrase from './pages/ValidatorOnboarding/KeyGeneration/ConfirmRecoveryPhrase/ConfirmRecoveryPhrase' import ConfirmRecoveryPhrase from './pages/ValidatorOnboarding/KeyGeneration/ConfirmRecoveryPhrase/ConfirmRecoveryPhrase'
import Deposit from './pages/ValidatorOnboarding/Deposit/Deposit' import Deposit from './pages/ValidatorOnboarding/Deposit/Deposit'
import DevicesHealthCheck from './pages/DevicesHealthCheck/DevicesHealthCheck' import DeviceHealthCheck from './pages/DeviceHealthCheck/DeviceHealthCheck'
const injected = injectedModule() const injected = injectedModule()
const walletConnect = walletConnectModule(wcV2InitOptions) const walletConnect = walletConnectModule(wcV2InitOptions)
@ -62,7 +62,7 @@ const router = createBrowserRouter([
}, },
{ {
path: '/device-health-check', path: '/device-health-check',
element: <DevicesHealthCheck />, element: <DeviceHealthCheck />,
}, },
{ {
path: '/device-sync-status', path: '/device-sync-status',

View File

@ -0,0 +1,18 @@
import type { Meta, StoryObj } from '@storybook/react'
import DeviceHealthCheck from './DeviceHealthCheck'
const meta: Meta = {
title: 'Pages/DeviceHealthCheck',
component: DeviceHealthCheck,
decorators: [],
tags: ['autodocs'],
}
export default meta
type DeviceHealthCheckStory = StoryObj<typeof DeviceHealthCheck>
export const Page: DeviceHealthCheckStory = {
args: {},
}

View File

@ -15,7 +15,7 @@ import { useWindowSize } from '../../hooks/useWindowSize'
import RightSidebar from '../../components/General/RightSideBar/RightSidebar' import RightSidebar from '../../components/General/RightSideBar/RightSidebar'
import LeftSidebar from '../../components/General/LeftSidebar/LeftSidebar' import LeftSidebar from '../../components/General/LeftSidebar/LeftSidebar'
const DevicesHealthCheck = () => { const DeviceHealthCheck = () => {
const deviceHealthState = useSelector( const deviceHealthState = useSelector(
(state: RootState) => state.deviceHealth, (state: RootState) => state.deviceHealth,
) )
@ -80,4 +80,4 @@ const DevicesHealthCheck = () => {
) )
} }
export default DevicesHealthCheck export default DeviceHealthCheck

View File

@ -1,18 +0,0 @@
import type { Meta, StoryObj } from '@storybook/react'
import DevicesHealthCheck from './DevicesHealthCheck'
const meta: Meta = {
title: 'Pages/DevicesHealthCheck',
component: DevicesHealthCheck,
decorators: [],
tags: ['autodocs'],
}
export default meta
type DevicesHealthCheckStory = StoryObj<typeof DevicesHealthCheck>
export const Page: DevicesHealthCheckStory = {
args: {},
}

View File

@ -1,54 +0,0 @@
import { createSlice, PayloadAction } from '@reduxjs/toolkit'
interface DeviceHealthState {
storage: number
maxStorage: number
cpuLoad: number[]
memory: number[]
maxMemory: number
latency: number[]
}
const initialState: DeviceHealthState = {
storage: 44,
maxStorage: 100,
cpuLoad: [25, 31, 5, 14, 20, 81, 50, 34, 12, 123, 4, 90, 56, 35, 90],
memory: [15, 31, 5, 14, 20, 81, 50, 34, 12, 123, 4, 90, 56, 35, 90],
maxMemory: 120,
latency: [55, 31, 5, 14, 20, 81, 50, 34, 12, 50, 4, 90, 56, 35, 59],
}
const deviceHealthSlice = createSlice({
name: 'deviceHealth',
initialState,
reducers: {
setStorage: (
state: DeviceHealthState,
action: PayloadAction<{ storage: number; maxStorage: number }>,
) => {
state.storage = action.payload.storage
state.maxStorage = action.payload.maxStorage
},
setCpuLoad: (state: DeviceHealthState, action: PayloadAction<number[]>) => {
state.cpuLoad = action.payload
},
setMemory: (
state: DeviceHealthState,
action: PayloadAction<{ memory: number[]; maxMemory: number }>,
) => {
state.memory = action.payload.memory
state.maxMemory = action.payload.maxMemory
},
setNetworkHealth: (
state: DeviceHealthState,
action: PayloadAction<{ latency: number[] }>,
) => {
state.latency = action.payload.latency
},
},
})
export const { setStorage, setCpuLoad, setMemory, setNetworkHealth } =
deviceHealthSlice.actions
export default deviceHealthSlice.reducer

View File

@ -1,7 +1,7 @@
import { configureStore } from '@reduxjs/toolkit' import { configureStore } from '@reduxjs/toolkit'
import themeReducer from './theme/slice' import themeReducer from './theme/slice'
import deviceHealthReducer from './deviceHealthCheck/slice' import deviceHealthReducer from './DeviceHealthCheck/slice'
import pinnedMessageReducer from './PinnedMessage/slice' import pinnedMessageReducer from './PinnedMessage/slice'
import execClientReducer from './ValidatorOnboarding/ClientSetup/slice' import execClientReducer from './ValidatorOnboarding/ClientSetup/slice'
import keyGenerationReducer from './ValidatorOnboarding/KeyGeneration/slice' import keyGenerationReducer from './ValidatorOnboarding/KeyGeneration/slice'