|
1 | 1 | import React from 'react';
|
2 | 2 | import PropTypes from 'prop-types';
|
3 | 3 | import {connect} from 'react-redux';
|
4 |
| -import {Link} from 'react-router-dom'; |
5 | 4 | import cn from 'bem-cn-lite';
|
6 |
| -import _ from 'lodash'; |
7 | 5 |
|
8 |
| -import {calcUptime} from '../../utils'; |
9 | 6 | import {backend} from '../../store';
|
10 | 7 | import {getTablet, getTabletDescribe} from '../../store/reducers/tablet';
|
11 | 8 | import '../../services/api';
|
12 | 9 |
|
13 |
| -import InfoViewer from '../../components/InfoViewer/InfoViewer'; |
14 | 10 | import EntityStatus from '../../components/EntityStatus/EntityStatus';
|
15 | 11 | import {Tag} from '../../components/Tag';
|
16 | 12 | import {Icon} from '../../components/Icon';
|
17 | 13 | import {EmptyState} from '../../components/EmptyState';
|
18 | 14 | import {Link as ExternalLink, Button, Loader} from '@gravity-ui/uikit';
|
19 |
| -import DataTable from '@gravity-ui/react-data-table'; |
20 | 15 | import {CriticalActionDialog} from '../../components/CriticalActionDialog';
|
21 | 16 | import routes, {createHref} from '../../routes';
|
22 | 17 | import {getDefaultNodePath} from '../Node/NodePages';
|
23 | 18 |
|
24 | 19 | import {TabletTable} from './TabletTable';
|
| 20 | +import {TabletInfo} from './TabletInfo'; |
25 | 21 |
|
26 | 22 | import './Tablet.scss';
|
27 | 23 |
|
28 |
| -const b = cn('tablet-page'); |
| 24 | +export const b = cn('tablet-page'); |
29 | 25 |
|
30 | 26 | class Tablet extends React.Component {
|
31 | 27 | static propTypes = {
|
@@ -194,25 +190,13 @@ class Tablet extends React.Component {
|
194 | 190 | }
|
195 | 191 | };
|
196 | 192 |
|
197 |
| - hasUptime = () => { |
198 |
| - const {tablet} = this.props; |
199 |
| - |
200 |
| - return tablet.State === 'Active'; |
201 |
| - }; |
202 |
| - |
203 | 193 | hasHiveId = () => {
|
204 | 194 | const {tablet} = this.props;
|
205 | 195 | const {HiveId} = tablet;
|
206 | 196 |
|
207 | 197 | return HiveId && HiveId !== '0';
|
208 | 198 | };
|
209 | 199 |
|
210 |
| - getSchemeShard = () => { |
211 |
| - const {tablet} = this.props; |
212 |
| - |
213 |
| - return _.get(tablet, 'TenantId.SchemeShard'); |
214 |
| - }; |
215 |
| - |
216 | 200 | isDisabledResume = () => {
|
217 | 201 | const {tablet} = this.props;
|
218 | 202 | const {disableTabletActions} = this.state;
|
@@ -244,53 +228,6 @@ class Tablet extends React.Component {
|
244 | 228 | renderTablet = () => {
|
245 | 229 | const {tablet, tenantPath} = this.props;
|
246 | 230 | const {TabletId: id} = tablet;
|
247 |
| - const schemeShard = this.getSchemeShard(); |
248 |
| - |
249 |
| - const tabletInfo = [ |
250 |
| - {label: 'Database', value: tenantPath}, |
251 |
| - this.hasHiveId() |
252 |
| - ? { |
253 |
| - label: 'HiveId', |
254 |
| - value: ( |
255 |
| - <ExternalLink |
256 |
| - href={createHref(routes.tablet, {id: tablet.HiveId})} |
257 |
| - target="_blank" |
258 |
| - > |
259 |
| - {tablet.HiveId} |
260 |
| - </ExternalLink> |
261 |
| - ), |
262 |
| - } |
263 |
| - : null, |
264 |
| - schemeShard |
265 |
| - ? { |
266 |
| - label: 'SchemeShard', |
267 |
| - value: ( |
268 |
| - <ExternalLink |
269 |
| - href={createHref(routes.tablet, {id: schemeShard})} |
270 |
| - target="_blank" |
271 |
| - > |
272 |
| - {schemeShard} |
273 |
| - </ExternalLink> |
274 |
| - ), |
275 |
| - } |
276 |
| - : null, |
277 |
| - {label: 'Type', value: tablet.Type}, |
278 |
| - {label: 'State', value: tablet.State}, |
279 |
| - this.hasUptime() ? {label: 'Uptime', value: calcUptime(tablet.ChangeTime)} : null, |
280 |
| - {label: 'Generation', value: tablet.Generation}, |
281 |
| - { |
282 |
| - label: 'Node', |
283 |
| - value: ( |
284 |
| - <Link className={b('link')} to={getDefaultNodePath(String(tablet.NodeId))}> |
285 |
| - {tablet.NodeId} |
286 |
| - </Link> |
287 |
| - ), |
288 |
| - }, |
289 |
| - ].filter(Boolean); |
290 |
| - |
291 |
| - if (tablet.SlaveId || tablet.FollowerId) { |
292 |
| - tabletInfo.push({label: 'Follower', value: tablet.SlaveId || tablet.FollowerId}); |
293 |
| - } |
294 | 231 |
|
295 | 232 | const externalLinks = [
|
296 | 233 | {
|
@@ -319,7 +256,7 @@ class Tablet extends React.Component {
|
319 | 256 | </a>
|
320 | 257 | {(tablet.Master || tablet.Leader) && <Tag text="Leader" type="blue" />}
|
321 | 258 | </div>
|
322 |
| - <InfoViewer info={tabletInfo} /> |
| 259 | + <TabletInfo tablet={tablet} tenantPath={tenantPath} /> |
323 | 260 | <div className={b('controls')}>
|
324 | 261 | <Button
|
325 | 262 | onClick={this.showKillDialog}
|
|
0 commit comments