Updates to upload check, docs

This commit is contained in:
Bryan Ashby 2017-02-09 22:03:21 -07:00
parent f9e91987ac
commit 2e10fdfdf5
5 changed files with 39 additions and 20 deletions

View File

@ -45,6 +45,9 @@ nvm install 6
nvm alias default 6 nvm alias default 6
``` ```
### ES6
Newly written code will use ES6 and a lot of code has started the migration process. Of note is the `MenuModule` class. If you have created a mod that inherits from `MenuModule`, you will need to upgrade your class to ES6.
## Manual Database Upgrade ## Manual Database Upgrade
A few upgrades need to be made to your SQLite databases: A few upgrades need to be made to your SQLite databases:

View File

@ -121,23 +121,21 @@ function shutdownSystem() {
}, },
function stopListeningServers(callback) { function stopListeningServers(callback) {
return require('./listening_server.js').shutdown( () => { return require('./listening_server.js').shutdown( () => {
// :TODO: log err
return callback(null); // ignore err return callback(null); // ignore err
}); });
}, },
function stopEventScheduler(callback) { function stopEventScheduler(callback) {
if(initServices.eventScheduler) { if(initServices.eventScheduler) {
return initServices.eventScheduler.shutdown( () => { return initServices.eventScheduler.shutdown( () => {
callback(null); // ignore err return callback(null); // ignore err
}); });
} else { } else {
return callback(null); return callback(null);
} }
}, },
function stopFileAreaWeb(callback) { function stopFileAreaWeb(callback) {
require('./file_area_web.js').startup(err => { require('./file_area_web.js').startup( () => {
// :TODO: Log me if err return callback(null); // ignore err
return callback(null);
}); });
}, },
function stopMsgNetwork(callback) { function stopMsgNetwork(callback) {

View File

@ -566,6 +566,12 @@ function scanFile(filePath, options, iterator, cb) {
getExistingFileEntriesBySha256(fileEntry.fileSha256, (err, dupeEntries) => { getExistingFileEntriesBySha256(fileEntry.fileSha256, (err, dupeEntries) => {
return callback(err, dupeEntries); return callback(err, dupeEntries);
}); });
},
function finished(dupeEntries, callback) {
stepInfo.step = 'finished';
callIter( () => {
return callback(null, dupeEntries);
});
} }
], ],
(err, dupeEntries) => { (err, dupeEntries) => {

View File

@ -401,8 +401,9 @@ exports.MenuModule = class MenuModule extends PluginModule {
let textView; let textView;
let customMciId = startId; let customMciId = startId;
const config = this.menuConfig.config; const config = this.menuConfig.config;
const endId = options.endId || 99; // we'll fail to get a view before 99
while( (textView = this.viewControllers[formName].getView(customMciId)) ) { while(customMciId <= endId && (textView = this.viewControllers[formName].getView(customMciId)) ) {
const key = `${formName}InfoFormat${customMciId}`; // e.g. "mainInfoFormat10" const key = `${formName}InfoFormat${customMciId}`; // e.g. "mainInfoFormat10"
const format = config[key]; const format = config[key];

View File

@ -49,7 +49,7 @@ const MciViewIds = {
calcHashIndicator : 1, calcHashIndicator : 1,
archiveListIndicator : 2, archiveListIndicator : 2,
descFileIndicator : 3, descFileIndicator : 3,
logStep : 4,
customRangeStart : 10, // 10+ = customs customRangeStart : 10, // 10+ = customs
}, },
@ -218,9 +218,12 @@ exports.getModule = class UploadModule extends MenuModule {
const fmtObj = Object.assign( {}, stepInfo); const fmtObj = Object.assign( {}, stepInfo);
let stepIndicatorFmt = ''; let stepIndicatorFmt = '';
let logStepFmt;
const indicatorStates = this.menuConfig.config.indicatorStates || [ '|', '/', '-', '\\' ]; const fmtConfig = this.menuConfig.config;
const indicatorFinished = this.menuConfig.config.indicatorFinished || '√';
const indicatorStates = fmtConfig.indicatorStates || [ '|', '/', '-', '\\' ];
const indicatorFinished = fmtConfig.indicatorFinished || '√';
const indicator = { }; const indicator = { };
const self = this; const self = this;
@ -241,43 +244,47 @@ exports.getModule = class UploadModule extends MenuModule {
switch(stepInfo.step) { switch(stepInfo.step) {
case 'start' : case 'start' :
stepIndicatorFmt = this.menuConfig.config.scanningStartFormat || 'Scanning {fileName}'; logStepFmt = stepIndicatorFmt = fmtConfig.scanningStartFormat || 'Scanning {fileName}';
break; break;
case 'hash_update' : case 'hash_update' :
stepIndicatorFmt = this.menuConfig.calcHashFormat || 'Calculating hash/checksums: {calcHashPercent}%'; stepIndicatorFmt = fmtConfig.calcHashFormat || 'Calculating hash/checksums: {calcHashPercent}%';
updateIndicator(MciViewIds.processing.calcHashIndicator); updateIndicator(MciViewIds.processing.calcHashIndicator);
break; break;
case 'hash_finish' : case 'hash_finish' :
stepIndicatorFmt = this.menuConfig.calcHashCompleteFormat || 'Finished calculating hash/checksums'; stepIndicatorFmt = fmtConfig.calcHashCompleteFormat || 'Finished calculating hash/checksums';
updateIndicator(MciViewIds.processing.calcHashIndicator, true); updateIndicator(MciViewIds.processing.calcHashIndicator, true);
break; break;
case 'archive_list_start' : case 'archive_list_start' :
stepIndicatorFmt = this.menuConfig.extractArchiveListFormat || 'Extracting archive list'; stepIndicatorFmt = fmtConfig.extractArchiveListFormat || 'Extracting archive list';
updateIndicator(MciViewIds.processing.archiveListIndicator); updateIndicator(MciViewIds.processing.archiveListIndicator);
break; break;
case 'archive_list_finish' : case 'archive_list_finish' :
fmtObj.archivedFileCount = stepInfo.archiveEntries.length; fmtObj.archivedFileCount = stepInfo.archiveEntries.length;
stepIndicatorFmt = this.menuConfig.extractArchiveListFinishFormat || 'Archive list extracted ({archivedFileCount} files)'; stepIndicatorFmt = fmtConfig.extractArchiveListFinishFormat || 'Archive list extracted ({archivedFileCount} files)';
updateIndicator(MciViewIds.processing.archiveListIndicator, true); updateIndicator(MciViewIds.processing.archiveListIndicator, true);
break; break;
case 'archive_list_failed' : case 'archive_list_failed' :
stepIndicatorFmt = this.menuConfig.extractArchiveListFailedFormat || 'Archive list extraction failed'; stepIndicatorFmt = fmtConfig.extractArchiveListFailedFormat || 'Archive list extraction failed';
break; break;
case 'desc_files_start' : case 'desc_files_start' :
stepIndicatorFmt = this.menuConfig.processingDescFilesFormat || 'Processing description files'; stepIndicatorFmt = fmtConfig.processingDescFilesFormat || 'Processing description files';
updateIndicator(MciViewIds.processing.descFileIndicator); updateIndicator(MciViewIds.processing.descFileIndicator);
break; break;
case 'desc_files_finish' : case 'desc_files_finish' :
stepIndicatorFmt = this.menuConfig.processingDescFilesFinishFormat || 'Finished processing description files'; stepIndicatorFmt = fmtConfig.processingDescFilesFinishFormat || 'Finished processing description files';
updateIndicator(MciViewIds.processing.descFileIndicator, true); updateIndicator(MciViewIds.processing.descFileIndicator, true);
break; break;
case 'finished' :
logStepFmt = stepIndicatorFmt = fmtConfig.scanningStartFormat || 'Finished';
break;
} }
fmtObj.stepIndicatorText = stringFormat(stepIndicatorFmt, fmtObj); fmtObj.stepIndicatorText = stringFormat(stepIndicatorFmt, fmtObj);
@ -288,6 +295,10 @@ exports.getModule = class UploadModule extends MenuModule {
if(indicator.mci && indicator.text) { if(indicator.mci && indicator.text) {
this.setViewText('processing', indicator.mci, indicator.text); this.setViewText('processing', indicator.mci, indicator.text);
} }
if(logStepFmt) {
this.setViewText('processing', MciViewIds.processing.logStep, stringFormat(logStepFmt, fmtObj), { appendMultiLine : true } );
}
} else { } else {
this.client.term.pipeWrite(fmtObj.stepIndicatorText); this.client.term.pipeWrite(fmtObj.stepIndicatorText);
} }