Skip to content
Open
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
1 change: 1 addition & 0 deletions js/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ function initializeApplication() {
initTable();
setupEventListeners();
checkConfigUrlParameter();
updateTextareaContent();
}

/**
Expand Down
20 changes: 18 additions & 2 deletions js/io.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,30 @@ const importJSON = () => {
// Retrieve JSON string from textarea
const jsonContent = document.getElementById('jsonContent').value || '{}';
console.log('Importing JSON:', jsonContent);
// Parse the JSON string to an object
const data = JSON.parse(jsonContent);

// Parse the JSON string to an object with safe parsing
let data;
try {
data = JSON.parse(jsonContent);
} catch (error) {
console.error('JSON parse error:', error);
swal({
title: "Error",
text: "Invalid JSON format",
icon: "error",
button: "OK",
});
return;
}

console.log('Parsed JSON data:', data);
// Store the parsed object into local storage
localStorage.setItem('convivial_profiler_builder', JSON.stringify(data));
console.log('Data stored in local storage:', localStorage.getItem('convivial_profiler_builder'));

// Update the textarea with the stored content
updateTextareaContent();

// Remove the "config" query parameter from the URL
removeConfigUrlParameter();

Expand Down
5 changes: 1 addition & 4 deletions test/js/profilers.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,6 @@
console.log('ConvivialProfiler not initialized, skipping auto-execution');
return;
}

// Everything looks good, execute profilers
console.log('Auto-executing profilers on page load');
executeProfilers();

}, 500); // 500ms delay to ensure iframe communication is complete
});