Skip to content

Commit

Permalink
Merge pull request #39 from trailofbits/VF/close-all-sarif-files-button
Browse files Browse the repository at this point in the history
Add button to close all SARIF files
  • Loading branch information
fcasal authored Sep 11, 2024
2 parents 82dfaf0 + 20cb2d9 commit 0963eee
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "sarif-explorer",
"displayName": "SARIF Explorer",
"description": "SARIF Explorer: Explore static analysis results effectively and enjoyably.",
"version": "1.2.7",
"version": "1.2.8",
"publisher": "trailofbits",
"author": {
"name": "Trail of Bits"
Expand Down
5 changes: 5 additions & 0 deletions src/webviewSrc/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@
class="smallButton codicon codicon-repo-push"
title="Send all results marked as BUG to weAudit"
></div>
<div
id="closeAllSarifFilesButton"
class="smallButton codicon codicon-close"
title="Close all SARIF files"
></div>
</div>
</div>

Expand Down
2 changes: 1 addition & 1 deletion src/webviewSrc/result/resultsTableWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ export class ResultsTableWidget {
}
};

// 10. Settings button
// 10. Send bugs to WeAudit button
const sendBugsToWeAuditButton = getElementByIdOrThrow(this.SEND_BUGS_TO_WEAUDIT_BUTTON_ID) as HTMLButtonElement;
sendBugsToWeAuditButton.onclick = () => {
apiSendBugsToWeAudit(this.resultsTable.getBugs());
Expand Down
12 changes: 12 additions & 0 deletions src/webviewSrc/sarifFile/sarifFileListWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ export class SarifFileListWidget {
/* eslint-disable @typescript-eslint/naming-convention */
private SARIF_LIST_TABLE_ID = "sarifFileTable";
private SARIF_LIST_OPEN_BUTTON_ID = "openNewSarifFileButton";
private CLOSE_ALL_SARIF_FILES_BUTTON_ID = "closeAllSarifFilesButton";
/* eslint-enable @typescript-eslint/naming-convention */

private sarifFileListData: SarifFileList;
Expand Down Expand Up @@ -112,6 +113,17 @@ export class SarifFileListWidget {
apiLaunchOpenSarifFileDialog();
};

// Close all SARIF files button
const closeAllSarifFilesButton = getElementByIdOrThrow(
this.CLOSE_ALL_SARIF_FILES_BUTTON_ID,
) as HTMLButtonElement;
closeAllSarifFilesButton.onclick = () => {
this.sarifFilePathToRow.forEach((sarifFileAndRow) => {
this.removeSarifFile(sarifFileAndRow);
apiCloseSarifFile(sarifFileAndRow.sarifFile.getSarifFilePath());
});
};

this.sarifFileTableElement.setAttribute("tabindex", "0");

this.sarifFileTableElement.addEventListener("keydown", (e: KeyboardEvent) => {
Expand Down

0 comments on commit 0963eee

Please sign in to comment.