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,
|
ResultTableProps,
|
||||||
selectableZebraStripe,
|
selectableZebraStripe,
|
||||||
jumpToLocation,
|
jumpToLocation,
|
||||||
emptyQueryResultsMessage,
|
|
||||||
} from "./result-table-utils";
|
} from "./result-table-utils";
|
||||||
import { onNavigation } from "./results";
|
import { onNavigation } from "./results";
|
||||||
import {
|
import {
|
||||||
@@ -22,6 +21,7 @@ import { sendTelemetry } from "../common/telemetry";
|
|||||||
import { AlertTableHeader } from "./AlertTableHeader";
|
import { AlertTableHeader } from "./AlertTableHeader";
|
||||||
import { SarifMessageWithLocations } from "./locations/SarifMessageWithLocations";
|
import { SarifMessageWithLocations } from "./locations/SarifMessageWithLocations";
|
||||||
import { SarifLocation } from "./locations/SarifLocation";
|
import { SarifLocation } from "./locations/SarifLocation";
|
||||||
|
import { EmptyQueryResultsMessage } from "./EmptyQueryResultsMessage";
|
||||||
|
|
||||||
type AlertTableProps = ResultTableProps & {
|
type AlertTableProps = ResultTableProps & {
|
||||||
resultSet: InterpretedResultSet<SarifInterpretationData>;
|
resultSet: InterpretedResultSet<SarifInterpretationData>;
|
||||||
@@ -84,7 +84,7 @@ export class AlertTable extends React.Component<
|
|||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return emptyQueryResultsMessage();
|
return <EmptyQueryResultsMessage />;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,6 @@
|
|||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
||||||
import {
|
import { className, jumpToLocation } from "./result-table-utils";
|
||||||
className,
|
|
||||||
emptyQueryResultsMessage,
|
|
||||||
jumpToLocation,
|
|
||||||
} from "./result-table-utils";
|
|
||||||
import {
|
import {
|
||||||
RAW_RESULTS_LIMIT,
|
RAW_RESULTS_LIMIT,
|
||||||
RawResultsSortState,
|
RawResultsSortState,
|
||||||
@@ -20,6 +16,7 @@ import { tryGetResolvableLocation } from "../../common/bqrs-utils";
|
|||||||
import { ScrollIntoViewHelper } from "./scroll-into-view-helper";
|
import { ScrollIntoViewHelper } from "./scroll-into-view-helper";
|
||||||
import { sendTelemetry } from "../common/telemetry";
|
import { sendTelemetry } from "../common/telemetry";
|
||||||
import { assertNever } from "../../common/helpers-pure";
|
import { assertNever } from "../../common/helpers-pure";
|
||||||
|
import { EmptyQueryResultsMessage } from "./EmptyQueryResultsMessage";
|
||||||
|
|
||||||
type RawTableProps = {
|
type RawTableProps = {
|
||||||
databaseUri: string;
|
databaseUri: string;
|
||||||
@@ -130,7 +127,7 @@ export function RawTable({
|
|||||||
}, [resultSet]);
|
}, [resultSet]);
|
||||||
|
|
||||||
if (dataRows.length === 0) {
|
if (dataRows.length === 0) {
|
||||||
return emptyQueryResultsMessage();
|
return <EmptyQueryResultsMessage />;
|
||||||
}
|
}
|
||||||
|
|
||||||
const tableRows = dataRows.map((row: ResultRow, rowIndex: number) => (
|
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 { ResolvableLocationValue } from "../../common/bqrs-cli-types";
|
||||||
import {
|
import {
|
||||||
RawResultsSortState,
|
RawResultsSortState,
|
||||||
@@ -8,7 +7,6 @@ import {
|
|||||||
} from "../../common/interface-types";
|
} from "../../common/interface-types";
|
||||||
import { assertNever } from "../../common/helpers-pure";
|
import { assertNever } from "../../common/helpers-pure";
|
||||||
import { vscode } from "../vscode-api";
|
import { vscode } from "../vscode-api";
|
||||||
import { sendTelemetry } from "../common/telemetry";
|
|
||||||
|
|
||||||
export interface ResultTableProps {
|
export interface ResultTableProps {
|
||||||
resultSet: ResultSet;
|
resultSet: ResultSet;
|
||||||
@@ -107,25 +105,3 @@ export function nextSortDirection(
|
|||||||
return assertNever(direction);
|
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