Skip to content

Commit 51c83ea

Browse files
authored
Merge branch 'main' into astandrik.view-query-text-on-info-919
2 parents 7d59c74 + 640dd97 commit 51c83ea

File tree

30 files changed

+433
-66
lines changed

30 files changed

+433
-66
lines changed

playwright.config.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ const config: PlaywrightTestConfig = {
2525
baseURL: baseUrl || 'http://localhost:3000/',
2626
testIdAttribute: 'data-qa',
2727
trace: 'on-first-retry',
28-
video: 'retain-on-failure',
29-
screenshot: 'only-on-failure',
28+
// Always record video and take screenshots on main branch, otherwise only on failure
29+
video: process.env.GITHUB_REF === 'refs/heads/main' ? 'on' : 'retain-on-failure',
30+
screenshot: process.env.GITHUB_REF === 'refs/heads/main' ? 'on' : 'only-on-failure',
3031
},
3132
projects: [
3233
{

src/components/CellWithPopover/CellWithPopover.scss

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
.ydb-cell-with-popover {
2-
display: flex;
2+
display: inline-flex;
33

44
max-width: 100%;
55

6+
&_full-width {
7+
display: flex;
8+
}
9+
610
&__popover {
711
display: inline-block;
812
overflow: hidden;

src/components/CellWithPopover/CellWithPopover.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export function CellWithPopover({
2222
...props
2323
}: CellWithPopoverProps) {
2424
return (
25-
<div className={b({fullWidth}, wrapperClassName)}>
25+
<div className={b({'full-width': fullWidth}, wrapperClassName)}>
2626
<Popover
2727
delayClosing={DELAY_TIMEOUT}
2828
delayOpening={DELAY_TIMEOUT}

src/components/FullNodeViewer/FullNodeViewer.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {InfoViewer} from '../InfoViewer/InfoViewer';
55
import type {InfoViewerItem} from '../InfoViewer/InfoViewer';
66
import {PoolUsage} from '../PoolUsage/PoolUsage';
77
import {ProgressViewer} from '../ProgressViewer/ProgressViewer';
8+
import {NodeUptime} from '../UptimeViewer/UptimeViewer';
89

910
import './FullNodeViewer.scss';
1011

@@ -30,7 +31,10 @@ export const FullNodeViewer = ({node, className}: FullNodeViewerProps) => {
3031

3132
commonInfo.push(
3233
{label: 'Version', value: node?.Version},
33-
{label: 'Uptime', value: node?.Uptime},
34+
{
35+
label: 'Uptime',
36+
value: <NodeUptime StartTime={node?.StartTime} DisconnectTime={node?.DisconnectTime} />,
37+
},
3438
{label: 'DC', value: node?.DataCenterDescription || node?.DC},
3539
{label: 'Rack', value: node?.Rack},
3640
);

src/components/Stack/Stack.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
--ydb-stack-offset-x: 4px;
44
--ydb-stack-offset-y: 4px;
55
--ydb-stack-offset-x-hover: 4px;
6-
--ydb-stack-offset-y-hover: 8px;
6+
--ydb-stack-offset-y-hover: 6px;
77

88
position: relative;
99

src/components/Table/Table.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
background-color: var(--g-color-base-background);
4040
@include mixins.text-subheader-2();
41-
&_align_right {
41+
:is(&_align_right) {
4242
#{$block}__table-header-content {
4343
justify-content: flex-end;
4444

src/components/TooltipsContent/TabletTooltipContent/TabletTooltipContent.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import type {TTabletStateInfo} from '../../../types/api/tablet';
2-
import {getUptimeFromDateFormatted} from '../../../utils/dataFormatters/dataFormatters';
32
import {InfoViewer, createInfoFormatter, formatObject} from '../../InfoViewer';
3+
import {TabletUptime} from '../../UptimeViewer/UptimeViewer';
44

55
const formatTablet = createInfoFormatter<TTabletStateInfo>({
66
values: {
7-
ChangeTime: (value) => getUptimeFromDateFormatted(value),
7+
ChangeTime: (value) => {
8+
return <TabletUptime ChangeTime={value} />;
9+
},
810
},
911
labels: {
1012
TabletId: 'Tablet',
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
import {DefinitionList} from '@gravity-ui/uikit';
2+
3+
import {EMPTY_DATA_PLACEHOLDER} from '../../utils/constants';
4+
import {
5+
formatDateTime,
6+
getDowntimeFromDateFormatted,
7+
getUptimeFromDateFormatted,
8+
} from '../../utils/dataFormatters/dataFormatters';
9+
import {CellWithPopover} from '../CellWithPopover/CellWithPopover';
10+
11+
import i18n from './i18n';
12+
13+
interface NodeUptimeProps {
14+
StartTime?: string;
15+
DisconnectTime?: string;
16+
}
17+
18+
export function NodeUptime({StartTime, DisconnectTime}: NodeUptimeProps) {
19+
let uptime: string | undefined;
20+
21+
if (DisconnectTime) {
22+
uptime = getDowntimeFromDateFormatted(DisconnectTime);
23+
} else if (StartTime) {
24+
uptime = getUptimeFromDateFormatted(StartTime);
25+
}
26+
27+
if (!uptime) {
28+
return EMPTY_DATA_PLACEHOLDER;
29+
}
30+
return (
31+
<CellWithPopover
32+
placement={['top', 'auto']}
33+
content={
34+
<DefinitionList responsive>
35+
{StartTime ? (
36+
<DefinitionList.Item key={'StartTime'} name={i18n('start-time')}>
37+
{formatDateTime(StartTime, {withTimeZone: true})}
38+
</DefinitionList.Item>
39+
) : null}
40+
{DisconnectTime ? (
41+
<DefinitionList.Item key={'DisconnectTime'} name={i18n('disconnect-time')}>
42+
{formatDateTime(DisconnectTime, {withTimeZone: true})}
43+
</DefinitionList.Item>
44+
) : null}
45+
</DefinitionList>
46+
}
47+
>
48+
{uptime}
49+
</CellWithPopover>
50+
);
51+
}
52+
53+
interface TabletUptimeProps {
54+
ChangeTime?: string;
55+
}
56+
57+
export function TabletUptime({ChangeTime}: TabletUptimeProps) {
58+
let uptime: string | undefined;
59+
60+
if (ChangeTime) {
61+
uptime = getUptimeFromDateFormatted(ChangeTime);
62+
}
63+
64+
if (!uptime) {
65+
return EMPTY_DATA_PLACEHOLDER;
66+
}
67+
return (
68+
<CellWithPopover
69+
placement={['top', 'auto']}
70+
content={
71+
<DefinitionList responsive>
72+
<DefinitionList.Item key={'changeTime'} name={i18n('change-time')}>
73+
{formatDateTime(ChangeTime, {withTimeZone: true})}
74+
</DefinitionList.Item>
75+
</DefinitionList>
76+
}
77+
>
78+
{uptime}
79+
</CellWithPopover>
80+
);
81+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"start-time": "Start time",
3+
"disconnect-time": "Disconnect time",
4+
"change-time": "Change time"
5+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import {registerKeysets} from '../../../utils/i18n';
2+
3+
import en from './en.json';
4+
5+
const COMPONENT = 'ydb-uptime-viewer';
6+
7+
export default registerKeysets(COMPONENT, {en});

0 commit comments

Comments
 (0)