ydb-embedded-ui 4.4.2 → 4.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/components/ContentWithPopup/ContentWithPopup.tsx +51 -0
  3. package/dist/components/CriticalActionDialog/CriticalActionDialog.tsx +3 -0
  4. package/dist/components/ExternalLinkWithIcon/ExternalLinkWithIcon.scss +7 -0
  5. package/dist/components/ExternalLinkWithIcon/ExternalLinkWithIcon.tsx +24 -0
  6. package/dist/components/NodeHostWrapper/NodeHostWrapper.tsx +2 -2
  7. package/dist/components/PoolBar/PoolBar.scss +6 -1
  8. package/dist/components/PoolBar/PoolBar.tsx +39 -0
  9. package/dist/components/PoolsGraph/PoolsGraph.scss +1 -1
  10. package/dist/components/PoolsGraph/PoolsGraph.tsx +23 -0
  11. package/dist/components/Tablet/Tablet.scss +4 -1
  12. package/dist/components/Tablet/Tablet.tsx +11 -35
  13. package/dist/components/{Tooltips/NodeEndpointsTooltip/NodeEndpointsTooltip.scss → TooltipsContent/NodeEndpointsTooltipContent/NodeEndpointsTooltipContent.scss} +1 -1
  14. package/dist/components/{Tooltips/NodeEndpointsTooltip/NodeEndpointsTooltip.tsx → TooltipsContent/NodeEndpointsTooltipContent/NodeEndpointsTooltipContent.tsx} +3 -3
  15. package/dist/components/TooltipsContent/PoolTooltipContent/PoolTooltipContent.tsx +24 -0
  16. package/dist/components/TooltipsContent/TabletTooltipContent/TabletTooltipContent.tsx +34 -0
  17. package/dist/components/TooltipsContent/index.ts +3 -0
  18. package/dist/containers/Cluster/Cluster.tsx +14 -10
  19. package/dist/containers/{ClusterInfo → Cluster/ClusterInfo}/ClusterInfo.scss +8 -40
  20. package/dist/containers/Cluster/ClusterInfo/ClusterInfo.tsx +223 -0
  21. package/dist/containers/{ClusterInfo → Cluster/ClusterInfo}/utils.ts +1 -1
  22. package/dist/containers/Cluster/VersionsBar/VersionsBar.scss +27 -0
  23. package/dist/containers/Cluster/VersionsBar/VersionsBar.tsx +33 -0
  24. package/dist/containers/Header/Header.tsx +3 -6
  25. package/dist/containers/Nodes/Nodes.tsx +0 -11
  26. package/dist/containers/Nodes/getNodesColumns.tsx +3 -20
  27. package/dist/containers/Tablet/Tablet.scss +4 -0
  28. package/dist/containers/Tablet/Tablet.tsx +2 -1
  29. package/dist/containers/Tablet/TabletControls/TabletControls.tsx +19 -27
  30. package/dist/containers/Tablets/Tablets.tsx +1 -17
  31. package/dist/containers/TabletsFilters/TabletsFilters.js +2 -14
  32. package/dist/containers/Tenant/Diagnostics/Consumers/columns/columns.tsx +2 -2
  33. package/dist/containers/Tenant/Diagnostics/Diagnostics.tsx +37 -38
  34. package/dist/containers/Tenant/Diagnostics/DiagnosticsPages.ts +15 -28
  35. package/dist/containers/Tenant/Diagnostics/TenantOverview/TenantOverview.js +4 -14
  36. package/dist/containers/Tenant/Diagnostics/TopQueries/TopQueries.tsx +5 -3
  37. package/dist/containers/Tenant/ObjectGeneral/ObjectGeneral.tsx +2 -3
  38. package/dist/containers/Tenant/ObjectSummary/ObjectSummary.tsx +3 -3
  39. package/dist/containers/Tenant/Tenant.tsx +14 -15
  40. package/dist/containers/Tenant/TenantPages.tsx +3 -6
  41. package/dist/containers/Tenant/utils/schemaActions.ts +4 -4
  42. package/dist/containers/Tenants/Tenants.js +3 -17
  43. package/dist/containers/Versions/NodesTable/NodesTable.tsx +4 -34
  44. package/dist/routes.ts +1 -1
  45. package/dist/store/reducers/index.ts +1 -1
  46. package/dist/store/reducers/tenant/constants.ts +19 -0
  47. package/dist/store/reducers/{tenant.js → tenant/tenant.ts} +27 -36
  48. package/dist/store/reducers/tenant/types.ts +25 -0
  49. package/dist/types/additionalProps.ts +11 -0
  50. package/dist/utils/index.js +2 -1
  51. package/dist/utils/tooltip.js +8 -80
  52. package/package.json +2 -1
  53. package/dist/components/Breadcrumbs/Breadcrumbs.js +0 -25
  54. package/dist/components/Breadcrumbs/Breadcrumbs.scss +0 -5
  55. package/dist/components/Collapse/Collapse.js +0 -84
  56. package/dist/components/Collapse/Collapse.scss +0 -70
  57. package/dist/components/PoolBar/PoolBar.js +0 -52
  58. package/dist/components/PoolsGraph/PoolsGraph.js +0 -33
  59. package/dist/containers/ClusterInfo/ClusterInfo.tsx +0 -207
