Skip to content

Commit fa39bd1

Browse files
committed
Update export/copy buttons copy when repositories are selected
This changes the text of the export/copy buttons on a variant analysis when at least one repository is selected. This makes it more clear that the user is only exporting/copying the results of the selected repositories.
1 parent baea365 commit fa39bd1

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ export type VariantAnalysisActionsProps = {
1414
onExportResultsClick: () => void;
1515
copyRepositoryListDisabled?: boolean;
1616
exportResultsDisabled?: boolean;
17+
18+
hasSelectedRepositories?: boolean;
1719
};
1820

1921
const Container = styled.div`
@@ -35,6 +37,7 @@ export const VariantAnalysisActions = ({
3537
onExportResultsClick,
3638
copyRepositoryListDisabled,
3739
exportResultsDisabled,
40+
hasSelectedRepositories,
3841
}: VariantAnalysisActionsProps) => {
3942
return (
4043
<Container>
@@ -45,14 +48,18 @@ export const VariantAnalysisActions = ({
4548
onClick={onCopyRepositoryListClick}
4649
disabled={copyRepositoryListDisabled}
4750
>
48-
Copy repository list
51+
{hasSelectedRepositories
52+
? "Copy selected repositories as a list"
53+
: "Copy repository list"}
4954
</Button>
5055
<Button
5156
appearance="primary"
5257
onClick={onExportResultsClick}
5358
disabled={exportResultsDisabled}
5459
>
55-
Export results
60+
{hasSelectedRepositories
61+
? "Export selected results"
62+
: "Export results"}
5663
</Button>
5764
</>
5865
)}

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ export const VariantAnalysisHeader = ({
131131
stopQueryDisabled={!variantAnalysis.actionsWorkflowRunId}
132132
exportResultsDisabled={!hasDownloadedRepos}
133133
copyRepositoryListDisabled={!hasReposWithResults}
134+
hasSelectedRepositories={
135+
selectedRepositoryIds && selectedRepositoryIds.length > 0
136+
}
134137
/>
135138
</Row>
136139
<VariantAnalysisStats

extensions/ql-vscode/src/view/variant-analysis/__tests__/VariantAnalysisActions.spec.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,17 @@ describe(VariantAnalysisActions.name, () => {
9393

9494
expect(container.querySelectorAll("vscode-button").length).toEqual(0);
9595
});
96+
97+
it("changes the text on the buttons when repositories are selected", async () => {
98+
render({
99+
variantAnalysisStatus: VariantAnalysisStatus.Succeeded,
100+
showResultActions: true,
101+
hasSelectedRepositories: true,
102+
});
103+
104+
expect(screen.getByText("Export selected results")).toBeInTheDocument();
105+
expect(
106+
screen.getByText("Copy selected repositories as a list"),
107+
).toBeInTheDocument();
108+
});
96109
});

0 commit comments

Comments
 (0)