@@ -7,6 +7,7 @@ import { createSlice } from '@reduxjs/toolkit';
7
7
* Import the needed reducers
8
8
*/
9
9
import { nodeCollectorReducer , updateCollectorValues } from './node.reducer.js' ;
10
+ import { getCollectorErrors } from './node.utils.js' ;
10
11
11
12
/**
12
13
* Import the types
@@ -79,7 +80,7 @@ export const nodeSlice = createSlice({
79
80
80
81
newState . error = {
81
82
code : action . payload . data . code ,
82
- details : action . payload . data . details ,
83
+ collectors : getCollectorErrors ( action . payload . data ) ,
83
84
message : action . payload . data . message ,
84
85
internalHttpStatus : action . payload . data . httpResponseCode ,
85
86
status : 'error' ,
@@ -277,7 +278,7 @@ export const nodeSlice = createSlice({
277
278
// Let's check if the node has a client and collectors
278
279
if ( state . status !== CONTINUE_STATUS ) {
279
280
console . error (
280
- `\`collectors are only available on nodes with \`status\` of ${ CONTINUE_STATUS } ` ,
281
+ `\`collectors\` are only available on nodes with \`status\` of ${ CONTINUE_STATUS } ` ,
281
282
) ;
282
283
return [ ] ;
283
284
}
@@ -287,7 +288,7 @@ export const nodeSlice = createSlice({
287
288
// Let's check if the node has a client and collectors
288
289
if ( state . status !== CONTINUE_STATUS ) {
289
290
console . error (
290
- `\`collectors are only available on nodes with \`status\` of ${ CONTINUE_STATUS } ` ,
291
+ `\`collectors\` are only available on nodes with \`status\` of ${ CONTINUE_STATUS } ` ,
291
292
) ;
292
293
return ;
293
294
}
@@ -296,6 +297,14 @@ export const nodeSlice = createSlice({
296
297
selectError : ( state ) => {
297
298
return state . error ;
298
299
} ,
300
+ selectErrorCollectors : ( state ) => {
301
+ if ( state . status !== ERROR_STATUS ) {
302
+ console . error (
303
+ `\`errorCollectors\` are only available on nodes with \`status\` of ${ ERROR_STATUS } ` ,
304
+ ) ;
305
+ }
306
+ return state . error ?. collectors || [ ] ;
307
+ } ,
299
308
selectServer : ( state ) => {
300
309
return state . server ;
301
310
} ,
0 commit comments