Browse Source

Fix: Don't auto-load schedules without agent ID

Fixed annoying alert on initial authentication:
- Only auto-load schedules if agent_id is already saved
- Show friendly message in table instead of alert
- User can enter agent ID then click Refresh

Before: Alert popup 'Please enter an Agent ID first'
After: Helpful message in table

👾 Generated with [Letta Code](https://letta.com)

Co-Authored-By: Letta <noreply@letta.com>
Cameron Pfiffer 3 months ago
parent
commit
54bbb8a25e
1 changed files with 9 additions and 3 deletions
  1. 9 3
      dashboard.html

+ 9 - 3
dashboard.html

@@ -501,8 +501,11 @@
             sessionStorage.setItem('letta_api_key', API_KEY);
             document.getElementById('main-content').classList.remove('hidden');
             showStatus('api-key-status', 'Connected successfully', 'success');
-            loadSchedules();
-            loadResults();
+            
+            // Only auto-load if we have a saved agent ID
+            if (DEFAULT_AGENT_ID) {
+                loadSchedules();
+            }
         }
 
         function clearApiKey() {
@@ -534,7 +537,10 @@
         async function loadSchedules() {
             const agentId = document.getElementById('agent-id').value.trim();
             if (!agentId) {
-                alert('Please enter an Agent ID first');
+                const onetimeBody = document.querySelector('#onetime-table tbody');
+                const recurringBody = document.querySelector('#recurring-table tbody');
+                onetimeBody.innerHTML = '<tr><td colspan="5" class="empty">Enter an Agent ID and click Refresh to view schedules</td></tr>';
+                recurringBody.innerHTML = '<tr><td colspan="7" class="empty">Enter an Agent ID and click Refresh to view schedules</td></tr>';
                 return;
             }