@stacksjs/defaults 0.75.529 → 0.75.537

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 (248) hide show
  1. package/ai/skills/stacks-actions/SKILL.md +1 -1
  2. package/ai/skills/stacks-build/SKILL.md +1 -1
  3. package/ai/skills/stacks-dashboard/SKILL.md +2 -2
  4. package/ai/skills/stacks-database/SKILL.md +1 -1
  5. package/ai/skills/stacks-migrations/SKILL.md +2 -2
  6. package/ai/skills/stacks-native/CATALOG.md +6 -6
  7. package/app/Actions/Dashboard/Commerce/CommerceCouponsAction.ts +27 -15
  8. package/app/Actions/Dashboard/Commerce/CommerceCouponsExportAction.ts +45 -0
  9. package/app/Actions/Dashboard/Commerce/CommerceCustomersAction.ts +22 -12
  10. package/app/Actions/Dashboard/Commerce/CommerceCustomersExportAction.ts +44 -0
  11. package/app/Actions/Dashboard/Commerce/CommercePosCheckoutAction.ts +9 -29
  12. package/app/Actions/Dashboard/Commerce/CommercePrintDevicesAction.ts +7 -9
  13. package/app/Actions/Dashboard/Commerce/CommerceProductDetailAction.ts +9 -8
  14. package/app/Actions/Dashboard/Commerce/CommerceTaxesAction.ts +7 -9
  15. package/app/Actions/Dashboard/Commerce/ManufacturerIndexAction.ts +8 -20
  16. package/app/Actions/Dashboard/Commerce/commerce-coupon-list.test.ts +203 -0
  17. package/app/Actions/Dashboard/Commerce/commerce-coupon-list.ts +248 -0
  18. package/app/Actions/Dashboard/Commerce/commerce-customer-list.test.ts +183 -0
  19. package/app/Actions/Dashboard/Commerce/commerce-customer-list.ts +186 -0
  20. package/app/Actions/Dashboard/Commerce/commerce-customer-records.test.ts +1 -34
  21. package/app/Actions/Dashboard/Commerce/commerce-customer-records.ts +0 -11
  22. package/app/Actions/Dashboard/Commerce/commerce-manufacturer-list.test.ts +118 -0
  23. package/app/Actions/Dashboard/Commerce/commerce-manufacturer-list.ts +41 -0
  24. package/app/Actions/Dashboard/Commerce/commerce-pos-catalog.test.ts +17 -5
  25. package/app/Actions/Dashboard/Commerce/commerce-pos-catalog.ts +17 -3
  26. package/app/Actions/Dashboard/Commerce/commerce-print-device-list.test.ts +99 -0
  27. package/app/Actions/Dashboard/Commerce/commerce-print-device-list.ts +18 -0
  28. package/app/Actions/Dashboard/Commerce/commerce-product-list.ts +5 -5
  29. package/app/Actions/Dashboard/Commerce/commerce-product-options.test.ts +81 -0
  30. package/app/Actions/Dashboard/Commerce/commerce-tax-rate-list.test.ts +99 -0
  31. package/app/Actions/Dashboard/Commerce/commerce-tax-rate-list.ts +18 -0
  32. package/app/Actions/Dashboard/Commerce/coupon-records.test.ts +1 -16
  33. package/app/Actions/Dashboard/Commerce/coupon-records.ts +6 -10
  34. package/app/Actions/Dashboard/Commerce/manufacturer-records.test.ts +5 -17
  35. package/app/Actions/Dashboard/Commerce/manufacturer-records.ts +0 -29
  36. package/app/Actions/Dashboard/Email/captured-mail.test.ts +16 -0
  37. package/app/Actions/Dashboard/Email/captured-mail.ts +9 -1
  38. package/app/Actions/Dashboard/Models/model-write.ts +36 -3
  39. package/app/Actions/Dashboard/Notifications/NotificationDeliveryHistoryAction.ts +13 -58
  40. package/app/Actions/Dashboard/Notifications/notification-delivery-history.ts +74 -0
  41. package/app/Actions/SitemapAction.ts +3 -1
  42. package/app/Models/Notification.ts +3 -1
  43. package/app/Models/NotificationDelivery.ts +4 -0
  44. package/app/Models/User.ts +10 -1
  45. package/bootstrap.ts +10 -2
  46. package/functions/commerce/tax-types.ts +21 -0
  47. package/functions/dashboard-list.test.ts +16 -0
  48. package/functions/dashboard-list.ts +14 -6
  49. package/functions/dashboard-model-record.test.ts +139 -0
  50. package/functions/dashboard-model-record.ts +353 -0
  51. package/functions/monitoring/errors.ts +22 -103
  52. package/functions/notifications/deliveries.ts +7 -38
  53. package/functions/queries.ts +7 -10
  54. package/ide/vscode/package.json +1 -1
  55. package/package.json +5 -5
  56. package/resources/components/Dashboard/Analytics/AnalyticsHub.stx +2 -2
  57. package/resources/components/Dashboard/Analytics/CampaignAnalytics.stx +22 -28
  58. package/resources/components/Dashboard/Analytics/EventAnalytics.stx +26 -34
  59. package/resources/components/Dashboard/Analytics/SalesAnalytics.stx +29 -37
  60. package/resources/components/Dashboard/Analytics/WebAnalyticsBreakdown.stx +12 -16
  61. package/resources/components/Dashboard/Analytics/WebAnalyticsDashboard.stx +43 -53
  62. package/resources/components/Dashboard/App/RequestsOverview.stx +2 -1
  63. package/resources/components/Dashboard/App/SourceInventory.stx +2 -1
  64. package/resources/components/Dashboard/Auth/AccessTokens.stx +3 -5
  65. package/resources/components/Dashboard/Billing/BillingPaymentMethodsPanel.stx +9 -11
  66. package/resources/components/Dashboard/Billing/BillingSettings.stx +1 -1
  67. package/resources/components/Dashboard/Buddy/BuddyAssistant.stx +4 -6
  68. package/resources/components/Dashboard/Commerce/CommerceCategoriesDashboard.stx +2 -2
  69. package/resources/components/Dashboard/Commerce/CommerceCategoriesTable.stx +3 -3
  70. package/resources/components/Dashboard/Commerce/CommerceCategoryDialog.stx +2 -2
  71. package/resources/components/Dashboard/Commerce/CommerceCategoryHierarchy.stx +3 -5
  72. package/resources/components/Dashboard/Commerce/CommerceCouponBreakdown.stx +17 -13
  73. package/resources/components/Dashboard/Commerce/CommerceCouponDialog.stx +1 -1
  74. package/resources/components/Dashboard/Commerce/CommerceCouponsDashboard.stx +57 -85
  75. package/resources/components/Dashboard/Commerce/CommerceCouponsTable.stx +32 -9
  76. package/resources/components/Dashboard/Commerce/CommerceCustomerDialog.stx +1 -1
  77. package/resources/components/Dashboard/Commerce/CommerceCustomersDashboard.stx +49 -83
  78. package/resources/components/Dashboard/Commerce/CommerceCustomersTable.stx +32 -9
  79. package/resources/components/Dashboard/Commerce/CommerceGiftCardBreakdown.stx +9 -15
  80. package/resources/components/Dashboard/Commerce/CommerceGiftCardDialog.stx +1 -1
  81. package/resources/components/Dashboard/Commerce/CommerceGiftCardsDashboard.stx +35 -119
  82. package/resources/components/Dashboard/Commerce/CommerceGiftCardsTable.stx +3 -3
  83. package/resources/components/Dashboard/Commerce/CommerceManufacturerDialog.stx +1 -1
  84. package/resources/components/Dashboard/Commerce/CommerceManufacturersDashboard.stx +3 -5
  85. package/resources/components/Dashboard/Commerce/CommerceManufacturersTable.stx +2 -2
  86. package/resources/components/Dashboard/Commerce/CommerceOrderDialog.stx +4 -4
  87. package/resources/components/Dashboard/Commerce/CommerceOrdersDashboard.stx +42 -129
  88. package/resources/components/Dashboard/Commerce/CommerceOrdersTable.stx +3 -3
  89. package/resources/components/Dashboard/Commerce/CommerceOverviewDashboard.stx +1 -1
  90. package/resources/components/Dashboard/Commerce/CommerceOverviewOrdersTable.stx +9 -11
  91. package/resources/components/Dashboard/Commerce/CommerceOverviewProductsTable.stx +5 -7
  92. package/resources/components/Dashboard/Commerce/CommerceOverviewStats.stx +14 -16
  93. package/resources/components/Dashboard/Commerce/CommercePaymentsBreakdown.stx +12 -18
  94. package/resources/components/Dashboard/Commerce/CommercePaymentsDashboard.stx +41 -120
  95. package/resources/components/Dashboard/Commerce/CommercePaymentsTable.stx +1 -1
  96. package/resources/components/Dashboard/Commerce/CommercePosCart.stx +13 -15
  97. package/resources/components/Dashboard/Commerce/CommercePosCatalog.stx +17 -19
  98. package/resources/components/Dashboard/Commerce/CommercePosCheckoutDialog.stx +2 -2
  99. package/resources/components/Dashboard/Commerce/CommercePosDashboard.stx +1 -1
  100. package/resources/components/Dashboard/Commerce/CommercePosReceiptDialog.stx +1 -1
  101. package/resources/components/Dashboard/Commerce/CommerceProductDetailDashboard.stx +5 -5
  102. package/resources/components/Dashboard/Commerce/CommerceProductDialog.stx +3 -3
  103. package/resources/components/Dashboard/Commerce/CommerceProductsDashboard.stx +41 -122
  104. package/resources/components/Dashboard/Commerce/CommerceProductsTable.stx +3 -3
  105. package/resources/components/Dashboard/Commerce/CommerceReviewEditDialog.stx +1 -1
  106. package/resources/components/Dashboard/Commerce/CommerceReviewsDashboard.stx +38 -122
  107. package/resources/components/Dashboard/Commerce/CommerceReviewsTable.stx +2 -2
  108. package/resources/components/Dashboard/Commerce/CommerceTaxDialog.stx +3 -3
  109. package/resources/components/Dashboard/Commerce/CommerceTaxesDashboard.stx +5 -4
  110. package/resources/components/Dashboard/Commerce/CommerceTaxesTable.stx +4 -3
  111. package/resources/components/Dashboard/Commerce/CommerceUnitDialog.stx +3 -7
  112. package/resources/components/Dashboard/Commerce/CommerceUnitsDashboard.stx +3 -5
  113. package/resources/components/Dashboard/Commerce/CommerceUnitsTable.stx +2 -2
  114. package/resources/components/Dashboard/Commerce/CommerceVariantDialog.stx +3 -3
  115. package/resources/components/Dashboard/Commerce/CommerceVariantsDashboard.stx +4 -4
  116. package/resources/components/Dashboard/Commerce/CommerceVariantsTable.stx +3 -5
  117. package/resources/components/Dashboard/Commerce/Delivery/CourierDialog.stx +1 -1
  118. package/resources/components/Dashboard/Commerce/Delivery/CouriersDashboard.stx +1 -1
  119. package/resources/components/Dashboard/Commerce/Delivery/CouriersTable.stx +2 -2
  120. package/resources/components/Dashboard/Commerce/Delivery/DeliveryOverviewDashboard.stx +44 -52
  121. package/resources/components/Dashboard/Commerce/Delivery/DeliveryPagination.stx +2 -2
  122. package/resources/components/Dashboard/Commerce/Delivery/DeliveryRouteDialog.stx +1 -1
  123. package/resources/components/Dashboard/Commerce/Delivery/DeliveryRoutesDashboard.stx +1 -1
  124. package/resources/components/Dashboard/Commerce/Delivery/DeliveryRoutesTable.stx +2 -2
  125. package/resources/components/Dashboard/Commerce/Delivery/DigitalDeliveriesDashboard.stx +1 -1
  126. package/resources/components/Dashboard/Commerce/Delivery/DigitalDeliveryTable.stx +2 -2
  127. package/resources/components/Dashboard/Commerce/Delivery/LicenseKeyDialog.stx +3 -3
  128. package/resources/components/Dashboard/Commerce/Delivery/LicenseKeysDashboard.stx +1 -1
  129. package/resources/components/Dashboard/Commerce/Delivery/LicenseKeysTable.stx +2 -2
  130. package/resources/components/Dashboard/Commerce/Delivery/ShippingMethodsDashboard.stx +1 -1
  131. package/resources/components/Dashboard/Commerce/Delivery/ShippingMethodsTable.stx +2 -2
  132. package/resources/components/Dashboard/Commerce/Delivery/ShippingRateDialog.stx +2 -2
  133. package/resources/components/Dashboard/Commerce/Delivery/ShippingRatesDashboard.stx +1 -1
  134. package/resources/components/Dashboard/Commerce/Delivery/ShippingRatesTable.stx +2 -2
  135. package/resources/components/Dashboard/Commerce/Delivery/ShippingZoneDialog.stx +1 -1
  136. package/resources/components/Dashboard/Commerce/Delivery/ShippingZonesDashboard.stx +1 -1
  137. package/resources/components/Dashboard/Commerce/Delivery/ShippingZonesTable.stx +4 -8
  138. package/resources/components/Dashboard/Commerce/PaymentDetailsDialog.stx +1 -3
  139. package/resources/components/Dashboard/Commerce/PrintDeviceBreakdown.stx +9 -15
  140. package/resources/components/Dashboard/Commerce/PrintDeviceDialog.stx +1 -1
  141. package/resources/components/Dashboard/Commerce/PrintDevicesDashboard.stx +3 -3
  142. package/resources/components/Dashboard/Commerce/PrintDevicesTable.stx +3 -3
  143. package/resources/components/Dashboard/Commerce/PrintLogBreakdown.stx +3 -9
  144. package/resources/components/Dashboard/Commerce/PrintLogDetailsDialog.stx +1 -1
  145. package/resources/components/Dashboard/Commerce/PrintLogsDashboard.stx +4 -4
  146. package/resources/components/Dashboard/Commerce/PrintLogsTable.stx +8 -10
  147. package/resources/components/Dashboard/Commerce/ProductWaitlistDashboard.stx +37 -109
  148. package/resources/components/Dashboard/Commerce/ProductWaitlistEntryDialog.stx +3 -3
  149. package/resources/components/Dashboard/Commerce/ProductWaitlistTable.stx +2 -2
  150. package/resources/components/Dashboard/Commerce/RestaurantWaitlistDashboard.stx +38 -112
  151. package/resources/components/Dashboard/Commerce/RestaurantWaitlistEntryDialog.stx +2 -2
  152. package/resources/components/Dashboard/Commerce/RestaurantWaitlistTable.stx +2 -2
  153. package/resources/components/Dashboard/Content/AuthorsDashboard.stx +4 -4
  154. package/resources/components/Dashboard/Content/BlogDashboard.stx +4 -4
  155. package/resources/components/Dashboard/Content/CommentsDashboard.stx +36 -83
  156. package/resources/components/Dashboard/Content/ContentDashboard.stx +12 -14
  157. package/resources/components/Dashboard/Content/ContentTaxonomyDashboard.stx +2 -2
  158. package/resources/components/Dashboard/Content/FileManagerDashboard.stx +8 -12
  159. package/resources/components/Dashboard/Content/FileStoragePanel.stx +6 -10
  160. package/resources/components/Dashboard/Content/FileUploadDialog.stx +1 -3
  161. package/resources/components/Dashboard/Content/PagesDashboard.stx +39 -78
  162. package/resources/components/Dashboard/Content/PostEditorDialog.stx +4 -8
  163. package/resources/components/Dashboard/Content/PostsDashboard.stx +44 -85
  164. package/resources/components/Dashboard/Content/SeoDashboard.stx +5 -4
  165. package/resources/components/Dashboard/Data/DataRecords.stx +140 -12
  166. package/resources/components/Dashboard/Deployments/DeploymentList.stx +4 -4
  167. package/resources/components/Dashboard/Deployments/DeploymentTable.stx +3 -1
  168. package/resources/components/Dashboard/Elements/DropdownNavigation.stx +5 -7
  169. package/resources/components/Dashboard/Email/CapturedMailDashboard.stx +1 -3
  170. package/resources/components/Dashboard/Email/CapturedMailList.stx +18 -20
  171. package/resources/components/Dashboard/Email/EmailActivityDashboard.stx +24 -28
  172. package/resources/components/Dashboard/Email/EmailSettingsList.stx +6 -8
  173. package/resources/components/Dashboard/Email/EmailSettingsNavigation.stx +10 -12
  174. package/resources/components/Dashboard/Email/EmailSidebar.stx +33 -37
  175. package/resources/components/Dashboard/Email/InboxMessageDetail.stx +1 -1
  176. package/resources/components/Dashboard/Email/InboxMessageList.stx +16 -18
  177. package/resources/components/Dashboard/Email/InboxSettingsDashboard.stx +1 -1
  178. package/resources/components/Dashboard/Environment/EnvironmentDashboard.stx +2 -2
  179. package/resources/components/Dashboard/GlobalSearch.stx +19 -21
  180. package/resources/components/Dashboard/Home/DashboardHome.stx +8 -1
  181. package/resources/components/Dashboard/Infrastructure/CloudDashboard.stx +1 -1
  182. package/resources/components/Dashboard/Infrastructure/DnsDashboard.stx +27 -13
  183. package/resources/components/Dashboard/Infrastructure/LogsDashboard.stx +1 -1
  184. package/resources/components/Dashboard/Infrastructure/MailboxesDashboard.stx +46 -8
  185. package/resources/components/Dashboard/Infrastructure/ServerlessDashboard.stx +1 -1
  186. package/resources/components/Dashboard/Infrastructure/ServersDashboard.stx +1 -1
  187. package/resources/components/Dashboard/Jobs/JobDetail.stx +1 -1
  188. package/resources/components/Dashboard/Jobs/JobHistory.stx +44 -57
  189. package/resources/components/Dashboard/Jobs/JobTable.stx +23 -25
  190. package/resources/components/Dashboard/Kanban/KanbanCardDialog.stx +1 -1
  191. package/resources/components/Dashboard/Library/ComponentsDashboard.stx +1 -1
  192. package/resources/components/Dashboard/Management/AssignmentDrawer.stx +5 -7
  193. package/resources/components/Dashboard/Management/PermissionsDashboard.stx +35 -43
  194. package/resources/components/Dashboard/Marketing/AbandonedCartsDashboard.stx +11 -13
  195. package/resources/components/Dashboard/Marketing/CampaignDialog.stx +1 -3
  196. package/resources/components/Dashboard/Marketing/CampaignsDashboard.stx +2 -2
  197. package/resources/components/Dashboard/Marketing/CampaignsTable.stx +2 -2
  198. package/resources/components/Dashboard/Marketing/MarketingListsDashboard.stx +1 -1
  199. package/resources/components/Dashboard/Marketing/MarketingListsTable.stx +2 -2
  200. package/resources/components/Dashboard/Marketing/SocialPostDialog.stx +1 -3
  201. package/resources/components/Dashboard/Marketing/SocialPostsDashboard.stx +2 -2
  202. package/resources/components/Dashboard/Marketing/SocialPostsTable.stx +2 -2
  203. package/resources/components/Dashboard/Models/ModelRecordActions.stx +11 -2
  204. package/resources/components/Dashboard/Models/ModelRecordCreate.stx +193 -0
  205. package/resources/components/Dashboard/Models/ModelRecordDetail.stx +144 -0
  206. package/resources/components/Dashboard/Models/ModelRecordEdit.stx +176 -0
  207. package/resources/components/Dashboard/Models/ModelRecordsDashboard.stx +52 -186
  208. package/resources/components/Dashboard/Models/ModelsOverview.stx +2 -4
  209. package/resources/components/Dashboard/Monitoring/ErrorDashboard.stx +47 -81
  210. package/resources/components/Dashboard/Monitoring/ErrorTable.stx +4 -2
  211. package/resources/components/Dashboard/NotFoundDashboard.stx +4 -4
  212. package/resources/components/Dashboard/Notifications/NotificationDeliveryHistory.stx +43 -77
  213. package/resources/components/Dashboard/Notifications/NotificationDeliveryOverview.stx +15 -17
  214. package/resources/components/Dashboard/Notifications/NotificationDeliveryTable.stx +1 -1
  215. package/resources/components/Dashboard/Operations/AuditDashboard.stx +1 -1
  216. package/resources/components/Dashboard/Operations/ChangeDashboard.stx +1 -1
  217. package/resources/components/Dashboard/Operations/IncidentDashboard.stx +1 -1
  218. package/resources/components/Dashboard/Operations/MigrationDashboard.stx +2 -2
  219. package/resources/components/Dashboard/Operations/RecoveryDashboard.stx +1 -1
  220. package/resources/components/Dashboard/Operations/SchedulerDashboard.stx +1 -1
  221. package/resources/components/Dashboard/Queries/QueryDashboard.stx +60 -86
  222. package/resources/components/Dashboard/Queries/QueryDetail.stx +5 -9
  223. package/resources/components/Dashboard/Realtime/RealtimeDashboard.stx +6 -8
  224. package/resources/components/Dashboard/Remote/RemoteConsole.stx +14 -20
  225. package/resources/components/Dashboard/Settings/AppearanceSettingsDashboard.stx +48 -54
  226. package/resources/components/Dashboard/Settings/MailSettingsDashboard.stx +8 -8
  227. package/resources/components/Dashboard/Settings/SettingsDashboard.stx +43 -47
  228. package/resources/components/Dashboard/Teams/TeamInvitationDashboard.stx +2 -2
  229. package/resources/components/Dashboard/UI/ActivityTable.stx +2 -1
  230. package/resources/components/Dashboard/UI/Button.stx +15 -0
  231. package/resources/components/Dashboard/UI/MetricCards.stx +5 -7
  232. package/resources/components/Dashboard/UI/Pagination.stx +3 -5
  233. package/resources/components/Dashboard/UI/QuickLinks.stx +2 -2
  234. package/resources/components/Dashboard/UI/Select.stx +1 -0
  235. package/resources/components/Dashboard/UI/Table.stx +139 -96
  236. package/resources/components/Dashboard/UI/Tabs.stx +18 -20
  237. package/routes/dashboard-api.ts +2 -0
  238. package/routes/dashboard.ts +246 -253
  239. package/routes/storefront.ts +31 -0
  240. package/stx-components-plugin.ts +12 -1
  241. package/views/dashboard/content/categories/index.stx +1 -1
  242. package/views/dashboard/content/tags/index.stx +1 -1
  243. package/views/dashboard/layouts/default.stx +27 -12
  244. package/views/dashboard/models/[model]/[id]/edit.stx +8 -0
  245. package/views/dashboard/models/[model]/[id].stx +8 -0
  246. package/views/dashboard/models/[model]/create.stx +8 -0
  247. package/resources/components/Dashboard/CreateRecordModal.stx +0 -138
  248. package/resources/components/Dashboard/Models/EditRecordModal.stx +0 -81
