77 TriangleExclamationFill ,
88} from '@gravity-ui/icons' ;
99import 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
1212import ShortyString from '../../../../components/ShortyString/ShortyString' ;
1313import 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+
159193function IssueList ( props : { issues : IssueMessage [ ] ; expanded : boolean ; level : number } ) {
160194 const { issues, level, expanded} = props ;
161195 return (
0 commit comments