@stacksjs/defaults 0.75.487 → 0.75.490
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.
- package/ai/skills/stacks-actions/SKILL.md +1 -1
- package/ai/skills/stacks-dashboard/SKILL.md +27 -2
- package/ai/skills/stacks-native/CATALOG.md +9 -9
- package/ai/skills/stacks-search-engine/SKILL.md +14 -0
- package/app/Actions/Dashboard/Commerce/CommerceCategoriesAction.ts +7 -13
- package/app/Actions/Dashboard/Commerce/CommerceCustomerChoicesAction.ts +34 -0
- package/app/Actions/Dashboard/Commerce/CommerceDeliveryAction.ts +7 -16
- package/app/Actions/Dashboard/Commerce/CommerceGiftCardsAction.ts +21 -15
- package/app/Actions/Dashboard/Commerce/CommerceGiftCardsExportAction.ts +41 -0
- package/app/Actions/Dashboard/Commerce/CommerceOrderCustomersAction.ts +37 -0
- package/app/Actions/Dashboard/Commerce/CommerceOrdersAction.ts +26 -41
- package/app/Actions/Dashboard/Commerce/CommerceOrdersExportAction.ts +43 -0
- package/app/Actions/Dashboard/Commerce/CommercePaymentsAction.ts +24 -21
- package/app/Actions/Dashboard/Commerce/CommercePaymentsExportAction.ts +41 -0
- package/app/Actions/Dashboard/Commerce/CommercePosAction.ts +18 -48
- package/app/Actions/Dashboard/Commerce/CommercePosProductsAction.ts +39 -0
- package/app/Actions/Dashboard/Commerce/CommercePrintLogsAction.ts +14 -104
- package/app/Actions/Dashboard/Commerce/CommercePrintLogsExportAction.ts +41 -0
- package/app/Actions/Dashboard/Commerce/CommerceProductChoicesAction.ts +32 -0
- package/app/Actions/Dashboard/Commerce/CommerceProductsAction.ts +24 -43
- package/app/Actions/Dashboard/Commerce/CommerceProductsExportAction.ts +44 -0
- package/app/Actions/Dashboard/Commerce/CourierIndexAction.ts +3 -1
- package/app/Actions/Dashboard/Commerce/DeliveryRouteIndexAction.ts +23 -12
- package/app/Actions/Dashboard/Commerce/DigitalDeliveryIndexAction.ts +3 -1
- package/app/Actions/Dashboard/Commerce/LicenseKeyIndexAction.ts +24 -23
- package/app/Actions/Dashboard/Commerce/LicenseKeyOptionsAction.ts +35 -16
- package/app/Actions/Dashboard/Commerce/ProductWaitlistIndexAction.ts +22 -22
- package/app/Actions/Dashboard/Commerce/RestaurantWaitlistIndexAction.ts +22 -17
- package/app/Actions/Dashboard/Commerce/ReviewIndexAction.ts +22 -31
- package/app/Actions/Dashboard/Commerce/ShippingMethodIndexAction.ts +3 -1
- package/app/Actions/Dashboard/Commerce/ShippingRateIndexAction.ts +3 -1
- package/app/Actions/Dashboard/Commerce/ShippingZoneIndexAction.ts +3 -1
- package/app/Actions/Dashboard/Commerce/commerce-category-list.test.ts +100 -0
- package/app/Actions/Dashboard/Commerce/commerce-category-list.ts +26 -0
- package/app/Actions/Dashboard/Commerce/commerce-choice-records.ts +56 -0
- package/app/Actions/Dashboard/Commerce/commerce-choices.test.ts +88 -0
- package/app/Actions/Dashboard/Commerce/commerce-choices.ts +70 -0
- package/app/Actions/Dashboard/Commerce/commerce-delivery-overview.test.ts +151 -0
- package/app/Actions/Dashboard/Commerce/commerce-delivery-overview.ts +85 -0
- package/app/Actions/Dashboard/Commerce/commerce-delivery-route-list.test.ts +153 -0
- package/app/Actions/Dashboard/Commerce/commerce-delivery-route-list.ts +180 -0
- package/app/Actions/Dashboard/Commerce/commerce-delivery.ts +24 -9
- package/app/Actions/Dashboard/Commerce/commerce-gift-card-list.test.ts +221 -0
- package/app/Actions/Dashboard/Commerce/commerce-gift-card-list.ts +259 -0
- package/app/Actions/Dashboard/Commerce/commerce-license-key-list.test.ts +184 -0
- package/app/Actions/Dashboard/Commerce/commerce-license-key-list.ts +217 -0
- package/app/Actions/Dashboard/Commerce/commerce-order-list.test.ts +183 -0
- package/app/Actions/Dashboard/Commerce/commerce-order-list.ts +278 -0
- package/app/Actions/Dashboard/Commerce/commerce-order-records.test.ts +29 -0
- package/app/Actions/Dashboard/Commerce/commerce-payment-list.test.ts +180 -0
- package/app/Actions/Dashboard/Commerce/commerce-payment-list.ts +272 -0
- package/app/Actions/Dashboard/Commerce/commerce-pos-catalog.test.ts +171 -0
- package/app/Actions/Dashboard/Commerce/commerce-pos-catalog.ts +152 -0
- package/app/Actions/Dashboard/Commerce/commerce-pos.test.ts +1 -12
- package/app/Actions/Dashboard/Commerce/commerce-pos.ts +0 -26
- package/app/Actions/Dashboard/Commerce/commerce-print-log-list.test.ts +202 -0
- package/app/Actions/Dashboard/Commerce/commerce-print-log-list.ts +286 -0
- package/app/Actions/Dashboard/Commerce/commerce-product-list.test.ts +174 -0
- package/app/Actions/Dashboard/Commerce/commerce-product-list.ts +276 -0
- package/app/Actions/Dashboard/Commerce/commerce-product-waitlist-list.test.ts +183 -0
- package/app/Actions/Dashboard/Commerce/commerce-product-waitlist-list.ts +170 -0
- package/app/Actions/Dashboard/Commerce/commerce-record.ts +21 -0
- package/app/Actions/Dashboard/Commerce/commerce-restaurant-waitlist-list.test.ts +189 -0
- package/app/Actions/Dashboard/Commerce/commerce-restaurant-waitlist-list.ts +177 -0
- package/app/Actions/Dashboard/Commerce/commerce-review-list.test.ts +193 -0
- package/app/Actions/Dashboard/Commerce/commerce-review-list.ts +220 -0
- package/app/Actions/Dashboard/Commerce/commerce-sql.ts +57 -0
- package/app/Actions/Dashboard/Commerce/payment-records.test.ts +16 -0
- package/app/Actions/Dashboard/Commerce/product-waitlist-records.test.ts +6 -5
- package/app/Actions/Dashboard/Commerce/product-waitlist-records.ts +16 -45
- package/app/Actions/Dashboard/Commerce/restaurant-waitlist-records.ts +4 -24
- package/app/Actions/Dashboard/Content/content-list.ts +10 -0
- package/app/Actions/Dashboard/Content/file-listing-metadata.test.ts +46 -0
- package/app/Actions/Dashboard/Content/file-manager.ts +51 -10
- package/app/Actions/Dashboard/DashboardHomeAction.test.ts +13 -9
- package/app/Actions/Dashboard/DashboardHomeAction.ts +42 -21
- package/app/Actions/Dashboard/Jobs/JobStatsAction.ts +5 -2
- package/app/Actions/Dashboard/Kanban/UsersListAction.ts +13 -9
- package/app/Actions/Dashboard/Kanban/kanban-response.test.ts +40 -0
- package/app/Actions/Dashboard/Kanban/kanban-response.ts +53 -1
- package/app/Actions/Dashboard/Kanban/kanban-users.test.ts +114 -0
- package/app/Actions/Dashboard/Kanban/kanban-users.ts +32 -0
- package/app/Actions/Dashboard/Models/ModelShowAction.ts +8 -0
- package/app/Actions/Dashboard/Models/ModelsIndexAction.ts +16 -2
- package/app/Actions/Dashboard/Models/model-migration.test.ts +27 -0
- package/app/Actions/Dashboard/Models/model-migration.ts +23 -0
- package/app/Actions/Dashboard/Queue/QueueStatsAction.ts +9 -6
- package/app/Actions/Dashboard/Queue/QueueWorkersAction.ts +3 -2
- package/app/Actions/Dashboard/Queue/queue-stats.ts +10 -0
- package/app/Actions/Dashboard/Queue/worker-snapshots.test.ts +31 -0
- package/app/Actions/Dashboard/Queue/worker-snapshots.ts +33 -0
- package/app/Actions/Dashboard/named-search.test.ts +36 -0
- package/app/Actions/Dashboard/named-search.ts +80 -0
- package/app/Models/QueueWorker.ts +1 -0
- package/app/Models/Request.ts +4 -2
- package/bootstrap.ts +6 -1
- package/functions/commerce/shippings/dashboard-resource.ts +12 -1
- package/functions/commerce/shippings/delivery-routes.ts +1 -0
- package/functions/commerce/shippings/license-keys.ts +1 -0
- package/functions/dashboard-list.test.ts +132 -1
- package/functions/dashboard-list.ts +198 -1
- package/functions/queue.ts +2 -0
- package/ide/vscode/package.json +1 -1
- package/package.json +2 -2
- package/resources/components/Dashboard/Commerce/CommerceGiftCardBreakdown.stx +38 -12
- package/resources/components/Dashboard/Commerce/CommerceGiftCardsDashboard.stx +122 -68
- package/resources/components/Dashboard/Commerce/CommerceGiftCardsTable.stx +29 -6
- package/resources/components/Dashboard/Commerce/CommerceOrderDialog.stx +59 -2
- package/resources/components/Dashboard/Commerce/CommerceOrdersDashboard.stx +126 -80
- package/resources/components/Dashboard/Commerce/CommerceOrdersTable.stx +28 -3
- package/resources/components/Dashboard/Commerce/CommercePaymentsBreakdown.stx +12 -29
- package/resources/components/Dashboard/Commerce/CommercePaymentsDashboard.stx +139 -60
- package/resources/components/Dashboard/Commerce/CommercePaymentsTable.stx +27 -2
- package/resources/components/Dashboard/Commerce/CommercePosCatalog.stx +17 -1
- package/resources/components/Dashboard/Commerce/CommercePosCheckoutDialog.stx +47 -3
- package/resources/components/Dashboard/Commerce/CommercePosDashboard.stx +59 -49
- package/resources/components/Dashboard/Commerce/CommerceProductsDashboard.stx +116 -82
- package/resources/components/Dashboard/Commerce/CommerceProductsTable.stx +28 -4
- package/resources/components/Dashboard/Commerce/CommerceReviewsDashboard.stx +120 -69
- package/resources/components/Dashboard/Commerce/CommerceReviewsTable.stx +29 -6
- package/resources/components/Dashboard/Commerce/Delivery/DeliveryRoutesDashboard.stx +79 -52
- package/resources/components/Dashboard/Commerce/Delivery/DeliveryRoutesTable.stx +31 -8
- package/resources/components/Dashboard/Commerce/Delivery/LicenseKeyDialog.stx +71 -13
- package/resources/components/Dashboard/Commerce/Delivery/LicenseKeysDashboard.stx +69 -81
- package/resources/components/Dashboard/Commerce/Delivery/LicenseKeysTable.stx +31 -8
- package/resources/components/Dashboard/Commerce/PrintLogBreakdown.stx +21 -17
- package/resources/components/Dashboard/Commerce/PrintLogsDashboard.stx +23 -22
- package/resources/components/Dashboard/Commerce/ProductWaitlistDashboard.stx +116 -20
- package/resources/components/Dashboard/Commerce/ProductWaitlistEntryDialog.stx +100 -12
- package/resources/components/Dashboard/Commerce/ProductWaitlistTable.stx +34 -16
- package/resources/components/Dashboard/Commerce/RestaurantWaitlistDashboard.stx +107 -19
- package/resources/components/Dashboard/Commerce/RestaurantWaitlistEntryDialog.stx +65 -6
- package/resources/components/Dashboard/Commerce/RestaurantWaitlistTable.stx +29 -3
- package/resources/components/Dashboard/Kanban/KanbanBoardsDashboard.stx +10 -1
- package/resources/components/Dashboard/Kanban/KanbanCardDialog.stx +21 -1
- package/resources/components/Dashboard/Models/ModelRecordsDashboard.stx +24 -4
- package/resources/components/Dashboard/Models/ModelsOverview.stx +13 -2
- package/resources/components/Dashboard/Queue/QueueDashboard.stx +8 -2
- package/resources/functions/dashboard/sidebar.ts +26 -1
- package/routes/dashboard-api.ts +11 -0
- package/views/dashboard/stores/kanban.ts +38 -6
|
@@ -11,6 +11,7 @@ interface ModelRow {
|
|
|
11
11
|
source: 'userland' | 'framework'
|
|
12
12
|
apiUri: string
|
|
13
13
|
apiRoutes: string[]
|
|
14
|
+
migrated?: boolean
|
|
14
15
|
error: string | null
|
|
15
16
|
}
|
|
16
17
|
|
|
@@ -26,6 +27,7 @@ interface ModelsResponse {
|
|
|
26
27
|
totalRecords: number
|
|
27
28
|
userlandCount: number
|
|
28
29
|
unavailableModels: number
|
|
30
|
+
unmigratedModels?: number
|
|
29
31
|
categoryGroups: ModelGroup[]
|
|
30
32
|
}
|
|
31
33
|
|
|
@@ -35,6 +37,7 @@ const totalModels = state(0)
|
|
|
35
37
|
const totalRecords = state(0)
|
|
36
38
|
const userlandCount = state(0)
|
|
37
39
|
const unavailableModels = state(0)
|
|
40
|
+
const unmigratedModels = state(0)
|
|
38
41
|
const categoryGroups = state<ModelGroup[]>([])
|
|
39
42
|
const loading = state(true)
|
|
40
43
|
const loadError = state('')
|
|
@@ -78,6 +81,7 @@ async function loadModels(): Promise<void> {
|
|
|
78
81
|
totalRecords.set(response.totalRecords || 0)
|
|
79
82
|
userlandCount.set(response.userlandCount || 0)
|
|
80
83
|
unavailableModels.set(response.unavailableModels || 0)
|
|
84
|
+
unmigratedModels.set(response.unmigratedModels || 0)
|
|
81
85
|
categoryGroups.set(response.categoryGroups || [])
|
|
82
86
|
}
|
|
83
87
|
catch (error) {
|
|
@@ -85,6 +89,7 @@ async function loadModels(): Promise<void> {
|
|
|
85
89
|
totalRecords.set(0)
|
|
86
90
|
userlandCount.set(0)
|
|
87
91
|
unavailableModels.set(0)
|
|
92
|
+
unmigratedModels.set(0)
|
|
88
93
|
categoryGroups.set([])
|
|
89
94
|
loadError.set(error instanceof Error ? error.message : 'Models could not be loaded.')
|
|
90
95
|
}
|
|
@@ -98,7 +103,7 @@ onMount(() => {
|
|
|
98
103
|
})
|
|
99
104
|
</script>
|
|
100
105
|
|
|
101
|
-
<div class="
|
|
106
|
+
<div class="flex flex-col gap-6">
|
|
102
107
|
<header class="flex flex-col gap-4 sm:flex-row sm:items-end sm:justify-between">
|
|
103
108
|
<div>
|
|
104
109
|
<h1 class="font-semibold text-2xl text-neutral-900 tracking-tight dark:text-white">{{ title() }}</h1>
|
|
@@ -132,6 +137,11 @@ onMount(() => {
|
|
|
132
137
|
<span>{{ unavailableModels() }} model {{ unavailableModels() === 1 ? 'count is' : 'counts are' }} unavailable. Affected cards remain unavailable instead of reporting zero records.</span>
|
|
133
138
|
</div>
|
|
134
139
|
|
|
140
|
+
<div :if="!loadError() && unmigratedModels() > 0" role="status" class="flex gap-3 items-start px-4 py-3 text-neutral-700 text-sm dark:text-neutral-200 bg-neutral-50 dark:bg-neutral-800/60 border border-neutral-200 rounded-lg dark:border-neutral-700">
|
|
141
|
+
<span aria-hidden="true" class="flex-none mt-0.5 h-4 w-4 i-hugeicons-database-sync-01"></span>
|
|
142
|
+
<span>{{ unmigratedModels() }} {{ unmigratedModels() === 1 ? 'model has' : 'models have' }} no table yet. Run <code>./buddy migrate</code> to create {{ unmigratedModels() === 1 ? 'it' : 'them' }}.</span>
|
|
143
|
+
</div>
|
|
144
|
+
|
|
135
145
|
<Card padding="none">
|
|
136
146
|
<div class="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between p-5 border-b border-neutral-200 dark:border-neutral-700">
|
|
137
147
|
<div>
|
|
@@ -191,7 +201,8 @@ onMount(() => {
|
|
|
191
201
|
<div>
|
|
192
202
|
<dt class="text-neutral-500 text-xs dark:text-neutral-400">Records</dt>
|
|
193
203
|
<dd :if="model.count !== null" class="mt-1 font-medium text-neutral-900 text-sm dark:text-white">{{ model.count.toLocaleString() }}</dd>
|
|
194
|
-
<dd :if="model.count === null" class="mt-1 font-medium text-amber-700 text-sm dark:text-amber-300">Unavailable</dd>
|
|
204
|
+
<dd :if="model.count === null && model.migrated !== false" class="mt-1 font-medium text-amber-700 text-sm dark:text-amber-300">Unavailable</dd>
|
|
205
|
+
<dd :if="model.migrated === false" class="mt-1 font-medium text-neutral-500 text-sm dark:text-neutral-400">Not migrated</dd>
|
|
195
206
|
</div>
|
|
196
207
|
<div>
|
|
197
208
|
<dt class="text-neutral-500 text-xs dark:text-neutral-400">Attributes</dt>
|
|
@@ -11,6 +11,7 @@ const stats = state<QueueAggregateStats | null>(null)
|
|
|
11
11
|
const queueConnected = state(false)
|
|
12
12
|
const workerRunning = state(false)
|
|
13
13
|
const activeWorkerJobs = state(0)
|
|
14
|
+
const workersMigrated = state(true)
|
|
14
15
|
const isLoading = state(true)
|
|
15
16
|
const isRetrying = state(false)
|
|
16
17
|
const loadError = state('')
|
|
@@ -63,6 +64,7 @@ async function loadQueue(): Promise<void> {
|
|
|
63
64
|
workers.set(workerData.data)
|
|
64
65
|
workerRunning.set(workerData.worker_running)
|
|
65
66
|
activeWorkerJobs.set(workerData.active_jobs)
|
|
67
|
+
workersMigrated.set(workerData.workers_migrated !== false)
|
|
66
68
|
}
|
|
67
69
|
catch (error) {
|
|
68
70
|
loadError.set('Queue data could not be loaded.')
|
|
@@ -134,7 +136,7 @@ onMount(() => {
|
|
|
134
136
|
<div class="flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-neutral-700">
|
|
135
137
|
<div>
|
|
136
138
|
<h2 class="font-semibold text-gray-900 dark:text-white">Queue breakdown</h2>
|
|
137
|
-
<p class="mt-1 text-gray-500 text-sm dark:text-neutral-400">
|
|
139
|
+
<p class="mt-1 text-gray-500 text-sm dark:text-neutral-400">Declared queues and recorded jobs, with totals grouped by queue name.</p>
|
|
138
140
|
</div>
|
|
139
141
|
<p class="text-gray-500 text-sm dark:text-neutral-400">{{ stats()?.throughputPerMinute || 0 }} jobs/min across reporting workers</p>
|
|
140
142
|
</div>
|
|
@@ -159,7 +161,11 @@ onMount(() => {
|
|
|
159
161
|
Retry failed jobs
|
|
160
162
|
</Button>
|
|
161
163
|
</div>
|
|
162
|
-
<div :if="!isLoading() &&
|
|
164
|
+
<div :if="!isLoading() && !workersMigrated()" role="status" class="px-5 py-12 text-center">
|
|
165
|
+
<p class="font-semibold text-gray-900 dark:text-white">Worker telemetry is not set up yet</p>
|
|
166
|
+
<p class="mt-1 text-gray-500 text-sm dark:text-neutral-400">Workers report here through the <code>queue_workers</code> table. Run <code>./buddy migrate</code> to create it.</p>
|
|
167
|
+
</div>
|
|
168
|
+
<div :if="!isLoading() && workersMigrated() && workerRows().length === 0" class="px-5 py-12 text-center">
|
|
163
169
|
<p class="font-semibold text-gray-900 dark:text-white">No workers tracked in this process</p>
|
|
164
170
|
<p class="mt-1 text-gray-500 text-sm dark:text-neutral-400">Start a queue worker to populate heartbeat and processing metrics.</p>
|
|
165
171
|
</div>
|
|
@@ -74,6 +74,8 @@ export interface AppNavSection {
|
|
|
74
74
|
|
|
75
75
|
export interface DiscoveredManifest {
|
|
76
76
|
models: DiscoveredModel[]
|
|
77
|
+
/** Native schema inventory, including private operational models. */
|
|
78
|
+
schemaModels?: string[]
|
|
77
79
|
sections: DashboardSectionToggles
|
|
78
80
|
/** Sections this application declared. Empty for a project that declared none. */
|
|
79
81
|
nav: AppNavSection[]
|
|
@@ -181,11 +183,34 @@ export function parseDiscoveredManifest(source: string): DiscoveredManifest {
|
|
|
181
183
|
|
|
182
184
|
return {
|
|
183
185
|
models,
|
|
186
|
+
...(envelope.schemaModels === undefined ? {} : { schemaModels: normalizeSchemaModels(envelope.schemaModels) }),
|
|
184
187
|
sections: normalizeManifestToggles(envelope.sections),
|
|
185
188
|
nav: normalizeManifestNav(envelope.nav),
|
|
186
189
|
}
|
|
187
190
|
}
|
|
188
191
|
|
|
192
|
+
function normalizeSchemaModels(value: unknown): string[] {
|
|
193
|
+
if (!Array.isArray(value) || value.some(name => typeof name !== 'string'))
|
|
194
|
+
throw new TypeError('manifest schemaModels must be an array of model names')
|
|
195
|
+
return value as string[]
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/** Hide built-in modules whose backing models are outside this app's schema. */
|
|
199
|
+
export function filterSchemaNavSections(sections: Array<[string, string, NavItem[]]>, schemaModels?: readonly string[]): Array<[string, string, NavItem[]]> {
|
|
200
|
+
if (!schemaModels) return sections
|
|
201
|
+
const available = new Set(schemaModels)
|
|
202
|
+
const required: Record<string, string[]> = {
|
|
203
|
+
'/activity': ['Activity'], '/teams': ['Team'], '/subscribers': ['Subscriber'],
|
|
204
|
+
'/releases': ['Release'], '/deployments': ['Deployment'], '/requests': ['Request'],
|
|
205
|
+
'/queries': ['QueryLog'], '/queries/slow': ['QueryLog'], '/queries/history': ['QueryLog'],
|
|
206
|
+
'/errors': ['Error'], '/notifications/dashboard': ['Notification'], '/logs': ['Log'],
|
|
207
|
+
'/management/permissions': ['Role', 'Permission'], '/kanban': ['Board', 'Card', 'Column'],
|
|
208
|
+
}
|
|
209
|
+
return sections.map(([id, label, items]): [string, string, NavItem[]] => [id, label, id.startsWith('app-nav-') ? items : items.filter(item =>
|
|
210
|
+
(required[item.to] ?? []).every(model => available.has(model)))])
|
|
211
|
+
.filter(([, , items]) => items.length > 0)
|
|
212
|
+
}
|
|
213
|
+
|
|
189
214
|
/**
|
|
190
215
|
* App-declared sections are validated at config load; this only has to survive
|
|
191
216
|
* a manifest written by an older framework version, which has no `nav` key.
|
|
@@ -699,7 +724,7 @@ function loadAppNavFromConfig(configPath = resolve(process.cwd(), 'config/dashbo
|
|
|
699
724
|
export function buildWebSidebarSections(): WebSidebarSection[] {
|
|
700
725
|
const manifest = loadDiscoveredManifest()
|
|
701
726
|
const appNav = manifest.nav.length > 0 ? manifest.nav : loadAppNavFromConfig()
|
|
702
|
-
const sections = buildNavSections(manifest.models, manifest.sections, appNav)
|
|
727
|
+
const sections = filterSchemaNavSections(buildNavSections(manifest.models, manifest.sections, appNav), manifest.schemaModels)
|
|
703
728
|
|
|
704
729
|
return [
|
|
705
730
|
{
|
package/routes/dashboard-api.ts
CHANGED
|
@@ -107,6 +107,9 @@ route.group({ prefix: '/api/dashboard', apiResponse: true }, () => {
|
|
|
107
107
|
guard(route.get('/library/components', 'Actions/Dashboard/Library/GetComponents'))
|
|
108
108
|
guard(route.post('/library/components', 'Actions/Dashboard/Library/CreateComponent'))
|
|
109
109
|
if (feature('commerce')) {
|
|
110
|
+
// The products and customers the waitlist dialogs offer, searched (commerce-choices.ts).
|
|
111
|
+
guard(route.get('/commerce/product-choices', 'Actions/Dashboard/Commerce/CommerceProductChoicesAction'))
|
|
112
|
+
guard(route.get('/commerce/customer-choices', 'Actions/Dashboard/Commerce/CommerceCustomerChoicesAction'))
|
|
110
113
|
guard(route.get('/commerce/waitlist-products', 'Actions/Dashboard/Commerce/ProductWaitlistIndexAction'))
|
|
111
114
|
guard(route.post('/commerce/waitlist-products', 'Actions/Commerce/WaitlistProductStoreAction'))
|
|
112
115
|
guard(route.patch('/commerce/waitlist-products/{id}', 'Actions/Commerce/WaitlistProductUpdateAction'))
|
|
@@ -123,6 +126,7 @@ route.group({ prefix: '/api/dashboard', apiResponse: true }, () => {
|
|
|
123
126
|
guard(route.patch('/commerce/coupons/{id}', 'Actions/Commerce/CouponUpdateAction'))
|
|
124
127
|
guard(route.delete('/commerce/coupons/{id}', 'Actions/Commerce/CouponDestroyAction'))
|
|
125
128
|
guard(route.get('/commerce/gift-cards', 'Actions/Dashboard/Commerce/CommerceGiftCardsAction'))
|
|
129
|
+
guard(route.get('/commerce/gift-cards/export', 'Actions/Dashboard/Commerce/CommerceGiftCardsExportAction'))
|
|
126
130
|
guard(route.post('/commerce/gift-cards', 'Actions/Commerce/GiftCardStoreAction'))
|
|
127
131
|
guard(route.patch('/commerce/gift-cards/{id}', 'Actions/Commerce/GiftCardUpdateAction'))
|
|
128
132
|
guard(route.delete('/commerce/gift-cards/{id}', 'Actions/Commerce/GiftCardDestroyAction'))
|
|
@@ -135,12 +139,17 @@ route.group({ prefix: '/api/dashboard', apiResponse: true }, () => {
|
|
|
135
139
|
guard(route.patch('/commerce/customers/{id}', 'Actions/Commerce/CustomerUpdateAction'))
|
|
136
140
|
guard(route.delete('/commerce/customers/{id}', 'Actions/Commerce/CustomerDestroyAction'))
|
|
137
141
|
guard(route.get('/commerce/orders', 'Actions/Dashboard/Commerce/CommerceOrdersAction'))
|
|
142
|
+
guard(route.get('/commerce/orders/export', 'Actions/Dashboard/Commerce/CommerceOrdersExportAction'))
|
|
143
|
+
guard(route.get('/commerce/orders/customers', 'Actions/Dashboard/Commerce/CommerceOrderCustomersAction'))
|
|
138
144
|
guard(route.post('/commerce/orders', 'Actions/Commerce/OrderStoreAction'))
|
|
139
145
|
guard(route.patch('/commerce/orders/{id}', 'Actions/Commerce/OrderUpdateAction'))
|
|
140
146
|
guard(route.delete('/commerce/orders/{id}', 'Actions/Commerce/OrderDestroyAction'))
|
|
141
147
|
guard(route.get('/commerce/pos', 'Actions/Dashboard/Commerce/CommercePosAction'))
|
|
148
|
+
guard(route.get('/commerce/pos/products', 'Actions/Dashboard/Commerce/CommercePosProductsAction'))
|
|
142
149
|
guard(route.post('/commerce/pos/checkout', 'Actions/Dashboard/Commerce/CommercePosCheckoutAction'))
|
|
143
150
|
guard(route.get('/commerce/products', 'Actions/Dashboard/Commerce/CommerceProductsAction'))
|
|
151
|
+
// Before `{id}`, so "export" is never read as a product id.
|
|
152
|
+
guard(route.get('/commerce/products/export', 'Actions/Dashboard/Commerce/CommerceProductsExportAction'))
|
|
144
153
|
guard(route.get('/commerce/products/{id}', 'Actions/Dashboard/Commerce/CommerceProductDetailAction'))
|
|
145
154
|
guard(route.post('/commerce/products', 'Actions/Commerce/Product/ProductStoreAction'))
|
|
146
155
|
guard(route.patch('/commerce/products/{id}', 'Actions/Commerce/Product/ProductUpdateAction'))
|
|
@@ -164,12 +173,14 @@ route.group({ prefix: '/api/dashboard', apiResponse: true }, () => {
|
|
|
164
173
|
guard(route.patch('/commerce/variants/{id}', 'Actions/Commerce/Product/ProductVariantUpdateAction'))
|
|
165
174
|
guard(route.delete('/commerce/variants/{id}', 'Actions/Commerce/Product/ProductVariantDestroyAction'))
|
|
166
175
|
guard(route.get('/commerce/payments', 'Actions/Dashboard/Commerce/CommercePaymentsAction'))
|
|
176
|
+
guard(route.get('/commerce/payments/export', 'Actions/Dashboard/Commerce/CommercePaymentsExportAction'))
|
|
167
177
|
guard(route.post('/commerce/payments/{id}/refund', 'Actions/Dashboard/Commerce/PaymentRefundAction'))
|
|
168
178
|
guard(route.get('/commerce/print-devices', 'Actions/Dashboard/Commerce/CommercePrintDevicesAction'))
|
|
169
179
|
guard(route.post('/commerce/print-devices', 'Actions/Commerce/PrintDeviceStoreAction'))
|
|
170
180
|
guard(route.patch('/commerce/print-devices/{id}', 'Actions/Commerce/PrintDeviceUpdateAction'))
|
|
171
181
|
guard(route.delete('/commerce/print-devices/{id}', 'Actions/Commerce/PrintDeviceDestroyAction'))
|
|
172
182
|
guard(route.get('/commerce/print-logs', 'Actions/Dashboard/Commerce/CommercePrintLogsAction'))
|
|
183
|
+
guard(route.get('/commerce/print-logs/export', 'Actions/Dashboard/Commerce/CommercePrintLogsExportAction'))
|
|
173
184
|
guard(route.delete('/commerce/print-logs/{id}', 'Actions/Commerce/ReceiptDestroyAction'))
|
|
174
185
|
}
|
|
175
186
|
guard(route.get('/deployments', 'Actions/Dashboard/Deployments/GetDeployments'))
|
|
@@ -126,6 +126,10 @@ export const kanbanStore = defineStore('kanban', () => {
|
|
|
126
126
|
const loading = state(true)
|
|
127
127
|
const loadingBoard = state(false)
|
|
128
128
|
const error = state<string | null>(null)
|
|
129
|
+
// Why the last board delete failed. Kept apart from `error`, which means the
|
|
130
|
+
// board list could not load: a failed delete used to replace the whole list
|
|
131
|
+
// with "Couldn't load boards" (stacksjs/stacks#3217).
|
|
132
|
+
const deleteError = state<string | null>(null)
|
|
129
133
|
const errorBoard = state<string | null>(null)
|
|
130
134
|
|
|
131
135
|
// Card detail modal state. Holding card + comments here
|
|
@@ -137,8 +141,13 @@ export const kanbanStore = defineStore('kanban', () => {
|
|
|
137
141
|
const openCard = state<CardDetail | null>(null)
|
|
138
142
|
const loadingCard = state(false)
|
|
139
143
|
const errorCard = state<string | null>(null)
|
|
144
|
+
// The assignee picker's users: one bounded page of a server-side search
|
|
145
|
+
// (stacksjs/stacks#3216), and how many users matched it.
|
|
140
146
|
const users = state<UserSummary[]>([])
|
|
147
|
+
const usersTotal = state(0)
|
|
148
|
+
const userSearch = state('')
|
|
141
149
|
const loadingUsers = state(false)
|
|
150
|
+
let usersRequest = 0
|
|
142
151
|
|
|
143
152
|
const hasBoards = derived(() => boards().length > 0)
|
|
144
153
|
|
|
@@ -224,6 +233,7 @@ export const kanbanStore = defineStore('kanban', () => {
|
|
|
224
233
|
|
|
225
234
|
async function deleteBoard(id: number): Promise<boolean> {
|
|
226
235
|
const snapshot = boards()
|
|
236
|
+
deleteError.set(null)
|
|
227
237
|
// Optimistic remove.
|
|
228
238
|
boards.set(snapshot.filter(b => b.id !== id))
|
|
229
239
|
try {
|
|
@@ -232,7 +242,7 @@ export const kanbanStore = defineStore('kanban', () => {
|
|
|
232
242
|
}
|
|
233
243
|
catch (e) {
|
|
234
244
|
boards.set(snapshot)
|
|
235
|
-
|
|
245
|
+
deleteError.set(e instanceof Error ? e.message : String(e))
|
|
236
246
|
return false
|
|
237
247
|
}
|
|
238
248
|
}
|
|
@@ -491,18 +501,37 @@ export const kanbanStore = defineStore('kanban', () => {
|
|
|
491
501
|
}
|
|
492
502
|
}
|
|
493
503
|
|
|
494
|
-
|
|
495
|
-
|
|
504
|
+
/**
|
|
505
|
+
* The users matching `search` (name or email, ignoring case), newest request
|
|
506
|
+
* wins. It used to load the first 500 by name once and never search, so
|
|
507
|
+
* anyone past the 500th could not be assigned.
|
|
508
|
+
*/
|
|
509
|
+
async function loadUsers(search = ''): Promise<void> {
|
|
510
|
+
const term = search.trim()
|
|
511
|
+
userSearch.set(term)
|
|
512
|
+
const request = ++usersRequest
|
|
496
513
|
loadingUsers.set(true)
|
|
497
514
|
try {
|
|
498
|
-
const
|
|
515
|
+
const params = new URLSearchParams()
|
|
516
|
+
if (term)
|
|
517
|
+
params.set('q', term)
|
|
518
|
+
const suffix = params.toString()
|
|
519
|
+
const data = await dashboardApi<{ users?: UserSummary[], total?: number }>(`/api/dashboard/kanban/users${suffix ? `?${suffix}` : ''}`)
|
|
520
|
+
if (request !== usersRequest)
|
|
521
|
+
return
|
|
499
522
|
users.set(data.users ?? [])
|
|
523
|
+
usersTotal.set(data.total ?? (data.users?.length ?? 0))
|
|
500
524
|
}
|
|
501
525
|
catch {
|
|
502
|
-
// Soft-fail
|
|
526
|
+
// Soft-fail: the picker shows no users rather than an error.
|
|
527
|
+
if (request === usersRequest) {
|
|
528
|
+
users.set([])
|
|
529
|
+
usersTotal.set(0)
|
|
530
|
+
}
|
|
503
531
|
}
|
|
504
532
|
finally {
|
|
505
|
-
|
|
533
|
+
if (request === usersRequest)
|
|
534
|
+
loadingUsers.set(false)
|
|
506
535
|
}
|
|
507
536
|
}
|
|
508
537
|
|
|
@@ -700,6 +729,7 @@ export const kanbanStore = defineStore('kanban', () => {
|
|
|
700
729
|
loading,
|
|
701
730
|
loadingBoard,
|
|
702
731
|
error,
|
|
732
|
+
deleteError,
|
|
703
733
|
errorBoard,
|
|
704
734
|
hasBoards,
|
|
705
735
|
loadBoards,
|
|
@@ -717,6 +747,8 @@ export const kanbanStore = defineStore('kanban', () => {
|
|
|
717
747
|
loadingCard,
|
|
718
748
|
errorCard,
|
|
719
749
|
users,
|
|
750
|
+
usersTotal,
|
|
751
|
+
userSearch,
|
|
720
752
|
loadingUsers,
|
|
721
753
|
openCardDetail,
|
|
722
754
|
closeCardDetail,
|