Skip to content

Commit 9034c51

Browse files
committed
Fix conflicts
Signed-off-by: Steven Esser <[email protected]>
2 parents 3723513 + 5f957b6 commit 9034c51

21 files changed

+14296
-3861
lines changed

.travis.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
language: node_js
22
sudo: required
3-
dist: precise
3+
dist: xenial
44

55
node_js:
6-
- "8"
6+
- "10"
77

88
env:
99
global:
@@ -15,7 +15,7 @@ matrix:
1515
python: 2.7.13
1616
- os: osx
1717
language: generic
18-
osx_image: xcode7.3
18+
osx_image: xcode11
1919

2020

2121
before_install:
@@ -40,4 +40,4 @@ addons:
4040
after_success:
4141
- openssl aes-256-cbc -K $encrypted_906d16ae5679_key -iv $encrypted_906d16ae5679_iv -in deploy_rsa.enc -out /tmp/deploy_rsa -d
4242
- chmod 600 /tmp/deploy_rsa
43-
- scp -i /tmp/deploy_rsa dist/AboutCode*.tar.gz [email protected]:/home/frs/project/aboutcode-manager/builds/
43+
- scp -i /tmp/deploy_rsa dist/ScanCode*.tar.gz [email protected]:/home/frs/project/aboutcode-manager/builds/

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,25 +54,25 @@ Then, from your command line:
5454

5555
```bash
5656
# Clone this repository
57-
git clone https://github.com/nexB/scancode-workbench.git
57+
$ git clone https://github.com/nexB/scancode-workbench.git
5858

5959
# Go into the repository
60-
cd scancode-workbench
60+
$ cd scancode-workbench
6161

6262
# Install dependencies and run the app
63-
npm install
63+
$ npm install
6464

6565
# Rebuild native Node.js modules against the app version of Node.js
6666
# MacOS, Linux and Git Bash on Windows
67-
$(npm bin)/electron-rebuild
67+
$ $(npm bin)/electron-rebuild
6868
# Windows except for Git Bash
69-
.\node_modules\.bin\electron-rebuild.cmd
69+
> .\node_modules\.bin\electron-rebuild.cmd
7070

7171
# Run the app
72-
npm start
72+
$ npm start
7373
```
7474

75-
## Release instructions
75+
## Release Instructions
7676

7777
You can build a `dist` directory containing executables for any one of three
7878
target platforms by running:

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ platform:
66
- x64
77

88
install:
9-
- ps: Install-Product node 8 x64
9+
- ps: Install-Product node 10 x64
1010
- node --version
1111
- npm --version
1212
- openssl version

assets/app/css/main.css

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
/*---------------------------------------
2+
$('.jstree').jstree(true).refresh(true);
3+
$('.jstree').jstree(true).refresh(true);
24
Font source mapping
35
-----------------------------------------*/
46
@font-face {
@@ -280,12 +282,22 @@ body {
280282
/*---------------------------------------
281283
DataTables custom
282284
-----------------------------------------*/
285+
.table {
286+
table-layout: fixed;
287+
word-wrap: break-word;
288+
}
289+
290+
.dataTable td {
291+
overflow: hidden;
292+
text-overflow: ellipsis;
293+
white-space: nowrap;
294+
}
295+
283296
.column-right-justify {
284297
text-align: right;
285298
}
286299

287300
.dataTable td select {
288-
word-wrap: break-word;
289301
width: 100%;
290302
}
291303

assets/app/js/controllers/conclusionDialog.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ class ConclusionDialog extends Controller {
139139
.then(() => this.getHandler('delete')(conclusion));
140140
}
141141
});
142+
$('.jstree').jstree(true).refresh(true);
142143
}
143144

144145
// Populate modal input fields with suggestions from ScanCode results

assets/app/js/controllers/dejacodeExportDialog.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
#
3-
# Copyright (c) 2017 nexB Inc. and others. All rights reserved.
3+
# Copyright (c) 2019 nexB Inc. and others. All rights reserved.
44
# https://nexb.com and https://github.com/nexB/scancode-workbench/
55
# The ScanCode Workbench software is licensed under the Apache License version 2.0.
66
# ScanCode is a trademark of nexB Inc.
@@ -57,10 +57,10 @@ class DejaCodeExportDialog extends Controller {
5757
const productVersion = this.productVersion.val();
5858
const productNameVersion = productName.concat(':', productVersion);
5959
const apiUrl = this.apiUrl.val();
60-
const apiKey = this.apiKey.val();
60+
const apiKey = this.apiKey.val().trim();
6161

6262
// Test whether any form field is empty
63-
if (productName === '' || productVersion === '' || apiUrl === '' || apiKey === '') {
63+
if (productName === '' || apiUrl === '' || apiKey === '') {
6464
throw new Error('Please make sure you complete all fields in the upload form.');
6565
}
6666

assets/app/js/controllers/fileDashboard.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,6 @@ class FileDashboard extends Controller {
163163
unload: true,
164164
done: () => {
165165
this.sourceLanguageChartProgressbar.hide();
166-
this.sourceLanguageChart.hide('No Value Detected');
167166
this.sourceLanguageChart.flush();
168167
}
169168
}));
@@ -176,7 +175,6 @@ class FileDashboard extends Controller {
176175
unload: true,
177176
done: () => {
178177
this.fileTypeChartProgressbar.hide();
179-
this.fileTypeChart.hide('No Value Detected');
180178
this.fileTypeChart.flush();
181179
}
182180
}));
@@ -189,7 +187,6 @@ class FileDashboard extends Controller {
189187
unload: true,
190188
done: () => {
191189
this.holdersChartProgressbar.hide();
192-
this.holdersChart.hide('No Value Detected');
193190
this.holdersChart.flush();
194191
}
195192
}));

