@@ -18,7 +18,7 @@ import React from 'react';
18
18
import { connect } from 'react-redux' ;
19
19
import { withParams } from '../router' ;
20
20
import { Details , name } from '../metadata' ;
21
- import metrics from '../metrics' ;
21
+ import { bytesToHumanReadable , quantityToScalar } from '../metrics' ;
22
22
import { selectors } from './' ;
23
23
import p from '../pods' ;
24
24
import { Card , DonutChart , Form } from '../components' ;
@@ -73,13 +73,13 @@ export const NodesDetailPage = withParams(
73
73
. map ( c => c . resources . requests ?? { } ) ;
74
74
const requestedCpu = requests
75
75
. map ( r => r . cpu ?? 0 )
76
- . reduce ( ( acc , c ) => acc + metrics . selectors . quantityToScalar ( c ) , 0 ) ;
77
- const allocatableMemory = metrics . selectors . quantityToScalar (
76
+ . reduce ( ( acc , c ) => acc + quantityToScalar ( c ) , 0 ) ;
77
+ const allocatableMemory = quantityToScalar (
78
78
selectors . statusAllocatableMemory ( node )
79
79
) ;
80
80
const requestedMemory = requests
81
81
. map ( r => r . memory ?? 0 )
82
- . reduce ( ( acc , c ) => acc + metrics . selectors . quantityToScalar ( c ) , 0 ) ;
82
+ . reduce ( ( acc , c ) => acc + quantityToScalar ( c ) , 0 ) ;
83
83
return (
84
84
< ResourceDetailPage
85
85
kind = 'Nodes'
@@ -94,20 +94,16 @@ export const NodesDetailPage = withParams(
94
94
title = 'CPU'
95
95
description = 'Requested vs. allocatable'
96
96
partial = { requestedCpu . toFixed ( 3 ) }
97
- total = { metrics . selectors
98
- . quantityToScalar ( selectors . statusAllocatableCpu ( node ) )
99
- . toFixed ( 3 ) }
97
+ total = { quantityToScalar (
98
+ selectors . statusAllocatableCpu ( node )
99
+ ) . toFixed ( 3 ) }
100
100
/>
101
101
< Dial
102
102
title = 'Memory'
103
103
description = 'Requested vs. allocatable'
104
104
percent = { ( requestedMemory / allocatableMemory ) * 100 }
105
- partial = { metrics . selectors . bytesToHumanReadable (
106
- requestedMemory
107
- ) }
108
- total = { metrics . selectors . bytesToHumanReadable (
109
- allocatableMemory
110
- ) }
105
+ partial = { bytesToHumanReadable ( requestedMemory ) }
106
+ total = { bytesToHumanReadable ( allocatableMemory ) }
111
107
/>
112
108
< Dial
113
109
title = 'Pods'
0 commit comments