@goodandready/dsh-cron 0.1.22 → 0.1.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/client.js +25 -4
  2. package/package.json +1 -1
package/lib/client.js CHANGED
@@ -239,6 +239,8 @@ const React = window.React || require('react');
239
239
  const [query, setQuery] = React.useState('');
240
240
  const [tasks, setTasks] = React.useState([]);
241
241
  const [recs, setRecs] = React.useState([]);
242
+ const [loading, setLoading] = React.useState(false);
243
+ const [fetchError, setFetchError] = React.useState(null);
242
244
  const [dropdownOpen, setDropdownOpen] = React.useState(false);
243
245
 
244
246
  // Manual / Edit modal state
@@ -300,16 +302,20 @@ const React = window.React || require('react');
300
302
 
301
303
  const fetchTasks = async () => {
302
304
  setLoading(true);
305
+ setFetchError(null);
303
306
  try {
304
307
  const res = await fetch('/dsh-cron/tasks?status=' + encodeURIComponent(tab) + '&query=' + encodeURIComponent(query));
305
308
  const data = await res.json();
306
309
  if (data && data.ok) {
307
310
  setTasks(data.tasks || []);
308
- setRecommendations(data.recommendations || []);
311
+ setRecs(data.recommendations || []);
309
312
  setStats(data.stats || null);
313
+ } else {
314
+ setFetchError(data && data.error ? data.error : 'Не удалось загрузить задачи');
310
315
  }
311
316
  } catch (err) {
312
317
  console.error('[dsh-cron] fetch tasks error:', err);
318
+ setFetchError(err.message || 'Ошибка сети при загрузке задач');
313
319
  } finally {
314
320
  setLoading(false);
315
321
  }
@@ -649,10 +655,25 @@ const React = window.React || require('react');
649
655
  }, t === 'all' ? 'Все' : t === 'active' ? 'Активные' : t === 'paused' ? 'На паузе' : 'Завершенные')
650
656
  )
651
657
  ),
658
+ fetchError ? React.createElement('div', {
659
+ className: 'dsh-cron-status-banner',
660
+ 'data-type': 'error',
661
+ style: { margin: '8px 0', display: 'flex', alignItems: 'center', justifyContent: 'space-between' }
662
+ },
663
+ React.createElement('span', null, 'Ошибка загрузки задач: ' + fetchError),
664
+ React.createElement('button', {
665
+ type: 'button',
666
+ className: 'dsh-cron-btn',
667
+ style: { marginLeft: '8px', padding: '2px 8px', fontSize: '12px' },
668
+ onClick: () => fetchTasks()
669
+ }, 'Повторить')
670
+ ) : null,
652
671
  React.createElement('div', { className: 'dsh-cron-task-list' },
653
- tasks.length === 0
654
- ? React.createElement('div', { style: { color: '#777', padding: '16px 0', fontSize: '14px' } }, 'Нет запланированных задач')
655
- : tasks.map((task) =>
672
+ loading && tasks.length === 0
673
+ ? React.createElement('div', { style: { color: '#888', padding: '16px 0', fontSize: '14px' } }, 'Загрузка запланированных задач...')
674
+ : tasks.length === 0
675
+ ? React.createElement('div', { style: { color: '#777', padding: '16px 0', fontSize: '14px' } }, 'Нет запланированных задач')
676
+ : tasks.map((task) =>
656
677
  React.createElement('div', {
657
678
  key: task.id,
658
679
  className: 'dsh-cron-task-item',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@goodandready/dsh-cron",
3
- "version": "0.1.22",
3
+ "version": "0.1.23",
4
4
  "description": "Scheduled cron tasks, background automation and agent execution for DeepSeek Harness.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",