feat: refactor parsing and scanning logic for test files
- Updated `parseFilename` to `parseTargetFilename` and modified its return structure to include `test_id` instead of `file_id`. - Introduced `parseResultFilename` to extract `test_id` and `device` from result file names. - Enhanced `fullScan` to separately handle target and results directories, improving clarity and functionality. - Updated database interactions to use `test_id` instead of `file_id` across various modules. - Added a new `/rescan` endpoint to trigger a full scan of target and results directories. - Improved logging and error handling throughout the scanning process. - Introduced `parseTputRssi` to extract throughput and RSSI data from log files.
This commit is contained in:
+3
-3
@@ -68,10 +68,10 @@ function startWatching(targetDir, resultsDir) {
|
||||
if (path.normalize(dirPath) === path.normalize(resultsDir)) return;
|
||||
const dirName = path.basename(dirPath);
|
||||
const segs = dirName.split(/[_\-]/);
|
||||
const file_id = segs.find(s => /^R\d+[A-Z0-9]+$/i.test(s)) || null;
|
||||
const test_id = segs.find(s => /^R\d+[A-Z0-9]+$/i.test(s)) || null;
|
||||
const device = segs.find(s => /^CGW\d+$/i.test(s)) || null;
|
||||
if (file_id) {
|
||||
resetByFileIdAndDevice(file_id, device);
|
||||
if (test_id) {
|
||||
resetByFileIdAndDevice(test_id, device);
|
||||
broadcast({ type: 'update' });
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user