@@ -7,7 +7,8 @@
7
7
  // works the same on a table with 10 rows and one with a million. Rows and
8
8
  // writes go through the model, so scopes, casts and observers apply.
9
9
  import { useNavigation } from '@stacksjs/defaults/views/dashboard/composables/useNavigation'
10
- import { DashboardApiError, dashboardApi } from '@stacksjs/defaults/functions/dashboard-api'
10
+ import { dashboardApi } from '@stacksjs/defaults/functions/dashboard-api'
11
+ import { modelRecordCreateHref, modelRecordEditHref, modelRecordHref } from '@stacksjs/defaults/functions/dashboard-model-record'
11
12
  import { pushToast } from '@stacksjs/defaults/functions/toasts'
12
13
 
13
14
  interface ColumnMeta {
@@ -16,15 +17,6 @@ interface ColumnMeta {
16
17
  type: 'number' | 'boolean' | 'date' | 'json' | 'text'
17
18
  }
18
19
 
19
- interface CreateField {
20
- name: string
21
- label: string
22
- type: 'boolean' | 'date' | 'datetime' | 'email' | 'enum' | 'number' | 'text'
23
- required: boolean
24
- defaultValue: unknown
25
- options: string[]
26
- }
27
-
28
20
  interface WriteCapabilities {
29
21
  create: boolean
30
22
  update: boolean
@@ -45,7 +37,6 @@ interface ResponseShape {
45
37
  dir: 'asc' | 'desc'
46
38
  writable: boolean
47
39
  writeCapabilities: WriteCapabilities
48
- createFields: CreateField[]
49
40
  updateColumns: string[]
50
41
  migrated?: boolean
51
42
  error: string | null
@@ -67,8 +58,6 @@ const dir = state<'asc' | 'desc'>('desc')
67
58
  const search = state(navigation.urlQuery('q') || '')
68
59
  const filters = state<Record<string, string>>({})
69
60
  const writeCapabilities = state<WriteCapabilities>({ create: false, update: false, destroy: false })
70
- const createFields = state<CreateField[]>([])
71
- const updateColumns = state<string[]>([])
72
61
  const error = state<string | null>(null)
73
62
  // False when the model's table has not been created yet: the server checked the
74
63
  // catalog after the query failed, so this is never a guess from an error.
@@ -76,15 +65,8 @@ const migrated = state(true)
76
65
  const loading = state(true)
77
66
  const showFilters = state(false)
78
67
 
79
- // The row being edited. `null` closes the editor; EditRecordModal owns the
80
- // working copy so cancelling leaves the table row unchanged.
81
- const editing = state<Record<string, unknown> | null>(null)
82
68
  const saving = state(false)
83
69
  const confirmingDelete = state<Record<string, unknown> | null>(null)
84
- const showCreate = state(false)
85
- const creating = state(false)
86
- const createError = state('')
87
- const createErrors = state<Record<string, string[]>>({})
88
70
 
89
71
  const slug = derived(() => navigation.urlSegment(-1) || '')
90
72
 
@@ -110,9 +92,8 @@ const filterLabel = derived(() => {
110
92
  const isEmpty = derived(() => !loading() && !error() && migrated() && rows().length === 0)
111
93
 
112
94
  const subtitle = derived(() => migrated()
113
- ? `${recordLabel()} · ${tableName()} · via Stacks ORM`
114
- : `Not migrated · ${tableName()}`)
115
- const canManageRows = derived(() => writeCapabilities().update || writeCapabilities().destroy)
95
+ ? `${recordLabel()} in the ${tableName()} table`
96
+ : `The ${tableName()} table has not been created yet`)
116
97
 
117
98
  const deleteDescription = derived(() => {
118
99
  const row = confirmingDelete()
@@ -121,23 +102,6 @@ const deleteDescription = derived(() => {
121
102
  return `Row ${row.id} will be removed through the model, so soft deletes and observers apply.`
122
103
  })
123
104
 
124
- // Fields for the edit modal, carrying their starting value. Derived from the
125
- // row being edited rather than from its mutable draft, so the list changes
126
- // exactly once per open: deriving it from the working copy would rebuild
127
- // every input on each keystroke and steal focus mid-word.
128
- const editFields = derived(() => {
129
- const row = editing()
130
- if (!row) return []
131
- return columnMeta().map(column => ({
132
- name: column.name,
133
- label: column.label,
134
- value: row[column.name] === null || row[column.name] === undefined ? '' : String(row[column.name]),
135
- // The model API accepts only fillable attributes and declared belongs-to
136
- // keys. Every other database column stays visible as read-only context.
137
- readonly: !updateColumns().includes(column.name),
138
- }))
139
- })
140
-
141
105
  // Skeleton rows while a query is in flight. Matching the real row count
142
106
  // keeps the table from collapsing and jumping back on every keystroke.
143
107
  const skeletonRows = derived(() => Array.from({ length: Math.min(8, Math.max(3, rows().length || 6)) }, (_, i) => i))
@@ -219,8 +183,6 @@ async function load() {
219
183
  lastPage.set(data.lastPage ?? 1)
220
184
  sort.set(data.sort ?? '')
221
185
  writeCapabilities.set(data.writeCapabilities ?? { create: false, update: false, destroy: false })
222
- createFields.set(data.createFields ?? [])
223
- updateColumns.set(data.updateColumns ?? [])
224
186
  migrated.set(data.migrated !== false)
225
187
  error.set(data.error ?? null)
226
188
  }
@@ -271,81 +233,18 @@ function onPerPageChange() {
271
233
  void load()
272
234
  }
273
235
 
236
+ // The eye and the pencil each open a page of the record's own.
274
237
  function startEdit(row: Record<string, unknown>) {
275
- editing.set(row)
238
+ navigate(modelRecordEditHref(slug(), String(row.id)))
276
239
  }
277
240
 
278
- function openCreate(): void {
279
- createError.set('')
280
- createErrors.set({})
281
- showCreate.set(true)
241
+ function startView(row: Record<string, unknown>) {
242
+ navigate(modelRecordHref(slug(), String(row.id)))
282
243
  }
283
244
 
284
- async function createRecord(fields: Record<string, unknown>): Promise<void> {
285
- creating.set(true)
286
- createError.set('')
287
- createErrors.set({})
288
- try {
289
- const result = await dashboardApi<{ ok: boolean, id?: number | string | null, error?: string, errors?: Record<string, string[]> }>(
290
- `/api/dashboard/models/${encodeURIComponent(slug())}`,
291
- { method: 'POST', body: { fields } },
292
- )
293
- if (!result?.ok) {
294
- createError.set(result?.error || 'The record was rejected.')
295
- createErrors.set(result?.errors ?? {})
296
- return
297
- }
298
- pushToast('success', `${modelName()} created`, { detail: result.id ? `Record ${result.id}` : undefined })
299
- showCreate.set(false)
300
- page.set(1)
301
- await load()
302
- }
303
- catch (reason) {
304
- createError.set(reason instanceof Error ? reason.message : String(reason))
305
- if (reason instanceof DashboardApiError && reason.fields) {
306
- createErrors.set(Object.fromEntries(
307
- Object.entries(reason.fields).map(([field, message]) => [field, [message]]),
308
- ))
309
- }
310
- }
311
- finally {
312
- creating.set(false)
313
- }
314
- }
315
-
316
- async function saveEdit(values: Record<string, string>) {
317
- const row = editing()
318
- if (!row) return
319
- // Send only what actually changed, so a save never rewrites columns the
320
- // editor merely displayed.
321
- const fields: Record<string, unknown> = {}
322
- for (const [column, value] of Object.entries(values)) {
323
- const original = row[column]
324
- const originalText = original === null || original === undefined ? '' : String(original)
325
- if (value !== originalText) fields[column] = value === '' ? null : value
326
- }
327
- if (Object.keys(fields).length === 0) {
328
- editing.set(null)
329
- return
330
- }
331
-
332
- saving.set(true)
333
- try {
334
- const result = await dashboardApi<{ ok: boolean, error?: string }>(
335
- `/api/dashboard/models/${encodeURIComponent(slug())}/${row.id}`,
336
- { method: 'PATCH', body: { fields } },
337
- )
338
- if (!result?.ok) throw new Error(result?.error || 'The update was rejected.')
339
- pushToast('success', `${modelName()} ${row.id} updated`)
340
- editing.set(null)
341
- await load()
342
- }
343
- catch (e) {
344
- pushToast('error', 'Could not save', { detail: e instanceof Error ? e.message : String(e) })
345
- }
346
- finally {
347
- saving.set(false)
348
- }
245
+ // Creating has a page of its own too.
246
+ function openCreate(): void {
247
+ navigate(modelRecordCreateHref(slug()))
349
248
  }
350
249
 
351
250
  async function confirmDelete() {
@@ -377,7 +276,7 @@ void load()
377
276
  </script>
378
277
 
379
278
  <template>
380
- <div class="p-6 space-y-4">
279
+ <div class="flex flex-col gap-4 p-6">
381
280
 
382
281
  <!-- Written out rather than using <PageHeader>: that component renders on
383
282
  the server, so a `{{ }}` placeholder in it is baked at render time and
@@ -438,9 +337,7 @@ void load()
438
337
  @change="onPerPageChange"
439
338
  class="px-2 h-8 text-[12px] text-neutral-700 dark:text-neutral-200 bg-white dark:bg-white/10 border border-black/10 rounded-md dark:border-white/15 focus:border-blue-500/50"
440
339
  >
441
- <template :for="option in PER_PAGE_OPTIONS">
442
- <option :value="option" :selected="option === perPage()">{{ option }}</option>
443
- </template>
340
+ <option :for="option in PER_PAGE_OPTIONS" :value="option" :selected="option === perPage()">{{ option }}</option>
444
341
  </select>
445
342
  </div>
446
343
  </div>
@@ -485,31 +382,27 @@ void load()
485
382
  <table class="min-w-full">
486
383
  <thead class="bg-neutral-50 dark:bg-white/5">
487
384
  <tr>
488
- <template :for="column in columnMeta()">
489
- <th scope="col" class="px-3 py-2 whitespace-nowrap group">
490
- <button type="button" @click="toggleSort(column)" :class="headerClass(column)">
491
- <span>{{ column.label }}</span>
492
- <span :class="sortIconClass(column)"></span>
493
- </button>
494
- </th>
495
- </template>
496
- <th :if="canManageRows()" scope="col" class="right-0 sticky z-20 px-3 py-2 w-24 font-medium text-[11px] text-neutral-500 text-right tracking-wide uppercase dark:text-neutral-400 bg-neutral-50 dark:bg-neutral-800 border-black/5 border-l dark:border-white/10">Actions</th>
385
+ <th :for="column in columnMeta()" scope="col" class="px-3 py-2 whitespace-nowrap group">
386
+ <button type="button" @click="toggleSort(column)" :class="headerClass(column)">
387
+ <span>{{ column.label }}</span>
388
+ <span :class="sortIconClass(column)"></span>
389
+ </button>
390
+ </th>
391
+ <th scope="col" class="right-0 sticky z-20 px-3 py-2 w-28 font-medium text-[11px] text-neutral-500 text-right tracking-wide uppercase dark:text-neutral-400 bg-neutral-50 dark:bg-neutral-800 border-black/5 border-l dark:border-white/10">Actions</th>
497
392
  </tr>
498
393
 
499
394
  <!-- Per-column filter row -->
500
395
  <tr :if="showFilters()" class="bg-white dark:bg-neutral-900">
501
- <template :for="column in columnMeta()">
502
- <th scope="col" class="pb-2 px-2">
503
- <input
504
- type="text"
505
- :value="filters()[column.name] || ''"
506
- @input="onFilterInput(column.name, $event)"
507
- :placeholder="column.label"
508
- class="block px-2 py-1 w-full font-normal text-[12px] text-neutral-900 dark:text-neutral-100 placeholder:text-neutral-400 dark:placeholder:text-neutral-500 bg-white dark:bg-white/10 border border-black/10 rounded-md dark:border-white/15 focus:border-blue-400 focus:outline-none"
509
- >
510
- </th>
511
- </template>
512
- <th :if="canManageRows()" class="right-0 sticky z-20 bg-white dark:bg-neutral-900 border-black/5 border-l dark:border-white/10"></th>
396
+ <th :for="column in columnMeta()" scope="col" class="pb-2 px-2">
397
+ <input
398
+ type="text"
399
+ :value="filters()[column.name] || ''"
400
+ @input="onFilterInput(column.name, $event)"
401
+ :placeholder="column.label"
402
+ class="block px-2 py-1 w-full font-normal text-[12px] text-neutral-900 dark:text-neutral-100 placeholder:text-neutral-400 dark:placeholder:text-neutral-500 bg-white dark:bg-white/10 border border-black/10 rounded-md dark:border-white/15 focus:border-blue-400 focus:outline-none"
403
+ >
404
+ </th>
405
+ <th class="right-0 sticky z-20 bg-white dark:bg-neutral-900 border-black/5 border-l dark:border-white/10"></th>
513
406
  </tr>
514
407
  </thead>
515
408
 
@@ -518,38 +411,31 @@ void load()
518
411
  rather than one: `:if` and `:for` on the same <template> do not
519
412
  compose, and a table may legally carry several bodies. -->
520
413
  <tbody :if="loading()" class="divide-black/5 divide-y dark:divide-white/8">
521
- <template :for="i in skeletonRows()">
522
- <tr>
523
- <template :for="column in columnMeta()">
524
- <td class="px-3 py-2">
525
- <div class="h-3 bg-neutral-200 dark:bg-white/10 rounded animate-pulse"></div>
526
- </td>
527
- </template>
528
- <td :if="canManageRows()" class="right-0 sticky z-10 px-3 py-2 bg-white dark:bg-neutral-900 border-black/5 border-l dark:border-white/10">
529
- <div class="ml-auto h-3 w-16 bg-neutral-200 dark:bg-white/10 rounded animate-pulse"></div>
530
- </td>
531
- </tr>
532
- </template>
414
+ <tr :for="i in skeletonRows()">
415
+ <td :for="column in columnMeta()" class="px-3 py-2">
416
+ <div class="h-3 bg-neutral-200 dark:bg-white/10 rounded animate-pulse"></div>
417
+ </td>
418
+ <td class="right-0 sticky z-10 px-3 py-2 bg-white dark:bg-neutral-900 border-black/5 border-l dark:border-white/10">
419
+ <div class="ml-auto h-3 w-16 bg-neutral-200 dark:bg-white/10 rounded animate-pulse"></div>
420
+ </td>
421
+ </tr>
533
422
  </tbody>
534
423
 
535
424
  <tbody :if="!loading()" class="divide-black/5 divide-y dark:divide-white/8">
536
- <template :for="row in rows()">
537
- <tr class="hover:bg-neutral-50 dark:hover:bg-white/5 transition-colors group">
538
- <template :for="column in columnMeta()">
539
- <td :class="cellClass(column)" :title="cellValue(row, column)">{{ cellValue(row, column) }}</td>
540
- </template>
541
- <td :if="canManageRows()" class="right-0 sticky z-10 px-3 py-2 text-right bg-white dark:bg-neutral-900 group-hover:bg-neutral-50 dark:group-hover:bg-white/5 border-black/5 border-l dark:border-white/10 transition-colors">
542
- <ModelRecordActions
543
- :record="row"
544
- :modelName="modelName()"
545
- :canUpdate="writeCapabilities().update"
546
- :canDestroy="writeCapabilities().destroy"
547
- @edit="startEdit"
548
- @delete="confirmingDelete.set($event)"
549
- />
550
- </td>
551
- </tr>
552
- </template>
425
+ <tr :for="row in rows()" class="hover:bg-neutral-50 dark:hover:bg-white/5 transition-colors group">
426
+ <td :for="column in columnMeta()" :class="cellClass(column)" :title="cellValue(row, column)">{{ cellValue(row, column) }}</td>
427
+ <td class="right-0 sticky z-10 px-3 py-2 text-right bg-white dark:bg-neutral-900 group-hover:bg-neutral-50 dark:group-hover:bg-white/5 border-black/5 border-l dark:border-white/10 transition-colors">
428
+ <ModelRecordActions
429
+ :record="row"
430
+ :modelName="modelName()"
431
+ :canUpdate="writeCapabilities().update"
432
+ :canDestroy="writeCapabilities().destroy"
433
+ @view="startView"
434
+ @edit="startEdit"
435
+ @delete="confirmingDelete.set($event)"
436
+ />
437
+ </td>
438
+ </tr>
553
439
  </tbody>
554
440
  </table>
555
441
  </div>
@@ -566,15 +452,6 @@ void load()
566
452
  </div>
567
453
  </div>
568
454
 
569
- <EditRecordModal
570
- :open="Boolean(editing())"
571
- :modelName="modelName()"
572
- :fields="editFields()"
573
- :busy="saving()"
574
- @close="editing.set(null)"
575
- @submit="saveEdit($event)"
576
- />
577
-
578
455
  <ConfirmDialog
579
456
  :isOpen="Boolean(confirmingDelete())"
580
457
  :title="'Delete this ' + modelName() + '?'"
@@ -584,17 +461,6 @@ void load()
584
461
  @close="confirmingDelete.set(null)"
585
462
  @confirm="confirmDelete"
586
463
  />
587
-
588
- <CreateRecordModal
589
- :open="showCreate()"
590
- :modelName="modelName()"
591
- :fields="createFields()"
592
- :busy="creating()"
593
- :error="createError()"
594
- :errors="createErrors()"
595
- @close="showCreate.set(false)"
596
- @submit="createRecord($event)"
597
- />
598
464
  </div>
599
465
  </template>
600
466
 
@@ -159,9 +159,7 @@ onMount(() => {
159
159
  <span class="sr-only">Filter model category</span>
160
160
  <select x-model="selectedCategory" class="block px-3 py-2 w-full text-neutral-900 text-sm dark:text-white bg-white dark:bg-neutral-900 border border-neutral-300 rounded-lg dark:border-neutral-700 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500/20">
161
161
  <option value="all">All categories</option>
162
- <template :for="category in categories()">
163
- <option :value="category.key">{{ category.label }}</option>
164
- </template>
162
+ <option :for="category in categories()" :value="category.key">{{ category.label }}</option>
165
163
  </select>
166
164
  </label>
167
165
  </div>
@@ -203,7 +201,7 @@ onMount(() => {
203
201
  <dt class="text-neutral-500 text-xs dark:text-neutral-400">Records</dt>
204
202
  <dd :if="model.count !== null" class="mt-1 font-medium text-neutral-900 text-sm dark:text-white">{{ model.count.toLocaleString() }}</dd>
205
203
  <dd :if="model.count === null && model.migrated !== false" class="mt-1 font-medium text-amber-700 text-sm dark:text-amber-300">Unavailable</dd>
206
- <dd :if="model.migrated === false" class="mt-1 font-medium text-neutral-500 text-sm dark:text-neutral-400">Not migrated</dd>
204
+ <dd :if="model.migrated === false" class="mt-1 font-medium text-neutral-500 text-sm dark:text-neutral-400" title="Run ./buddy migrate to create its table">No table yet</dd>
207
205
  </div>
208
206
  <div>
209
207
  <dt class="text-neutral-500 text-xs dark:text-neutral-400">Attributes</dt>
@@ -1,8 +1,8 @@
1
- <div class="p-6 space-y-6">
1
+ <div class="flex flex-col gap-6 p-6">
2
2
 
3
3
  <PageHeader title="Error Tracking" description="Monitor and manage application errors. Similar errors are grouped together." />
4
4
 
5
- <div :show="hasStats" class="grid gap-4 grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 mb-6">
5
+ <div :show="hasStats" class="grid gap-4 grid-cols-1 sm:grid-cols-2 lg:grid-cols-4">
6
6
  <StatsCard title="Total Errors" icon="i-hugeicons-bug-01" iconBg="primary">
7
7
  <template #value>{{ totalErrorsLabel() }}</template>
8
8
  </StatsCard>
@@ -23,6 +23,8 @@
23
23
  </StatsCard>
24
24
  </div>
25
25
 
26
+ <div :if="loadError()" role="alert" class="flex gap-4 items-center justify-between p-4 text-red-700 text-sm dark:text-red-300 bg-red-50 dark:bg-red-950/30 border border-red-200 rounded-lg dark:border-red-900"><span>{{ loadError() }}</span><Button variant="secondary" size="sm" @click="loadGroups()">Retry</Button></div>
27
+
26
28
  <Card padding="none">
27
29
  <template #header>
28
30
  <div class="flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between">
@@ -47,6 +49,7 @@
47
49
 
48
50
  <ErrorTable
49
51
  :errors="filteredErrors"
52
+ :loading="loading()"
50
53
  :total="groupTotal"
51
54
  :currentPage="groupPage"
52
55
  :perPage="groupPerPage"
@@ -152,7 +155,8 @@
152
155
  </div>
153
156
 
154
157
  <script client>
155
- import { useErrors } from '../../../../functions/monitoring/errors'
158
+ import { useServerList } from '../../../../functions/dashboard-list'
159
+ import { fetchErrorGroupPage, useErrors } from '../../../../functions/monitoring/errors'
156
160
  import { pushToast } from '../../../../functions/toasts'
157
161
 
158
162
  interface ErrorGroup {
@@ -166,20 +170,47 @@ interface ErrorGroup {
166
170
  stack?: string | null
167
171
  }
168
172
 
169
- const { groupedErrors, groupedErrorsPage, errorStats, fetchGroupedErrors, fetchErrorStats, resolveErrorGroup, ignoreErrorGroup, unresolveErrorGroup, deleteErrorGroup } = useErrors()
173
+ const { errorStats, fetchErrorStats, resolveErrorGroup, ignoreErrorGroup, unresolveErrorGroup, deleteErrorGroup } = useErrors()
170
174
 
171
- const searchQuery = state('')
172
175
  const statusFilter = state('')
173
176
  const typeFilter = state('')
174
177
 
178
+ /** Every recorded type, from the server: a page alone would list only its own. */
179
+ const types = state<string[]>([])
180
+
175
181
  // The groups are one page, searched, filtered and sorted by the server
176
- // (stacksjs/stacks#3195); these are what it was last asked for.
177
- const listPage = state(1)
178
- const perPage = state(10)
179
- const appliedSearch = state('')
180
- const sortKey = state('')
181
- const sortDirection = state<'asc' | 'desc'>('desc')
182
- let searchTimer: ReturnType<typeof setTimeout> | undefined
182
+ // (stacksjs/stacks#3195); useServerList keeps the request order, paging,
183
+ // header sort and search debounce this page used to keep itself. Unsorted is
184
+ // most recently seen first, which the server reads as last_seen descending.
185
+ const {
186
+ records,
187
+ total: groupTotal,
188
+ page: groupPage,
189
+ perPage: groupPerPage,
190
+ search: searchQuery,
191
+ loading,
192
+ loadError,
193
+ load,
194
+ changePage: changeGroupPage,
195
+ changePageSize: changeGroupPageSize,
196
+ changeSort: changeGroupSort,
197
+ } = useServerList<ErrorGroup>({
198
+ fetch: async (query) => {
199
+ const result = await fetchErrorGroupPage(query)
200
+ return { ...result, records: result.groups as unknown as ErrorGroup[] }
201
+ },
202
+ defaultSort: { sort: 'last_seen', direction: 'desc' },
203
+ // The table's sortable columns are named as the server sorts them.
204
+ columnSorts: { type: 'type', count: 'count', status: 'status', last_seen: 'last_seen' },
205
+ filters: () => ({ status: statusFilter(), type: typeFilter() }),
206
+ perPage: 10,
207
+ searchParam: 'search',
208
+ onLoad: (result) => {
209
+ const page = result as { types?: string[] }
210
+ types.set(Array.isArray(page.types) ? page.types : [])
211
+ },
212
+ onError: error => pushToast('error', 'Could not load errors', { detail: error instanceof Error ? error.message : String(error) }),
213
+ })
183
214
 
184
215
  const selectedError = state<ErrorGroup | null>(null)
185
216
  const isDetailModalOpen = state(false)
@@ -194,7 +225,7 @@ const statusOptions = [
194
225
  ]
195
226
 
196
227
  function errorList(): ErrorGroup[] {
197
- return (groupedErrors.value as ErrorGroup[]) || []
228
+ return records()
198
229
  }
199
230
 
200
231
  function statsValue(): { total?: number, unresolved?: number, last_24h?: number, resolved?: number, trend?: number } | null {
@@ -208,84 +239,19 @@ const last24hLabel = derived(() => String(statsValue()?.last_24h ?? 0))
208
239
  const resolvedStatsLabel = derived(() => String(statsValue()?.resolved ?? 0))
209
240
  const trendValue = derived(() => statsValue()?.trend ?? 0)
210
241
 
211
- function pageInfo(): { total: number, page: number, types: string[] } {
212
- return (groupedErrorsPage.value as { total: number, page: number, types: string[] } | null) ?? { total: 0, page: 1, types: [] }
213
- }
214
-
215
242
  /** Every recorded type, from the server: a page alone would list only its own. */
216
243
  const typeOptions = derived(() => [
217
244
  { value: '', label: 'All Types' },
218
- ...pageInfo().types.map(type => ({ value: type, label: type })),
245
+ ...types().map(type => ({ value: type, label: type })),
219
246
  ])
220
247
 
221
248
  /** The page the server chose; its search, filters and order are already applied. */
222
249
  const filteredErrors = derived(() => errorList())
223
- const groupTotal = derived(() => pageInfo().total)
224
- const groupPage = derived(() => pageInfo().page)
225
- const groupPerPage = derived(() => perPage())
226
-
227
- async function loadGroups(): Promise<void> {
228
- await fetchGroupedErrors({
229
- page: listPage(),
230
- perPage: perPage(),
231
- search: appliedSearch(),
232
- status: statusFilter(),
233
- type: typeFilter(),
234
- sort: sortKey() || undefined,
235
- direction: sortDirection(),
236
- })
237
- // The server moves back to the last page when a delete or a narrower
238
- // filter leaves this one past the end.
239
- listPage.set(pageInfo().page)
240
- }
241
-
242
- function changeGroupPage(value: number | CustomEvent<number>): void {
243
- listPage.set(Number(eventValue(value)) || 1)
244
- void loadGroups()
245
- }
246
250
 
247
- function changeGroupPageSize(value: number | CustomEvent<number>): void {
248
- perPage.set(Number(eventValue(value)) || 10)
249
- listPage.set(1)
250
- void loadGroups()
251
+ function loadGroups(): Promise<void> {
252
+ return load()
251
253
  }
252
254
 
253
- function changeGroupSort(value: { key: string, direction: string } | CustomEvent<{ key: string, direction: string }>): void {
254
- const sort = eventValue(value)
255
- sortKey.set(sort.key || '')
256
- sortDirection.set(sort.direction === 'asc' ? 'asc' : 'desc')
257
- listPage.set(1)
258
- void loadGroups()
259
- }
260
-
261
- // The search and the two filters are model bindings; a change to any asks
262
- // the server for page 1, the search once typing pauses.
263
- let shownSearch = searchQuery()
264
- effect(() => {
265
- const term = searchQuery().trim()
266
- if (term === shownSearch)
267
- return
268
- shownSearch = term
269
- if (searchTimer)
270
- clearTimeout(searchTimer)
271
- searchTimer = setTimeout(() => {
272
- appliedSearch.set(term)
273
- listPage.set(1)
274
- void loadGroups()
275
- }, 250)
276
- })
277
-
278
- let shownFilters = JSON.stringify([statusFilter(), typeFilter()])
279
- effect(() => {
280
- const filters = JSON.stringify([statusFilter(), typeFilter()])
281
- if (filters === shownFilters)
282
- return
283
- shownFilters = filters
284
- listPage.set(1)
285
- void loadGroups()
286
- })
287
-
288
-
289
255
  const hasFilters = derived(() => searchQuery() !== '' || (statusFilter() ?? '') !== '' || (typeFilter() ?? '') !== '')
290
256
  const emptyTitle = derived(() => hasFilters() ? 'No matching errors' : 'No errors found')
291
257
  const emptyDescription = derived(() => hasFilters() ? 'Try adjusting your filters' : 'Your application is running smoothly!')
@@ -19,6 +19,7 @@ const emptyDescription = useReactiveProp('emptyDescription', 'Your application i
19
19
  // filters, sorts and pages the groups, so this shows them as given and hands
20
20
  // paging and sorting back to the parent.
21
21
  const total = useReactiveProp('total', 0)
22
+ const loading = useReactiveProp('loading', false)
22
23
  const currentPage = useReactiveProp('currentPage', 1)
23
24
  const perPage = useReactiveProp('perPage', 10)
24
25
  const emit = defineEmits(['view', 'resolve', 'ignore', 'unresolve', 'delete', 'row-click', 'page-change', 'page-size-change', 'sort'])
@@ -67,11 +68,11 @@ const COLUMNS = [
67
68
 
68
69
  /** Resolve and ignore an open error; reopen one that is resolved or ignored. */
69
70
  const ROW_ACTIONS = [
70
- { action: 'view', label: 'View details of', icon: 'i-hugeicons-view' },
71
+ { action: 'view', label: 'View details of' },
71
72
  { action: 'resolve', label: 'Resolve', icon: 'i-hugeicons-checkmark-circle-02', class: 'text-green-500', when: { key: 'open', equals: true } },
72
73
  { action: 'ignore', label: 'Ignore', icon: 'i-hugeicons-view-off', class: 'text-amber-500', when: { key: 'open', equals: true } },
73
74
  { action: 'unresolve', label: 'Unresolve', icon: 'i-hugeicons-refresh', class: 'text-neutral-500', when: { key: 'open', equals: false } },
74
- { action: 'delete', label: 'Delete', icon: 'i-hugeicons-delete-02', class: 'text-red-500' },
75
+ { action: 'delete', label: 'Delete' },
75
76
  ]
76
77
 
77
78
  const rows = derived(() => (errors() as ErrorGroup[]).map((error, index) => ({
@@ -104,6 +105,7 @@ function changeSort(sort: { key: string, direction: string }): void {
104
105
  <Table
105
106
  :columns="COLUMNS"
106
107
  :data="rows()"
108
+ :loading="loading()"
107
109
  :row-actions="ROW_ACTIONS"
108
110
  action-label-key="actionName"
109
111
  row-key="rowId"
@@ -37,17 +37,17 @@
37
37
  </div>
38
38
  </div>
39
39
  </StxLink>
40
- <StxLink to="/content/dashboard" class="overflow-hidden bg-white dark:bg-neutral-800 rounded-lg shadow hover:shadow-md duration-200 transition-shadow">
40
+ <StxLink to="/models" class="overflow-hidden bg-white dark:bg-neutral-800 rounded-lg shadow hover:shadow-md duration-200 transition-shadow">
41
41
  <div class="p-5">
42
42
  <div class="flex items-center">
43
43
  <div class="flex-shrink-0 p-3 bg-green-500 rounded-md">
44
- <div class="h-6 w-6 text-white i-hugeicons-document-validation"></div>
44
+ <div class="h-6 w-6 text-white i-hugeicons-database"></div>
45
45
  </div>
46
46
  <div class="flex-1 ml-5 w-0">
47
47
  <dl>
48
- <dt class="font-medium text-gray-900 text-sm truncate dark:text-white">Blog</dt>
48
+ <dt class="font-medium text-gray-900 text-sm truncate dark:text-white">Models</dt>
49
49
  <dd class="mt-1 text-gray-500 text-sm dark:text-neutral-400">
50
- Manage your blog posts and categories
50
+ Browse the records in your models
51
51
  </dd>
52
52
  </dl>
53
53
  </div>