Skip to content

Commit c952d24

Browse files
committed
feat: Refactor task actions, dashboard, object, and report for improved functionality and clarity
1 parent 0eb1d3c commit c952d24

4 files changed

Lines changed: 16 additions & 20 deletions

File tree

examples/app-todo/src/actions/task.actions.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,8 @@ export const CompleteTaskAction: Action = {
88
type: 'script',
99
execute: 'completeTask',
1010
locations: ['record_header', 'list_item'],
11-
confirmMessage: 'Are you sure you want to mark this task as complete?',
1211
successMessage: 'Task marked as complete!',
1312
refreshAfter: true,
14-
visibleWhen: 'is_completed = false',
1513
};
1614

1715
/** Mark Task as In Progress */
@@ -24,7 +22,6 @@ export const StartTaskAction: Action = {
2422
locations: ['record_header', 'list_item'],
2523
successMessage: 'Task started!',
2624
refreshAfter: true,
27-
visibleWhen: 'status = "not_started"',
2825
};
2926

3027
/** Defer Task */
@@ -93,7 +90,6 @@ export const MassCompleteTasksAction: Action = {
9390
type: 'script',
9491
execute: 'massCompleteTasks',
9592
locations: ['list_toolbar'],
96-
confirmMessage: 'Are you sure you want to complete all selected tasks?',
9793
successMessage: 'Selected tasks marked as complete!',
9894
refreshAfter: true,
9995
};
@@ -106,7 +102,6 @@ export const DeleteCompletedAction: Action = {
106102
type: 'script',
107103
execute: 'deleteCompletedTasks',
108104
locations: ['list_toolbar'],
109-
confirmMessage: 'Are you sure you want to delete all completed tasks? This action cannot be undone.',
110105
successMessage: 'Completed tasks deleted!',
111106
refreshAfter: true,
112107
};

examples/app-todo/src/dashboards/task.dashboard.ts

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ export const TaskDashboard: Dashboard = {
7474
filter: { is_completed: true, completed_date: { $gte: '{last_4_weeks}' } },
7575
categoryField: 'completed_date',
7676
aggregate: 'count',
77-
dateGranularity: 'week',
7877
layout: { x: 0, y: 6, w: 8, h: 4 },
7978
options: { showDataLabels: true }
8079
},
@@ -89,27 +88,21 @@ export const TaskDashboard: Dashboard = {
8988
options: { showLegend: true }
9089
},
9190

92-
// Row 4: Lists
91+
// Row 4: Tables
9392
{
9493
title: 'Overdue Tasks',
95-
type: 'list',
94+
type: 'table',
9695
object: 'task',
9796
filter: { is_overdue: true, is_completed: false },
98-
columns: ['subject', 'due_date', 'priority'],
99-
sortBy: 'due_date',
100-
sortOrder: 'asc',
101-
limit: 10,
97+
aggregate: 'count',
10298
layout: { x: 0, y: 10, w: 6, h: 4 },
10399
},
104100
{
105101
title: 'Due Today',
106-
type: 'list',
102+
type: 'table',
107103
object: 'task',
108104
filter: { due_date: '{today}', is_completed: false },
109-
columns: ['subject', 'priority', 'status'],
110-
sortBy: 'priority',
111-
sortOrder: 'desc',
112-
limit: 10,
105+
aggregate: 'count',
113106
layout: { x: 6, y: 10, w: 6, h: 4 },
114107
},
115108
],

examples/app-todo/src/objects/task.object.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,18 @@ export const Task = ObjectSchema.create({
7171
}),
7272

7373
// Tags
74-
tags: Field.multiSelect(['important', 'quick_win', 'blocked', 'follow_up', 'review'], {
74+
tags: {
75+
type: 'select',
7576
label: 'Tags',
76-
}),
77+
multiple: true,
78+
options: [
79+
{ label: 'Important', value: 'important', color: '#EF4444' },
80+
{ label: 'Quick Win', value: 'quick_win', color: '#10B981' },
81+
{ label: 'Blocked', value: 'blocked', color: '#F59E0B' },
82+
{ label: 'Follow Up', value: 'follow_up', color: '#3B82F6' },
83+
{ label: 'Review', value: 'review', color: '#8B5CF6' },
84+
]
85+
},
7786

7887
// Recurrence
7988
is_recurring: Field.boolean({

examples/app-todo/src/reports/task.report.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ export const OverdueTasksReport: ReportInput = {
6767
{ field: 'category', label: 'Category' },
6868
],
6969
filter: { is_overdue: true, is_completed: false },
70-
sortBy: [{ field: 'due_date', order: 'asc' }],
7170
};
7271

7372
/** Completed Tasks Report */

0 commit comments

Comments
 (0)