-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathobjectstack.config.ts
More file actions
276 lines (273 loc) · 10.3 KB
/
objectstack.config.ts
File metadata and controls
276 lines (273 loc) · 10.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
import { defineStack } from '@objectstack/spec';
import { App } from '@objectstack/spec/ui';
import { TodoTask } from './src/domains/todo/task.object';
import { TodoTaskActions } from './src/domains/todo/task.actions';
// Helper to create dates relative to today
const daysFromNow = (days: number) => {
const d = new Date();
d.setDate(d.getDate() + days);
return d;
};
export default defineStack({
objects: [TodoTask],
views: [
{
listViews: {
all: {
name: 'all',
label: 'All Tasks',
type: 'grid',
data: { provider: 'object', object: 'todo_task' },
columns: ['subject', 'status', 'priority', 'assignee', 'category', 'due_date', 'is_completed'],
},
board: {
name: 'board',
label: 'Board',
type: 'kanban',
data: { provider: 'object', object: 'todo_task' },
columns: ['subject', 'priority', 'assignee', 'due_date'],
kanban: {
groupByField: 'status',
columns: ['priority', 'assignee', 'due_date'],
},
},
calendar: {
name: 'calendar',
label: 'Calendar',
type: 'calendar',
data: { provider: 'object', object: 'todo_task' },
columns: ['subject', 'status', 'due_date'],
calendar: {
startDateField: 'due_date',
titleField: 'subject',
},
},
active: {
name: 'active',
label: 'Active',
type: 'grid',
data: { provider: 'object', object: 'todo_task' },
columns: ['subject', 'status', 'priority', 'assignee', 'due_date'],
filter: [{ field: 'status', operator: '!=', value: 'Done' }],
sort: [{ field: 'priority', order: 'asc' }],
},
},
},
],
actions: [
...TodoTaskActions,
],
apps: [
App.create({
name: 'todo_app',
label: 'Task Tracker',
icon: 'check-square',
description: 'Manage tasks, track progress, and collaborate with your team',
branding: {
primaryColor: '#10B981',
},
navigation: [
{
id: 'nav_task_dashboard',
type: 'dashboard',
dashboardName: 'task_dashboard',
label: 'Dashboard',
icon: 'layout-dashboard',
},
{
id: 'nav_todo_task',
type: 'object',
objectName: 'todo_task',
label: 'All Tasks',
icon: 'list-todo',
},
{
id: 'nav_todo_board',
type: 'object',
objectName: 'todo_task',
viewName: 'board',
label: 'Task Board',
icon: 'kanban-square',
},
{
id: 'nav_todo_calendar',
type: 'object',
objectName: 'todo_task',
viewName: 'calendar',
label: 'Calendar',
icon: 'calendar',
},
{
id: 'nav_todo_help',
type: 'page',
pageName: 'todo_help',
label: 'Help',
icon: 'help-circle',
},
],
}),
],
dashboards: [
{
name: 'task_dashboard',
label: 'Task Overview',
description: 'Task metrics, status distribution, and category breakdown',
widgets: [
{
id: 'total_tasks',
title: 'Total Tasks',
type: 'metric',
object: 'todo_task',
layout: { x: 0, y: 0, w: 1, h: 1 },
options: {
label: 'Total Tasks',
value: '12',
icon: 'ListTodo',
},
},
{
id: 'in_progress',
title: 'In Progress',
type: 'metric',
object: 'todo_task',
layout: { x: 1, y: 0, w: 1, h: 1 },
options: {
label: 'In Progress',
value: '4',
trend: { value: 2, direction: 'up', label: 'this week' },
icon: 'Clock',
},
},
{
id: 'completed',
title: 'Completed',
type: 'metric',
object: 'todo_task',
layout: { x: 2, y: 0, w: 1, h: 1 },
options: {
label: 'Completed',
value: '3',
trend: { value: 25, direction: 'up', label: 'completion rate' },
icon: 'CheckCircle2',
},
},
{
id: 'overdue',
title: 'Overdue',
type: 'metric',
object: 'todo_task',
layout: { x: 3, y: 0, w: 1, h: 1 },
options: {
label: 'Overdue',
value: '2',
trend: { value: 1, direction: 'down', label: 'vs last week' },
icon: 'AlertTriangle',
},
},
{
id: 'tasks_by_status',
title: 'Tasks by Status',
type: 'donut',
object: 'todo_task',
categoryField: 'status',
valueField: 'count',
aggregate: 'count',
layout: { x: 0, y: 1, w: 2, h: 2 },
options: {
xField: 'status',
yField: 'count',
data: {
provider: 'value',
items: [
{ status: 'Backlog', count: 2 },
{ status: 'Todo', count: 2 },
{ status: 'In Progress', count: 4 },
{ status: 'Review', count: 1 },
{ status: 'Done', count: 3 },
],
},
},
},
{
id: 'tasks_by_category',
title: 'Tasks by Category',
type: 'bar',
object: 'todo_task',
categoryField: 'category',
valueField: 'count',
aggregate: 'count',
layout: { x: 2, y: 1, w: 2, h: 2 },
options: {
xField: 'category',
yField: 'count',
data: {
provider: 'value',
items: [
{ category: 'Feature', count: 4 },
{ category: 'Bug', count: 3 },
{ category: 'Documentation', count: 2 },
{ category: 'Design', count: 1 },
{ category: 'Chore', count: 2 },
],
},
},
},
],
},
],
pages: [
{
name: 'todo_help',
label: 'Help',
type: 'app',
regions: [
{
name: 'main',
components: [
{
type: 'container',
properties: {
className: 'prose max-w-3xl mx-auto p-8 text-foreground',
children: [
{ type: 'text', properties: { value: '# Task Tracker Guide', className: 'text-3xl font-bold mb-6 block' } },
{ type: 'text', properties: { value: 'Your task management workspace for tracking work across your team.', className: 'text-muted-foreground mb-6 block' } },
{ type: 'text', properties: { value: '## Views', className: 'text-xl font-semibold mb-3 block' } },
{ type: 'text', properties: { value: '- **All Tasks** — Grid view with sorting, filtering, and search\n- **Board** — Kanban board grouped by status (drag-and-drop)\n- **Calendar** — Tasks displayed by due date\n- **Active** — Filtered view showing non-completed tasks', className: 'whitespace-pre-line mb-6 block' } },
{ type: 'text', properties: { value: '## Workflow', className: 'text-xl font-semibold mb-3 block' } },
{ type: 'text', properties: { value: 'Tasks flow through stages: **Backlog** → **Todo** → **In Progress** → **Review** → **Done**. Use the Board view to drag tasks between columns.', className: 'mb-4 block' } },
],
},
},
],
},
],
},
],
manifest: {
id: 'com.example.todo',
version: '1.0.0',
type: 'app',
name: 'Task Tracker',
description: 'Task management with Kanban boards and calendar views',
data: [
{
object: 'todo_task',
mode: 'upsert',
records: [
{ subject: 'Redesign login page', status: 'In Progress', priority: 'High', assignee: 'Alice Chen', category: 'Feature', due_date: daysFromNow(2), is_completed: false, estimated_hours: 8 },
{ subject: 'Fix payment gateway timeout', status: 'In Progress', priority: 'Critical', assignee: 'Bob Smith', category: 'Bug', due_date: daysFromNow(1), is_completed: false, estimated_hours: 4 },
{ subject: 'Write API documentation', status: 'Todo', priority: 'Medium', assignee: 'Alice Chen', category: 'Documentation', due_date: daysFromNow(5), is_completed: false, estimated_hours: 6 },
{ subject: 'Update user onboarding flow', status: 'Review', priority: 'High', assignee: 'Charlie Park', category: 'Design', due_date: daysFromNow(0), is_completed: false, estimated_hours: 12 },
{ subject: 'Migrate database to v3', status: 'In Progress', priority: 'High', assignee: 'Bob Smith', category: 'Chore', due_date: daysFromNow(3), is_completed: false, estimated_hours: 16 },
{ subject: 'Add dark mode support', status: 'Todo', priority: 'Medium', assignee: 'Alice Chen', category: 'Feature', due_date: daysFromNow(7), is_completed: false, estimated_hours: 10 },
{ subject: 'Fix mobile responsive layout', status: 'In Progress', priority: 'High', assignee: 'Charlie Park', category: 'Bug', due_date: daysFromNow(-1), is_completed: false, estimated_hours: 5 },
{ subject: 'Create release notes for v2.0', status: 'Backlog', priority: 'Low', assignee: 'Alice Chen', category: 'Documentation', due_date: daysFromNow(14), is_completed: false, estimated_hours: 3 },
{ subject: 'Implement search autocomplete', status: 'Backlog', priority: 'Medium', assignee: 'Bob Smith', category: 'Feature', due_date: daysFromNow(10), is_completed: false, estimated_hours: 8 },
{ subject: 'Set up CI/CD pipeline', status: 'Done', priority: 'Medium', assignee: 'Bob Smith', category: 'Chore', due_date: daysFromNow(-5), is_completed: true, estimated_hours: 6 },
{ subject: 'Design dashboard widgets', status: 'Done', priority: 'Low', assignee: 'Charlie Park', category: 'Design', due_date: daysFromNow(-3), is_completed: true, estimated_hours: 8 },
{ subject: 'Optimize image loading', status: 'Done', priority: 'Medium', assignee: 'Alice Chen', category: 'Feature', due_date: daysFromNow(-2), is_completed: true, estimated_hours: 4 },
],
},
],
},
});