Skip to content

Commit 4a46873

Browse files
committed
Merge remote-tracking branch 'origin/main' into koesie10/compare-styled
2 parents b421a19 + 4a32170 commit 4a46873

File tree

5 files changed

+69
-52
lines changed

5 files changed

+69
-52
lines changed

docs/test-plan.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,8 @@ Run one of the above MRVAs, but cancel it from within VS Code:
170170

171171
Note that this test requires the feature flag: `codeQL.model.llmGeneration`
172172

173+
A package that the AI normally gives models for is `javax.servlet-api` from the `jhy/jsoup` repository.
174+
173175
1. Click "Model with AI".
174176
- Check that rows change to "Thinking".
175177
- Check that results come back and rows get filled out.

extensions/ql-vscode/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
- Remove support for CodeQL CLI versions older than 2.11.6. [#3087](https://github.com/github/vscode-codeql/pull/3087)
77
- Preserve focus on results viewer when showing a location in a file. [#3088](https://github.com/github/vscode-codeql/pull/3088)
88
- The `dataflowtracking` and `tainttracking` snippets expand to the new module-based interface. [#3091](https://github.com/github/vscode-codeql/pull/3091)
9+
- The compare view will now show a loading message while the results are loading. [#3107](https://github.com/github/vscode-codeql/pull/3107)
910

1011
## 1.10.0 - 16 November 2023
1112

extensions/ql-vscode/src/view/compare/Compare.tsx

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,6 @@ import CompareTable from "./CompareTable";
1212

1313
import "../results/resultsView.css";
1414

15-
const emptyComparison: SetComparisonsMessage = {
16-
t: "setComparisons",
17-
stats: {},
18-
result: undefined,
19-
commonResultSetNames: [],
20-
currentResultSetName: "",
21-
databaseUri: "",
22-
message: "Empty comparison",
23-
};
24-
2515
const Header = styled.div`
2616
display: flex;
2717
`;
@@ -35,12 +25,13 @@ const Message = styled.div`
3525
`;
3626

3727
export function Compare(_: Record<string, never>): JSX.Element {
38-
const [comparison, setComparison] =
39-
useState<SetComparisonsMessage>(emptyComparison);
28+
const [comparison, setComparison] = useState<SetComparisonsMessage | null>(
29+
null,
30+
);
4031

41-
const message = comparison.message || "Empty comparison";
32+
const message = comparison?.message || "Empty comparison";
4233
const hasRows =
43-
comparison.result &&
34+
comparison?.result &&
4435
(comparison.result.to.length || comparison.result.from.length);
4536

4637
useEffect(() => {
@@ -63,6 +54,7 @@ export function Compare(_: Record<string, never>): JSX.Element {
6354
window.removeEventListener("message", listener);
6455
};
6556
}, []);
57+
6658
if (!comparison) {
6759
return <div>Waiting for results to load.</div>;
6860
}

extensions/ql-vscode/src/view/compare/CompareTable.tsx

Lines changed: 15 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
import * as React from "react";
22

33
import { SetComparisonsMessage } from "../../common/interface-types";
4-
import RawTableHeader from "../results/RawTableHeader";
54
import { className } from "../results/result-table-utils";
6-
import { ResultRow } from "../../common/bqrs-cli-types";
7-
import RawTableRow from "../results/RawTableRow";
85
import { vscode } from "../vscode-api";
9-
import { sendTelemetry } from "../common/telemetry";
106
import TextButton from "../common/TextButton";
117
import { styled } from "styled-components";
8+
import { RawCompareResultTable } from "./RawCompareResultTable";
129

1310
interface Props {
1411
comparison: SetComparisonsMessage;
@@ -40,24 +37,6 @@ export default function CompareTable(props: Props) {
4037
});
4138
}
4239

43-
function createRows(rows: ResultRow[], databaseUri: string) {
44-
return (
45-
<tbody>
46-
{rows.map((row, rowIndex) => (
47-
<RawTableRow
48-
key={rowIndex}
49-
rowIndex={rowIndex}
50-
row={row}
51-
databaseUri={databaseUri}
52-
onSelected={() => {
53-
sendTelemetry("comapre-view-result-clicked");
54-
}}
55-
/>
56-
))}
57-
</tbody>
58-
);
59-
}
60-
6140
return (
6241
<Table>
6342
<thead>
@@ -85,24 +64,22 @@ export default function CompareTable(props: Props) {
8564
<tbody>
8665
<tr>
8766
<td>
88-
<table className={className}>
89-
<RawTableHeader
90-
columns={result.columns}
91-
schemaName={comparison.currentResultSetName}
92-
preventSort={true}
93-
/>
94-
{createRows(result.from, comparison.databaseUri)}
95-
</table>
67+
<RawCompareResultTable
68+
columns={result.columns}
69+
schemaName={comparison.currentResultSetName}
70+
rows={result.from}
71+
databaseUri={comparison.databaseUri}
72+
className={className}
73+
/>
9674
</td>
9775
<td>
98-
<table className={className}>
99-
<RawTableHeader
100-
columns={result.columns}
101-
schemaName={comparison.currentResultSetName}
102-
preventSort={true}
103-
/>
104-
{createRows(result.to, comparison.databaseUri)}
105-
</table>
76+
<RawCompareResultTable
77+
columns={result.columns}
78+
schemaName={comparison.currentResultSetName}
79+
rows={result.to}
80+
databaseUri={comparison.databaseUri}
81+
className={className}
82+
/>
10683
</td>
10784
</tr>
10885
</tbody>
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import * as React from "react";
2+
import { ResultRow } from "../../common/bqrs-cli-types";
3+
import { sendTelemetry } from "../common/telemetry";
4+
import RawTableHeader from "../results/RawTableHeader";
5+
import RawTableRow from "../results/RawTableRow";
6+
7+
interface Props {
8+
columns: ReadonlyArray<{ name?: string }>;
9+
schemaName: string;
10+
rows: ResultRow[];
11+
databaseUri: string;
12+
13+
className?: string;
14+
}
15+
16+
export function RawCompareResultTable({
17+
columns,
18+
schemaName,
19+
rows,
20+
databaseUri,
21+
className,
22+
}: Props) {
23+
return (
24+
<table className={className}>
25+
<RawTableHeader
26+
columns={columns}
27+
schemaName={schemaName}
28+
preventSort={true}
29+
/>
30+
<tbody>
31+
{rows.map((row, rowIndex) => (
32+
<RawTableRow
33+
key={rowIndex}
34+
rowIndex={rowIndex}
35+
row={row}
36+
databaseUri={databaseUri}
37+
onSelected={() => {
38+
sendTelemetry("comapre-view-result-clicked");
39+
}}
40+
/>
41+
))}
42+
</tbody>
43+
</table>
44+
);
45+
}

0 commit comments

Comments
 (0)