@@ -162,6 +162,7 @@ $(document).ready(() => {
162162 ipcRenderer . on ( 'import-JSON' , importJson ) ;
163163 ipcRenderer . on ( 'export-JSON' , exportJson ) ;
164164 ipcRenderer . on ( 'export-JSON-components-only' , exportJsonComponents ) ;
165+ ipcRenderer . on ( 'get-ScanInfo' , getScanInfo ) ;
165166
166167 // Opens the dashboard view when the app is first opened
167168 showDashboardButton . trigger ( 'click' ) ;
@@ -204,6 +205,25 @@ $(document).ready(() => {
204205 return updateViews ( ) ;
205206 }
206207
208+ // Get the ScanCode version and options data from the DB and populate and open the modal
209+ function getScanInfo ( ) {
210+ return aboutCodeDB . sync
211+ . then ( ( db ) => db . Header . findById ( 1 )
212+ . then ( ( header ) => {
213+ const scancode_label = $ ( '#scancode-info' ) . find ( '#scancode-label' ) ;
214+ const scancode_display = $ ( '#scancode-info' ) . find ( '#scancode-display' ) ;
215+ if ( header === null || header . scancode_version === null || header . scancode_options === null ) {
216+ scancode_label . text ( 'Please import a ScanCode results file or an AboutCode Manager sqlite file to see the scan options.' ) ;
217+ scancode_display . css ( 'display' , 'none' ) ;
218+ } else {
219+ scancode_label . text ( 'This information has been extracted from your imported ScanCode JSON file:' ) ;
220+ scancode_display . text ( 'ScanCode version: ' + header . scancode_version + '\n\nScanCode options: ' + JSON . stringify ( header . scancode_options , null , 2 ) ) ;
221+ scancode_display . css ( 'display' , 'block' ) ;
222+ }
223+ } ) )
224+ . then ( $ ( '#myModal' ) . modal ( 'show' ) ) ;
225+ }
226+
207227 /** Loads data for all views based on the current data */
208228 function updateViews ( ) {
209229 return aboutCodeDB . sync
0 commit comments