Skip to content

Commit cce2e8a

Browse files
authored
fix: fixes toggle all when fields have not been set for JSON (#3349)
1 parent 8513824 commit cce2e8a

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

assets/components/LogViewer/LogDetails.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,10 @@ const toggleAllFields = computed({
133133
for (const key of visibleKeys.value.keys()) {
134134
visibleKeys.value.set(key, value);
135135
}
136+
137+
for (const field of fields.value) {
138+
visibleKeys.value.set(field.key, value);
139+
}
136140
},
137141
});
138142

assets/models/LogEntry.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,17 @@ export class ComplexLogEntry extends LogEntry<JSONObject> {
8686
return flattenJSON(message);
8787
} else {
8888
const flatJSON = flattenJSON(message);
89+
const filteredJSON: Record<string, any> = {};
8990
for (const [keys, enabled] of visibleKeys.value.entries()) {
9091
const key = keys.join(".");
9192
if (!enabled) {
9293
delete flatJSON[key];
94+
continue;
9395
}
96+
filteredJSON[key] = flatJSON[key];
97+
delete flatJSON[key];
9498
}
95-
return flatJSON;
99+
return { ...filteredJSON, ...flatJSON };
96100
}
97101
});
98102
} else {

0 commit comments

Comments
 (0)