Skip to content

Commit c44049f

Browse files
committed
Display version and options of imported scan #239
Signed-off-by: John M. Horan <[email protected]>
1 parent 3bd78f1 commit c44049f

File tree

4 files changed

+48
-0
lines changed

4 files changed

+48
-0
lines changed

assets/app/css/main.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,3 +558,11 @@ div.dataTables_scrollHead th:first-child {
558558
.select2-container .select2-search__field{
559559
width: 100% !important;
560560
}
561+
562+
/*---------------------------------------
563+
ScanCode modal custom
564+
-----------------------------------------*/
565+
566+
body .modal-scancode {
567+
width: 800px;
568+
}

assets/app/js/renderer.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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,16 @@ $(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).then(header => {
212+
scancode_label = $('#scancode-label').find('#scancode-display');
213+
scancode_label.text('ScanCode version: ' + header.scancode_version + '\n\nScanCode options: ' + JSON.stringify(header.scancode_options, null, 2));
214+
}))
215+
.then($("#myModal").modal('show'));
216+
}
217+
207218
/** Loads data for all views based on the current data */
208219
function updateViews() {
209220
return aboutCodeDB.sync

index.html

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,30 @@ <h3>Debugging</h3>
416416
</div>
417417
</div>
418418

419+
<!-- ScanCode info modal -->
420+
<div class="modal fade" id="myModal" role="dialog" tabindex="-1">
421+
<div class="modal-dialog modal-scancode">
422+
<div class="modal-content">
423+
<div class="modal-header">
424+
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
425+
<h4 class="modal-title">ScanCode Version and Options</h4>
426+
</div>
427+
<div class="modal-body">
428+
<div id="scancode-label" style="text-align: left;">
429+
<p>
430+
This information has been extracted from your imported ScanCode JSON file:
431+
</p>
432+
433+
<pre id="scancode-display"></pre>
434+
</div>
435+
</div>
436+
<div class="modal-footer">
437+
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
438+
</div>
439+
</div><!-- /.modal-content -->
440+
</div><!-- /.modal-dialog -->
441+
</div><!-- /.modal -->
442+
419443
<script>require('./assets/app/js/renderer.js');</script>
420444
</body>
421445
</html>

main.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,11 @@ function getTemplate() {
202202
label: `AboutCode Manager Version ${packageJson.version}`,
203203
enabled: false
204204
},
205+
{
206+
label: 'Get ScanCode Version and Options',
207+
accelerator: 'CmdOrCtrl+G',
208+
click: sendEventToRenderer('get-ScanInfo')
209+
},
205210
{
206211
type: 'separator'
207212
},

0 commit comments

Comments
 (0)