11import * as React from "react" ;
22
33import { SetComparisonsMessage } from "../../common/interface-types" ;
4- import RawTableHeader from "../results/RawTableHeader" ;
54import { className } from "../results/result-table-utils" ;
6- import { ResultRow } from "../../common/bqrs-cli-types" ;
7- import RawTableRow from "../results/RawTableRow" ;
85import { vscode } from "../vscode-api" ;
9- import { sendTelemetry } from "../common/telemetry" ;
106import TextButton from "../common/TextButton" ;
117import { styled } from "styled-components" ;
8+ import { RawCompareResultTable } from "./RawCompareResultTable" ;
129
1310interface Props {
1411 comparison : SetComparisonsMessage ;
@@ -31,24 +28,6 @@ export default function CompareTable(props: Props) {
3128 } ) ;
3229 }
3330
34- function createRows ( rows : ResultRow [ ] , databaseUri : string ) {
35- return (
36- < tbody >
37- { rows . map ( ( row , rowIndex ) => (
38- < RawTableRow
39- key = { rowIndex }
40- rowIndex = { rowIndex }
41- row = { row }
42- databaseUri = { databaseUri }
43- onSelected = { ( ) => {
44- sendTelemetry ( "comapre-view-result-clicked" ) ;
45- } }
46- />
47- ) ) }
48- </ tbody >
49- ) ;
50- }
51-
5231 return (
5332 < table className = "vscode-codeql__compare-body" >
5433 < thead >
@@ -76,24 +55,22 @@ export default function CompareTable(props: Props) {
7655 < tbody >
7756 < tr >
7857 < td >
79- < table className = { className } >
80- < RawTableHeader
81- columns = { result . columns }
82- schemaName = { comparison . currentResultSetName }
83- preventSort = { true }
84- />
85- { createRows ( result . from , comparison . databaseUri ) }
86- </ table >
58+ < RawCompareResultTable
59+ columns = { result . columns }
60+ schemaName = { comparison . currentResultSetName }
61+ rows = { result . from }
62+ databaseUri = { comparison . databaseUri }
63+ className = { className }
64+ />
8765 </ td >
8866 < td >
89- < table className = { className } >
90- < RawTableHeader
91- columns = { result . columns }
92- schemaName = { comparison . currentResultSetName }
93- preventSort = { true }
94- />
95- { createRows ( result . to , comparison . databaseUri ) }
96- </ table >
67+ < RawCompareResultTable
68+ columns = { result . columns }
69+ schemaName = { comparison . currentResultSetName }
70+ rows = { result . to }
71+ databaseUri = { comparison . databaseUri }
72+ className = { className }
73+ />
9774 </ td >
9875 </ tr >
9976 </ tbody >
0 commit comments