Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/CloudLogging.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// src/CloudLogging.js
import { useState, useEffect } from "react";
import { GoogleOAuthProvider, useGoogleLogin } from "@react-oauth/google";
import ExtraDataSource from "./ExtraDataSource";
import { log } from "./Utils";
import { toast, ToastContainer } from "react-toastify";
import "react-toastify/dist/ReactToastify.css";
Expand Down Expand Up @@ -375,6 +376,8 @@ const CloudLoggingForm = ({ onLogsReceived, onFileUpload }) => {
</div>
)}
<div className="cloud-logging-buttons">
{ExtraDataSource.isAvailable() && ExtraDataSource.renderButton(onLogsReceived)}

<button
type="button"
onClick={handleFetch}
Expand Down
4 changes: 4 additions & 0 deletions src/ExtraDataSource.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// src/ExtraDataSource.js - mock implementation
export default {
isAvailable: () => false,
};
6 changes: 5 additions & 1 deletion src/LogTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,6 @@ function LogTable(props) {
return column.solutionTypes.indexOf(props.logData.solutionType) !== -1;
}
);

// Add dynamic columns
_.map(props.extraColumns, (dotPath) => {
const elems = dotPath.split(".");
Expand All @@ -294,6 +293,11 @@ function LogTable(props) {
accessor: dotPath === ".error" ? "error" : dotPath,
width: columnRegularWidth,
className: "logtable-cell",
Cell: ({ cell }) => {
const value = cell.value;
if (value === undefined || value === null) return null;
return typeof value === "boolean" ? String(value) : value;
},
});
});
const headers = [
Expand Down
18 changes: 16 additions & 2 deletions src/localStorage.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,14 @@ export function parseJsonContent(content) {
if (Array.isArray(obj)) return obj.map(processJsonObject);

return Object.keys(obj).reduce((result, key) => {
const newKey = key.replace(/_/g, "");
let value = obj[key];

if (value === null || value === undefined) {
return result;
}

const newKey = key.replace(/_/g, "");

// Check if this is a value object with only a 'value' property and flatten
if (
value !== null &&
Expand All @@ -157,9 +162,18 @@ export function parseJsonContent(content) {
"value" in value
) {
value = value.value;

if (value === null || value === undefined) {
return result;
}
} else if (typeof value === "object" && value !== null) {
// Recursively process nested objects
value = processJsonObject(value);

// Skip empty objects (those with no properties after processing)
if (typeof value === "object" && !Array.isArray(value) && Object.keys(value).length === 0) {
return result;
}
}

result[newKey] = value;
Expand All @@ -170,7 +184,7 @@ export function parseJsonContent(content) {
try {
const parsed = JSON.parse(content);
const processedData = processJsonObject(parsed);
log("Processed JSON data: removed underscores and flattened value objects");
log("Processed JSON data: removed underscores, flattened value objects, and pruned null/undefined fields");
return sortObjectKeys(processedData);
} catch (error) {
log("Initial JSON parsing failed, attempting to wrap in array");
Expand Down
Loading