1
0
mirror of https://github.com/amir20/dozzle.git synced 2025-12-21 13:23:07 +01:00

fix: unfound fields are shown by default instead of hidden (#3342)

This commit is contained in:
Amir Raminfar
2024-10-26 08:15:29 -07:00
committed by GitHub
parent 6f7c1d8ba6
commit c1d31313b2
2 changed files with 28 additions and 20 deletions

View File

@@ -1,5 +1,5 @@
import { Component, ComputedRef, Ref } from "vue";
import { flattenJSON, getDeep } from "@/utils";
import { flattenJSON } from "@/utils";
import ComplexLogItem from "@/components/LogViewer/ComplexLogItem.vue";
import SimpleLogItem from "@/components/LogViewer/SimpleLogItem.vue";
import ContainerEventLogItem from "@/components/LogViewer/ContainerEventLogItem.vue";
@@ -85,10 +85,14 @@ export class ComplexLogEntry extends LogEntry<JSONObject> {
if (visibleKeys.value.size === 0) {
return flattenJSON(message);
} else {
const keys = Array.from(visibleKeys.value.entries())
.filter(([, value]) => value)
.map(([key]) => key);
return keys.reduce((acc, attr) => ({ ...acc, [attr.join(".")]: getDeep(message, attr) }), {});
const flatJSON = flattenJSON(message);
for (const [keys, enabled] of visibleKeys.value.entries()) {
const key = keys.join(".");
if (!enabled) {
delete flatJSON[key];
}
}
return flatJSON;
}
});
} else {