assets/app/js/controllers/jsTree.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,8 @@ class JsTree extends Controller {
182182
data.instance.set_icon(data.node, 'fa fa-folder fa_custom_package');
183183
}
184184
})
185-
// Select the root node when the tree is refreshed
186-
.on('refresh.jstree', () => {
185+
// Select the root node when the tree is loaded
186+
.on('loaded.jstree', () => {
187187
const rootNode = this.jsTree().jstree('get_node', '#').children;
188188
this.jsTree().jstree('select_node', rootNode);
189189
})

assets/app/js/controllers/licenseDashboard.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ class LicenseDashboard extends Controller {
164164
unload: true,
165165
done: () => {
166166
this.licenseExpressionChartProgressbar.hide();
167-
this.licenseExpressionChart.hide('No Value Detected');
168167
this.licenseExpressionChart.flush();
169168
}
170169
}));
@@ -177,7 +176,6 @@ class LicenseDashboard extends Controller {
177176
unload: true,
178177
done: () => {
179178
this.licenseKeyChartProgressbar.hide();
180-
this.licenseKeyChart.hide('No Value Detected');
181179
this.licenseKeyChart.flush();
182180
}
183181
}));
@@ -190,7 +188,6 @@ class LicenseDashboard extends Controller {
190188
unload: true,
191189
done: () => {
192190
this.licensePolicyChartProgressbar.hide();
193-
this.licensePolicyChart.hide('No Value Detected');
194191
this.licensePolicyChart.flush();
195192
}
196193
}));

assets/app/js/controllers/packageDashboard.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ class PackageDashboard extends Controller {
148148
unload: true,
149149
done: () => {
150150
this.packageTypeChartProgressbar.hide();
151-
this.packageTypeChart.hide('No Value Detected');
152151
this.packageTypeChart.flush();
153152
}
154153
}));
@@ -161,7 +160,6 @@ class PackageDashboard extends Controller {
161160
unload: true,
162161
done: () => {
163162
this.packageLanguageChartProgressbar.hide();
164-
this.packageLanguageChart.hide('No Value Detected');
165163
this.packageLanguageChart.flush();
166164
}
167165
}));
@@ -174,7 +172,6 @@ class PackageDashboard extends Controller {
174172
unload: true,
175173
done: () => {
176174
this.packageLicenseChartProgressbar.hide();
177-
this.packageLicenseChart.hide('No Value Detected');
178175
this.packageLicenseChart.flush();
179176
}
180177
}));

assets/app/js/controllers/scanDataTable.js