@@ -0,0 +1,19 @@
1
+ export const TENANT_GENERAL_TABS_IDS = {
2
+ query: 'query',
3
+ diagnostics: 'diagnostics',
4
+ } as const;
5
+
6
+ export const TENANT_DIAGNOSTICS_TABS_IDS = {
7
+ overview: 'overview',
8
+ topQueries: 'topQueries',
9
+ topShards: 'topShards',
10
+ nodes: 'nodes',
11
+ tablets: 'tablets',
12
+ storage: 'storage',
13
+ network: 'network',
14
+ describe: 'describe',
15
+ hotKeys: 'hotKeys',
16
+ graph: 'graph',
17
+ consumers: 'consumers',
18
+ partitions: 'partitions',
19
+ } as const;
@@ -1,13 +1,20 @@
1
- import {createRequestActionTypes, createApiRequest} from '../utils';
2
- import '../../services/api';
3
- import _ from 'lodash';
1
+ import type {Reducer} from 'redux';
2
+
3
+ import type {TTenant} from '../../../types/api/tenant';
4
+ import type {TenantAction, TenantDiagnosticsTab, TenantGeneralTab, TenantState} from './types';
5
+
6
+ import '../../../services/api';
7
+ import {createRequestActionTypes, createApiRequest} from '../../utils';
8
+
9
+ export const FETCH_TENANT = createRequestActionTypes('tenant', 'FETCH_TENANT');
4
10
 
5
- const FETCH_TENANT = createRequestActionTypes('tenant', 'FETCH_TENANT');
6
11
  const SET_TOP_LEVEL_TAB = 'tenant/SET_TOP_LEVEL_TAB';
7
12
  const SET_DIAGNOSTICS_TAB = 'tenant/SET_DIAGNOSTICS_TAB';
8
13
  const CLEAR_TENANT = 'tenant/CLEAR_TENANT';
9
14
 
