ydb-embedded-ui 4.3.0 → 4.4.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.
- package/CHANGELOG.md +24 -0
- package/dist/containers/App/Content.js +2 -8
- package/dist/containers/AsideNavigation/AsideNavigation.tsx +1 -1
- package/dist/containers/Cluster/Cluster.scss +4 -0
- package/dist/containers/Cluster/Cluster.tsx +14 -8
- package/dist/{components → containers}/ClusterInfo/ClusterInfo.scss +39 -0
- package/dist/containers/ClusterInfo/ClusterInfo.tsx +207 -0
- package/dist/containers/ClusterInfo/utils.ts +13 -0
- package/dist/containers/Header/Header.tsx +9 -16
- package/dist/containers/Nodes/Nodes.tsx +4 -6
- package/dist/containers/Storage/DiskStateProgressBar/DiskStateProgressBar.tsx +2 -3
- package/dist/containers/Tenant/Diagnostics/Partitions/Headers/Headers.tsx +4 -4
- package/dist/containers/Tenant/Diagnostics/Partitions/Partitions.scss +4 -0
- package/dist/containers/Tenant/Diagnostics/Partitions/Partitions.tsx +2 -2
- package/dist/containers/Tenant/Diagnostics/Partitions/PartitionsControls/PartitionsControls.tsx +20 -26
- package/dist/containers/Tenant/Diagnostics/Partitions/i18n/en.json +1 -1
- package/dist/containers/Tenant/Diagnostics/Partitions/i18n/ru.json +1 -1
- package/dist/containers/UserSettings/Setting.tsx +82 -0
- package/dist/containers/UserSettings/UserSettings.tsx +61 -102
- package/dist/containers/UserSettings/i18n/en.json +20 -0
- package/dist/containers/UserSettings/i18n/index.ts +11 -0
- package/dist/containers/UserSettings/i18n/ru.json +20 -0
- package/dist/containers/Versions/GroupedNodesTree/GroupedNodesTree.scss +59 -0
- package/dist/containers/Versions/GroupedNodesTree/GroupedNodesTree.tsx +98 -0
- package/dist/containers/Versions/NodesTable/NodesTable.tsx +150 -0
- package/dist/containers/Versions/NodesTreeTitle/NodesTreeTitle.scss +55 -0
- package/dist/containers/Versions/NodesTreeTitle/NodesTreeTitle.tsx +62 -0
- package/dist/containers/Versions/Versions.scss +32 -0
- package/dist/containers/Versions/Versions.tsx +121 -0
- package/dist/containers/Versions/groupNodes.ts +124 -0
- package/dist/containers/Versions/types.ts +16 -0
- package/dist/routes.ts +0 -6
- package/dist/services/api.ts +3 -0
- package/dist/store/reducers/cluster/cluster.ts +4 -0
- package/dist/store/reducers/cluster/types.ts +3 -2
- package/dist/store/reducers/clusterNodes/clusterNodes.tsx +64 -0
- package/dist/store/reducers/clusterNodes/types.ts +22 -0
- package/dist/store/reducers/index.ts +2 -8
- package/dist/store/reducers/partitions/partitions.ts +2 -2
- package/dist/store/reducers/partitions/types.ts +1 -1
- package/dist/types/additionalProps.ts +5 -0
- package/dist/types/versions.ts +9 -0
- package/dist/utils/constants.ts +0 -11
- package/dist/utils/hooks/useSetting.ts +5 -3
- package/dist/utils/versions/getVersionsColors.ts +98 -0
- package/dist/utils/versions/index.ts +3 -0
- package/dist/utils/versions/parseNodesToVersionsValues.ts +28 -0
- package/dist/utils/versions/parseVersion.ts +23 -0
- package/package.json +1 -1
- package/dist/components/ClusterInfo/ClusterInfo.tsx +0 -239
- package/dist/components/FullGroupViewer/FullGroupViewer.js +0 -147
- package/dist/components/FullGroupViewer/FullGroupViewer.scss +0 -35
- package/dist/components/GroupTreeViewer/GroupTreeViewer.js +0 -87
- package/dist/components/GroupTreeViewer/GroupTreeViewer.scss +0 -16
- package/dist/components/GroupViewer/GroupViewer.js +0 -100
- package/dist/components/GroupViewer/GroupViewer.scss +0 -45
- package/dist/components/PDiskViewer/PDiskViewer.js +0 -79
- package/dist/components/PDiskViewer/PDiskViewer.scss +0 -46
- package/dist/components/TabletsViewer/TabletsViewer.js +0 -44
- package/dist/components/TabletsViewer/TabletsViewer.scss +0 -40
- package/dist/components/VerticalBars/VerticalBars.scss +0 -15
- package/dist/components/VerticalBars/VerticalBars.tsx +0 -38
- package/dist/components/VerticalBars/index.ts +0 -1
- package/dist/containers/Group/Group.js +0 -97
- package/dist/containers/Group/Group.scss +0 -6
- package/dist/containers/Header/Host/Host.js +0 -66
- package/dist/containers/Header/Host/Host.scss +0 -50
- package/dist/containers/Pdisk/Pdisk.js +0 -156
- package/dist/containers/Pdisk/Pdisk.scss +0 -42
- package/dist/containers/Pool/Pool.js +0 -170
- package/dist/containers/Pool/Pool.scss +0 -35
- package/dist/containers/Vdisk/Vdisk.js +0 -158
- package/dist/containers/Vdisk/Vdisk.scss +0 -42
- package/dist/containers/VdiskPdiskNode/VdiskPdiskNode.js +0 -526
- package/dist/containers/VdiskPdiskNode/VdiskPdiskNode.scss +0 -60
- package/dist/store/reducers/group.js +0 -49
- package/dist/store/reducers/pdisk.js +0 -51
- package/dist/store/reducers/pool.js +0 -42
- package/dist/store/reducers/vdisk.js +0 -49
@@ -1,38 +0,0 @@
|
|
1
|
-
import cn from 'bem-cn-lite';
|
2
|
-
import {useMemo} from 'react';
|
3
|
-
|
4
|
-
import './VerticalBars.scss';
|
5
|
-
|
6
|
-
const b = cn('ydb-bars');
|
7
|
-
|
8
|
-
const calculateValuesInPercents = (values: number[]) => {
|
9
|
-
const max = Math.max(...values);
|
10
|
-
|
11
|
-
if (!max) {
|
12
|
-
return values;
|
13
|
-
}
|
14
|
-
|
15
|
-
const res = [];
|
16
|
-
|
17
|
-
for (const value of values) {
|
18
|
-
res.push((value / max) * 100);
|
19
|
-
}
|
20
|
-
|
21
|
-
return res;
|
22
|
-
};
|
23
|
-
|
24
|
-
interface VerticalBarsProps {
|
25
|
-
values: number[];
|
26
|
-
}
|
27
|
-
|
28
|
-
export const VerticalBars = ({values}: VerticalBarsProps) => {
|
29
|
-
const preparedValues = useMemo(() => calculateValuesInPercents(values), [values]);
|
30
|
-
|
31
|
-
const getBars = () => {
|
32
|
-
return preparedValues.map((value, index) => {
|
33
|
-
return <div key={index} style={{height: `${value}%`}} className={b('value')} />;
|
34
|
-
});
|
35
|
-
};
|
36
|
-
|
37
|
-
return <div className={b()}>{getBars()}</div>;
|
38
|
-
};
|
@@ -1 +0,0 @@
|
|
1
|
-
export * from './VerticalBars';
|
@@ -1,97 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import PropTypes from 'prop-types';
|
3
|
-
import cn from 'bem-cn-lite';
|
4
|
-
import {connect} from 'react-redux';
|
5
|
-
import {getGroupInfo, clearStore} from '../../store/reducers/group';
|
6
|
-
import FullGroupViewer from '../../components/FullGroupViewer/FullGroupViewer';
|
7
|
-
import {Loader} from '@gravity-ui/uikit';
|
8
|
-
import {GROUP_AUTO_RELOAD_INTERVAL} from '../../utils/constants';
|
9
|
-
import './Group.scss';
|
10
|
-
|
11
|
-
const b = cn('group');
|
12
|
-
|
13
|
-
class Group extends React.Component {
|
14
|
-
static renderLoader() {
|
15
|
-
return (
|
16
|
-
<div className={'loader'}>
|
17
|
-
<Loader size="l" />
|
18
|
-
</div>
|
19
|
-
);
|
20
|
-
}
|
21
|
-
|
22
|
-
static propTypes = {
|
23
|
-
className: PropTypes.string,
|
24
|
-
loading: PropTypes.bool,
|
25
|
-
wasLoaded: PropTypes.bool,
|
26
|
-
error: PropTypes.bool,
|
27
|
-
getGroupInfo: PropTypes.func,
|
28
|
-
clearStore: PropTypes.func,
|
29
|
-
group: PropTypes.object,
|
30
|
-
location: PropTypes.object,
|
31
|
-
match: PropTypes.object,
|
32
|
-
};
|
33
|
-
|
34
|
-
static defaultProps = {
|
35
|
-
className: '',
|
36
|
-
};
|
37
|
-
|
38
|
-
componentDidMount() {
|
39
|
-
const {id} = this.props.match.params;
|
40
|
-
this.props.getGroupInfo(id);
|
41
|
-
this.reloadDescriptor = setInterval(
|
42
|
-
() => this.props.getGroupInfo(id),
|
43
|
-
GROUP_AUTO_RELOAD_INTERVAL,
|
44
|
-
);
|
45
|
-
}
|
46
|
-
|
47
|
-
componentWillUnmount() {
|
48
|
-
this.props.clearStore();
|
49
|
-
clearInterval(this.reloadDescriptor);
|
50
|
-
}
|
51
|
-
|
52
|
-
renderContent = () => {
|
53
|
-
const {className, group} = this.props;
|
54
|
-
return (
|
55
|
-
<div className={`${b()} ${className}`}>
|
56
|
-
<FullGroupViewer group={group} />
|
57
|
-
</div>
|
58
|
-
);
|
59
|
-
};
|
60
|
-
|
61
|
-
render() {
|
62
|
-
const {loading, wasLoaded, error, group} = this.props;
|
63
|
-
|
64
|
-
if (loading && !wasLoaded) {
|
65
|
-
return Group.renderLoader();
|
66
|
-
} else if (error) {
|
67
|
-
return <div>{error.statusText}</div>;
|
68
|
-
} else if (group) {
|
69
|
-
return this.renderContent();
|
70
|
-
} else {
|
71
|
-
return <div className="error">no data</div>;
|
72
|
-
}
|
73
|
-
}
|
74
|
-
}
|
75
|
-
|
76
|
-
const mapStateToProps = (state) => {
|
77
|
-
const {data, wasLoaded, loading, error} = state.group;
|
78
|
-
|
79
|
-
let group;
|
80
|
-
if (data) {
|
81
|
-
group = data.StoragePools[0].Groups[0];
|
82
|
-
}
|
83
|
-
|
84
|
-
return {
|
85
|
-
group,
|
86
|
-
wasLoaded,
|
87
|
-
loading,
|
88
|
-
error,
|
89
|
-
};
|
90
|
-
};
|
91
|
-
|
92
|
-
const mapDispatchToProps = {
|
93
|
-
getGroupInfo,
|
94
|
-
clearStore,
|
95
|
-
};
|
96
|
-
|
97
|
-
export default connect(mapStateToProps, mapDispatchToProps)(Group);
|
@@ -1,66 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import PropTypes from 'prop-types';
|
3
|
-
import cn from 'bem-cn-lite';
|
4
|
-
|
5
|
-
import {Link as ExternalLink} from '@gravity-ui/uikit';
|
6
|
-
|
7
|
-
import EntityStatus from '../../../components/EntityStatus/EntityStatus';
|
8
|
-
import {Tag} from '../../../components/Tag';
|
9
|
-
|
10
|
-
import {calcUptime} from '../../../utils';
|
11
|
-
import {customBackend} from '../../../store';
|
12
|
-
|
13
|
-
import './Host.scss';
|
14
|
-
|
15
|
-
const b = cn('host');
|
16
|
-
|
17
|
-
export default class Host extends React.Component {
|
18
|
-
static propTypes = {
|
19
|
-
host: PropTypes.object,
|
20
|
-
singleClusterMode: PropTypes.bool,
|
21
|
-
};
|
22
|
-
|
23
|
-
renderStatus = () => {
|
24
|
-
const {host} = this.props;
|
25
|
-
|
26
|
-
return (
|
27
|
-
<div className={b('status')}>
|
28
|
-
<EntityStatus size="m" status={host.SystemState} name={'Internal viewer'} />
|
29
|
-
</div>
|
30
|
-
);
|
31
|
-
};
|
32
|
-
|
33
|
-
render() {
|
34
|
-
const {host, backend, singleClusterMode} = this.props;
|
35
|
-
const uptime = calcUptime(host.StartTime);
|
36
|
-
|
37
|
-
let link = backend + '/internal';
|
38
|
-
|
39
|
-
if (singleClusterMode && !customBackend) {
|
40
|
-
link = `/internal`;
|
41
|
-
}
|
42
|
-
|
43
|
-
return (
|
44
|
-
<div className={b()}>
|
45
|
-
<div className={b('common')}>
|
46
|
-
{link ? (
|
47
|
-
<ExternalLink href={link}>{this.renderStatus()}</ExternalLink>
|
48
|
-
) : (
|
49
|
-
this.renderStatus()
|
50
|
-
)}
|
51
|
-
<Tag text={host.DataCenter} />
|
52
|
-
</div>
|
53
|
-
<div className={b('info')}>
|
54
|
-
<div className={b('info-item')}>
|
55
|
-
<div className={b('label')}>Uptime</div>
|
56
|
-
<div className={b('value')}>{uptime}</div>
|
57
|
-
</div>
|
58
|
-
<div className={b('info-item')}>
|
59
|
-
<div className={b('label')}>Version</div>
|
60
|
-
<div className={b('value')}>{host.Version}</div>
|
61
|
-
</div>
|
62
|
-
</div>
|
63
|
-
</div>
|
64
|
-
);
|
65
|
-
}
|
66
|
-
}
|
@@ -1,50 +0,0 @@
|
|
1
|
-
.host {
|
2
|
-
display: flex;
|
3
|
-
flex-direction: column;
|
4
|
-
|
5
|
-
&__common {
|
6
|
-
display: flex;
|
7
|
-
align-items: center;
|
8
|
-
|
9
|
-
margin-bottom: 4px;
|
10
|
-
}
|
11
|
-
&__status {
|
12
|
-
display: flex;
|
13
|
-
|
14
|
-
margin-right: 15px;
|
15
|
-
|
16
|
-
font-size: var(--yc-text-body-2-font-size);
|
17
|
-
line-height: var(--yc-text-body-2-line-height);
|
18
|
-
}
|
19
|
-
&__info {
|
20
|
-
display: flex;
|
21
|
-
align-items: center;
|
22
|
-
}
|
23
|
-
&__info-item {
|
24
|
-
display: flex;
|
25
|
-
|
26
|
-
margin-right: 20px;
|
27
|
-
|
28
|
-
&:last-child {
|
29
|
-
margin-right: 0;
|
30
|
-
}
|
31
|
-
}
|
32
|
-
&__label {
|
33
|
-
margin-right: 10px;
|
34
|
-
|
35
|
-
font-size: var(--yc-text-body-1-font-size);
|
36
|
-
line-height: var(--yc-text-body-1-line-height);
|
37
|
-
|
38
|
-
color: var(--yc-color-text-hint);
|
39
|
-
|
40
|
-
.yc-root_theme_dark & {
|
41
|
-
color: var(--yc-color-text-hint);
|
42
|
-
}
|
43
|
-
}
|
44
|
-
&__value {
|
45
|
-
font-size: var(--yc-text-body-1-font-size);
|
46
|
-
line-height: var(--yc-text-body-1-line-height);
|
47
|
-
|
48
|
-
color: var(--yc-color-text-primary);
|
49
|
-
}
|
50
|
-
}
|
@@ -1,156 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import PropTypes from 'prop-types';
|
3
|
-
import cn from 'bem-cn-lite';
|
4
|
-
import qs from 'qs';
|
5
|
-
import {connect} from 'react-redux';
|
6
|
-
|
7
|
-
import {Link} from 'react-router-dom';
|
8
|
-
import {Loader} from '@gravity-ui/uikit';
|
9
|
-
|
10
|
-
import InfoViewer from '../../components/InfoViewer/InfoViewer';
|
11
|
-
import EntityStatus from '../../components/EntityStatus/EntityStatus';
|
12
|
-
import ProgressViewer from '../../components/ProgressViewer/ProgressViewer';
|
13
|
-
|
14
|
-
import {getPdiskInfo, clearStore} from '../../store/reducers/pdisk';
|
15
|
-
import {PDISK_AUTO_RELOAD_INTERVAL} from '../../utils/constants';
|
16
|
-
import {formatStorageValues, calcUptime} from '../../utils';
|
17
|
-
import {getDefaultNodePath} from '../Node/NodePages';
|
18
|
-
|
19
|
-
import './Pdisk.scss';
|
20
|
-
|
21
|
-
const b = cn('pdisk');
|
22
|
-
|
23
|
-
class Pdisk extends React.Component {
|
24
|
-
static renderLoader() {
|
25
|
-
return (
|
26
|
-
<div className={'loader'}>
|
27
|
-
<Loader size="l" />
|
28
|
-
</div>
|
29
|
-
);
|
30
|
-
}
|
31
|
-
|
32
|
-
static propTypes = {
|
33
|
-
className: PropTypes.string,
|
34
|
-
loading: PropTypes.bool,
|
35
|
-
wasLoaded: PropTypes.bool,
|
36
|
-
error: PropTypes.bool,
|
37
|
-
getPdiskInfo: PropTypes.func,
|
38
|
-
clearStore: PropTypes.func,
|
39
|
-
pdisk: PropTypes.object,
|
40
|
-
location: PropTypes.object,
|
41
|
-
};
|
42
|
-
|
43
|
-
static defaultProps = {
|
44
|
-
className: '',
|
45
|
-
};
|
46
|
-
|
47
|
-
componentDidMount() {
|
48
|
-
const queryParams = qs.parse(this.props.location.search, {
|
49
|
-
ignoreQueryPrefix: true,
|
50
|
-
});
|
51
|
-
const nodeId = queryParams.node_id;
|
52
|
-
this.props.getPdiskInfo(nodeId);
|
53
|
-
this.reloadDescriptor = setInterval(
|
54
|
-
() => this.props.getPdiskInfo(nodeId),
|
55
|
-
PDISK_AUTO_RELOAD_INTERVAL,
|
56
|
-
);
|
57
|
-
}
|
58
|
-
|
59
|
-
componentWillUnmount() {
|
60
|
-
this.props.clearStore();
|
61
|
-
clearInterval(this.reloadDescriptor);
|
62
|
-
}
|
63
|
-
|
64
|
-
renderContent = () => {
|
65
|
-
const {
|
66
|
-
TotalSize,
|
67
|
-
AvailableSize,
|
68
|
-
ChangeTime,
|
69
|
-
Device,
|
70
|
-
Guid,
|
71
|
-
NodeId,
|
72
|
-
PDiskId,
|
73
|
-
Path,
|
74
|
-
Realtime,
|
75
|
-
State,
|
76
|
-
} = this.props.pdisk;
|
77
|
-
|
78
|
-
const pdiskInfo = [
|
79
|
-
{label: 'Device', value: <EntityStatus status={Device} />},
|
80
|
-
{label: 'Realtime', value: <EntityStatus status={Realtime} />},
|
81
|
-
{label: 'State', value: State},
|
82
|
-
{
|
83
|
-
label: 'Size',
|
84
|
-
value: (
|
85
|
-
<ProgressViewer
|
86
|
-
value={TotalSize - AvailableSize || 0}
|
87
|
-
capacity={TotalSize || 0}
|
88
|
-
formatValues={formatStorageValues}
|
89
|
-
colorizeProgress={true}
|
90
|
-
className={b('size')}
|
91
|
-
/>
|
92
|
-
),
|
93
|
-
},
|
94
|
-
{label: 'ChangeTime', value: calcUptime(ChangeTime)},
|
95
|
-
{label: 'Path', value: Path},
|
96
|
-
{label: 'Guid', value: Guid},
|
97
|
-
{
|
98
|
-
label: 'NodeId',
|
99
|
-
value: (
|
100
|
-
<Link className={b('link')} to={getDefaultNodePath(NodeId)}>
|
101
|
-
{NodeId}
|
102
|
-
</Link>
|
103
|
-
),
|
104
|
-
},
|
105
|
-
];
|
106
|
-
|
107
|
-
return (
|
108
|
-
<div className={b()}>
|
109
|
-
<div className={b('row')}>
|
110
|
-
<span className={b('title')}>PDisk </span>
|
111
|
-
<EntityStatus status={Device} name={PDiskId} />
|
112
|
-
</div>
|
113
|
-
|
114
|
-
<div className={b('column')}>
|
115
|
-
<InfoViewer className={b('section')} info={pdiskInfo} />
|
116
|
-
</div>
|
117
|
-
</div>
|
118
|
-
);
|
119
|
-
};
|
120
|
-
|
121
|
-
render() {
|
122
|
-
const {loading, wasLoaded, error} = this.props;
|
123
|
-
|
124
|
-
if (loading && !wasLoaded) {
|
125
|
-
return Pdisk.renderLoader();
|
126
|
-
} else if (error) {
|
127
|
-
return <div>{error.statusText}</div>;
|
128
|
-
} else {
|
129
|
-
return this.renderContent();
|
130
|
-
}
|
131
|
-
}
|
132
|
-
}
|
133
|
-
|
134
|
-
const mapStateToProps = (state, ownProps) => {
|
135
|
-
const {data, wasLoaded, loading, error} = state.pdisk;
|
136
|
-
|
137
|
-
const {id} = ownProps.match.params;
|
138
|
-
let pdisk;
|
139
|
-
if (data) {
|
140
|
-
pdisk = data.PDiskStateInfo.filter((disk) => disk.PDiskId === Number(id))[0];
|
141
|
-
}
|
142
|
-
|
143
|
-
return {
|
144
|
-
pdisk,
|
145
|
-
wasLoaded,
|
146
|
-
loading,
|
147
|
-
error,
|
148
|
-
};
|
149
|
-
};
|
150
|
-
|
151
|
-
const mapDispatchToProps = {
|
152
|
-
getPdiskInfo,
|
153
|
-
clearStore,
|
154
|
-
};
|
155
|
-
|
156
|
-
export default connect(mapStateToProps, mapDispatchToProps)(Pdisk);
|
@@ -1,42 +0,0 @@
|
|
1
|
-
@import '../../styles/mixins.scss';
|
2
|
-
|
3
|
-
.pdisk {
|
4
|
-
padding: 20px;
|
5
|
-
@include container-fluid();
|
6
|
-
|
7
|
-
.info-viewer__items {
|
8
|
-
grid-template-columns: auto;
|
9
|
-
}
|
10
|
-
|
11
|
-
&__row {
|
12
|
-
display: flex;
|
13
|
-
}
|
14
|
-
|
15
|
-
&__column {
|
16
|
-
display: flex;
|
17
|
-
flex-direction: column;
|
18
|
-
}
|
19
|
-
|
20
|
-
&__title {
|
21
|
-
margin-right: 16px;
|
22
|
-
|
23
|
-
font-size: var(--yc-text-body-2-font-size);
|
24
|
-
font-weight: 500;
|
25
|
-
line-height: var(--yc-text-body-2-line-height);
|
26
|
-
text-transform: uppercase;
|
27
|
-
}
|
28
|
-
|
29
|
-
&__section {
|
30
|
-
padding: 15px 0;
|
31
|
-
}
|
32
|
-
|
33
|
-
&__size {
|
34
|
-
margin-top: -8px;
|
35
|
-
}
|
36
|
-
|
37
|
-
&__link {
|
38
|
-
text-decoration: none;
|
39
|
-
|
40
|
-
color: var(--yc-color-base-special);
|
41
|
-
}
|
42
|
-
}
|
@@ -1,170 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import PropTypes from 'prop-types';
|
3
|
-
import cn from 'bem-cn-lite';
|
4
|
-
import {connect} from 'react-redux';
|
5
|
-
import _ from 'lodash';
|
6
|
-
|
7
|
-
import {Loader} from '@gravity-ui/uikit';
|
8
|
-
import ReactList from 'react-list';
|
9
|
-
|
10
|
-
import EntityStatus from '../../components/EntityStatus/EntityStatus';
|
11
|
-
import GroupTreeViewer from '../../components/GroupTreeViewer/GroupTreeViewer';
|
12
|
-
import Breadcrumbs from '../../components/Breadcrumbs/Breadcrumbs';
|
13
|
-
import {ProblemFilter} from '../../components/ProblemFilter/ProblemFilter';
|
14
|
-
import {Illustration} from '../../components/Illustration';
|
15
|
-
|
16
|
-
import {getPoolInfo} from '../../store/reducers/pool';
|
17
|
-
import {AUTO_RELOAD_INTERVAL, ALL} from '../../utils/constants';
|
18
|
-
import {changeFilter} from '../../store/reducers/settings';
|
19
|
-
|
20
|
-
import './Pool.scss';
|
21
|
-
|
22
|
-
const b = cn('pool');
|
23
|
-
|
24
|
-
class Pool extends React.Component {
|
25
|
-
static renderLoader() {
|
26
|
-
return (
|
27
|
-
<div className={'loader'}>
|
28
|
-
<Loader size="l" />
|
29
|
-
</div>
|
30
|
-
);
|
31
|
-
}
|
32
|
-
|
33
|
-
static propTypes = {
|
34
|
-
loading: PropTypes.bool,
|
35
|
-
wasLoaded: PropTypes.bool,
|
36
|
-
error: PropTypes.bool,
|
37
|
-
getPoolInfo: PropTypes.func,
|
38
|
-
pool: PropTypes.object,
|
39
|
-
poolName: PropTypes.string,
|
40
|
-
match: PropTypes.object,
|
41
|
-
filter: PropTypes.string,
|
42
|
-
changeFilter: PropTypes.func,
|
43
|
-
};
|
44
|
-
|
45
|
-
static defaultProps = {
|
46
|
-
pool: {},
|
47
|
-
};
|
48
|
-
|
49
|
-
static filterGroups(groups, filter) {
|
50
|
-
return _.filter(groups, (item) => {
|
51
|
-
return filter === ALL || (item.Overall && item.Overall !== 'Green');
|
52
|
-
});
|
53
|
-
}
|
54
|
-
|
55
|
-
componentDidMount() {
|
56
|
-
const {poolName} = this.props.match.params;
|
57
|
-
this.props.getPoolInfo(decodeURIComponent(poolName));
|
58
|
-
this.reloadDescriptor = setInterval(
|
59
|
-
() => this.props.getPoolInfo(decodeURIComponent(poolName)),
|
60
|
-
AUTO_RELOAD_INTERVAL,
|
61
|
-
);
|
62
|
-
}
|
63
|
-
|
64
|
-
componentWillUnmount() {
|
65
|
-
clearInterval(this.reloadDescriptor);
|
66
|
-
}
|
67
|
-
|
68
|
-
state = {
|
69
|
-
extendedGroups: new Set(),
|
70
|
-
};
|
71
|
-
|
72
|
-
makeHandleGroupClick = (groupIndex) => () => {
|
73
|
-
const {extendedGroups} = this.state;
|
74
|
-
const newExtendedGroups = new Set([...extendedGroups]);
|
75
|
-
|
76
|
-
if (newExtendedGroups.has(groupIndex)) {
|
77
|
-
newExtendedGroups.delete(groupIndex);
|
78
|
-
} else {
|
79
|
-
newExtendedGroups.add(groupIndex);
|
80
|
-
}
|
81
|
-
|
82
|
-
this.setState({extendedGroups: newExtendedGroups});
|
83
|
-
};
|
84
|
-
|
85
|
-
makeRenderGroups = (groups) => (index, key) => {
|
86
|
-
const group = groups[index];
|
87
|
-
const {extendedGroups} = this.state;
|
88
|
-
|
89
|
-
return (
|
90
|
-
<GroupTreeViewer
|
91
|
-
key={key}
|
92
|
-
group={group}
|
93
|
-
collapsed={!extendedGroups.has(index)}
|
94
|
-
onClick={this.makeHandleGroupClick(index)}
|
95
|
-
/>
|
96
|
-
);
|
97
|
-
};
|
98
|
-
|
99
|
-
renderContent = () => {
|
100
|
-
const {pool, filter, changeFilter} = this.props;
|
101
|
-
const {extendedGroups} = this.state;
|
102
|
-
|
103
|
-
const breadcrumbsItems = [{text: 'Database'}, {text: 'Storage Pool'}];
|
104
|
-
|
105
|
-
if (pool && pool.StoragePools) {
|
106
|
-
const poolInfo = pool.StoragePools[0];
|
107
|
-
const filteredGroups = Pool.filterGroups(poolInfo.Groups, filter);
|
108
|
-
|
109
|
-
return (
|
110
|
-
<div className={b()}>
|
111
|
-
<Breadcrumbs items={breadcrumbsItems} />
|
112
|
-
<div className={b('row')}>
|
113
|
-
<span className={b('title')}>Pool </span>
|
114
|
-
<EntityStatus status={poolInfo.Overall} name={poolInfo.Name}></EntityStatus>
|
115
|
-
</div>
|
116
|
-
|
117
|
-
<div className={b('controls')}>
|
118
|
-
<div className={b('title', {groups: true})}>Groups</div>
|
119
|
-
<ProblemFilter value={filter} onChange={changeFilter} />
|
120
|
-
</div>
|
121
|
-
|
122
|
-
{filteredGroups.length === 0 ? (
|
123
|
-
<Illustration name="thumbsUp" width="200" />
|
124
|
-
) : (
|
125
|
-
<ReactList
|
126
|
-
itemRenderer={this.makeRenderGroups(filteredGroups)}
|
127
|
-
length={filteredGroups.length}
|
128
|
-
itemSizeGetter={GroupTreeViewer.makeGetHeight(
|
129
|
-
filteredGroups,
|
130
|
-
extendedGroups,
|
131
|
-
)}
|
132
|
-
type="variable"
|
133
|
-
/>
|
134
|
-
)}
|
135
|
-
</div>
|
136
|
-
);
|
137
|
-
}
|
138
|
-
};
|
139
|
-
|
140
|
-
render() {
|
141
|
-
const {loading, wasLoaded, error} = this.props;
|
142
|
-
|
143
|
-
if (loading && !wasLoaded) {
|
144
|
-
return Pool.renderLoader();
|
145
|
-
} else if (error) {
|
146
|
-
return <div>{error.statusText}</div>;
|
147
|
-
} else {
|
148
|
-
return this.renderContent();
|
149
|
-
}
|
150
|
-
}
|
151
|
-
}
|
152
|
-
|
153
|
-
const mapStateToProps = (state) => {
|
154
|
-
const {data: pool, wasLoaded, loading, error} = state.pool;
|
155
|
-
|
156
|
-
return {
|
157
|
-
pool,
|
158
|
-
wasLoaded,
|
159
|
-
loading,
|
160
|
-
error,
|
161
|
-
filter: state.settings.problemFilter,
|
162
|
-
};
|
163
|
-
};
|
164
|
-
|
165
|
-
const mapDispatchToProps = {
|
166
|
-
getPoolInfo,
|
167
|
-
changeFilter,
|
168
|
-
};
|
169
|
-
|
170
|
-
export default connect(mapStateToProps, mapDispatchToProps)(Pool);
|
@@ -1,35 +0,0 @@
|
|
1
|
-
@import '../../styles/mixins.scss';
|
2
|
-
|
3
|
-
.pool {
|
4
|
-
@include container-fluid();
|
5
|
-
|
6
|
-
&__row {
|
7
|
-
display: flex;
|
8
|
-
}
|
9
|
-
|
10
|
-
&__title {
|
11
|
-
margin-right: 16px;
|
12
|
-
|
13
|
-
font-size: var(--yc-text-body-2-font-size);
|
14
|
-
font-weight: 500;
|
15
|
-
line-height: var(--yc-text-body-2-line-height);
|
16
|
-
text-transform: uppercase;
|
17
|
-
|
18
|
-
&_groups {
|
19
|
-
margin-right: 32px;
|
20
|
-
}
|
21
|
-
}
|
22
|
-
|
23
|
-
&__controls {
|
24
|
-
display: flex;
|
25
|
-
align-items: center;
|
26
|
-
|
27
|
-
margin: 25px 0 10px;
|
28
|
-
}
|
29
|
-
|
30
|
-
&__breadcrumbs {
|
31
|
-
padding: 20px 0;
|
32
|
-
|
33
|
-
font-size: var(--yc-text-body-2-font-size);
|
34
|
-
}
|
35
|
-
}
|