added logs list start date guard
This commit is contained in:
File diff suppressed because one or more lines are too long
Vendored
+1
-1
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
<!-- prism -->
|
<!-- prism -->
|
||||||
<script src="./libs/prism/prism.js" data-manual></script>
|
<script src="./libs/prism/prism.js" data-manual></script>
|
||||||
<script type="module" crossorigin src="./assets/index-CpG9NuT1.js"></script>
|
<script type="module" crossorigin src="./assets/index-Bf0sznwH.js"></script>
|
||||||
<link rel="modulepreload" crossorigin href="./assets/pocketbase.es-B_4DUNUU.js">
|
<link rel="modulepreload" crossorigin href="./assets/pocketbase.es-B_4DUNUU.js">
|
||||||
<link rel="stylesheet" crossorigin href="./assets/index-BLsHBFKX.css">
|
<link rel="stylesheet" crossorigin href="./assets/index-BLsHBFKX.css">
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
+12
-1
@@ -19,11 +19,20 @@ export function logsList(logsSettings) {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// used as loose guard to prevent new logs to constantly push the old ones to later pages
|
||||||
|
let loadStartDate;
|
||||||
|
|
||||||
async function load(reset = false) {
|
async function load(reset = false) {
|
||||||
logsSettings.isListLoading = true;
|
logsSettings.isListLoading = true;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const page = reset ? 1 : data.lastPage + 1;
|
let page;
|
||||||
|
if (reset) {
|
||||||
|
page = 1;
|
||||||
|
loadStartDate = new Date().toISOString().replace("T", " ");
|
||||||
|
} else {
|
||||||
|
page = data.lastPage + 1;
|
||||||
|
}
|
||||||
|
|
||||||
const normalizedFilter = (logsSettings.presets || []).concat(
|
const normalizedFilter = (logsSettings.presets || []).concat(
|
||||||
app.utils.normalizeSearchFilter(logsSettings.filter, ["level", "message", "data"]),
|
app.utils.normalizeSearchFilter(logsSettings.filter, ["level", "message", "data"]),
|
||||||
@@ -41,6 +50,8 @@ export function logsList(logsSettings) {
|
|||||||
const max = app.utils.toRFC3339Datetime(maxDate);
|
const max = app.utils.toRFC3339Datetime(maxDate);
|
||||||
|
|
||||||
normalizedFilter.push(`created >= "${min}" && created <= "${max}"`);
|
normalizedFilter.push(`created >= "${min}" && created <= "${max}"`);
|
||||||
|
} else {
|
||||||
|
normalizedFilter.push(`created <= "${loadStartDate}"`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await app.pb.logs.getList(page, perPage, {
|
const result = await app.pb.logs.getList(page, perPage, {
|
||||||
|
|||||||
Reference in New Issue
Block a user