Skip to content

Commit f8d542d

Browse files
committed
Only show the "result format" dropdown for (path-)problem queries
1 parent 6715669 commit f8d542d

3 files changed

Lines changed: 22 additions & 4 deletions

File tree

extensions/ql-vscode/src/stories/variant-analysis/RepositoriesSearchSortRow.stories.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,15 @@ export const RepositoriesSearchSortRow = () => {
2828
ResultFormat.Alerts,
2929
);
3030

31+
const variantAnalysisQueryKind = "problem";
32+
3133
return (
3234
<RepositoriesSearchSortRowComponent
3335
filterSortValue={filterSortValue}
3436
resultFormatValue={resultFormatValue}
3537
onFilterSortChange={setFilterSortValue}
3638
onResultFormatChange={setResultFormatValue}
39+
variantAnalysisQueryKind={variantAnalysisQueryKind}
3740
/>
3841
);
3942
};

extensions/ql-vscode/src/view/variant-analysis/RepositoriesSearchSortRow.tsx

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ type Props = {
1717
resultFormatValue: ResultFormat;
1818
onFilterSortChange: Dispatch<SetStateAction<RepositoriesFilterSortState>>;
1919
onResultFormatChange: Dispatch<SetStateAction<ResultFormat>>;
20+
variantAnalysisQueryKind: string | undefined;
2021
};
2122

2223
const Container = styled.div`
@@ -43,11 +44,21 @@ const RepositoriesResultFormatColumn = styled(RepositoriesResultFormat)`
4344
flex: 1;
4445
`;
4546

47+
function showResultFormatColumn(
48+
variantAnalysisQueryKind: string | undefined,
49+
): boolean {
50+
return (
51+
variantAnalysisQueryKind === "problem" ||
52+
variantAnalysisQueryKind === "path-problem"
53+
);
54+
}
55+
4656
export const RepositoriesSearchSortRow = ({
4757
filterSortValue,
4858
resultFormatValue,
4959
onFilterSortChange,
5060
onResultFormatChange,
61+
variantAnalysisQueryKind,
5162
}: Props) => {
5263
const handleSearchValueChange = useCallback(
5364
(searchValue: string) => {
@@ -100,10 +111,12 @@ export const RepositoriesSearchSortRow = ({
100111
value={filterSortValue.sortKey}
101112
onChange={handleSortKeyChange}
102113
/>
103-
<RepositoriesResultFormatColumn
104-
value={resultFormatValue}
105-
onChange={handleResultFormatChange}
106-
/>
114+
{showResultFormatColumn(variantAnalysisQueryKind) && (
115+
<RepositoriesResultFormatColumn
116+
value={resultFormatValue}
117+
onChange={handleResultFormatChange}
118+
/>
119+
)}
107120
</Container>
108121
);
109122
};

extensions/ql-vscode/src/view/variant-analysis/VariantAnalysisOutcomePanels.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ export const VariantAnalysisOutcomePanels = ({
129129
resultFormatValue={resultFormat}
130130
onFilterSortChange={setFilterSortState}
131131
onResultFormatChange={setResultFormat}
132+
variantAnalysisQueryKind={variantAnalysis.query.kind}
132133
/>
133134
<VariantAnalysisAnalyzedRepos
134135
variantAnalysis={variantAnalysis}
@@ -150,6 +151,7 @@ export const VariantAnalysisOutcomePanels = ({
150151
resultFormatValue={resultFormat}
151152
onFilterSortChange={setFilterSortState}
152153
onResultFormatChange={setResultFormat}
154+
variantAnalysisQueryKind={variantAnalysis.query.kind}
153155
/>
154156
<VSCodePanels>
155157
{scannedReposCount > 0 && (

0 commit comments

Comments
 (0)