querysub 0.367.0 → 0.368.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -239,8 +239,8 @@ export class IndexedLogs<T> {
|
|
|
239
239
|
if (!hasLogger) return false;
|
|
240
240
|
// NOTE: Prefer to do the searching on the move logs service. However, if it's not available, any service can do searching. It just might lag that server...
|
|
241
241
|
if (preferredOnly) {
|
|
242
|
-
let entryPoint = await NodeCapabilitiesController.nodes[nodeId].getEntryPoint();
|
|
243
|
-
if (!entryPoint
|
|
242
|
+
let entryPoint = await timeoutToUndefinedSilent(2500, NodeCapabilitiesController.nodes[nodeId].getEntryPoint());
|
|
243
|
+
if (!entryPoint?.includes("movelogs")) return false;
|
|
244
244
|
}
|
|
245
245
|
added = true;
|
|
246
246
|
|
|
@@ -298,21 +298,28 @@ export class IndexedLogs<T> {
|
|
|
298
298
|
let backblazeLogs = this.getPublicLogs();
|
|
299
299
|
let paths: TimeFilePath[] = [];
|
|
300
300
|
|
|
301
|
+
let promises: Promise<void>[] = [];
|
|
302
|
+
|
|
301
303
|
if (config.only !== "public") {
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
304
|
+
promises.push((async () => {
|
|
305
|
+
let localPaths = await new TimeFileTree(localLogs).findAllPaths({
|
|
306
|
+
startTime: config.startTime,
|
|
307
|
+
endTime: config.endTime,
|
|
308
|
+
});
|
|
309
|
+
paths.push(...localPaths);
|
|
310
|
+
})());
|
|
307
311
|
}
|
|
308
312
|
|
|
309
313
|
if (config.only !== "local") {
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
314
|
+
promises.push((async () => {
|
|
315
|
+
let backblazePaths = await new TimeFileTree(backblazeLogs).findAllPaths({
|
|
316
|
+
startTime: config.startTime,
|
|
317
|
+
endTime: config.endTime,
|
|
318
|
+
});
|
|
319
|
+
paths.push(...backblazePaths);
|
|
320
|
+
})());
|
|
315
321
|
}
|
|
322
|
+
await Promise.all(promises);
|
|
316
323
|
|
|
317
324
|
// Bake in the size to ensure more cache hits (without this, every single access will always result in a file/remote call).
|
|
318
325
|
let pathsWithSize = await Promise.all(paths.map(async (path): Promise<TimeFilePathWithSize> => {
|
|
@@ -357,6 +364,10 @@ export class IndexedLogs<T> {
|
|
|
357
364
|
try {
|
|
358
365
|
let resultObj = await this.clientFind({
|
|
359
366
|
...config,
|
|
367
|
+
params: {
|
|
368
|
+
...config.params,
|
|
369
|
+
only: "local",
|
|
370
|
+
},
|
|
360
371
|
nodeId: machineNode,
|
|
361
372
|
onResult(match) {
|
|
362
373
|
config.onResult(match);
|
|
@@ -25,6 +25,7 @@ import { errorToUndefined } from "../../../errors";
|
|
|
25
25
|
import { IndexedLogResults, createEmptyIndexedLogResults, mergeIndexedLogResults } from "./BufferIndexHelpers";
|
|
26
26
|
import { TimeFilePath } from "./TimeFileTree";
|
|
27
27
|
import { isPublic } from "../../../config";
|
|
28
|
+
import { Zip } from "../../../zip";
|
|
28
29
|
|
|
29
30
|
let searchText = new URLParam("searchText", "");
|
|
30
31
|
let excludePendingResults = new URLParam("excludePendingResults", false);
|
|
@@ -76,7 +77,7 @@ export class LogViewer3 extends qreact.Component {
|
|
|
76
77
|
let paths: TimeFilePathWithSize[] = [];
|
|
77
78
|
if (savedPathsURL.value) {
|
|
78
79
|
const compressed = Buffer.from(savedPathsURL.value, "base64");
|
|
79
|
-
const decompressed =
|
|
80
|
+
const decompressed = Zip.gunzipSync(compressed);
|
|
80
81
|
paths = JSON.parse(decompressed.toString("utf8"));
|
|
81
82
|
} else {
|
|
82
83
|
paths = this.state.paths;
|
|
@@ -95,7 +96,7 @@ export class LogViewer3 extends qreact.Component {
|
|
|
95
96
|
freezePaths() {
|
|
96
97
|
const json = JSON.stringify(this.state.paths);
|
|
97
98
|
const buffer = Buffer.from(json, "utf8");
|
|
98
|
-
const compressed =
|
|
99
|
+
const compressed = Zip.gzipSync(buffer, 9);
|
|
99
100
|
savedPathsURL.value = compressed.toString("base64");
|
|
100
101
|
}
|
|
101
102
|
|
|
@@ -342,6 +343,8 @@ export class LogViewer3 extends qreact.Component {
|
|
|
342
343
|
|
|
343
344
|
Querysub.commitLocal(() => {
|
|
344
345
|
this.state.loadingPaths = true;
|
|
346
|
+
this.state.results = [];
|
|
347
|
+
this.state.stats = undefined;
|
|
345
348
|
});
|
|
346
349
|
|
|
347
350
|
let loggers = await getLoggers2Async();
|
|
@@ -364,7 +367,7 @@ export class LogViewer3 extends qreact.Component {
|
|
|
364
367
|
let allPaths: TimeFilePathWithSize[] = [];
|
|
365
368
|
let range = Querysub.localRead(() => getTimeRange());
|
|
366
369
|
|
|
367
|
-
|
|
370
|
+
await Promise.all(selectedLoggers.map(async (logger) => {
|
|
368
371
|
let paths = await logger.clientGetPaths({
|
|
369
372
|
startTime: range.startTime,
|
|
370
373
|
endTime: range.endTime,
|
|
@@ -372,7 +375,7 @@ export class LogViewer3 extends qreact.Component {
|
|
|
372
375
|
forceReadPublic: readPublicLogs.value,
|
|
373
376
|
});
|
|
374
377
|
allPaths.push(...paths);
|
|
375
|
-
}
|
|
378
|
+
}));
|
|
376
379
|
sort(allPaths, x => -x.startTime);
|
|
377
380
|
|
|
378
381
|
Querysub.commitLocal(() => {
|
|
@@ -740,7 +743,9 @@ export class LogViewer3 extends qreact.Component {
|
|
|
740
743
|
</Button>
|
|
741
744
|
<TimeRangeSelector />
|
|
742
745
|
</div>
|
|
743
|
-
{!isPublic() && readPublicLogs.value && <
|
|
746
|
+
{!isPublic() && readPublicLogs.value && <div className={css.fontSize(40).pad2(12, 6).hsl(280, 40, 50).colorhsl(0, 0, 100).boldStyle}>
|
|
747
|
+
Reading public logs
|
|
748
|
+
</div>}
|
|
744
749
|
|
|
745
750
|
<div className={css.hbox(10).fillWidth}>
|
|
746
751
|
<InputLabelURL
|
|
@@ -156,12 +156,12 @@ export class TimeFileTree {
|
|
|
156
156
|
// Find all days in this month
|
|
157
157
|
const days = await this.archives.find(monthFolder + "/", { shallow: true, type: "folders" });
|
|
158
158
|
|
|
159
|
-
|
|
159
|
+
await Promise.all(days.map(async (dayFolder) => {
|
|
160
160
|
// dayFolder is a full path like "2024/01/15"
|
|
161
161
|
const day = parseInt(dayFolder.split("/").at(-1) || "", 10);
|
|
162
162
|
|
|
163
163
|
if (isNaN(day) || day < 1 || day > 31) {
|
|
164
|
-
|
|
164
|
+
return;
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
// Check if this day is in range
|
|
@@ -169,7 +169,7 @@ export class TimeFileTree {
|
|
|
169
169
|
const dayEndDate = new Date(Date.UTC(year, month - 1, day, 23, 59, 59, 999));
|
|
170
170
|
|
|
171
171
|
if (dayEndDate.getTime() < config.startTime || dayDate.getTime() > config.endTime) {
|
|
172
|
-
|
|
172
|
+
return;
|
|
173
173
|
}
|
|
174
174
|
|
|
175
175
|
// Find all log files in this day
|
|
@@ -187,7 +187,7 @@ export class TimeFileTree {
|
|
|
187
187
|
results.push(decoded);
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
|
-
}
|
|
190
|
+
}));
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
193
|
|