Skip to content

Commit

Permalink
Fix conflicts
Browse files Browse the repository at this point in the history
Signed-off-by: Steven Esser <[email protected]>
  • Loading branch information
steven-esser committed Sep 27, 2019
2 parents 3723513 + 5f957b6 commit 9034c51
Show file tree
Hide file tree
Showing 21 changed files with 14,296 additions and 3,861 deletions.
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
language: node_js
sudo: required
dist: precise
dist: xenial

node_js:
- "8"
- "10"

env:
global:
Expand All @@ -15,7 +15,7 @@ matrix:
python: 2.7.13
- os: osx
language: generic
osx_image: xcode7.3
osx_image: xcode11


before_install:
Expand All @@ -40,4 +40,4 @@ addons:
after_success:
- openssl aes-256-cbc -K $encrypted_906d16ae5679_key -iv $encrypted_906d16ae5679_iv -in deploy_rsa.enc -out /tmp/deploy_rsa -d
- chmod 600 /tmp/deploy_rsa
- scp -i /tmp/deploy_rsa dist/AboutCode*.tar.gz [email protected]:/home/frs/project/aboutcode-manager/builds/
- scp -i /tmp/deploy_rsa dist/ScanCode*.tar.gz [email protected]:/home/frs/project/aboutcode-manager/builds/
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,25 +54,25 @@ Then, from your command line:

```bash
# Clone this repository
git clone https://github.com/nexB/scancode-workbench.git
$ git clone https://github.com/nexB/scancode-workbench.git

# Go into the repository
cd scancode-workbench
$ cd scancode-workbench

# Install dependencies and run the app
npm install
$ npm install

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

# Run the app
npm start
$ npm start
```

## Release instructions
## Release Instructions

You can build a `dist` directory containing executables for any one of three
target platforms by running:
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ platform:
- x64

install:
- ps: Install-Product node 8 x64
- ps: Install-Product node 10 x64
- node --version
- npm --version
- openssl version
Expand Down
14 changes: 13 additions & 1 deletion assets/app/css/main.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/*---------------------------------------
$('.jstree').jstree(true).refresh(true);
$('.jstree').jstree(true).refresh(true);
Font source mapping
-----------------------------------------*/
@font-face {
Expand Down Expand Up @@ -280,12 +282,22 @@ body {
/*---------------------------------------
DataTables custom
-----------------------------------------*/
.table {
table-layout: fixed;
word-wrap: break-word;
}

.dataTable td {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}

.column-right-justify {
text-align: right;
}

.dataTable td select {
word-wrap: break-word;
width: 100%;
}

Expand Down
1 change: 1 addition & 0 deletions assets/app/js/controllers/conclusionDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ class ConclusionDialog extends Controller {
.then(() => this.getHandler('delete')(conclusion));
}
});
$('.jstree').jstree(true).refresh(true);
}