10
- const tenantReducer = (state = {loading: false, wasLoaded: false, tenant: {}}, action) => {
15
+ const initialState = {loading: false, wasLoaded: false};
16
+
17
+ const tenantReducer: Reducer<TenantState, TenantAction> = (state = initialState, action) => {
11
18
  switch (action.type) {
12
19
  case FETCH_TENANT.REQUEST: {
13
20
  return {
@@ -17,12 +24,9 @@ const tenantReducer = (state = {loading: false, wasLoaded: false, tenant: {}}, a
17
24
  }
18
25
 
19
26
  case FETCH_TENANT.SUCCESS: {
20
- const {tenant, tenantNodes} = action.data;
21
-
22
27
  return {
23
28
  ...state,
24
- tenant,
25
- tenantNodes,
29
+ tenant: action.data,
26
30
  loading: false,
27
31
  wasLoaded: true,
28
32
  error: undefined,
@@ -32,7 +36,7 @@ const tenantReducer = (state = {loading: false, wasLoaded: false, tenant: {}}, a
32
36
  case FETCH_TENANT.FAILURE: {
33
37
  return {
34
38
  ...state,
35
- data: action.error,
39
+ error: action.error,
36
40
  loading: false,
37
41
  wasLoaded: true,
38
42
  };
@@ -41,7 +45,7 @@ const tenantReducer = (state = {loading: false, wasLoaded: false, tenant: {}}, a
41
45
  case CLEAR_TENANT: {
42
46
  return {
43
47
  ...state,
44
- tenant: {},
48
+ tenant: undefined,
45
49
  loading: true,
46
50
  };
47
51
  }
@@ -65,45 +69,32 @@ const tenantReducer = (state = {loading: false, wasLoaded: false, tenant: {}}, a
65
69
  }
66
70
  };
67
71
 
68
- export const clearTenant = () => {
69
- return {type: CLEAR_TENANT};
70
- };
71
-
72
- export const getTenantInfo = ({path}) => {
72
+ export const getTenantInfo = ({path}: {path: string}) => {
73
73
  return createApiRequest({
74
- request: Promise.all([window.api.getTenantInfo({path}), window.api.getCompute(path)]),
74
+ request: window.api.getTenantInfo({path}),
75
75
  actions: FETCH_TENANT,
76
- dataHandler: ([tenantData, nodesData]) => {
77
- const tenant = tenantData.TenantInfo[0];
78
- const tenantNodes = _.map(nodesData?.Tenants[0]?.Nodes, (item) => {
79
- if (item.Host && item.Endpoints) {
80
- const address = _.find(item.Endpoints, {Name: 'http-mon'})?.Address;
81
- return {
82
- id: item.NodeId,
83
- backend: `${item.Host}${address ? address : ''}`,
84
- };
85
- }
86
-
87
- return undefined;
88
- }).filter(Boolean);
89
-
90
- return {tenant, tenantNodes};
76
+ dataHandler: (tenantData): TTenant | undefined => {
77
+ return tenantData.TenantInfo?.[0];
91
78
  },
92
79
  });
93
80
  };
94
81
 
95
- export function setTopLevelTab(tab) {
82
+ export const clearTenant = () => {
83
+ return {type: CLEAR_TENANT} as const;
84
+ };
85
+
86
+ export function setTopLevelTab(tab: TenantGeneralTab) {
96
87
  return {
97
88
  type: SET_TOP_LEVEL_TAB,
98
89
  data: tab,
99
- };
90
+ } as const;
100
91
  }
101
92
 
102
- export function setDiagnosticsTab(tab) {
93
+ export function setDiagnosticsTab(tab: TenantDiagnosticsTab) {
103
94
  return {
104
95
  type: SET_DIAGNOSTICS_TAB,
105
96
  data: tab,
106
- };
97
+ } as const;
107
98
  }
108
99
 
109
100
  export default tenantReducer;
@@ -0,0 +1,25 @@
1
+ import type {IResponseError} from '../../../types/api/error';
2
+ import type {TTenant} from '../../../types/api/tenant';
3
+ import type {ValueOf} from '../../../types/common';
4
+ import type {ApiRequestAction} from '../../utils';
5
+
6
+ import {TENANT_DIAGNOSTICS_TABS_IDS, TENANT_GENERAL_TABS_IDS} from './constants';
7
+ import {FETCH_TENANT, clearTenant, setDiagnosticsTab, setTopLevelTab} from './tenant';
8
+
9
+ export type TenantGeneralTab = ValueOf<typeof TENANT_GENERAL_TABS_IDS>;
10
+ export type TenantDiagnosticsTab = ValueOf<typeof TENANT_DIAGNOSTICS_TABS_IDS>;
11
+
12
+ export interface TenantState {
13
+ loading: boolean;
14
+ wasLoaded: boolean;
15
+ topLevelTab?: TenantGeneralTab;
16
+ diagnosticsTab?: TenantDiagnosticsTab;
17
+ tenant?: TTenant;
18
+ error?: IResponseError;
19
+ }
20
+
21
+ export type TenantAction =
22
+ | ApiRequestAction<typeof FETCH_TENANT, TTenant | undefined, IResponseError>
23
+ | ReturnType<typeof clearTenant>
24
+ | ReturnType<typeof setTopLevelTab>
25
+ | ReturnType<typeof setDiagnosticsTab>;
@@ -1,5 +1,16 @@
1
+ import type {InfoViewerItem} from '../components/InfoViewer';
1
2
  import type {VersionToColorMap} from './versions';
2
3
 
3
4
  export interface AdditionalVersionsProps {
4
5
  getVersionToColorMap?: () => VersionToColorMap;
5
6
  }
7
+
8
+ export interface ClusterLink {
9
+ title: string;
10
+ url: string;
11
+ }
12
+
13
+ export interface AdditionalClusterProps {
14
+ info?: InfoViewerItem[];
15
+ links?: ClusterLink[];
16
+ }
@@ -97,7 +97,8 @@ export const formatDateTime = (value) => {
97
97
 
98
98
  export const calcUptimeInSeconds = (milliseconds) => {
99
99
  const currentDate = new Date();
100
- return (currentDate - Number(milliseconds)) / 1000;
100
+ const diff = currentDate - Number(milliseconds);
101
+ return diff <= 0 ? 0 : diff / 1000;
101
102
  };
102
103
 
103
104
  export const calcUptime = (milliseconds) => {
@@ -1,83 +1,11 @@
1
1
  import cn from 'bem-cn-lite';
2
- import {calcUptime} from '.';
3
2
  import JSONTree from 'react-json-inspector';
4
3
 
5
- import {NodeEndpointsTooltip} from '../components/Tooltips/NodeEndpointsTooltip/NodeEndpointsTooltip';
6
-
7
- const poolB = cn('pool-tooltip');
8
-
9
- const PoolTooltip = (props) => {
10
- const {data} = props;
11
- const usage = (data.Usage * 100).toFixed(2);
12
- return (
13
- data && (
14
- <div className={poolB()}>
15
- <table>
16
- <tbody>
17
- <tr>
18
- <td className={poolB('label')}>Pool</td>
19
- <td>{data.Name}</td>
20
- </tr>
21
- <tr>
22
- <td className={poolB('label')}>Usage</td>
23
- <td>{usage} %</td>
24
- </tr>
25
- <tr>
26
- <td className={poolB('label')}>Threads</td>
27
- <td>{data.Threads}</td>
28
- </tr>
29
- </tbody>
30
- </table>
31
- </div>
32
- )
33
- );
34
- };
35
-
36
- const tabletB = cn('tablet-tooltip');
37
-
38
- const TabletTooltip = (props) => {
39
- const {data, additionalData} = props;
40
- return (
41
- data && (
42
- <div className={tabletB()}>
43
- <table>
44
- <tbody>
45
- <tr>
46
- <td className={tabletB('label')}>Tablet</td>
47
- <td className={tabletB('value')}>{data.TabletId}</td>
48
- </tr>
49
- <tr>
50
- <td className={tabletB('label')}>NodeID</td>
51
- <td className={tabletB('value')}>{data.NodeId}</td>
52
- </tr>
53
- <tr>
54
- <td className={tabletB('label')}>State</td>
55
- <td className={tabletB('value')}>{data.State}</td>
56
- </tr>
57
- <tr>
58
- <td className={tabletB('label')}>Type</td>
59
- <td className={tabletB('value')}>{data.Type}</td>
60
- </tr>
61
- <tr>
62
- <td className={tabletB('label')}>Uptime</td>
63
- <td className={tabletB('value')}>{calcUptime(data.ChangeTime)}</td>
64
- </tr>
65
- <tr>
66
- <td className={tabletB('label')}>Generation</td>
67
- <td className={tabletB('value')}>{data.Generation}</td>
68
- </tr>
69
- {additionalData && (
70
- <tr>
71
- <td className={tabletB('label')}>{additionalData.name}</td>
72
- <td className={tabletB('value')}>{additionalData.value}</td>
73
- </tr>
74
- )}
75
- </tbody>
76
- </table>
77
- </div>
78
- )
79
- );
80
- };
4
+ import {
5
+ NodeEndpointsTooltipContent,
6
+ TabletTooltipContent,
7
+ PoolTooltipContent,
8
+ } from '../components/TooltipsContent';
81
9
 
82
10
  const nodeB = cn('node-tootltip');
83
11
 
@@ -172,12 +100,12 @@ const jsonB = cn('json-tooltip');
172
100
 
173
101
  export const tooltipTemplates = {
174
102
  // eslint-disable-next-line react/display-name
175
- pool: (data) => <PoolTooltip data={data} />,
103
+ pool: (data) => <PoolTooltipContent data={data} />,
176
104
  // eslint-disable-next-line react/display-name
177
- tablet: (data, additionalData) => <TabletTooltip data={data} additionalData={additionalData} />,
105
+ tablet: (data) => <TabletTooltipContent data={data} />,
178
106
  // eslint-disable-next-line react/display-name
179
107
  node: (data) => <NodeTooltip data={data} />,
180
- nodeEndpoints: (data) => <NodeEndpointsTooltip data={data} />,
108
+ nodeEndpoints: (data) => <NodeEndpointsTooltipContent data={data} />,
181
109
  // eslint-disable-next-line react/display-name
182
110
  tabletsOverall: (data) => <TabletsOverallTooltip data={data} />,
183
111
  // eslint-disable-next-line react/display-name
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ydb-embedded-ui",
3
- "version": "4.4.2",
3
+ "version": "4.5.1",
4
4
  "files": [
5
5
  "dist"
6
6
  ],
@@ -48,6 +48,7 @@
48
48
  "//build:embedded": "echo 'PUBLIC_URL is a setting for create-react-app. Embedded version is built and hosted as is on ydb servers, with no way of knowing the final URL pattern. PUBLIC_URL=. keeps paths to all static relative, allowing servers to handle them as needed'",
49
49
  "build:embedded": "rm -rf build && PUBLIC_URL=. REACT_APP_BACKEND=http://localhost:8765 npm run build",
50
50
  "lint:styles": "stylelint 'src/**/*.scss'",
51
+ "unimported": "npx unimported --no-cache",
51
52
  "package": "rm -rf dist && copyfiles -u 1 'src/**/*' dist",
52
53
  "test": "react-app-rewired test",
53
54
  "eject": "react-scripts eject",
@@ -1,25 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import cn from 'bem-cn-lite';
4
- import {Breadcrumbs as BreadcrumbsUiKit} from '@gravity-ui/uikit';
5
-
6
- import './Breadcrumbs.scss';
7
-
8
- const b = cn('kv-breadcrumbs');
9
-
10
- class Breadcrumbs extends React.Component {
11
- static propTypes = {
12
- items: PropTypes.array,
13
- };
14
-
15
- static defaultProps = {
16
- items: [],
17
- };
18
-
19
- render() {
20
- const {items} = this.props;
21
- return <BreadcrumbsUiKit items={items} firstDisplayedItemsCount={1} className={b()} />;
22
- }
23
- }
24
-
25
- export default Breadcrumbs;
@@ -1,5 +0,0 @@
1
- .kv-breadcrumbs {
2
- padding: 20px 0;
3
-
4
- font-size: var(--yc-text-body-2-font-size);
5
- }
@@ -1,84 +0,0 @@
1
- import {useState, useEffect, useRef} from 'react';
2
- import block from 'bem-cn-lite';
3
- import {ArrowToggle, Button} from '@gravity-ui/uikit';
4
-
5
- import './Collapse.scss';
6
-
7
- const b = block('yc-collapse');
8
-
9
- function useEffectSkipFirst(fn, arr) {
10
- const isFirst = useRef(true);
11
-
12
- useEffect(() => {
13
- if (isFirst.current) {
14
- isFirst.current = false;
15
- return;
16
- }
17
-
18
- return fn();
19
- }, arr);
20
- }
21
-
22
- export const Collapse = ({
23
- title,
24
- children,
25
- arrowView = 'icon',
26
- emptyState = 'No data',
27
- titleSize = 'l',
28
- contentMarginTop = 12,
29
- defaultIsExpand,
30
- onChange,
31
- }) => {
32
- const [isExpand, setIsExpand] = useState(defaultIsExpand);
33
-
34
- const arrowDirection = isExpand ? 'top' : 'bottom';
35
-
36
- const arrowComponent =
37
- arrowView === 'button' ? (
38
- <Button view="flat" className={b('arrow-button')}>
39
- <ArrowToggle className={b('arrow')} direction={arrowDirection} size={20} />
40
- </Button>
41
- ) : (
42
- <ArrowToggle className={b('arrow')} direction={arrowDirection} size={20} />
43
- );
44
-
45
- useEffectSkipFirst(onChange, [isExpand]);
46
-
47
- return (
48
- <div className={b()}>
49
- <div
50
- className={b('panel', {
51
- 'no-data': !children,
52
- })}
53
- onClick={() => {
54
- setIsExpand(!isExpand);
55
- }}
56
- >
57
- {typeof title === 'string' ? (
58
- <h2
59
- className={b('title', {
60
- size: titleSize,
61
- })}
62
- >
63
- {title}
64
- </h2>
65
- ) : (
66
- title
67
- )}
68
-
69
- {children && <div className={b('arrow-wrapper')}>{arrowComponent}</div>}
70
- </div>
71
-
72
- {!children && <h4 className={b('empty-state-title')}>{emptyState}</h4>}
73
-
74
- {children && (
75
- <div
76
- className={b('content', {visible: isExpand})}
77
- style={{marginTop: contentMarginTop}}
78
- >
79
- {children}
80
- </div>
81
- )}
82
- </div>
83
- );
84
- };
@@ -1,70 +0,0 @@
1
- .yc-collapse {
2
- &__panel {
3
- display: inline-flex;
4
- align-items: center;
5
-
6
- cursor: pointer;
7
-
8
- &_no-data {
9
- cursor: default;
10
- }
11
- }
12
-
13
- &__title {
14
- margin: 0;
15
- }
16
-
17
- &__title_secondary {
18
- color: var(--yc-color-text-secondary);
19
- }
20
-
21
- &__title_size {
22
- &_s {
23
- font-size: var(--yc-text-body-1-font-size);
24
- line-height: var(--yc-text-body-1-line-height);
25
- }
26
-
27
- &_m {
28
- font-size: var(--yc-text-body-2-font-size);
29
- line-height: var(--yc-text-body-2-line-height);
30
- }
31
-
32
- &_l {
33
- font-size: var(--yc-text-body-3-font-size);
34
- line-height: var(--yc-text-body-3-line-height);
35
- }
36
- }
37
-
38
- &__arrow-wrapper {
39
- margin-left: 8px;
40
- }
41
-
42
- &__arrow-wrapper_secondary {
43
- color: var(--yc-color-text-secondary);
44
- .button2__text {
45
- color: var(--yc-color-text-secondary);
46
- }
47
- }
48
-
49
- &__content {
50
- display: none;
51
-
52
- &_visible {
53
- display: block;
54
- }
55
- }
56
-
57
- &__empty-state-title {
58
- font-size: var(--yc-text-body-1-font-size);
59
- font-weight: normal;
60
- line-height: var(--yc-text-body-1-line-height);
61
-
62
- opacity: 0.5;
63
- }
64
-
65
- &__arrow-button {
66
- .button2__text {
67
- margin: 0 4px;
68
- }
69
- }
70
- }
@@ -1,52 +0,0 @@
1
- import React from 'react';
2
- import cn from 'bem-cn-lite';
3
- import PropTypes from 'prop-types';
4
-
5
- import './PoolBar.scss';
6
-
7
- const b = cn('pool-bar');
8
-
9
- const getBarType = (usage) => {
10
- if (usage >= 75) {
11
- return 'danger';
12
- } else if (usage >= 50 && usage < 75) {
13
- return 'warning';
14
- } else {
15
- return 'normal';
16
- }
17
- };
18
-
19
- class PoolBar extends React.Component {
20
- static propTypes = {
21
- data: PropTypes.object,
22
- onMouseEnter: PropTypes.func,
23
- onMouseLeave: PropTypes.func,
24
- };
25
-
26
- bar = React.createRef();
27
-
28
- _onBarHover = () => {
29
- this.props.onMouseEnter(this.bar.current, this.props.data, 'pool');
30
- };
31
- _onBarLeave = () => {
32
- this.props.onMouseLeave();
33
- };
34
- render() {
35
- const {Usage: usage = 0} = this.props.data;
36
- const usagePercents = Math.min(usage * 100, 100);
37
- const type = getBarType(usagePercents);
38
-
39
- return (
40
- <div
41
- ref={this.bar}
42
- className={b({type})}
43
- onMouseEnter={this._onBarHover}
44
- onMouseLeave={this._onBarLeave}
45
- >
46
- <div style={{height: `${usagePercents}%`}} className={b('value', {type})} />
47
- </div>
48
- );
49
- }
50
- }
51
-
52
- export default PoolBar;
@@ -1,33 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import cn from 'bem-cn-lite';
4
-
5
- import PoolBar from '../PoolBar/PoolBar';
6
-
7
- import './PoolsGraph.scss';
8
-
9
- const b = cn('pools-graph');
10
-
11
- class PoolsGraph extends React.Component {
12
- static propTypes = {
13
- pools: PropTypes.arrayOf(PropTypes.object).isRequired,
14
- onMouseLeave: PropTypes.func,
15
- onMouseEnter: PropTypes.func,
16
- };
17
- static defaultProps = {
18
- pools: [],
19
- };
20
- render() {
21
- const {pools} = this.props;
22
-
23
- return (
24
- <div className={b()}>
25
- {pools.map((item, index) => (
26
- <PoolBar key={index} data={item} {...this.props} />
27
- ))}
28
- </div>
29
- );
30
- }
31
- }
32
-
33
- export default PoolsGraph;