Lines changed: 60 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,16 +110,30 @@ class ScanDataTable extends Controller {
110110
this._query(dataTablesInput, dataTablesCallback),
111111
columns: ScanDataTable.TABLE_COLUMNS,
112112
fixedColumns: { leftColumns: 1 },
113-
colResize: true,
113+
colResize: false,
114114
scrollX: true,
115115
scrollResize: true,
116116
deferRender: true,
117117
initComplete: () => this._initComplete(),
118118
drawCallback: () => this._drawCallback(),
119-
columnDefs: [{
120-
targets: [4, 5, 8, 16, 17, 19, 20, 22, 23, 28, 31],
121-
className: 'column-right-justify',
122-
}],
119+
columnDefs: [
120+
// Handle Path column fixed width and ellipsis
121+
{
122+
targets: 0,
123+
width: '500px',
124+
render: this._mouseHover()
125+
},
126+
// Handle the rest columns fixed width
127+
{
128+
targets: '_all',
129+
width: '95px',
130+
render: this._mouseHover()
131+
},
132+
{
133+
targets: [4, 5, 8, 16, 17, 19, 20, 22, 23, 28, 31],
134+
className: 'column-right-justify',
135+
}
136+
],
123137
buttons: [
124138
{ // Do not allow the first column to be hidden
125139
extend: 'colvis',
@@ -201,6 +215,47 @@ class ScanDataTable extends Controller {
201215
return this._dataTable;
202216
}
203217

218+
// Taken from https://datatables.net/plug-ins/dataRender/ellipsis
219+
// On mouse hover, show the whole string. Useful for when cell text overflows
220+
// and you need to see the whole string
221+
_mouseHover(cutoff, wordbreak, escapeHtml) {
222+
var esc = function(t) {
223+
return t
224+
.replace(/&/g, '&amp;')
225+
.replace(/</g, '&lt;')
226+
.replace(/>/g, '&gt;')
227+
.replace(/"/g, '&quot;');
228+
};
229+
230+
return function(d, type) {
231+
if (type !== 'display') {
232+
return d;
233+
}
234+
235+
if (typeof d !== 'number' && typeof d !== 'string') {
236+
return d;
237+
}
238+
239+
d = d.toString(); // cast numbers
240+
241+
if (d.length < cutoff) {
242+
return d;
243+
}
244+
245+
var shortened = d;
246+
247+
if (wordbreak) {
248+
shortened = shortened.replace(/\s([^\s]*)$/, '');
249+
}
250+
251+
if (escapeHtml) {
252+
shortened = esc(shortened);
253+
}
254+
255+
return '<span title="' + esc(d) + '">' + shortened + '</span>';
256+
};
257+
}
258+
204259
// This function is called every time DataTables needs to be redrawn.
205260
// For details on the parameters https://datatables.net/manual/server-side
206261
_query(dataTablesInput, dataTablesCallback) {

assets/app/js/renderer.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
#
3-
# Copyright (c) 2017 nexB Inc. and others. All rights reserved.
3+
# Copyright (c) 2019 nexB Inc. and others. All rights reserved.
44
# https://nexb.com and https://github.com/nexB/scancode-workbench/
55
# The ScanCode Workbench software is licensed under the Apache License version 2.0.
66
# ScanCode is a trademark of nexB Inc.
@@ -117,6 +117,12 @@ $(document).ready(() => {
117117
updateViewsByPath(scanDataTable._selectedPath);
118118
});
119119

120+
$(document).on('click', '#showApiKeyButton', () => {
121+
// Toggle API key visibilty (See issue: #391)
122+
const apiKeyInput = document.getElementById('apiKey');
123+
apiKeyInput.type = (apiKeyInput.type === 'password') ? 'text' : 'password';
124+
});
125+
120126
const splitter = new Splitter('#leftCol', '#rightCol')
121127
.on('drag-end', () => redrawCurrentView());
122128

assets/app/js/workbenchDB.js

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
const Sequelize = require('sequelize');
1818
const fs = require('fs');
19+
const path = require('path');
1920
const JSONStream = require('JSONStream');
2021
const Database = require('./models/database');
2122
const {parentPath} = require('./models/databaseUtils');
@@ -185,9 +186,15 @@ class WorkbenchDB {
185186
.then((db) => db.File.findAll(query))
186187
.then((files) => {
187188
return files.map((file) => {
189+
let file_name;
190+
if (!file.name) {
191+
file_name = path.basename(file.path);
192+
} else {
193+
file_name = file.name;
194+
}
188195
return {
189196
id: file.path,
190-
text: file.name,
197+
text: file_name,
191198
parent: file.parent,
192199
type: this.determineJSTreeType(file, promises),
193200
children: file.type === 'directory'
@@ -290,11 +297,6 @@ class WorkbenchDB {
290297
};
291298
}
292299

293-
// Show error for scans missing file type information
294-
if (header.scancode_options['--info'] === undefined) {
295-
reject(new WorkbenchDB.MissingFileInfoError());
296-
}
297-
298300
$.extend(header, {
299301
workbench_version: version,
300302
workbench_notice: 'Exported from ScanCode Workbench and provided on an "AS IS" BASIS, WITHOUT WARRANTIES\\nOR CONDITIONS OF ANY KIND, either express or implied. No content created from\\nScanCode Workbench should be considered or used as legal advice. Consult an Attorney\\nfor any legal advice.\\nScanCode Workbench is a free software analysis application from nexB Inc. and others.\\nVisit https://github.com/nexB/scancode-workbench/ for support and download."'
@@ -370,6 +372,12 @@ class WorkbenchDB {
370372
}
371373

372374
_addFlattenedFiles(files) {
375+
// Fix for issue #232
376+
$.each(files, (i, file) => {
377+
if (file.type === 'directory' && file.hasOwnProperty('size_count')) {
378+
file.size = file.size_count;
379+
}
380+
});
373381
files = $.map(files, (file) => this.db.FlatFile.flatten(file));
374382
return this.db.FlatFile.bulkCreate(files, {logging: false});
375383
}
@@ -386,6 +394,10 @@ class WorkbenchDB {
386394
transaction: t
387395
};
388396
$.each(files, (i, file) => {
397+
// Fix for issue #232
398+
if (file.type === 'directory' && file.hasOwnProperty('size_count')) {
399+
file.size = file.size_count;
400+
}
389401
file.parent = parentPath(file.path);
390402
file.headerId = headerId;
391403
});
@@ -500,6 +512,4 @@ class WorkbenchDB {
500512
}
501513
}
502514

503-
WorkbenchDB.MissingFileInfoError = class MissingFileInfoError extends Error {};
504-
505515
module.exports = WorkbenchDB;

0 commit comments

Comments
 (0)