Add YAML output on debug page.
This commit is contained in:
parent
7e2b79c672
commit
91a74fd887
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
{% block style %}
|
||||
<style>
|
||||
.json-display {
|
||||
.data-display {
|
||||
background-color: #f8f9fa;
|
||||
border: 1px solid #dee2e6;
|
||||
border-radius: 0.375rem;
|
||||
|
|
@ -72,13 +72,18 @@
|
|||
<h1>🐛 Trip Debug Information</h1>
|
||||
<p>Raw trip object data for: <strong>{{ trip.title }}</strong></p>
|
||||
<a href="{{ url_for('trip_page', start=start) }}" class="btn btn-primary">← Back to Trip Page</a>
|
||||
<button onclick="copyToClipboard()" class="btn btn-secondary">📋 Copy JSON</button>
|
||||
<button onclick="copyToClipboard('jsonDisplay', event)" class="btn btn-secondary">📋 Copy JSON</button>
|
||||
<button onclick="copyToClipboard('yamlDisplay', event)" class="btn btn-secondary">📋 Copy YAML</button>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<h3>Trip Object (JSON)</h3>
|
||||
<div class="json-display" id="jsonDisplay">{{ trip_json }}</div>
|
||||
<div class="data-display json-display" id="jsonDisplay">{{ trip_json }}</div>
|
||||
</div>
|
||||
<div class="col-12 mt-4">
|
||||
<h3>Trip Object (YAML)</h3>
|
||||
<div class="data-display" id="yamlDisplay">{{ trip_yaml }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -86,11 +91,11 @@
|
|||
|
||||
{% block scripts %}
|
||||
<script>
|
||||
function copyToClipboard() {
|
||||
const jsonText = document.getElementById('jsonDisplay').textContent;
|
||||
navigator.clipboard.writeText(jsonText).then(function() {
|
||||
function copyToClipboard(elementId, evt) {
|
||||
const clipText = document.getElementById(elementId).textContent;
|
||||
navigator.clipboard.writeText(clipText).then(function() {
|
||||
// Show a temporary notification
|
||||
const btn = event.target;
|
||||
const btn = evt.target;
|
||||
const originalText = btn.textContent;
|
||||
btn.textContent = '✅ Copied!';
|
||||
btn.classList.remove('btn-secondary');
|
||||
|
|
|
|||
|
|
@ -760,11 +760,13 @@ def trip_debug_page(start: str) -> str:
|
|||
|
||||
# Convert to JSON for pretty printing
|
||||
trip_json = json.dumps(trip_dict, indent=2, default=str)
|
||||
trip_yaml = yaml.safe_dump(json.loads(trip_json), sort_keys=False)
|
||||
|
||||
return flask.render_template(
|
||||
"trip_debug.html",
|
||||
trip=trip,
|
||||
trip_json=trip_json,
|
||||
trip_yaml=trip_yaml,
|
||||
start=start,
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue