django-cfg 1.4.107__py3-none-any.whl → 1.4.108__py3-none-any.whl

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.

Potentially problematic release.


This version of django-cfg might be problematic. Click here for more details.

Files changed (130) hide show
  1. django_cfg/__init__.py +1 -1
  2. django_cfg/apps/accounts/views/profile.py +19 -9
  3. django_cfg/apps/centrifugo/views/admin_api.py +4 -7
  4. django_cfg/apps/centrifugo/views/monitoring.py +3 -6
  5. django_cfg/apps/centrifugo/views/testing_api.py +3 -6
  6. django_cfg/apps/dashboard/services/system_health_service.py +16 -11
  7. django_cfg/apps/dashboard/views/activity_views.py +3 -5
  8. django_cfg/apps/dashboard/views/apizones_views.py +4 -5
  9. django_cfg/apps/dashboard/views/charts_views.py +4 -5
  10. django_cfg/apps/dashboard/views/overview_views.py +4 -5
  11. django_cfg/apps/dashboard/views/statistics_views.py +4 -5
  12. django_cfg/apps/dashboard/views/system_views.py +4 -5
  13. django_cfg/apps/knowbase/__init__.py +2 -2
  14. django_cfg/apps/knowbase/apps.py +2 -8
  15. django_cfg/apps/knowbase/views/base.py +9 -4
  16. django_cfg/apps/support/views/api.py +16 -7
  17. django_cfg/apps/tasks/__init__.py +61 -2
  18. django_cfg/apps/tasks/admin/__init__.py +3 -10
  19. django_cfg/apps/tasks/admin/config.py +98 -0
  20. django_cfg/apps/tasks/admin/task_log.py +265 -0
  21. django_cfg/apps/tasks/apps.py +7 -9
  22. django_cfg/apps/tasks/filters/__init__.py +10 -0
  23. django_cfg/apps/tasks/filters/task_log.py +121 -0
  24. django_cfg/apps/tasks/migrations/0001_initial.py +196 -0
  25. django_cfg/apps/tasks/models/__init__.py +4 -0
  26. django_cfg/apps/tasks/models/task_log.py +246 -0
  27. django_cfg/apps/tasks/serializers/__init__.py +28 -0
  28. django_cfg/apps/tasks/serializers/task_log.py +249 -0
  29. django_cfg/apps/tasks/services/__init__.py +10 -0
  30. django_cfg/apps/tasks/services/client/__init__.py +7 -0
  31. django_cfg/apps/tasks/services/client/client.py +234 -0
  32. django_cfg/apps/tasks/services/config_helper.py +63 -0
  33. django_cfg/apps/tasks/services/sync.py +204 -0
  34. django_cfg/apps/tasks/urls.py +7 -13
  35. django_cfg/apps/tasks/views/__init__.py +4 -10
  36. django_cfg/apps/tasks/views/task_log.py +41 -0
  37. django_cfg/apps/tasks/views/task_log_base.py +41 -0
  38. django_cfg/apps/tasks/views/task_log_overview.py +100 -0
  39. django_cfg/apps/tasks/views/task_log_related.py +41 -0
  40. django_cfg/apps/tasks/views/task_log_stats.py +91 -0
  41. django_cfg/apps/tasks/views/task_log_timeline.py +81 -0
  42. django_cfg/apps/urls.py +0 -1
  43. django_cfg/cli/commands/info.py +1 -1
  44. django_cfg/cli/utils.py +1 -1
  45. django_cfg/core/base/config_model.py +1 -1
  46. django_cfg/core/builders/apps_builder.py +1 -1
  47. django_cfg/core/generation/integration_generators/__init__.py +1 -1
  48. django_cfg/core/generation/integration_generators/tasks.py +14 -18
  49. django_cfg/core/generation/security_generators/crypto_fields.py +2 -1
  50. django_cfg/core/integration/display/startup.py +1 -1
  51. django_cfg/mixins/__init__.py +12 -0
  52. django_cfg/mixins/admin_api.py +37 -0
  53. django_cfg/mixins/client_api.py +39 -0
  54. django_cfg/models/django/constance.py +2 -8
  55. django_cfg/models/django/crypto_fields.py +13 -48
  56. django_cfg/models/tasks/__init__.py +8 -10
  57. django_cfg/models/tasks/backends.py +76 -207
  58. django_cfg/models/tasks/config.py +20 -127
  59. django_cfg/models/tasks/utils.py +17 -29
  60. django_cfg/modules/django_client/management/commands/generate_client.py +13 -1
  61. django_cfg/modules/django_unfold/navigation.py +121 -22
  62. django_cfg/pyproject.toml +2 -2
  63. django_cfg/registry/core.py +1 -1
  64. django_cfg/static/frontend/admin.zip +0 -0
  65. {django_cfg-1.4.107.dist-info → django_cfg-1.4.108.dist-info}/METADATA +3 -3
  66. {django_cfg-1.4.107.dist-info → django_cfg-1.4.108.dist-info}/RECORD +70 -107
  67. django_cfg/apps/tasks/admin/actions.py +0 -29
  68. django_cfg/apps/tasks/admin/tasks_admin.py +0 -154
  69. django_cfg/apps/tasks/api/serializers.py +0 -82
  70. django_cfg/apps/tasks/api/views.py +0 -571
  71. django_cfg/apps/tasks/serializers.py +0 -82
  72. django_cfg/apps/tasks/static/tasks/css/dashboard-alpine.css +0 -299
  73. django_cfg/apps/tasks/static/tasks/css/dashboard.css +0 -120
  74. django_cfg/apps/tasks/static/tasks/js/alpine/README.md +0 -47
  75. django_cfg/apps/tasks/static/tasks/js/alpine/actions/index.js +0 -8
  76. django_cfg/apps/tasks/static/tasks/js/alpine/actions/management.js +0 -123
  77. django_cfg/apps/tasks/static/tasks/js/alpine/actions/pagination.js +0 -21
  78. django_cfg/apps/tasks/static/tasks/js/alpine/actions/tasks.js +0 -101
  79. django_cfg/apps/tasks/static/tasks/js/alpine/actions/workers.js +0 -59
  80. django_cfg/apps/tasks/static/tasks/js/alpine/computed.js +0 -35
  81. django_cfg/apps/tasks/static/tasks/js/alpine/index.js +0 -148
  82. django_cfg/apps/tasks/static/tasks/js/alpine/loaders/index.js +0 -36
  83. django_cfg/apps/tasks/static/tasks/js/alpine/loaders/overview.js +0 -37
  84. django_cfg/apps/tasks/static/tasks/js/alpine/loaders/queues.js +0 -27
  85. django_cfg/apps/tasks/static/tasks/js/alpine/loaders/tasks.js +0 -32
  86. django_cfg/apps/tasks/static/tasks/js/alpine/loaders/workers.js +0 -21
  87. django_cfg/apps/tasks/static/tasks/js/alpine/state.js +0 -36
  88. django_cfg/apps/tasks/static/tasks/js/alpine/utils/formatters.js +0 -42
  89. django_cfg/apps/tasks/static/tasks/js/alpine/utils/helpers.js +0 -68
  90. django_cfg/apps/tasks/static/tasks/js/dashboard-alpine.js +0 -725
  91. django_cfg/apps/tasks/tasks/__init__.py +0 -10
  92. django_cfg/apps/tasks/tasks/demo_tasks.py +0 -127
  93. django_cfg/apps/tasks/templates/tasks/components/management_actions.html +0 -71
  94. django_cfg/apps/tasks/templates/tasks/components/overview_content.html +0 -94
  95. django_cfg/apps/tasks/templates/tasks/components/queues_content.html +0 -44
  96. django_cfg/apps/tasks/templates/tasks/components/tab_navigation.html +0 -45
  97. django_cfg/apps/tasks/templates/tasks/components/task_details_modal.html +0 -151
  98. django_cfg/apps/tasks/templates/tasks/components/tasks_content.html +0 -61
  99. django_cfg/apps/tasks/templates/tasks/components/tasks_mjs_integration.html +0 -269
  100. django_cfg/apps/tasks/templates/tasks/components/workers_content.html +0 -60
  101. django_cfg/apps/tasks/templates/tasks/layout/base.html +0 -20
  102. django_cfg/apps/tasks/templates/tasks/pages/dashboard-improved.html +0 -168
  103. django_cfg/apps/tasks/templates/tasks/pages/dashboard.html +0 -77
  104. django_cfg/apps/tasks/templates/tasks/partials/task_row_template.html +0 -40
  105. django_cfg/apps/tasks/templates/tasks/widgets/task_filters.html +0 -40
  106. django_cfg/apps/tasks/templates/tasks/widgets/task_footer.html +0 -86
  107. django_cfg/apps/tasks/templates/tasks/widgets/task_table.html +0 -90
  108. django_cfg/apps/tasks/urls_admin.py +0 -15
  109. django_cfg/apps/tasks/utils/__init__.py +0 -1
  110. django_cfg/apps/tasks/utils/simulator.py +0 -353
  111. django_cfg/apps/tasks/views/api.py +0 -571
  112. django_cfg/apps/tasks/views/dashboard.py +0 -89
  113. django_cfg/management/commands/rundramatiq.py +0 -24
  114. django_cfg/management/commands/rundramatiq_simulator.py +0 -22
  115. django_cfg/management/commands/task_clear.py +0 -25
  116. django_cfg/management/commands/task_status.py +0 -24
  117. django_cfg/modules/django_tasks/__init__.py +0 -29
  118. django_cfg/modules/django_tasks/dramatiq_setup.py +0 -20
  119. django_cfg/modules/django_tasks/factory.py +0 -127
  120. django_cfg/modules/django_tasks/management/commands/__init__.py +0 -0
  121. django_cfg/modules/django_tasks/management/commands/rundramatiq.py +0 -253
  122. django_cfg/modules/django_tasks/management/commands/rundramatiq_simulator.py +0 -436
  123. django_cfg/modules/django_tasks/management/commands/task_clear.py +0 -226
  124. django_cfg/modules/django_tasks/management/commands/task_status.py +0 -257
  125. django_cfg/modules/django_tasks/service.py +0 -281
  126. django_cfg/modules/django_tasks/settings.py +0 -107
  127. /django_cfg/{modules/django_tasks/management → apps/tasks/migrations}/__init__.py +0 -0
  128. {django_cfg-1.4.107.dist-info → django_cfg-1.4.108.dist-info}/WHEEL +0 -0
  129. {django_cfg-1.4.107.dist-info → django_cfg-1.4.108.dist-info}/entry_points.txt +0 -0
  130. {django_cfg-1.4.107.dist-info → django_cfg-1.4.108.dist-info}/licenses/LICENSE +0 -0
