Fix device health REDUX to work with latency

This commit is contained in:
Hristo Nedelkov 2023-09-28 22:40:32 +03:00
parent 419dbc3959
commit d83f1561b4

View File

@ -6,8 +6,8 @@ interface DeviceHealthState {
cpuLoad: number[] cpuLoad: number[]
memory: number[] memory: number[]
maxMemory: number maxMemory: number
uploadRate: number[] latency: number[]
downloadRate: number[]
} }
const initialState: DeviceHealthState = { const initialState: DeviceHealthState = {
@ -16,8 +16,8 @@ const initialState: DeviceHealthState = {
cpuLoad: [12, 123, 4, 90], cpuLoad: [12, 123, 4, 90],
memory: [25, 31, 5, 14, 20, 81], memory: [25, 31, 5, 14, 20, 81],
maxMemory: 120, maxMemory: 120,
uploadRate: [1, 4, 25, 65], latency: [1, 14,5, 25, 65, 4, 82,59],
downloadRate: [20, 3, 50, 30],
} }
const deviceHealthSlice = createSlice({ const deviceHealthSlice = createSlice({
@ -43,10 +43,10 @@ const deviceHealthSlice = createSlice({
}, },
setNetworkHealth: ( setNetworkHealth: (
state: DeviceHealthState, state: DeviceHealthState,
action: PayloadAction<{ uploadRate: number[]; downloadRate: number[] }>, action: PayloadAction<{ latency: number[] }>,
) => { ) => {
state.uploadRate = action.payload.uploadRate state.latency = action.payload.latency
state.downloadRate = action.payload.downloadRate
}, },
}, },
}) })