Fix dashboard loading and maximize chart area

- Fixed TA panel loading state - now waits for initial data before loading technical analysis
- Changed initial loading message from 'Loading technical analysis...' to 'Waiting for candle data...'
- Made strategy simulation sidebar collapsed by default to maximize chart area
- Added refresh timestamp to TA panel when manually refreshed
- Improved error messages for when data isn't available in database
This commit is contained in:
DiTus
2026-02-25 22:16:12 +01:00
parent c7ee5135ae
commit 258ac8eef2
3 changed files with 27 additions and 10 deletions

View File

@ -284,12 +284,13 @@ export class TradingDashboard {
});
}
async loadInitialData() {
async loadInitialData() {
await Promise.all([
this.loadData(1000, true),
this.loadStats()
]);
this.hasInitialLoad = true;
this.loadTA();
}
async loadData(limit = 1000, fitToContent = false) {
@ -464,14 +465,27 @@ export class TradingDashboard {
}
}
async loadTA() {
async loadTA() {
if (!this.hasInitialLoad) {
const time = new Date().toLocaleTimeString();
document.getElementById('taContent').innerHTML = `<div class="ta-loading">Loading technical analysis... ${time}</div>`;
return;
}
try {
const response = await fetch(`/api/v1/ta?symbol=BTC&interval=${this.currentInterval}`);
this.taData = await response.json();
const data = await response.json();
if (data.error) {
document.getElementById('taContent').innerHTML = `<div class="ta-error">${data.error}</div>`;
return;
}
this.taData = data;
this.renderTA();
} catch (error) {
console.error('Error loading TA:', error);
document.getElementById('taContent').innerHTML = '<div class="ta-error">Failed to load technical analysis</div>';
document.getElementById('taContent').innerHTML = '<div class="ta-error">Failed to load technical analysis. Please check if the database has candle data.</div>';
}
}
@ -590,6 +604,8 @@ export class TradingDashboard {
export function refreshTA() {
if (window.dashboard) {
const time = new Date().toLocaleTimeString();
document.getElementById('taContent').innerHTML = `<div class="ta-loading">Refreshing... ${time}</div>`;
window.dashboard.loadTA();
}
}