File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33 "displayName" : " Corgea" ,
44 "publisher" : " Corgea" ,
55 "description" : " Corgea helps you automatically fix insecure code." ,
6- "version" : " 1.5.0 " ,
6+ "version" : " 1.5.1 " ,
77 "icon" : " images/logo.png" ,
88 "license" : " UNLICENSED" ,
99 "repository" : {
Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ export interface ScanState {
3737 scanId ?: string ;
3838 output : string [ ] ;
3939 error ?: string ;
40+ lastScanType ?: 'full' | 'uncommitted' ;
4041}
4142
4243export default class scanningService {
@@ -66,7 +67,7 @@ export default class scanningService {
6667 return ;
6768 }
6869
69- await scanningService . scanProject ( false ) ;
70+ await scanningService . scanProject ( false , 'uncommitted' ) ;
7071 }
7172
7273 public static async getUncommittedFiles ( includeIgnored : boolean = false ) : Promise < any [ ] > {
@@ -95,7 +96,7 @@ export default class scanningService {
9596 */
9697 @OnCommand ( "corgea.scan-full" )
9798 @withErrorHandling ( )
98- public static async scanProject ( isFullScan : boolean = true ) {
99+ public static async scanProject ( isFullScan : boolean = true , scanType : 'full' | 'uncommitted' = 'full' ) {
99100 // Check if IDE scanning is enabled
100101 const isIdeScanningEnabled = await ConfigService . isIdeScanningEnabled ( ) ;
101102 if ( ! isIdeScanningEnabled ) {
@@ -121,6 +122,7 @@ export default class scanningService {
121122 scan : false
122123 } ,
123124 output : [ ] ,
125+ lastScanType : scanType ,
124126 } ;
125127
126128 // Notify webview that scan started
Original file line number Diff line number Diff line change @@ -8,24 +8,24 @@ interface ScanningErrorProps {
88
99const ScanningError : React . FC < ScanningErrorProps > = ( { isCancelled = false } ) => {
1010 const { state, actions } = useVulnerabilities ( ) ;
11-
11+ const actionsButtons = ( < div className = "error-actions" >
12+ < button className = "btn btn-primary mt-3" onClick = { actions . retryLastScan } >
13+ < i className = "fas fa-play" > </ i >
14+ Try Again
15+ </ button >
16+ < button className = "btn btn-secondary mt-3 ml-2" onClick = { actions . clearScanState } >
17+ < i className = "fas fa-times" > </ i >
18+ Clear
19+ </ button >
20+ </ div > ) ;
1221 if ( isCancelled ) {
1322 return (
1423 < div className = "scanning-error" >
1524 < div className = "error-icon" >
1625 < i className = "fas fa-times-circle" style = { { color : '#ff9500' } } > </ i >
1726 </ div >
1827 < div className = "error-message" > Scan was cancelled</ div >
19- < div className = "error-actions" >
20- < button className = "btn btn-primary mt-3" onClick = { actions . scanProject } >
21- < i className = "fas fa-play" > </ i >
22- Start New Scan
23- </ button >
24- < button className = "btn btn-secondary mt-3 ml-2" onClick = { actions . clearScanState } >
25- < i className = "fas fa-times" > </ i >
26- Clear
27- </ button >
28- </ div >
28+ { actionsButtons }
2929 </ div >
3030 ) ;
3131 }
@@ -36,10 +36,7 @@ const ScanningError: React.FC<ScanningErrorProps> = ({ isCancelled = false }) =>
3636 < i className = "fas fa-exclamation-triangle" > </ i >
3737 </ div >
3838 < div className = "error-message" > { state . scanState . error } </ div >
39- < button className = "btn btn-primary mt-3" onClick = { actions . scanProject } >
40- < i className = "fas fa-redo" > </ i >
41- Try Again
42- </ button >
39+ { actionsButtons }
4340 </ div >
4441 ) ;
4542} ;
Original file line number Diff line number Diff line change @@ -51,6 +51,7 @@ export interface ScanState {
5151 upload : boolean ;
5252 scan : boolean ;
5353 } ;
54+ lastScanType ?: 'full' | 'uncommitted' ;
5455}
5556
5657export interface FileGroup {
@@ -218,6 +219,7 @@ const VulnerabilitiesContext = createContext<{
218219 showUncommittedFilesModal : ( ) => void ;
219220 hideUncommittedFilesModal : ( ) => void ;
220221 clearScanState : ( ) => void ;
222+ retryLastScan : ( ) => void ;
221223 } ;
222224} | undefined > ( undefined ) ;
223225
@@ -309,6 +311,14 @@ export function VulnerabilitiesProvider({ children }: { children: ReactNode }) {
309311 } ,
310312 clearScanState : ( ) => {
311313 vscode . postMessage ( { type : 'clearScanState' } ) ;
314+ } ,
315+ retryLastScan : ( ) => {
316+ const lastScanType = state . scanState . lastScanType ;
317+ if ( lastScanType === 'uncommitted' ) {
318+ vscode . postMessage ( { type : 'scanUncommittedFiles' } ) ;
319+ } else {
320+ vscode . postMessage ( { type : 'scanProject' } ) ;
321+ }
312322 }
313323 } ;
314324
You can’t perform that action at this time.
0 commit comments