Skip to content

Commit ee89a55

Browse files
committed
status
1 parent e9acaca commit ee89a55

3 files changed

Lines changed: 12 additions & 26 deletions

File tree

TODO.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Tracked here for visibility. PRs and issues welcome.
1212
- [ ] after updating an activity in a provider, pull that activity again to our local so we have it updated
1313
- [ ] dang way too many notifications, we need less
1414
- [ ] i think we need a websocket or something for realtime updates
15+
- [ ] file provider should have an upload button that uploads a new file. dont overwrite existing files! (check filename on clientside and server side)
1516

1617
## Providers & Sync
1718

app/static/calendar.js

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,10 @@ function renderGrid(yearMonth, data) {
118118
// File provider has no per-month pull — only show footer if there is a status to display.
119119
let footerHtml = '';
120120
if (p !== 'file') {
121-
const btnContent = isActive ? '<span class="spinner spinner-sm"></span>' : '⬇';
121+
const btnContent = isActive ? '<span class="spinner spinner-sm"></span>'
122+
: pullStatus && pullStatus.status === 'success' ? '✓'
123+
: pullStatus && pullStatus.status === 'error' ? '✗'
124+
: '⬇';
122125
const btnDisabled = isActive ? ' disabled' : '';
123126
const pullBtn = '<button class="provider-pull-btn"' + btnDisabled
124127
+ ' data-month="' + yearMonth + '" data-provider="' + p
@@ -242,56 +245,39 @@ async function pullMonth(btn) {
242245
async function pullProviderMonth(btn) {
243246
const month = btn.dataset.month;
244247
const provider = btn.dataset.provider;
245-
const status = document.getElementById('status-' + month);
246248

247249
btn.disabled = true;
248250
btn.innerHTML = '<span class="spinner spinner-sm"></span>';
249-
status.textContent = '';
250-
status.className = 'pull-status';
251251

252252
let taskId;
253253
try {
254254
const res = await fetch('/api/sync/' + month + '/' + provider, { method: 'POST' });
255255
const data = await res.json();
256256
if (!res.ok) {
257-
status.textContent = data.error || 'Error';
258-
status.className = 'pull-status err';
259257
btn.disabled = false;
260-
btn.textContent = '';
258+
btn.textContent = '';
261259
return;
262260
}
263261
taskId = data.task_id;
264262
} catch (e) {
265-
status.textContent = 'Network error';
266-
status.className = 'pull-status err';
267263
btn.disabled = false;
268-
btn.textContent = '';
264+
btn.textContent = '';
269265
return;
270266
}
271267

272-
status.textContent = provider + ' in progress…';
273-
status.className = 'pull-status running';
274-
275268
pollTaskStatus(taskId, {
276269
onSuccess: () => {
277270
btn.disabled = false;
278-
btn.textContent = '⬇';
279-
status.textContent = provider + ' done ✓';
280-
status.className = 'pull-status ok';
271+
btn.textContent = '✓';
281272
loadCard(month);
282-
setTimeout(() => { status.textContent = ''; status.className = 'pull-status'; }, 30000);
283273
},
284-
onFailure: (data) => {
274+
onFailure: () => {
285275
btn.disabled = false;
286-
btn.textContent = '⬇';
287-
status.textContent = provider + ': ' + (data.info || 'Failed');
288-
status.className = 'pull-status err';
276+
btn.textContent = '✗';
289277
},
290278
onTimeout: () => {
291279
btn.disabled = false;
292-
btn.textContent = '⬇';
293-
status.textContent = provider + ': timed out – try again';
294-
status.className = 'pull-status err';
280+
btn.textContent = '✗';
295281
},
296282
});
297283
}

app/static/style.css

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -606,8 +606,7 @@ select#timezone:focus {
606606
gap: 4px;
607607
margin: 4px -8px -6px;
608608
padding: 3px 4px 3px 6px;
609-
background: rgba(0,0,0,0.18);
610-
border-radius: 0 0 4px 4px;
609+
border-top: 1px solid rgba(255,255,255,0.25);
611610
min-height: 22px;
612611
}
613612

0 commit comments

Comments
 (0)