Only show the "result format" dropdown for (path-)problem queries
This commit is contained in:
@@ -28,12 +28,15 @@ export const RepositoriesSearchSortRow = () => {
|
||||
ResultFormat.Alerts,
|
||||
);
|
||||
|
||||
const variantAnalysisQueryKind = "problem";
|
||||
|
||||
return (
|
||||
<RepositoriesSearchSortRowComponent
|
||||
filterSortValue={filterSortValue}
|
||||
resultFormatValue={resultFormatValue}
|
||||
onFilterSortChange={setFilterSortValue}
|
||||
onResultFormatChange={setResultFormatValue}
|
||||
variantAnalysisQueryKind={variantAnalysisQueryKind}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -17,6 +17,7 @@ type Props = {
|
||||
resultFormatValue: ResultFormat;
|
||||
onFilterSortChange: Dispatch<SetStateAction<RepositoriesFilterSortState>>;
|
||||
onResultFormatChange: Dispatch<SetStateAction<ResultFormat>>;
|
||||
variantAnalysisQueryKind: string | undefined;
|
||||
};
|
||||
|
||||
const Container = styled.div`
|
||||
@@ -43,11 +44,21 @@ const RepositoriesResultFormatColumn = styled(RepositoriesResultFormat)`
|
||||
flex: 1;
|
||||
`;
|
||||
|
||||
function showResultFormatColumn(
|
||||
variantAnalysisQueryKind: string | undefined,
|
||||
): boolean {
|
||||
return (
|
||||
variantAnalysisQueryKind === "problem" ||
|
||||
variantAnalysisQueryKind === "path-problem"
|
||||
);
|
||||
}
|
||||
|
||||
export const RepositoriesSearchSortRow = ({
|
||||
filterSortValue,
|
||||
resultFormatValue,
|
||||
onFilterSortChange,
|
||||
onResultFormatChange,
|
||||
variantAnalysisQueryKind,
|
||||
}: Props) => {
|
||||
const handleSearchValueChange = useCallback(
|
||||
(searchValue: string) => {
|
||||
@@ -100,10 +111,12 @@ export const RepositoriesSearchSortRow = ({
|
||||
value={filterSortValue.sortKey}
|
||||
onChange={handleSortKeyChange}
|
||||
/>
|
||||
{showResultFormatColumn(variantAnalysisQueryKind) && (
|
||||
<RepositoriesResultFormatColumn
|
||||
value={resultFormatValue}
|
||||
onChange={handleResultFormatChange}
|
||||
/>
|
||||
)}
|
||||
</Container>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -129,6 +129,7 @@ export const VariantAnalysisOutcomePanels = ({
|
||||
resultFormatValue={resultFormat}
|
||||
onFilterSortChange={setFilterSortState}
|
||||
onResultFormatChange={setResultFormat}
|
||||
variantAnalysisQueryKind={variantAnalysis.query.kind}
|
||||
/>
|
||||
<VariantAnalysisAnalyzedRepos
|
||||
variantAnalysis={variantAnalysis}
|
||||
@@ -150,6 +151,7 @@ export const VariantAnalysisOutcomePanels = ({
|
||||
resultFormatValue={resultFormat}
|
||||
onFilterSortChange={setFilterSortState}
|
||||
onResultFormatChange={setResultFormat}
|
||||
variantAnalysisQueryKind={variantAnalysis.query.kind}
|
||||
/>
|
||||
<VSCodePanels>
|
||||
{scannedReposCount > 0 && (
|
||||
|
||||
Reference in New Issue
Block a user