De-hardcode ticket URL and cluster name; improve diagnostic polling UX
app.py: - Context processor injects config.ticket_api.web_url into all templates (falls back to 'http://t.lotusguild.org/ticket/' if not set in config) templates/base.html: - Inject GANDALF_CONFIG JS global with ticket_web_url before app.js loads static/app.js: - Use GANDALF_CONFIG.ticket_web_url instead of hardcoded domain templates/index.html: - Use {{ config.ticket_api.web_url }} Jinja var instead of hardcoded domain monitor.py: - CLUSTER_NAME constant kept as default; NetworkMonitor now reads cluster_name from config monitor.cluster_name, falling back to the constant - All CLUSTER_NAME references inside class methods replaced with self.cluster_name templates/inspector.html: - pollDiagnostic() .catch() now clears interval and shows error message instead of silently ignoring network failures during active polling Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -41,6 +41,11 @@
|
||||
{% block content %}{% endblock %}
|
||||
</main>
|
||||
|
||||
<script>
|
||||
const GANDALF_CONFIG = {
|
||||
ticket_web_url: "{{ config.get('ticket_api', {}).get('web_url', 'http://t.lotusguild.org/ticket/') }}"
|
||||
};
|
||||
</script>
|
||||
<script src="{{ url_for('static', filename='app.js') }}"></script>
|
||||
{% block scripts %}{% endblock %}
|
||||
</body>
|
||||
|
||||
@@ -219,7 +219,7 @@
|
||||
<td>{{ e.consecutive_failures }}</td>
|
||||
<td>
|
||||
{% if e.ticket_id %}
|
||||
<a href="http://t.lotusguild.org/ticket/{{ e.ticket_id }}" target="_blank"
|
||||
<a href="{{ config.ticket_api.web_url }}{{ e.ticket_id }}" target="_blank"
|
||||
class="ticket-link">#{{ e.ticket_id }}</a>
|
||||
{% else %}–{% endif %}
|
||||
</td>
|
||||
|
||||
@@ -451,7 +451,11 @@ function pollDiagnostic(jobId, statusEl, resultsEl) {
|
||||
renderDiagnosticResults(resp.result, resultsEl);
|
||||
}
|
||||
})
|
||||
.catch(() => {});
|
||||
.catch(() => {
|
||||
clearInterval(_diagPollTimer);
|
||||
_diagPollTimer = null;
|
||||
statusEl.textContent = 'Error: lost connection while collecting diagnostics.';
|
||||
});
|
||||
}, 2000);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user