Move AlertTableTruncatedMessage to a new component in a new file
This commit is contained in:
@@ -23,6 +23,7 @@ import { SarifMessageWithLocations } from "./locations/SarifMessageWithLocations
|
||||
import { SarifLocation } from "./locations/SarifLocation";
|
||||
import { AlertTableDropdownIndicatorCell } from "./AlertTableDropdownIndicatorCell";
|
||||
import { AlertTableNoResults } from "./AlertTableNoResults";
|
||||
import { AlertTableTruncatedMessage } from "./AlertTableTruncatedMessage";
|
||||
|
||||
type AlertTableProps = ResultTableProps & {
|
||||
resultSet: InterpretedResultSet<SarifInterpretationData>;
|
||||
@@ -295,21 +296,15 @@ export class AlertTable extends React.Component<
|
||||
},
|
||||
);
|
||||
|
||||
if (numTruncatedResults > 0) {
|
||||
rows.push(
|
||||
<tr key="truncatd-message">
|
||||
<td colSpan={5} style={{ textAlign: "center", fontStyle: "italic" }}>
|
||||
Too many results to show at once. {numTruncatedResults} result(s)
|
||||
omitted.
|
||||
</td>
|
||||
</tr>,
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<table className={className}>
|
||||
<AlertTableHeader sortState={resultSet.interpretation.data.sortState} />
|
||||
<tbody>{rows}</tbody>
|
||||
<tbody>
|
||||
{rows}
|
||||
<AlertTableTruncatedMessage
|
||||
numTruncatedResults={numTruncatedResults}
|
||||
/>
|
||||
</tbody>
|
||||
</table>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
import * as React from "react";
|
||||
|
||||
interface Props {
|
||||
numTruncatedResults: number;
|
||||
}
|
||||
|
||||
export function AlertTableTruncatedMessage(props: Props): JSX.Element | null {
|
||||
if (props.numTruncatedResults === 0) {
|
||||
return null;
|
||||
}
|
||||
return (
|
||||
<tr key="truncatd-message">
|
||||
<td colSpan={5} style={{ textAlign: "center", fontStyle: "italic" }}>
|
||||
Too many results to show at once. {props.numTruncatedResults} result(s)
|
||||
omitted.
|
||||
</td>
|
||||
</tr>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user