// Populate modal input fields with suggestions from ScanCode results
Expand Down
6 changes: 3 additions & 3 deletions assets/app/js/controllers/dejacodeExportDialog.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
#
# Copyright (c) 2017 nexB Inc. and others. All rights reserved.
# Copyright (c) 2019 nexB Inc. and others. All rights reserved.
# https://nexb.com and https://github.com/nexB/scancode-workbench/
# The ScanCode Workbench software is licensed under the Apache License version 2.0.
# ScanCode is a trademark of nexB Inc.
Expand Down Expand Up @@ -57,10 +57,10 @@ class DejaCodeExportDialog extends Controller {
const productVersion = this.productVersion.val();
const productNameVersion = productName.concat(':', productVersion);
const apiUrl = this.apiUrl.val();
const apiKey = this.apiKey.val();
const apiKey = this.apiKey.val().trim();

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

Expand Down
3 changes: 0 additions & 3 deletions assets/app/js/controllers/fileDashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ class FileDashboard extends Controller {
unload: true,
done: () => {
this.sourceLanguageChartProgressbar.hide();
this.sourceLanguageChart.hide('No Value Detected');
this.sourceLanguageChart.flush();
}
}));
Expand All @@ -176,7 +175,6 @@ class FileDashboard extends Controller {
unload: true,
done: () => {
this.fileTypeChartProgressbar.hide();
this.fileTypeChart.hide('No Value Detected');
this.fileTypeChart.flush();
}
}));
Expand All @@ -189,7 +187,6 @@ class FileDashboard extends Controller {
unload: true,
done: () => {
this.holdersChartProgressbar.hide();
this.holdersChart.hide('No Value Detected');
this.holdersChart.flush();
}
}));
Expand Down
4 changes: 2 additions & 2 deletions assets/app/js/controllers/jsTree.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ class JsTree extends Controller {
data.instance.set_icon(data.node, 'fa fa-folder fa_custom_package');
}
})
// Select the root node when the tree is refreshed
.on('refresh.jstree', () => {
// Select the root node when the tree is loaded
.on('loaded.jstree', () => {
const rootNode = this.jsTree().jstree('get_node', '#').children;
this.jsTree().jstree('select_node', rootNode);
})
Expand Down
3 changes: 0 additions & 3 deletions assets/app/js/controllers/licenseDashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@ class LicenseDashboard extends Controller {
unload: true,
done: () => {
this.licenseExpressionChartProgressbar.hide();
this.licenseExpressionChart.hide('No Value Detected');
this.licenseExpressionChart.flush();
}
}));
Expand All @@ -177,7 +176,6 @@ class LicenseDashboard extends Controller {
unload: true,
done: () => {
this.licenseKeyChartProgressbar.hide();
this.licenseKeyChart.hide('No Value Detected');
this.licenseKeyChart.flush();
}
}));
Expand All @@ -190,7 +188,6 @@ class LicenseDashboard extends Controller {
unload: true,
done: () => {
this.licensePolicyChartProgressbar.hide();
this.licensePolicyChart.hide('No Value Detected');
this.licensePolicyChart.flush();
}
}));
Expand Down
3 changes: 0 additions & 3 deletions assets/app/js/controllers/packageDashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ class PackageDashboard extends Controller {
unload: true,
done: () => {
this.packageTypeChartProgressbar.hide();
this.packageTypeChart.hide('No Value Detected');
this.packageTypeChart.flush();
}
}));
Expand All @@ -161,7 +160,6 @@ class PackageDashboard extends Controller {
unload: true,
done: () => {
this.packageLanguageChartProgressbar.hide();
this.packageLanguageChart.hide('No Value Detected');
this.packageLanguageChart.flush();
}
}));
Expand All @@ -174,7 +172,6 @@ class PackageDashboard extends Controller {
unload: true,
done: () => {
this.packageLicenseChartProgressbar.hide();
this.packageLicenseChart.hide('No Value Detected');
this.packageLicenseChart.flush();
}
}));
Expand Down
65 changes: 60 additions & 5 deletions assets/app/js/controllers/scanDataTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,30 @@ class ScanDataTable extends Controller {
this._query(dataTablesInput, dataTablesCallback),
columns: ScanDataTable.TABLE_COLUMNS,
fixedColumns: { leftColumns: 1 },
colResize: true,
colResize: false,
scrollX: true,
scrollResize: true,
deferRender: true,
initComplete: () => this._initComplete(),
drawCallback: () => this._drawCallback(),
columnDefs: [{
targets: [4, 5, 8, 16, 17, 19, 20, 22, 23, 28, 31],
className: 'column-right-justify',
}],
columnDefs: [
// Handle Path column fixed width and ellipsis
{
targets: 0,
width: '500px',
render: this._mouseHover()
},
// Handle the rest columns fixed width
{
targets: '_all',
width: '95px',
render: this._mouseHover()
},
{
targets: [4, 5, 8, 16, 17, 19, 20, 22, 23, 28, 31],
className: 'column-right-justify',
}
],
buttons: [
{ // Do not allow the first column to be hidden
extend: 'colvis',
Expand Down Expand Up @@ -201,6 +215,47 @@ class ScanDataTable extends Controller {
return this._dataTable;
}

// Taken from https://datatables.net/plug-ins/dataRender/ellipsis
// On mouse hover, show the whole string. Useful for when cell text overflows
// and you need to see the whole string
_mouseHover(cutoff, wordbreak, escapeHtml) {
var esc = function(t) {
return t
.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;');
};

return function(d, type) {
if (type !== 'display') {
return d;
}

if (typeof d !== 'number' && typeof d !== 'string') {
return d;
}

d = d.toString(); // cast numbers

if (d.length < cutoff) {
return d;
}

var shortened = d;

if (wordbreak) {
shortened = shortened.replace(/\s([^\s]*)$/, '');
}

if (escapeHtml) {
shortened = esc(shortened);
}

return '<span title="' + esc(d) + '">' + shortened + '</span>';
};
}

// This function is called every time DataTables needs to be redrawn.
// For details on the parameters https://datatables.net/manual/server-side
_query(dataTablesInput, dataTablesCallback) {
Expand Down
8 changes: 7 additions & 1 deletion assets/app/js/renderer.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
#
# Copyright (c) 2017 nexB Inc. and others. All rights reserved.
# Copyright (c) 2019 nexB Inc. and others. All rights reserved.
# https://nexb.com and https://github.com/nexB/scancode-workbench/
# The ScanCode Workbench software is licensed under the Apache License version 2.0.
# ScanCode is a trademark of nexB Inc.
Expand Down Expand Up @@ -117,6 +117,12 @@ $(document).ready(() => {
updateViewsByPath(scanDataTable._selectedPath);
});

$(document).on('click', '#showApiKeyButton', () => {
// Toggle API key visibilty (See issue: #391)
const apiKeyInput = document.getElementById('apiKey');
apiKeyInput.type = (apiKeyInput.type === 'password') ? 'text' : 'password';
});

const splitter = new Splitter('#leftCol', '#rightCol')
.on('drag-end', () => redrawCurrentView());

Expand Down
26 changes: 18 additions & 8 deletions assets/app/js/workbenchDB.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

const Sequelize = require('sequelize');
const fs = require('fs');
const path = require('path');
const JSONStream = require('JSONStream');
const Database = require('./models/database');
const {parentPath} = require('./models/databaseUtils');
Expand Down Expand Up @@ -185,9 +186,15 @@ class WorkbenchDB {
.then((db) => db.File.findAll(query))
.then((files) => {
return files.map((file) => {
let file_name;
if (!file.name) {
file_name = path.basename(file.path);
} else {
file_name = file.name;
}
return {
id: file.path,
text: file.name,
text: file_name,
parent: file.parent,
type: this.determineJSTreeType(file, promises),
children: file.type === 'directory'
Expand Down Expand Up @@ -290,11 +297,6 @@ class WorkbenchDB {
};
}

// Show error for scans missing file type information
if (header.scancode_options['--info'] === undefined) {
reject(new WorkbenchDB.MissingFileInfoError());
}

$.extend(header, {
workbench_version: version,
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."'
Expand Down Expand Up @@ -370,6 +372,12 @@ class WorkbenchDB {
}

_addFlattenedFiles(files) {
// Fix for issue #232
$.each(files, (i, file) => {
if (file.type === 'directory' && file.hasOwnProperty('size_count')) {
file.size = file.size_count;
}
});
files = $.map(files, (file) => this.db.FlatFile.flatten(file));
return this.db.FlatFile.bulkCreate(files, {logging: false});
}
Expand All @@ -386,6 +394,10 @@ class WorkbenchDB {
transaction: t
};
$.each(files, (i, file) => {
// Fix for issue #232
if (file.type === 'directory' && file.hasOwnProperty('size_count')) {
file.size = file.size_count;
}
file.parent = parentPath(file.path);
file.headerId = headerId;
});
Expand Down Expand Up @@ -500,6 +512,4 @@ class WorkbenchDB {
}
}

WorkbenchDB.MissingFileInfoError = class MissingFileInfoError extends Error {};

module.exports = WorkbenchDB;
Loading

0 comments on commit 9034c51

Please sign in to comment.