Skip to content

Commit 874caf9

Browse files
authored
Merge branch 'main' into astandrik.e2e-tests-3
2 parents 9c446bd + 9390a3a commit 874caf9

File tree

3 files changed

+63
-29
lines changed

3 files changed

+63
-29
lines changed

package-lock.json

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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@
126126
"@gravity-ui/prettier-config": "^1.1.0",
127127
"@gravity-ui/stylelint-config": "^4.0.1",
128128
"@gravity-ui/tsconfig": "^1.0.0",
129-
"@playwright/test": "^1.42.1",
129+
"@playwright/test": "^1.49.1",
130130
"@testing-library/jest-dom": "^6.4.6",
131131
"@testing-library/react": "^16.0.1",
132132
"@testing-library/user-event": "^14.5.2",

src/containers/Tenant/Query/Issues/Issues.tsx

Lines changed: 47 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
TriangleExclamationFill,
88
} from '@gravity-ui/icons';
99
import type {IconData} from '@gravity-ui/uikit';
10-
import {ArrowToggle, Button, Icon} from '@gravity-ui/uikit';
10+
import {ArrowToggle, Button, Icon, Link} from '@gravity-ui/uikit';
1111

1212
import ShortyString from '../../../../components/ShortyString/ShortyString';
1313
import type {ErrorResponse, IssueMessage} from '../../../../types/api/query';
@@ -107,7 +107,6 @@ function Issue({
107107
}) {
108108
const [isExpand, setIsExpand] = React.useState(true);
109109
const severity = getSeverity(issue.severity);
110-
const position = getIssuePosition(issue);
111110

112111
const issues = issue.issues;
113112
const hasIssues = Array.isArray(issues) && issues.length > 0;
@@ -132,17 +131,7 @@ function Issue({
132131
</Button>
133132
)}
134133
{hideSeverity ? null : <IssueSeverity severity={severity} />}
135-
136-
<span className={blockIssue('message')}>
137-
{position && (
138-
<span className={blockIssue('place-text')} title="Position">
139-
{position}
140-
</span>
141-
)}
142-
<div className={blockIssue('message-text')}>
143-
<ShortyString value={issue.message} expandLabel={'Show full message'} />
144-
</div>
145-
</span>
134+
<IssueText issue={issue} />
146135
{issue.issue_code ? (
147136
<span className={blockIssue('code')}>Code: {issue.issue_code}</span>
148137
) : null}
@@ -156,6 +145,51 @@ function Issue({
156145
);
157146
}
158147

148+
interface IssueTextProps {
149+
issue: IssueMessage;
150+
}
151+
152+
function IssueText({issue}: IssueTextProps) {
153+
const position = getIssuePosition(issue);
154+
155+
const ydbEditor = window.ydbEditor;
156+
157+
const getIssue = () => {
158+
return (
159+
<span className={blockIssue('message')}>
160+
{position && (
161+
<span className={blockIssue('place-text')} title="Position">
162+
{position}
163+
</span>
164+
)}
165+
<div className={blockIssue('message-text')}>
166+
<ShortyString value={issue.message} expandLabel={'Show full message'} />
167+
</div>
168+
</span>
169+
);
170+
};
171+
172+
const {row, column} = issue.position ?? {};
173+
const isIssueClickable = isNumeric(row) && ydbEditor;
174+
if (!isIssueClickable) {
175+
return getIssue();
176+
}
177+
178+
const onIssueClickHandler = () => {
179+
const monacoPosition = {lineNumber: row, column: column ?? 0};
180+
181+
ydbEditor.setPosition(monacoPosition);
182+
ydbEditor.revealPositionInCenterIfOutsideViewport(monacoPosition);
183+
ydbEditor.focus();
184+
};
185+
186+
return (
187+
<Link href="#" extraProps={{draggable: false}} onClick={onIssueClickHandler} view="primary">
188+
{getIssue()}
189+
</Link>
190+
);
191+
}
192+
159193
function IssueList(props: {issues: IssueMessage[]; expanded: boolean; level: number}) {
160194
const {issues, level, expanded} = props;
161195
return (

0 commit comments

Comments
 (0)