feat(ui): Display Tools List JSON in a modal screen instead of direct download
Some checks failed
Deploy to OCIWP / deploy (push) Failing after 17s
Some checks failed
Deploy to OCIWP / deploy (push) Failing after 17s
This commit is contained in:
@@ -227,6 +227,29 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Modal for JSON Export -->
|
||||||
|
<div id="jsonExportModal" class="modal-overlay">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<div>
|
||||||
|
<h3 class="text-lg font-semibold text-white">Tools List JSON</h3>
|
||||||
|
<p class="text-sm text-zinc-400">Complete tools list in JSON format</p>
|
||||||
|
</div>
|
||||||
|
<button onclick="closeJsonExportModal()" class="text-zinc-400 hover:text-white">×</button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<textarea id="jsonExportViewer" class="code-textarea" readonly></textarea>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<div class="flex-grow flex gap-2">
|
||||||
|
<button class="btn-sm" onclick="copyJsonExport()">Copy to Clipboard</button>
|
||||||
|
<button class="btn-sm" onclick="downloadJsonExport()">Download File</button>
|
||||||
|
</div>
|
||||||
|
<button onclick="closeJsonExportModal()" class="btn-sm py-2 px-4">Close</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
let allTools = [];
|
let allTools = [];
|
||||||
let filteredTools = [];
|
let filteredTools = [];
|
||||||
@@ -896,7 +919,6 @@
|
|||||||
alert("No tools loaded.");
|
alert("No tools loaded.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// original tools array without the temp properties added for testing
|
|
||||||
const cleanTools = allTools.map(t => {
|
const cleanTools = allTools.map(t => {
|
||||||
const clean = { ...t };
|
const clean = { ...t };
|
||||||
delete clean._customPayload;
|
delete clean._customPayload;
|
||||||
@@ -908,7 +930,24 @@
|
|||||||
return clean;
|
return clean;
|
||||||
});
|
});
|
||||||
const jsonContent = JSON.stringify({ tools: cleanTools }, null, 2);
|
const jsonContent = JSON.stringify({ tools: cleanTools }, null, 2);
|
||||||
const blob = new Blob([jsonContent], { type: 'application/json' });
|
document.getElementById('jsonExportViewer').value = jsonContent;
|
||||||
|
document.getElementById('jsonExportModal').style.display = 'flex';
|
||||||
|
}
|
||||||
|
|
||||||
|
function closeJsonExportModal() {
|
||||||
|
document.getElementById('jsonExportModal').style.display = 'none';
|
||||||
|
}
|
||||||
|
|
||||||
|
function copyJsonExport() {
|
||||||
|
const viewer = document.getElementById('jsonExportViewer');
|
||||||
|
navigator.clipboard.writeText(viewer.value).then(() => {
|
||||||
|
alert("JSON copied to clipboard!");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function downloadJsonExport() {
|
||||||
|
const viewer = document.getElementById('jsonExportViewer');
|
||||||
|
const blob = new Blob([viewer.value], { type: 'application/json' });
|
||||||
const url = URL.createObjectURL(blob);
|
const url = URL.createObjectURL(blob);
|
||||||
const link = document.createElement("a");
|
const link = document.createElement("a");
|
||||||
link.setAttribute("href", url);
|
link.setAttribute("href", url);
|
||||||
|
|||||||
Reference in New Issue
Block a user