11import * as React from "react" ;
22import { useState } from "react" ;
33import { styled } from "styled-components" ;
4- import { VSCodeLink } from "@vscode/webview-ui-toolkit/react" ;
54import {
65 CellValue ,
76 RawResultSet ,
87 ResultSetSchema ,
98} from "../../common/bqrs-cli-types" ;
10- import { tryGetRemoteLocation } from "../../common/bqrs-utils" ;
119import TextButton from "../common/TextButton" ;
12- import { convertNonPrintableChars } from "../../ common/text-utils " ;
13- import { sendTelemetry , useTelemetryOnChange } from "../common/telemetry " ;
10+ import { useTelemetryOnChange } from "../common/telemetry " ;
11+ import { RawResultCell } from "./RawResultCell " ;
1412
1513const numOfResultsInContractedMode = 5 ;
1614
@@ -40,40 +38,6 @@ const TableContainer = styled.div<TableContainerProps>`
4038 padding: 0.4rem;
4139` ;
4240
43- type CellProps = {
44- value : CellValue ;
45- fileLinkPrefix : string ;
46- sourceLocationPrefix : string ;
47- } ;
48-
49- const sendRawResultsLinkTelemetry = ( ) => sendTelemetry ( "raw-results-link" ) ;
50-
51- const Cell = ( { value, fileLinkPrefix, sourceLocationPrefix } : CellProps ) => {
52- switch ( typeof value ) {
53- case "string" :
54- case "number" :
55- case "boolean" :
56- return < span > { convertNonPrintableChars ( value . toString ( ) ) } </ span > ;
57- case "object" : {
58- const url = tryGetRemoteLocation (
59- value . url ,
60- fileLinkPrefix ,
61- sourceLocationPrefix ,
62- ) ;
63- const safeLabel = convertNonPrintableChars ( value . label ) ;
64- if ( url ) {
65- return (
66- < VSCodeLink onClick = { sendRawResultsLinkTelemetry } href = { url } >
67- { safeLabel }
68- </ VSCodeLink >
69- ) ;
70- } else {
71- return < span > { safeLabel } </ span > ;
72- }
73- }
74- }
75- } ;
76-
7741type RowProps = {
7842 row : CellValue [ ] ;
7943 fileLinkPrefix : string ;
@@ -84,7 +48,7 @@ const Row = ({ row, fileLinkPrefix, sourceLocationPrefix }: RowProps) => (
8448 < >
8549 { row . map ( ( cell , cellIndex ) => (
8650 < StyledRow key = { cellIndex } >
87- < Cell
51+ < RawResultCell
8852 value = { cell }
8953 fileLinkPrefix = { fileLinkPrefix }
9054 sourceLocationPrefix = { sourceLocationPrefix }
0 commit comments