@@ -1,101 +0,0 @@
1
- /**
2
- * Task Management Actions
3
- */
4
-
5
- export async function viewTaskDetails(task) {
6
- console.log('View task details:', task);
7
- this.selectedTask = task;
8
- this.showTaskModal = true;
9
- }
10
-
11
- export function closeTaskModal() {
12
- this.showTaskModal = false;
13
- // Clear selected task after transition
14
- setTimeout(() => {
15
- this.selectedTask = null;
16
- }, 300);
17
- }
18
-
19
- export async function retryTask(task) {
20
- // TODO: Implement retry task endpoint in backend API
21
- this.showActionMessage('Retry task feature is not yet implemented', 'error');
22
-
23
- if (window.showNotification) {
24
- window.showNotification('Retry task feature is not yet implemented', 'error');
25
- }
26
-
27
- console.warn('⚠️ Retry task endpoint not implemented in API');
28
- }
29
-
30
- export async function deleteTask(task) {
31
- // TODO: Implement delete task endpoint in backend API
32
- this.showActionMessage('Delete task feature is not yet implemented', 'error');
33
-
34
- if (window.showNotification) {
35
- window.showNotification('Delete task feature is not yet implemented', 'error');
36
- }
37
-
38
- console.warn('⚠️ Delete task endpoint not implemented in API');
39
- }
40
-
41
- export async function clearCompletedTasks() {
42
- // TODO: Implement clear completed tasks endpoint in backend API
43
- this.showActionMessage('Clear completed tasks feature is not yet implemented', 'error');
44
-
45
- if (window.showNotification) {
46
- window.showNotification('Clear completed tasks feature is not yet implemented', 'error');
47
- }
48
-
49
- console.warn('⚠️ Clear completed tasks endpoint not implemented in API');
50
- }
51
-
52
- export async function exportTasksCSV() {
53
- try {
54
- this.showActionMessage('Exporting tasks to CSV...', 'info');
55
-
56
- // Simple CSV export implementation
57
- const headers = ['ID', 'Name', 'Status', 'Queue', 'Duration', 'Created', 'Updated'];
58
- const rows = this.tasks.map(task => [
59
- task.task_id || task.id,
60
- task.name,
61
- task.status,
62
- task.queue || 'default',
63
- task.duration || '',
64
- task.created_at || '',
65
- task.updated_at || ''
66
- ]);
67
-
68
- const csvContent = [
69
- headers.join(','),
70
- ...rows.map(row => row.map(cell => `"${cell}"`).join(','))
71
- ].join('\n');
72
-
73
- // Create blob and download
74
- const blob = new Blob([csvContent], { type: 'text/csv;charset=utf-8;' });
75
- const link = document.createElement('a');
76
- const url = URL.createObjectURL(blob);
77
-
78
- link.setAttribute('href', url);
79
- link.setAttribute('download', `tasks_export_${new Date().toISOString().split('T')[0]}.csv`);
80
- link.style.visibility = 'hidden';
81
-
82
- document.body.appendChild(link);
83
- link.click();
84
- document.body.removeChild(link);
85
-
86
- this.showActionMessage('Tasks exported successfully', 'success');
87
-
88
- if (window.showNotification) {
89
- window.showNotification('Tasks exported to CSV', 'success');
90
- }
91
-
92
- console.log('✅ Tasks exported to CSV');
93
- } catch (error) {
94
- console.error('❌ Failed to export tasks:', error);
95
- this.showActionMessage('Failed to export tasks: ' + error.message, 'error');
96
-
97
- if (window.showNotification) {
98
- window.showNotification('Failed to export tasks: ' + error.message, 'error');
99
- }
100
- }
101
- }
@@ -1,59 +0,0 @@
1
- /**
2
- * Worker Management Actions
3
- */
4
-
5
- export async function startWorkers() {
6
- try {
7
- this.loading = true;
8
- this.showActionMessage('Starting workers...', 'info');
9
- await window.tasksAPI.tasksApiWorkersManageCreate({ action: 'start' });
10
- await this.loadWorkers();
11
-
12
- this.showActionMessage('Workers started successfully', 'success');
13
-
14
- if (window.showNotification) {
15
- window.showNotification('Workers started successfully', 'success');
16
- }
17
-
18
- console.log('✅ Workers started');
19
- } catch (error) {
20
- console.error('❌ Failed to start workers:', error);
21
- this.showActionMessage('Failed to start workers: ' + error.message, 'error');
22
-
23
- if (window.showNotification) {
24
- window.showNotification('Failed to start workers: ' + error.message, 'error');
25
- }
26
- } finally {
27
- this.loading = false;
28
- }
29
- }
30
-
31
- export async function stopWorkers() {
32
- if (!confirm('Are you sure you want to stop all workers?')) {
33
- return;
34
- }
35
-
36
- try {
37
- this.loading = true;
38
- this.showActionMessage('Stopping workers...', 'info');
39
- await window.tasksAPI.tasksApiWorkersManageCreate({ action: 'stop' });
40
- await this.loadWorkers();
41
-
42
- this.showActionMessage('Workers stopped successfully', 'success');
43
-
44
- if (window.showNotification) {
45
- window.showNotification('Workers stopped successfully', 'success');
46
- }
47
-
48
- console.log('✅ Workers stopped');
49
- } catch (error) {
50
- console.error('❌ Failed to stop workers:', error);
51
- this.showActionMessage('Failed to stop workers: ' + error.message, 'error');
52
-
53
- if (window.showNotification) {
54
- window.showNotification('Failed to stop workers: ' + error.message, 'error');
55
- }
56
- } finally {
57
- this.loading = false;
58
- }
59
- }
@@ -1,35 +0,0 @@
1
- /**
2
- * Computed Properties (as regular functions, not getters)
3
- * Alpine.js will reactively call these when dependencies change
4
- */
5
-
6
- export function filteredTasks() {
7
- let filtered = this.tasks;
8
-
9
- // Apply status filter
10
- if (this.filters.status) {
11
- filtered = filtered.filter(task => task.status === this.filters.status);
12
- }
13
-
14
- // Apply queue filter
15
- if (this.filters.queue) {
16
- filtered = filtered.filter(task =>
17
- (task.queue || task.queue_name) === this.filters.queue
18
- );
19
- }
20
-
21
- // Apply search filter
22
- if (this.filters.search) {
23
- const search = this.filters.search.toLowerCase();
24
- filtered = filtered.filter(task =>
25
- task.name?.toLowerCase().includes(search) ||
26
- task.actor_name?.toLowerCase().includes(search) ||
27
- task.task_id?.toLowerCase().includes(search) ||
28
- task.message_id?.toLowerCase().includes(search) ||
29
- task.queue?.toLowerCase().includes(search) ||
30
- task.queue_name?.toLowerCase().includes(search)
31
- );
32
- }
33
-
34
- return filtered;
35
- }
@@ -1,148 +0,0 @@
1
- /**
2
- * Tasks Dashboard Alpine.js - Modular Version
3
- *
4
- * Entry point for modular Alpine.js dashboard component
5
- */
6
-
7
- import initialState from './state.js';
8
- import { filteredTasks } from './computed.js';
9
-
10
- // Loaders
11
- import {
12
- loadDashboardData,
13
- loadOverview,
14
- loadQueues,
15
- loadWorkers,
16
- loadTasks
17
- } from './loaders/index.js';
18
-
19
- // Actions
20
- import {
21
- clearAllTasks,
22
- clearAllQueues,
23
- purgeFailedTasks,
24
- simulateTasks
25
- } from './actions/management.js';
26
-
27
- import {
28
- startWorkers,
29
- stopWorkers
30
- } from './actions/workers.js';
31
-
32
- import {
33
- viewTaskDetails,
34
- closeTaskModal,
35
- retryTask,
36
- deleteTask,
37
- clearCompletedTasks,
38
- exportTasksCSV
39
- } from './actions/tasks.js';
40
-
41
- import {
42
- nextPage,
43
- previousPage,
44
- goToPage
45
- } from './actions/pagination.js';
46
-
47
- // Utils
48
- import {
49
- formatDuration,
50
- formatDate,
51
- getStatusColor
52
- } from './utils/formatters.js';
53
-
54
- import {
55
- updateLastUpdateTime,
56
- showActionMessage,
57
- applyFilters,
58
- toggleAutoRefresh,
59
- startAutoRefresh,
60
- stopAutoRefresh,
61
- onTabChange
62
- } from './utils/helpers.js';
63
-
64
- // Register component factory globally BEFORE Alpine loads
65
- window.tasksDashboardComponent = () => ({
66
- // State
67
- ...initialState,
68
-
69
- // Computed properties (as method)
70
- filteredTasks,
71
-
72
- // Lifecycle
73
- init() {
74
- console.log('🎯 Dashboard component initialized');
75
-
76
- // Initialize dashboard data
77
- this.loadDashboardData();
78
-
79
- // Start auto-refresh if enabled
80
- if (this.autoRefresh) {
81
- this.startAutoRefresh();
82
- }
83
-
84
- // Watch for tab changes
85
- this.$watch('activeTab', (value) => {
86
- console.log('Tab changed to:', value);
87
- this.onTabChange(value);
88
- });
89
- },
90
-
91
- // Data loading methods
92
- loadDashboardData,
93
- loadOverview,
94
- loadQueues,
95
- loadWorkers,
96
- loadTasks,
97
-
98
- // Management actions
99
- clearAllTasks,
100
- clearAllQueues,
101
- purgeFailedTasks,
102
- simulateTasks,
103
-
104
- // Worker actions
105
- startWorkers,
106
- stopWorkers,
107
-
108
- // Task actions
109
- viewTaskDetails,
110
- closeTaskModal,
111
- retryTask,
112
- deleteTask,
113
- clearCompletedTasks,
114
- exportTasksCSV,
115
-
116
- // Pagination
117
- nextPage,
118
- previousPage,
119
- goToPage,
120
-
121
- // Formatters
122
- formatDuration,
123
- formatDate,
124
- getStatusColor,
125
-
126
- // Helpers
127
- updateLastUpdateTime,
128
- showActionMessage,
129
- applyFilters,
130
- toggleAutoRefresh,
131
- startAutoRefresh,
132
- stopAutoRefresh,
133
- onTabChange
134
- });
135
-
136
- // Register with Alpine when it initializes
137
- document.addEventListener('alpine:init', () => {
138
- console.log('🚀 Registering tasksDashboard component with Alpine...');
139
- window.Alpine.data('tasksDashboard', window.tasksDashboardComponent);
140
- console.log('✅ Dashboard Alpine.js extensions loaded (modular)');
141
- });
142
-
143
- // Export for potential external use
144
- export default {
145
- initialState,
146
- filteredTasks,
147
- // Add other exports if needed
148
- };
@@ -1,36 +0,0 @@
1
- /**
2
- * Data Loaders - Load data from API endpoints
3
- */
4
-
5
- export { loadOverview } from './overview.js';
6
- export { loadQueues } from './queues.js';
7
- export { loadWorkers } from './workers.js';
8
- export { loadTasks } from './tasks.js';
9
-
10
- /**
11
- * Load all dashboard data in parallel
12
- */
13
- export async function loadDashboardData() {
14
- console.log('📊 Loading dashboard data...');
15
- this.loading = true;
16
-
17
- try {
18
- // Load all data in parallel
19
- await Promise.all([
20
- this.loadOverview(),
21
- this.loadQueues(),
22
- this.loadWorkers(),
23
- this.loadTasks()
24
- ]);
25
-
26
- this.updateLastUpdateTime();
27
- console.log('✅ Dashboard data loaded successfully');
28
- } catch (error) {
29
- console.error('❌ Failed to load dashboard data:', error);
30
- if (window.showNotification) {
31
- window.showNotification('Failed to load dashboard data', 'error');
32
- }
33
- } finally {
34
- this.loading = false;
35
- }
36
- }
@@ -1,37 +0,0 @@
1
- /**
2
- * Load Overview Statistics
3
- */
4
- export async function loadOverview() {
5
- if (!window.tasksAPI) return;
6
-
7
- try {
8
- const response = await window.tasksAPI.tasksApiTasksStatsRetrieve();
9
- const data = response?.data || response || {};
10
-
11
- // Flatten statistics into stats for easier access in template
12
- if (data.statistics) {
13
- this.stats = {
14
- ...data,
15
- ...data.statistics,
16
- // Map API fields to template fields
17
- total_tasks: data.statistics.total || 0,
18
- completed_tasks: data.statistics.completed || 0,
19
- running_tasks: data.statistics.running || 0,
20
- failed_tasks: data.statistics.failed || 0,
21
- pending_tasks: data.statistics.pending || 0,
22
- success_rate: (data.statistics.success_rate || 0) / 100 // Convert from % to decimal
23
- };
24
- } else {
25
- this.stats = data;
26
- }
27
-
28
- // Update counts
29
- this.counts.queues = this.stats.active_queues || 0;
30
- // Note: workers count is updated in loadWorkers()
31
- this.counts.tasks = this.stats.total_tasks || 0;
32
-
33
- console.log('📈 Overview stats loaded:', this.stats);
34
- } catch (error) {
35
- console.error('Failed to load overview:', error);
36
- }
37
- }
@@ -1,27 +0,0 @@
1
- /**
2
- * Load Queues Status
3
- */
4
- export async function loadQueues() {
5
- if (!window.tasksAPI) return;
6
-
7
- try {
8
- const response = await window.tasksAPI.tasksApiQueuesStatusRetrieve();
9
- const queuesData = response?.data?.queues || response?.queues;
10
-
11
- // Convert queues object to array if needed
12
- if (queuesData && typeof queuesData === 'object' && !Array.isArray(queuesData)) {
13
- this.queues = Object.entries(queuesData).map(([name, data]) => ({
14
- name,
15
- ...data
16
- }));
17
- } else {
18
- this.queues = queuesData || [];
19
- }
20
-
21
- this.counts.queues = this.queues.length;
22
-
23
- console.log('📋 Queues loaded:', this.queues.length);
24
- } catch (error) {
25
- console.error('Failed to load queues:', error);
26
- }
27
- }
@@ -1,32 +0,0 @@
1
- /**
2
- * Load Tasks List with Pagination
3
- */
4
- export async function loadTasks(page = 1) {
5
- if (!window.tasksAPI) return;
6
-
7
- try {
8
- // TODO: Pass page parameter to API when backend supports it
9
- const response = await window.tasksAPI.tasksApiTasksListRetrieve();
10
- const data = response?.data || response || {};
11
-
12
- this.tasks = data.tasks || [];
13
-
14
- // Update pagination info
15
- if (data.pagination) {
16
- this.pagination = {
17
- page: data.pagination.page || 1,
18
- page_size: data.pagination.page_size || 20,
19
- total_pages: data.pagination.total_pages || 1,
20
- total_count: data.pagination.total_count || this.tasks.length,
21
- has_next: data.pagination.has_next || false,
22
- has_previous: data.pagination.has_previous || false
23
- };
24
- }
25
-
26
- this.counts.tasks = this.pagination.total_count;
27
-
28
- console.log('📝 Tasks loaded:', this.tasks.length, 'Total:', this.pagination.total_count);
29
- } catch (error) {
30
- console.error('Failed to load tasks:', error);
31
- }
32
- }
@@ -1,21 +0,0 @@
1
- /**
2
- * Load Workers List
3
- */
4
- export async function loadWorkers() {
5
- if (!window.tasksAPI) return;
6
-
7
- try {
8
- const response = await window.tasksAPI.tasksApiWorkersListRetrieve();
9
- const data = response?.data || response || {};
10
-
11
- this.workers = data.workers || [];
12
- this.counts.workers = data.active_count || this.workers.length;
13
-
14
- // Update stats.workers for overview display
15
- this.stats.workers = this.counts.workers;
16
-
17
- console.log('👷 Workers loaded:', this.workers.length, 'Active:', this.counts.workers);
18
- } catch (error) {
19
- console.error('Failed to load workers:', error);
20
- }
21
- }
@@ -1,36 +0,0 @@
1
- /**
2
- * Dashboard Initial State
3
- */
4
- export default {
5
- activeTab: 'overview',
6
- loading: false,
7
- autoRefresh: true,
8
- autoRefreshInterval: null,
9
- lastUpdateTime: '--:--:--',
10
- tasks: [],
11
- queues: [],
12
- workers: [],
13
- stats: {},
14
- filters: {
15
- status: '',
16
- queue: '',
17
- search: ''
18
- },
19
- counts: {
20
- queues: 0,
21
- workers: 0,
22
- tasks: 0
23
- },
24
- actionMessage: '',
25
- actionType: 'info',
26
- showTaskModal: false,
27
- selectedTask: null,
28
- pagination: {
29
- page: 1,
30
- page_size: 20,
31
- total_pages: 1,
32
- total_count: 0,
33
- has_next: false,
34
- has_previous: false
35
- }
36
- };
@@ -1,42 +0,0 @@
1
- /**
2
- * Formatting Utilities
3
- */
4
-
5
- export function formatDuration(ms) {
6
- if (!ms) return '-';
7
-
8
- if (ms < 1000) {
9
- return `${ms}ms`;
10
- } else if (ms < 60000) {
11
- return `${(ms / 1000).toFixed(1)}s`;
12
- } else {
13
- return `${(ms / 60000).toFixed(1)}m`;
14
- }
15
- }
16
-
17
- export function formatDate(dateString) {
18
- if (!dateString) return '-';
19
-
20
- try {
21
- const date = new Date(dateString);
22
- return date.toLocaleString('en-US', {
23
- month: 'short',
24
- day: 'numeric',
25
- hour: '2-digit',
26
- minute: '2-digit',
27
- second: '2-digit'
28
- });
29
- } catch (error) {
30
- return dateString;
31
- }
32
- }
33
-
34
- export function getStatusColor(status) {
35
- const colors = {
36
- 'pending': 'yellow',
37
- 'running': 'blue',
38
- 'completed': 'green',
39
- 'failed': 'red'
40
- };
41
- return colors[status] || 'gray';
42
- }
@@ -1,68 +0,0 @@
1
- /**
2
- * Helper Utilities
3
- */
4
-
5
- export function updateLastUpdateTime() {
6
- const now = new Date();
7
- this.lastUpdateTime = now.toLocaleTimeString('en-US', { hour12: false });
8
- }
9
-
10
- export function showActionMessage(message, type = 'info') {
11
- this.actionMessage = message;
12
- this.actionType = type;
13
-
14
- // Auto-hide after 5 seconds
15
- setTimeout(() => {
16
- this.actionMessage = '';
17
- }, 5000);
18
- }
19
-
20
- export function applyFilters() {
21
- console.log('🔍 Applying filters:', this.filters);
22
- // The filteredTasks computed property will automatically update
23
- }
24
-
25
- export function toggleAutoRefresh() {
26
- this.autoRefresh = !this.autoRefresh;
27
-
28
- if (this.autoRefresh) {
29
- this.startAutoRefresh();
30
- } else {
31
- this.stopAutoRefresh();
32
- }
33
- }
34
-
35
- export function startAutoRefresh() {
36
- if (this.autoRefreshInterval) {
37
- clearInterval(this.autoRefreshInterval);
38
- }
39
-
40
- // Refresh every 30 seconds
41
- this.autoRefreshInterval = setInterval(() => {
42
- if (!this.loading) {
43
- this.loadDashboardData();
44
- }
45
- }, 30000);
46
-
47
- console.log('✅ Auto-refresh started (30s interval)');
48
- }
49
-
50
- export function stopAutoRefresh() {
51
- if (this.autoRefreshInterval) {
52
- clearInterval(this.autoRefreshInterval);
53
- this.autoRefreshInterval = null;
54
- }
55
- console.log('⏸️ Auto-refresh stopped');
56
- }
57
-
58
- export function onTabChange(tabName) {
59
- console.log(`Switched to ${tabName} tab`);
60
- // Refresh data for the active tab if needed
61
- if (tabName === 'tasks') {
62
- this.loadTasks();
63
- } else if (tabName === 'workers') {
64
- this.loadWorkers();
65
- } else if (tabName === 'queues') {
66
- this.loadQueues();
67
- }
68
- }