Skip to content

Commit e1257f4

Browse files
committed
feat: display view query text
1 parent 6be903d commit e1257f4

File tree

35 files changed

+792
-74
lines changed

35 files changed

+792
-74
lines changed

package-lock.json

Lines changed: 279 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
"react-redux": "^9.1.2",
4848
"react-router-dom": "^5.3.4",
4949
"react-split": "^2.0.14",
50+
"react-syntax-highlighter": "^15.6.1",
5051
"redux": "^5.0.1",
5152
"redux-location-state": "^2.8.2",
5253
"tslib": "^2.6.3",
@@ -136,6 +137,7 @@
136137
"@types/react": "^18.3.3",
137138
"@types/react-dom": "^18.3.0",
138139
"@types/react-router-dom": "^5.3.3",
140+
"@types/react-syntax-highlighter": "^15.5.13",
139141
"@types/uuid": "^10.0.0",
140142
"copyfiles": "^2.4.1",
141143
"http-proxy-middleware": "^2.0.6",

playwright.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const config: PlaywrightTestConfig = {
1919
: {
2020
command: 'npm run dev',
2121
port: 3000,
22+
reuseExistingServer: true,
2223
},
2324
use: {
2425
baseURL: baseUrl || 'http://localhost:3000/',

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
);
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
.sql-highlighter {
2+
code {
3+
white-space: pre-wrap !important;
4+
5+
color: var(--g-color-text-primary) !important;
6+
}
7+
8+
pre {
9+
margin: 0 !important;
10+
11+
background: transparent !important;
12+
}
13+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import {useThemeValue} from '@gravity-ui/uikit';
2+
import {PrismLight as SyntaxHighlighter} from 'react-syntax-highlighter';
3+
import plsql from 'react-syntax-highlighter/dist/esm/languages/prism/plsql';
4+
import {
5+
vscDarkPlus as darkTheme,
6+
materialLight as lightTheme,
7+
} from 'react-syntax-highlighter/dist/esm/styles/prism';
8+
9+
// Create custom themes with transparent backgrounds
10+
const light = {
11+
...lightTheme,
12+
'pre[class*="language-"]': {
13+
...lightTheme['pre[class*="language-"]'],
14+
background: 'transparent',
15+
},
16+
'code[class*="language-"]': {
17+
...lightTheme['code[class*="language-"]'],
18+
background: 'transparent',
19+
},
20+
};
21+
22+
const dark = {
23+
...darkTheme,
24+
'pre[class*="language-"]': {
25+
...darkTheme['pre[class*="language-"]'],
26+
background: 'transparent',
27+
},
28+
'code[class*="language-"]': {
29+
...darkTheme['code[class*="language-"]'],
30+
background: 'transparent',
31+
},
32+
};
33+
34+
import {cn} from '../../utils/cn';
35+
36+
import './SqlHighlighter.scss';
37+
38+
SyntaxHighlighter.registerLanguage('plsql', plsql);
39+
40+
const b = cn('sql-highlighter');
41+
42+
interface SqlHighlighterProps {
43+
children: string;
44+
className?: string;
45+
}
46+
47+
export const SqlHighlighter = ({children, className}: SqlHighlighterProps) => {
48+
const themeValue = useThemeValue();
49+
const isDark = themeValue === 'dark' || themeValue === 'dark-hc';
50+
51+
return (
52+
<div className={b(null, className)}>
53+
<SyntaxHighlighter language="sql" style={isDark ? dark : light}>
54+
{children}
55+
</SyntaxHighlighter>
56+
</div>
57+
);
58+
};

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/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',

0 commit comments

Comments
 (0)