Merge pull request #2714 from github/robertbrignull/EmptyQueryResultsMessage
Move EmptyQueryResultsMessage out of results-table-utils
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import * as React from "react";
|
||||
import { sendTelemetry } from "../common/telemetry";
|
||||
|
||||
function sendCodeQLLanguageGuidesTelemetry() {
|
||||
sendTelemetry("codeql-language-guides-link");
|
||||
}
|
||||
|
||||
export function EmptyQueryResultsMessage(): JSX.Element {
|
||||
return (
|
||||
<div className="vscode-codeql__empty-query-message">
|
||||
<span>
|
||||
This query returned no results. If this isn't what you were
|
||||
expecting, and for effective query-writing tips, check out the{" "}
|
||||
<a
|
||||
href="https://codeql.github.com/docs/codeql-language-guides/"
|
||||
onClick={sendCodeQLLanguageGuidesTelemetry}
|
||||
>
|
||||
CodeQL language guides
|
||||
</a>
|
||||
.
|
||||
</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -7,7 +7,6 @@ import {
|
||||
ResultTableProps,
|
||||
selectableZebraStripe,
|
||||
jumpToLocation,
|
||||
emptyQueryResultsMessage,
|
||||
} from "./result-table-utils";
|
||||
import { onNavigation } from "./results";
|
||||
import {
|
||||
@@ -22,6 +21,7 @@ import { sendTelemetry } from "../common/telemetry";
|
||||
import { AlertTableHeader } from "./AlertTableHeader";
|
||||
import { SarifMessageWithLocations } from "./locations/SarifMessageWithLocations";
|
||||
import { SarifLocation } from "./locations/SarifLocation";
|
||||
import { EmptyQueryResultsMessage } from "./EmptyQueryResultsMessage";
|
||||
|
||||
type AlertTableProps = ResultTableProps & {
|
||||
resultSet: InterpretedResultSet<SarifInterpretationData>;
|
||||
@@ -84,7 +84,7 @@ export class AlertTable extends React.Component<
|
||||
</span>
|
||||
);
|
||||
} else {
|
||||
return emptyQueryResultsMessage();
|
||||
return <EmptyQueryResultsMessage />;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
import * as React from "react";
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
||||
import {
|
||||
className,
|
||||
emptyQueryResultsMessage,
|
||||
jumpToLocation,
|
||||
} from "./result-table-utils";
|
||||
import { className, jumpToLocation } from "./result-table-utils";
|
||||
import {
|
||||
RAW_RESULTS_LIMIT,
|
||||
RawResultsSortState,
|
||||
@@ -20,6 +16,7 @@ import { tryGetResolvableLocation } from "../../common/bqrs-utils";
|
||||
import { ScrollIntoViewHelper } from "./scroll-into-view-helper";
|
||||
import { sendTelemetry } from "../common/telemetry";
|
||||
import { assertNever } from "../../common/helpers-pure";
|
||||
import { EmptyQueryResultsMessage } from "./EmptyQueryResultsMessage";
|
||||
|
||||
type RawTableProps = {
|
||||
databaseUri: string;
|
||||
@@ -130,7 +127,7 @@ export function RawTable({
|
||||
}, [resultSet]);
|
||||
|
||||
if (dataRows.length === 0) {
|
||||
return emptyQueryResultsMessage();
|
||||
return <EmptyQueryResultsMessage />;
|
||||
}
|
||||
|
||||
const tableRows = dataRows.map((row: ResultRow, rowIndex: number) => (
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import * as React from "react";
|
||||
import { ResolvableLocationValue } from "../../common/bqrs-cli-types";
|
||||
import {
|
||||
RawResultsSortState,
|
||||
@@ -8,7 +7,6 @@ import {
|
||||
} from "../../common/interface-types";
|
||||
import { assertNever } from "../../common/helpers-pure";
|
||||
import { vscode } from "../vscode-api";
|
||||
import { sendTelemetry } from "../common/telemetry";
|
||||
|
||||
export interface ResultTableProps {
|
||||
resultSet: ResultSet;
|
||||
@@ -107,25 +105,3 @@ export function nextSortDirection(
|
||||
return assertNever(direction);
|
||||
}
|
||||
}
|
||||
|
||||
function sendCodeQLLanguageGuidesTelemetry() {
|
||||
sendTelemetry("codeql-language-guides-link");
|
||||
}
|
||||
|
||||
export function emptyQueryResultsMessage(): JSX.Element {
|
||||
return (
|
||||
<div className="vscode-codeql__empty-query-message">
|
||||
<span>
|
||||
This query returned no results. If this isn't what you were
|
||||
expecting, and for effective query-writing tips, check out the{" "}
|
||||
<a
|
||||
href="https://codeql.github.com/docs/codeql-language-guides/"
|
||||
onClick={sendCodeQLLanguageGuidesTelemetry}
|
||||
>
|
||||
CodeQL language guides
|
||||
</a>
|
||||
.
|
||||
</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user