File tree Expand file tree Collapse file tree 5 files changed +53
-57
lines changed
containers/Tenant/Diagnostics/TenantOverview Expand file tree Collapse file tree 5 files changed +53
-57
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import PropTypes from 'prop-types';
44
55import InfoViewer from '../InfoViewer/InfoViewer' ;
66import ProgressViewer from '../ProgressViewer/ProgressViewer' ;
7- import PoolUsage from '../PoolUsage/PoolUsage' ;
7+ import { PoolUsage } from '../PoolUsage/PoolUsage' ;
88
99import { LOAD_AVERAGE_TIME_INTERVALS } from '../../utils/constants' ;
1010import { calcUptime } from '../../utils' ;
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1- .pool-usage {
1+ .ydb- pool-usage {
22 font-size : var (--yc-text-body-2-font-size );
33 line-height : var (--yc-text-body-2-line-height );
44 & __info {
Original file line number Diff line number Diff line change 1+ import block from 'bem-cn-lite' ;
2+
3+ import type { TPoolStats } from '../../types/api/nodes' ;
4+
5+ import './PoolUsage.scss' ;
6+
7+ const b = block ( 'ydb-pool-usage' ) ;
8+
9+ const getLineType = ( fillWidth : number ) => {
10+ let fillColor = 'green' ;
11+ if ( fillWidth > 60 && fillWidth <= 80 ) {
12+ fillColor = 'yellow' ;
13+ } else if ( fillWidth > 80 ) {
14+ fillColor = 'red' ;
15+ }
16+
17+ return fillColor ;
18+ } ;
19+
20+ interface PoolUsageProps {
21+ data ?: TPoolStats ;
22+ }
23+
24+ export const PoolUsage = ( { data : pool = { } } : PoolUsageProps ) => {
25+ const { Threads, Name = 'Unknown' , Usage = 0 } = pool ;
26+ const dataExist = Usage && Threads ;
27+
28+ const value = Math . floor ( Usage * 100 ) ;
29+ const fillWidth = value > 100 ? 100 : value ;
30+
31+ return (
32+ < div className = { b ( ) } >
33+ < div className = { b ( 'info' ) } >
34+ < div className = { b ( 'pool-name' ) } > { Name } </ div >
35+ { dataExist && (
36+ < div className = { b ( 'value' ) } >
37+ < div className = { b ( 'percents' ) } > { value < 1 ? '<1' : value } %</ div >
38+ < div className = { b ( 'threads' ) } > (×{ Threads } )</ div >
39+ </ div >
40+ ) }
41+ </ div >
42+ < div className = { b ( 'visual' ) } >
43+ < div
44+ className = { b ( 'usage-line' , { type : getLineType ( fillWidth ) } ) }
45+ style = { { width : `${ fillWidth } %` } }
46+ />
47+ </ div >
48+ </ div >
49+ ) ;
50+ } ;
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import {Loader} from '@gravity-ui/uikit';
66
77import EntityStatus from '../../../../components/EntityStatus/EntityStatus' ;
88import InfoViewer from '../../../../components/InfoViewer/InfoViewer' ;
9- import PoolUsage from '../../../../components/PoolUsage/PoolUsage' ;
9+ import { PoolUsage } from '../../../../components/PoolUsage/PoolUsage' ;
1010import { Tablet } from '../../../../components/Tablet' ;
1111
1212import { getTenantInfo } from '../../../../store/reducers/tenant/tenant' ;
You can’t perform that action at this time.
0 commit comments