This commit is contained in:
parent
779500d22e
commit
42a78c529d
5 changed files with 74 additions and 5 deletions
|
|
@ -159,6 +159,16 @@ async function fetchTasks() {
|
|||
const response = await fetchWithAuth(`${API_URL}/tasks`);
|
||||
const newTasks = await response.json();
|
||||
|
||||
// Check for deep link in URL
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
const urlTaskId = params.get('taskId');
|
||||
const urlRunId = params.get('runId');
|
||||
|
||||
if (urlTaskId && !state.selectedTaskId) {
|
||||
state.selectedTaskId = urlTaskId;
|
||||
state.selectedRunId = urlRunId;
|
||||
}
|
||||
|
||||
// Check if we should follow the latest run
|
||||
let newSelectedRunId = state.selectedRunId;
|
||||
if (state.selectedTaskId) {
|
||||
|
|
@ -179,6 +189,12 @@ async function fetchTasks() {
|
|||
tasks: newTasks,
|
||||
selectedRunId: newSelectedRunId
|
||||
});
|
||||
|
||||
// If we just loaded from a deep link, clear the params and select it
|
||||
if (urlTaskId) {
|
||||
window.history.replaceState({}, document.title, "/");
|
||||
selectTask(urlTaskId, urlRunId);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error fetching tasks:', error);
|
||||
}
|
||||
|
|
@ -806,6 +822,16 @@ async function initializeApp() {
|
|||
if (hasSession) {
|
||||
appEl.classList.remove('hidden');
|
||||
loginOverlay.classList.add('hidden');
|
||||
|
||||
// Handle deep links from notifications
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
const taskId = params.get('taskId');
|
||||
const runId = params.get('runId');
|
||||
if (taskId) {
|
||||
state.selectedTaskId = taskId;
|
||||
state.selectedRunId = runId;
|
||||
}
|
||||
|
||||
await fetchTasks();
|
||||
connectWebSocket();
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue