@stacksjs/defaults 0.75.529 → 0.75.535
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-build/SKILL.md +1 -1
- package/ai/skills/stacks-dashboard/SKILL.md +2 -2
- package/ai/skills/stacks-database/SKILL.md +1 -1
- package/ai/skills/stacks-migrations/SKILL.md +2 -2
- package/ai/skills/stacks-native/CATALOG.md +4 -4
- package/app/Actions/Dashboard/Commerce/CommerceCouponsAction.ts +27 -15
- package/app/Actions/Dashboard/Commerce/CommerceCouponsExportAction.ts +45 -0
- package/app/Actions/Dashboard/Commerce/CommerceCustomersAction.ts +22 -12
- package/app/Actions/Dashboard/Commerce/CommerceCustomersExportAction.ts +44 -0
- package/app/Actions/Dashboard/Commerce/CommercePosCheckoutAction.ts +9 -29
- package/app/Actions/Dashboard/Commerce/CommercePrintDevicesAction.ts +7 -9
- package/app/Actions/Dashboard/Commerce/CommerceProductDetailAction.ts +9 -8
- package/app/Actions/Dashboard/Commerce/CommerceTaxesAction.ts +7 -9
- package/app/Actions/Dashboard/Commerce/ManufacturerIndexAction.ts +8 -20
- package/app/Actions/Dashboard/Commerce/commerce-coupon-list.test.ts +203 -0
- package/app/Actions/Dashboard/Commerce/commerce-coupon-list.ts +248 -0
- package/app/Actions/Dashboard/Commerce/commerce-customer-list.test.ts +183 -0
- package/app/Actions/Dashboard/Commerce/commerce-customer-list.ts +186 -0
- package/app/Actions/Dashboard/Commerce/commerce-customer-records.test.ts +1 -34
- package/app/Actions/Dashboard/Commerce/commerce-customer-records.ts +0 -11
- package/app/Actions/Dashboard/Commerce/commerce-manufacturer-list.test.ts +118 -0
- package/app/Actions/Dashboard/Commerce/commerce-manufacturer-list.ts +41 -0
- package/app/Actions/Dashboard/Commerce/commerce-pos-catalog.test.ts +17 -5
- package/app/Actions/Dashboard/Commerce/commerce-pos-catalog.ts +17 -3
- package/app/Actions/Dashboard/Commerce/commerce-print-device-list.test.ts +99 -0
- package/app/Actions/Dashboard/Commerce/commerce-print-device-list.ts +18 -0
- package/app/Actions/Dashboard/Commerce/commerce-product-list.ts +5 -5
- package/app/Actions/Dashboard/Commerce/commerce-product-options.test.ts +81 -0
- package/app/Actions/Dashboard/Commerce/commerce-tax-rate-list.test.ts +99 -0
- package/app/Actions/Dashboard/Commerce/commerce-tax-rate-list.ts +18 -0
- package/app/Actions/Dashboard/Commerce/coupon-records.test.ts +1 -16
- package/app/Actions/Dashboard/Commerce/coupon-records.ts +6 -10
- package/app/Actions/Dashboard/Commerce/manufacturer-records.test.ts +5 -17
- package/app/Actions/Dashboard/Commerce/manufacturer-records.ts +0 -29
- package/app/Actions/Dashboard/Email/captured-mail.test.ts +16 -0
- package/app/Actions/Dashboard/Email/captured-mail.ts +9 -1
- package/app/Actions/Dashboard/Models/model-write.ts +36 -3
- package/app/Actions/Dashboard/Notifications/NotificationDeliveryHistoryAction.ts +13 -58
- package/app/Actions/Dashboard/Notifications/notification-delivery-history.ts +74 -0
- package/app/Actions/SitemapAction.ts +3 -1
- package/app/Models/Notification.ts +3 -1
- package/app/Models/NotificationDelivery.ts +4 -0
- package/app/Models/User.ts +10 -1
- package/bootstrap.ts +10 -2
- package/functions/commerce/tax-types.ts +21 -0
- package/functions/dashboard-list.test.ts +16 -0
- package/functions/dashboard-list.ts +14 -6
- package/functions/dashboard-model-record.test.ts +139 -0
- package/functions/dashboard-model-record.ts +353 -0
- package/functions/monitoring/errors.ts +22 -103
- package/functions/notifications/deliveries.ts +7 -38
- package/functions/queries.ts +7 -10
- package/ide/vscode/package.json +1 -1
- package/package.json +5 -5
- package/resources/components/Dashboard/Analytics/AnalyticsHub.stx +2 -2
- package/resources/components/Dashboard/Analytics/CampaignAnalytics.stx +22 -28
- package/resources/components/Dashboard/Analytics/EventAnalytics.stx +26 -34
- package/resources/components/Dashboard/Analytics/SalesAnalytics.stx +29 -37
- package/resources/components/Dashboard/Analytics/WebAnalyticsBreakdown.stx +12 -16
- package/resources/components/Dashboard/Analytics/WebAnalyticsDashboard.stx +43 -53
- package/resources/components/Dashboard/App/RequestsOverview.stx +2 -1
- package/resources/components/Dashboard/App/SourceInventory.stx +2 -1
- package/resources/components/Dashboard/Auth/AccessTokens.stx +3 -5
- package/resources/components/Dashboard/Billing/BillingPaymentMethodsPanel.stx +9 -11
- package/resources/components/Dashboard/Billing/BillingSettings.stx +1 -1
- package/resources/components/Dashboard/Buddy/BuddyAssistant.stx +4 -6
- package/resources/components/Dashboard/Commerce/CommerceCategoriesDashboard.stx +2 -2
- package/resources/components/Dashboard/Commerce/CommerceCategoriesTable.stx +3 -3
- package/resources/components/Dashboard/Commerce/CommerceCategoryDialog.stx +2 -2
- package/resources/components/Dashboard/Commerce/CommerceCategoryHierarchy.stx +3 -5
- package/resources/components/Dashboard/Commerce/CommerceCouponBreakdown.stx +17 -13
- package/resources/components/Dashboard/Commerce/CommerceCouponDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommerceCouponsDashboard.stx +57 -85
- package/resources/components/Dashboard/Commerce/CommerceCouponsTable.stx +32 -9
- package/resources/components/Dashboard/Commerce/CommerceCustomerDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommerceCustomersDashboard.stx +49 -83
- package/resources/components/Dashboard/Commerce/CommerceCustomersTable.stx +32 -9
- package/resources/components/Dashboard/Commerce/CommerceGiftCardBreakdown.stx +9 -15
- package/resources/components/Dashboard/Commerce/CommerceGiftCardDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommerceGiftCardsDashboard.stx +35 -119
- package/resources/components/Dashboard/Commerce/CommerceGiftCardsTable.stx +3 -3
- package/resources/components/Dashboard/Commerce/CommerceManufacturerDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommerceManufacturersDashboard.stx +3 -5
- package/resources/components/Dashboard/Commerce/CommerceManufacturersTable.stx +2 -2
- package/resources/components/Dashboard/Commerce/CommerceOrderDialog.stx +4 -4
- package/resources/components/Dashboard/Commerce/CommerceOrdersDashboard.stx +42 -129
- package/resources/components/Dashboard/Commerce/CommerceOrdersTable.stx +3 -3
- package/resources/components/Dashboard/Commerce/CommerceOverviewDashboard.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommerceOverviewOrdersTable.stx +9 -11
- package/resources/components/Dashboard/Commerce/CommerceOverviewProductsTable.stx +5 -7
- package/resources/components/Dashboard/Commerce/CommerceOverviewStats.stx +14 -16
- package/resources/components/Dashboard/Commerce/CommercePaymentsBreakdown.stx +12 -18
- package/resources/components/Dashboard/Commerce/CommercePaymentsDashboard.stx +41 -120
- package/resources/components/Dashboard/Commerce/CommercePaymentsTable.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommercePosCart.stx +13 -15
- package/resources/components/Dashboard/Commerce/CommercePosCatalog.stx +17 -19
- package/resources/components/Dashboard/Commerce/CommercePosCheckoutDialog.stx +2 -2
- package/resources/components/Dashboard/Commerce/CommercePosDashboard.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommercePosReceiptDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommerceProductDetailDashboard.stx +5 -5
- package/resources/components/Dashboard/Commerce/CommerceProductDialog.stx +3 -3
- package/resources/components/Dashboard/Commerce/CommerceProductsDashboard.stx +41 -122
- package/resources/components/Dashboard/Commerce/CommerceProductsTable.stx +3 -3
- package/resources/components/Dashboard/Commerce/CommerceReviewEditDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommerceReviewsDashboard.stx +38 -122
- package/resources/components/Dashboard/Commerce/CommerceReviewsTable.stx +2 -2
- package/resources/components/Dashboard/Commerce/CommerceTaxDialog.stx +3 -3
- package/resources/components/Dashboard/Commerce/CommerceTaxesDashboard.stx +5 -4
- package/resources/components/Dashboard/Commerce/CommerceTaxesTable.stx +4 -3
- package/resources/components/Dashboard/Commerce/CommerceUnitDialog.stx +3 -7
- package/resources/components/Dashboard/Commerce/CommerceUnitsDashboard.stx +3 -5
- package/resources/components/Dashboard/Commerce/CommerceUnitsTable.stx +2 -2
- package/resources/components/Dashboard/Commerce/CommerceVariantDialog.stx +3 -3
- package/resources/components/Dashboard/Commerce/CommerceVariantsDashboard.stx +4 -4
- package/resources/components/Dashboard/Commerce/CommerceVariantsTable.stx +3 -5
- package/resources/components/Dashboard/Commerce/Delivery/CourierDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/Delivery/CouriersDashboard.stx +1 -1
- package/resources/components/Dashboard/Commerce/Delivery/CouriersTable.stx +2 -2
- package/resources/components/Dashboard/Commerce/Delivery/DeliveryOverviewDashboard.stx +44 -52
- package/resources/components/Dashboard/Commerce/Delivery/DeliveryPagination.stx +2 -2
- package/resources/components/Dashboard/Commerce/Delivery/DeliveryRouteDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/Delivery/DeliveryRoutesDashboard.stx +1 -1
- package/resources/components/Dashboard/Commerce/Delivery/DeliveryRoutesTable.stx +2 -2
- package/resources/components/Dashboard/Commerce/Delivery/DigitalDeliveriesDashboard.stx +1 -1
- package/resources/components/Dashboard/Commerce/Delivery/DigitalDeliveryTable.stx +2 -2
- package/resources/components/Dashboard/Commerce/Delivery/LicenseKeyDialog.stx +3 -3
- package/resources/components/Dashboard/Commerce/Delivery/LicenseKeysDashboard.stx +1 -1
- package/resources/components/Dashboard/Commerce/Delivery/LicenseKeysTable.stx +2 -2
- package/resources/components/Dashboard/Commerce/Delivery/ShippingMethodsDashboard.stx +1 -1
- package/resources/components/Dashboard/Commerce/Delivery/ShippingMethodsTable.stx +2 -2
- package/resources/components/Dashboard/Commerce/Delivery/ShippingRateDialog.stx +2 -2
- package/resources/components/Dashboard/Commerce/Delivery/ShippingRatesDashboard.stx +1 -1
- package/resources/components/Dashboard/Commerce/Delivery/ShippingRatesTable.stx +2 -2
- package/resources/components/Dashboard/Commerce/Delivery/ShippingZoneDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/Delivery/ShippingZonesDashboard.stx +1 -1
- package/resources/components/Dashboard/Commerce/Delivery/ShippingZonesTable.stx +4 -8
- package/resources/components/Dashboard/Commerce/PaymentDetailsDialog.stx +1 -3
- package/resources/components/Dashboard/Commerce/PrintDeviceBreakdown.stx +9 -15
- package/resources/components/Dashboard/Commerce/PrintDeviceDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/PrintDevicesDashboard.stx +3 -3
- package/resources/components/Dashboard/Commerce/PrintDevicesTable.stx +3 -3
- package/resources/components/Dashboard/Commerce/PrintLogBreakdown.stx +3 -9
- package/resources/components/Dashboard/Commerce/PrintLogDetailsDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/PrintLogsDashboard.stx +4 -4
- package/resources/components/Dashboard/Commerce/PrintLogsTable.stx +8 -10
- package/resources/components/Dashboard/Commerce/ProductWaitlistDashboard.stx +37 -109
- package/resources/components/Dashboard/Commerce/ProductWaitlistEntryDialog.stx +3 -3
- package/resources/components/Dashboard/Commerce/ProductWaitlistTable.stx +2 -2
- package/resources/components/Dashboard/Commerce/RestaurantWaitlistDashboard.stx +38 -112
- package/resources/components/Dashboard/Commerce/RestaurantWaitlistEntryDialog.stx +2 -2
- package/resources/components/Dashboard/Commerce/RestaurantWaitlistTable.stx +2 -2
- package/resources/components/Dashboard/Content/AuthorsDashboard.stx +4 -4
- package/resources/components/Dashboard/Content/BlogDashboard.stx +4 -4
- package/resources/components/Dashboard/Content/CommentsDashboard.stx +36 -83
- package/resources/components/Dashboard/Content/ContentDashboard.stx +12 -14
- package/resources/components/Dashboard/Content/ContentTaxonomyDashboard.stx +2 -2
- package/resources/components/Dashboard/Content/FileManagerDashboard.stx +8 -12
- package/resources/components/Dashboard/Content/FileStoragePanel.stx +6 -10
- package/resources/components/Dashboard/Content/FileUploadDialog.stx +1 -3
- package/resources/components/Dashboard/Content/PagesDashboard.stx +39 -78
- package/resources/components/Dashboard/Content/PostEditorDialog.stx +4 -8
- package/resources/components/Dashboard/Content/PostsDashboard.stx +44 -85
- package/resources/components/Dashboard/Content/SeoDashboard.stx +5 -4
- package/resources/components/Dashboard/Data/DataRecords.stx +140 -12
- package/resources/components/Dashboard/Deployments/DeploymentList.stx +4 -4
- package/resources/components/Dashboard/Deployments/DeploymentTable.stx +3 -1
- package/resources/components/Dashboard/Elements/DropdownNavigation.stx +5 -7
- package/resources/components/Dashboard/Email/CapturedMailDashboard.stx +1 -3
- package/resources/components/Dashboard/Email/CapturedMailList.stx +18 -20
- package/resources/components/Dashboard/Email/EmailActivityDashboard.stx +24 -28
- package/resources/components/Dashboard/Email/EmailSettingsList.stx +6 -8
- package/resources/components/Dashboard/Email/EmailSettingsNavigation.stx +10 -12
- package/resources/components/Dashboard/Email/EmailSidebar.stx +33 -37
- package/resources/components/Dashboard/Email/InboxMessageDetail.stx +1 -1
- package/resources/components/Dashboard/Email/InboxMessageList.stx +16 -18
- package/resources/components/Dashboard/Email/InboxSettingsDashboard.stx +1 -1
- package/resources/components/Dashboard/Environment/EnvironmentDashboard.stx +2 -2
- package/resources/components/Dashboard/GlobalSearch.stx +19 -21
- package/resources/components/Dashboard/Home/DashboardHome.stx +8 -1
- package/resources/components/Dashboard/Infrastructure/CloudDashboard.stx +1 -1
- package/resources/components/Dashboard/Infrastructure/DnsDashboard.stx +27 -13
- package/resources/components/Dashboard/Infrastructure/LogsDashboard.stx +1 -1
- package/resources/components/Dashboard/Infrastructure/MailboxesDashboard.stx +46 -8
- package/resources/components/Dashboard/Infrastructure/ServerlessDashboard.stx +1 -1
- package/resources/components/Dashboard/Infrastructure/ServersDashboard.stx +1 -1
- package/resources/components/Dashboard/Jobs/JobDetail.stx +1 -1
- package/resources/components/Dashboard/Jobs/JobHistory.stx +44 -57
- package/resources/components/Dashboard/Jobs/JobTable.stx +23 -25
- package/resources/components/Dashboard/Kanban/KanbanCardDialog.stx +1 -1
- package/resources/components/Dashboard/Library/ComponentsDashboard.stx +1 -1
- package/resources/components/Dashboard/Management/AssignmentDrawer.stx +5 -7
- package/resources/components/Dashboard/Management/PermissionsDashboard.stx +35 -43
- package/resources/components/Dashboard/Marketing/AbandonedCartsDashboard.stx +11 -13
- package/resources/components/Dashboard/Marketing/CampaignDialog.stx +1 -3
- package/resources/components/Dashboard/Marketing/CampaignsDashboard.stx +2 -2
- package/resources/components/Dashboard/Marketing/CampaignsTable.stx +2 -2
- package/resources/components/Dashboard/Marketing/MarketingListsDashboard.stx +1 -1
- package/resources/components/Dashboard/Marketing/MarketingListsTable.stx +2 -2
- package/resources/components/Dashboard/Marketing/SocialPostDialog.stx +1 -3
- package/resources/components/Dashboard/Marketing/SocialPostsDashboard.stx +2 -2
- package/resources/components/Dashboard/Marketing/SocialPostsTable.stx +2 -2
- package/resources/components/Dashboard/Models/ModelRecordActions.stx +11 -2
- package/resources/components/Dashboard/Models/ModelRecordCreate.stx +193 -0
- package/resources/components/Dashboard/Models/ModelRecordDetail.stx +144 -0
- package/resources/components/Dashboard/Models/ModelRecordEdit.stx +176 -0
- package/resources/components/Dashboard/Models/ModelRecordsDashboard.stx +52 -186
- package/resources/components/Dashboard/Models/ModelsOverview.stx +2 -4
- package/resources/components/Dashboard/Monitoring/ErrorDashboard.stx +47 -81
- package/resources/components/Dashboard/Monitoring/ErrorTable.stx +4 -2
- package/resources/components/Dashboard/NotFoundDashboard.stx +4 -4
- package/resources/components/Dashboard/Notifications/NotificationDeliveryHistory.stx +43 -77
- package/resources/components/Dashboard/Notifications/NotificationDeliveryOverview.stx +15 -17
- package/resources/components/Dashboard/Notifications/NotificationDeliveryTable.stx +1 -1
- package/resources/components/Dashboard/Operations/AuditDashboard.stx +1 -1
- package/resources/components/Dashboard/Operations/ChangeDashboard.stx +1 -1
- package/resources/components/Dashboard/Operations/IncidentDashboard.stx +1 -1
- package/resources/components/Dashboard/Operations/MigrationDashboard.stx +2 -2
- package/resources/components/Dashboard/Operations/RecoveryDashboard.stx +1 -1
- package/resources/components/Dashboard/Operations/SchedulerDashboard.stx +1 -1
- package/resources/components/Dashboard/Queries/QueryDashboard.stx +60 -86
- package/resources/components/Dashboard/Queries/QueryDetail.stx +5 -9
- package/resources/components/Dashboard/Realtime/RealtimeDashboard.stx +6 -8
- package/resources/components/Dashboard/Remote/RemoteConsole.stx +14 -20
- package/resources/components/Dashboard/Settings/AppearanceSettingsDashboard.stx +48 -54
- package/resources/components/Dashboard/Settings/MailSettingsDashboard.stx +8 -8
- package/resources/components/Dashboard/Settings/SettingsDashboard.stx +43 -47
- package/resources/components/Dashboard/Teams/TeamInvitationDashboard.stx +2 -2
- package/resources/components/Dashboard/UI/ActivityTable.stx +2 -1
- package/resources/components/Dashboard/UI/Button.stx +15 -0
- package/resources/components/Dashboard/UI/MetricCards.stx +5 -7
- package/resources/components/Dashboard/UI/Pagination.stx +3 -5
- package/resources/components/Dashboard/UI/QuickLinks.stx +2 -2
- package/resources/components/Dashboard/UI/Select.stx +1 -0
- package/resources/components/Dashboard/UI/Table.stx +139 -96
- package/resources/components/Dashboard/UI/Tabs.stx +18 -20
- package/routes/dashboard-api.ts +2 -0
- package/routes/dashboard.ts +246 -253
- package/routes/storefront.ts +31 -0
- package/stx-components-plugin.ts +12 -1
- package/views/dashboard/content/categories/index.stx +1 -1
- package/views/dashboard/content/tags/index.stx +1 -1
- package/views/dashboard/layouts/default.stx +27 -12
- package/views/dashboard/models/[model]/[id]/edit.stx +8 -0
- package/views/dashboard/models/[model]/[id].stx +8 -0
- package/views/dashboard/models/[model]/create.stx +8 -0
- package/resources/components/Dashboard/CreateRecordModal.stx +0 -138
- package/resources/components/Dashboard/Models/EditRecordModal.stx +0 -81
|
@@ -4,102 +4,74 @@ import type {
|
|
|
4
4
|
NotificationDeliveryChannel,
|
|
5
5
|
NotificationDeliveryStatus,
|
|
6
6
|
} from '../../../../functions/notifications/deliveries'
|
|
7
|
+
import { useServerList } from '../../../../functions/dashboard-list'
|
|
7
8
|
import {
|
|
8
9
|
fetchNotificationDeliveryHistory,
|
|
9
10
|
retryNotificationDelivery,
|
|
10
11
|
} from '../../../../functions/notifications/deliveries'
|
|
12
|
+
import { pushToast } from '../../../../functions/toasts'
|
|
13
|
+
|
|
14
|
+
type DeliverySort = 'sent_at' | 'recipient' | 'channel' | 'status' | 'id'
|
|
11
15
|
|
|
12
|
-
const deliveries = state<NotificationDelivery[]>([])
|
|
13
|
-
const currentPage = state(1)
|
|
14
|
-
const perPage = state(20)
|
|
15
|
-
const totalItems = state(0)
|
|
16
|
-
const totalPages = state(1)
|
|
17
|
-
const isLoading = state(true)
|
|
18
|
-
const searchQuery = state('')
|
|
19
|
-
const appliedSearch = state('')
|
|
20
16
|
const selectedChannel = state<NotificationDeliveryChannel | 'all'>('all')
|
|
21
17
|
const selectedStatus = state<NotificationDeliveryStatus | 'all'>('all')
|
|
22
|
-
const sortField = state<
|
|
18
|
+
const sortField = state<DeliverySort>('sent_at')
|
|
23
19
|
const sortDirection = state<'asc' | 'desc'>('desc')
|
|
24
20
|
const selectedDelivery = state<NotificationDelivery | null>(null)
|
|
25
21
|
const showDetails = state(false)
|
|
26
22
|
const retryingId = state<number | null>(null)
|
|
27
23
|
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
// The server searches, filters, sorts and pages; useServerList keeps the
|
|
25
|
+
// request order, paging and search debounce this page used to keep itself.
|
|
26
|
+
// The sort select and direction toggle are the order, so a change to either
|
|
27
|
+
// asks for page 1.
|
|
28
|
+
const {
|
|
29
|
+
records: deliveries,
|
|
30
|
+
total: totalItems,
|
|
31
|
+
page: currentPage,
|
|
32
|
+
perPage,
|
|
33
|
+
search: searchQuery,
|
|
34
|
+
loading: isLoading,
|
|
35
|
+
load,
|
|
36
|
+
changePage,
|
|
37
|
+
} = useServerList<NotificationDelivery>({
|
|
38
|
+
fetch: async (query) => {
|
|
39
|
+
const result = await fetchNotificationDeliveryHistory(query)
|
|
40
|
+
return { records: result.deliveries, total: result.pagination.total, page: result.pagination.page }
|
|
41
|
+
},
|
|
42
|
+
defaultSort: () => ({ sort: sortField(), direction: sortDirection() }),
|
|
43
|
+
filters: () => ({ channel: selectedChannel(), status: selectedStatus() }),
|
|
44
|
+
perPage: 20,
|
|
45
|
+
searchParam: 'search',
|
|
46
|
+
onError: error => pushToast('error', 'Could not load notification delivery history', { detail: error instanceof Error ? error.message : String(error) }),
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
const totalPages = derived(() => Math.max(1, Math.ceil(totalItems() / perPage())))
|
|
30
50
|
const rangeStart = derived(() => totalItems() === 0 ? 0 : (currentPage() - 1) * perPage() + 1)
|
|
31
51
|
const rangeEnd = derived(() => Math.min(currentPage() * perPage(), totalItems()))
|
|
32
52
|
const canGoBack = derived(() => currentPage() > 1)
|
|
33
53
|
const canGoForward = derived(() => currentPage() < totalPages())
|
|
34
54
|
|
|
35
|
-
async function loadHistory(): Promise<void> {
|
|
36
|
-
requestController?.abort()
|
|
37
|
-
const controller = new AbortController()
|
|
38
|
-
requestController = controller
|
|
39
|
-
isLoading.set(true)
|
|
40
|
-
|
|
41
|
-
const result = await fetchNotificationDeliveryHistory({
|
|
42
|
-
page: currentPage(),
|
|
43
|
-
perPage: perPage(),
|
|
44
|
-
channel: selectedChannel(),
|
|
45
|
-
status: selectedStatus(),
|
|
46
|
-
search: appliedSearch(),
|
|
47
|
-
sort: sortField(),
|
|
48
|
-
direction: sortDirection(),
|
|
49
|
-
signal: controller.signal,
|
|
50
|
-
})
|
|
51
|
-
|
|
52
|
-
if (controller.signal.aborted)
|
|
53
|
-
return
|
|
54
|
-
|
|
55
|
-
if (result) {
|
|
56
|
-
deliveries.set(result.deliveries)
|
|
57
|
-
totalItems.set(result.pagination.total)
|
|
58
|
-
totalPages.set(result.pagination.total_pages)
|
|
59
|
-
}
|
|
60
|
-
isLoading.set(false)
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function applySearch(): void {
|
|
64
|
-
appliedSearch.set(searchQuery().trim())
|
|
65
|
-
currentPage.set(1)
|
|
66
|
-
void loadHistory()
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
function applyFilters(): void {
|
|
70
|
-
currentPage.set(1)
|
|
71
|
-
void loadHistory()
|
|
72
|
-
}
|
|
73
|
-
|
|
74
55
|
function resetFilters(): void {
|
|
75
56
|
searchQuery.set('')
|
|
76
|
-
appliedSearch.set('')
|
|
77
57
|
selectedChannel.set('all')
|
|
78
58
|
selectedStatus.set('all')
|
|
79
59
|
sortField.set('sent_at')
|
|
80
60
|
sortDirection.set('desc')
|
|
81
|
-
currentPage.set(1)
|
|
82
|
-
void loadHistory()
|
|
83
61
|
}
|
|
84
62
|
|
|
85
63
|
function toggleSortDirection(): void {
|
|
86
64
|
sortDirection.set(sortDirection() === 'asc' ? 'desc' : 'asc')
|
|
87
|
-
currentPage.set(1)
|
|
88
|
-
void loadHistory()
|
|
89
65
|
}
|
|
90
66
|
|
|
91
67
|
function previousPage(): void {
|
|
92
|
-
if (
|
|
93
|
-
|
|
94
|
-
currentPage.update(page => page - 1)
|
|
95
|
-
void loadHistory()
|
|
68
|
+
if (canGoBack())
|
|
69
|
+
changePage(currentPage() - 1)
|
|
96
70
|
}
|
|
97
71
|
|
|
98
72
|
function nextPage(): void {
|
|
99
|
-
if (
|
|
100
|
-
|
|
101
|
-
currentPage.update(page => page + 1)
|
|
102
|
-
void loadHistory()
|
|
73
|
+
if (canGoForward())
|
|
74
|
+
changePage(currentPage() + 1)
|
|
103
75
|
}
|
|
104
76
|
|
|
105
77
|
/**
|
|
@@ -126,12 +98,11 @@ async function retryDelivery(event: NotificationDelivery | CustomEvent<Notificat
|
|
|
126
98
|
retryingId.set(delivery.id)
|
|
127
99
|
const retried = await retryNotificationDelivery(delivery)
|
|
128
100
|
if (retried)
|
|
129
|
-
await
|
|
101
|
+
await load()
|
|
130
102
|
retryingId.set(null)
|
|
131
103
|
}
|
|
132
104
|
|
|
133
|
-
onMount(
|
|
134
|
-
onDestroy(() => requestController?.abort())
|
|
105
|
+
onMount(load)
|
|
135
106
|
</script>
|
|
136
107
|
|
|
137
108
|
<section class="py-4 lg:py-8 min-h-screen dark:bg-neutral-800">
|
|
@@ -150,19 +121,14 @@ onDestroy(() => requestController?.abort())
|
|
|
150
121
|
</StxLink>
|
|
151
122
|
</div>
|
|
152
123
|
|
|
153
|
-
<
|
|
124
|
+
<div class="grid gap-3 grid-cols-1 md:grid-cols-2 xl:grid-cols-6 mt-6">
|
|
154
125
|
<label class="xl:col-span-2">
|
|
155
126
|
<span class="sr-only">Search notification history</span>
|
|
156
|
-
<
|
|
157
|
-
<input x-model.trim="searchQuery" type="search" placeholder="Search recipient or content..." class="block px-3 py-2 w-full text-gray-900 text-sm dark:text-neutral-100 placeholder:text-gray-400 dark:bg-neutral-700 border-0 ring-1 ring-gray-300 ring-inset rounded-l-md dark:ring-neutral-600 focus:ring-2 focus:ring-blue-600 focus:ring-inset" />
|
|
158
|
-
<Button type="submit">
|
|
159
|
-
Search
|
|
160
|
-
</Button>
|
|
161
|
-
</span>
|
|
127
|
+
<input x-model="searchQuery" type="search" placeholder="Search recipient or content..." class="block px-3 py-2 w-full text-gray-900 text-sm dark:text-neutral-100 placeholder:text-gray-400 dark:bg-neutral-700 border-0 ring-1 ring-gray-300 ring-inset rounded-md dark:ring-neutral-600 focus:ring-2 focus:ring-blue-600 focus:ring-inset" />
|
|
162
128
|
</label>
|
|
163
129
|
<label>
|
|
164
130
|
<span class="sr-only">Channel</span>
|
|
165
|
-
<select x-model="selectedChannel" class="block px-3 py-2 w-full text-gray-900 text-sm dark:text-neutral-100 dark:bg-neutral-700 border-0 ring-1 ring-gray-300 ring-inset rounded-md dark:ring-neutral-600 focus:ring-2 focus:ring-blue-600"
|
|
131
|
+
<select x-model="selectedChannel" class="block px-3 py-2 w-full text-gray-900 text-sm dark:text-neutral-100 dark:bg-neutral-700 border-0 ring-1 ring-gray-300 ring-inset rounded-md dark:ring-neutral-600 focus:ring-2 focus:ring-blue-600">
|
|
166
132
|
<option value="all">All Channels</option>
|
|
167
133
|
<option value="email">Email</option>
|
|
168
134
|
<option value="sms">SMS</option>
|
|
@@ -174,7 +140,7 @@ onDestroy(() => requestController?.abort())
|
|
|
174
140
|
</label>
|
|
175
141
|
<label>
|
|
176
142
|
<span class="sr-only">Status</span>
|
|
177
|
-
<select x-model="selectedStatus" class="block px-3 py-2 w-full text-gray-900 text-sm dark:text-neutral-100 dark:bg-neutral-700 border-0 ring-1 ring-gray-300 ring-inset rounded-md dark:ring-neutral-600 focus:ring-2 focus:ring-blue-600"
|
|
143
|
+
<select x-model="selectedStatus" class="block px-3 py-2 w-full text-gray-900 text-sm dark:text-neutral-100 dark:bg-neutral-700 border-0 ring-1 ring-gray-300 ring-inset rounded-md dark:ring-neutral-600 focus:ring-2 focus:ring-blue-600">
|
|
178
144
|
<option value="all">All Statuses</option>
|
|
179
145
|
<option value="sent">Sent</option>
|
|
180
146
|
<option value="delivered">Delivered</option>
|
|
@@ -184,7 +150,7 @@ onDestroy(() => requestController?.abort())
|
|
|
184
150
|
</label>
|
|
185
151
|
<label>
|
|
186
152
|
<span class="sr-only">Sort field</span>
|
|
187
|
-
<select x-model="sortField" class="block px-3 py-2 w-full text-gray-900 text-sm dark:text-neutral-100 dark:bg-neutral-700 border-0 ring-1 ring-gray-300 ring-inset rounded-md dark:ring-neutral-600 focus:ring-2 focus:ring-blue-600"
|
|
153
|
+
<select x-model="sortField" class="block px-3 py-2 w-full text-gray-900 text-sm dark:text-neutral-100 dark:bg-neutral-700 border-0 ring-1 ring-gray-300 ring-inset rounded-md dark:ring-neutral-600 focus:ring-2 focus:ring-blue-600">
|
|
188
154
|
<option value="sent_at">Attempted</option>
|
|
189
155
|
<option value="recipient">Recipient</option>
|
|
190
156
|
<option value="channel">Channel</option>
|
|
@@ -198,7 +164,7 @@ onDestroy(() => requestController?.abort())
|
|
|
198
164
|
</Button>
|
|
199
165
|
<Button variant="secondary" fullWidth @click="resetFilters()">Reset</Button>
|
|
200
166
|
</div>
|
|
201
|
-
</
|
|
167
|
+
</div>
|
|
202
168
|
|
|
203
169
|
<div class="mt-6">
|
|
204
170
|
<NotificationDeliveryTable
|
|
@@ -135,24 +135,22 @@ onMount(loadOverview)
|
|
|
135
135
|
<div :if="!isLoading && overview.channels.length === 0" class="px-4 py-10 text-center text-gray-500 text-sm dark:text-neutral-400 bg-white dark:bg-neutral-700 ring-1 ring-gray-200 rounded-lg dark:ring-neutral-600">
|
|
136
136
|
No active channels yet.
|
|
137
137
|
</div>
|
|
138
|
-
<
|
|
139
|
-
<
|
|
140
|
-
<div class="flex items-center
|
|
141
|
-
<
|
|
142
|
-
|
|
143
|
-
<span class="capitalize">{{ channel.channel }}</span>
|
|
144
|
-
</div>
|
|
145
|
-
<span class="font-mono text-gray-500 text-xs dark:text-neutral-400">{{ attemptLabel(channel.total) }}</span>
|
|
138
|
+
<article :for="channel in overview.channels" class="px-4 py-4 bg-white dark:bg-neutral-700 ring-1 ring-gray-200 rounded-lg dark:ring-neutral-600">
|
|
139
|
+
<div class="flex items-center justify-between">
|
|
140
|
+
<div class="inline-flex gap-2 items-center font-medium text-gray-900 text-sm dark:text-neutral-100">
|
|
141
|
+
<span :class="'h-5 w-5 ' + channelIcon(channel.channel)"></span>
|
|
142
|
+
<span class="capitalize">{{ channel.channel }}</span>
|
|
146
143
|
</div>
|
|
147
|
-
<
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
<div class="
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
</
|
|
154
|
-
|
|
155
|
-
|
|
144
|
+
<span class="font-mono text-gray-500 text-xs dark:text-neutral-400">{{ attemptLabel(channel.total) }}</span>
|
|
145
|
+
</div>
|
|
146
|
+
<div class="overflow-hidden mt-4 h-2 bg-gray-100 dark:bg-neutral-600 rounded-full">
|
|
147
|
+
<div class="h-full bg-green-500 rounded-full" style="width: {{ channel.success_rate }}%"></div>
|
|
148
|
+
</div>
|
|
149
|
+
<div class="flex items-center justify-between mt-2 text-xs">
|
|
150
|
+
<span class="text-gray-500 dark:text-neutral-400">{{ channel.success_rate }}% successful</span>
|
|
151
|
+
<span :class="channel.failed > 0 ? 'text-red-600 dark:text-red-400' : 'text-gray-500 dark:text-neutral-400'">{{ formatNumber(channel.failed) }} failed</span>
|
|
152
|
+
</div>
|
|
153
|
+
</article>
|
|
156
154
|
</div>
|
|
157
155
|
</section>
|
|
158
156
|
</div>
|
|
@@ -71,7 +71,7 @@ const COLUMNS = [
|
|
|
71
71
|
|
|
72
72
|
const ROW_ACTIONS = [
|
|
73
73
|
{ action: 'retry', label: 'Retry delivery to', icon: 'i-hugeicons-reload', when: { key: 'retryable', equals: true } },
|
|
74
|
-
{ action: 'view', label: 'View details of delivery to'
|
|
74
|
+
{ action: 'view', label: 'View details of delivery to' },
|
|
75
75
|
]
|
|
76
76
|
|
|
77
77
|
const rows = derived(() => deliveries().map(delivery => ({
|
|
@@ -8,7 +8,7 @@ async function load(): Promise<void> { loading.set(true); try { data.set(await f
|
|
|
8
8
|
function date(value: string): string { return new Intl.DateTimeFormat(undefined, { dateStyle: 'medium', timeStyle: 'medium' }).format(new Date(value)) }
|
|
9
9
|
onMount(() => void load())
|
|
10
10
|
</script>
|
|
11
|
-
<div class="
|
|
11
|
+
<div class="flex flex-col gap-6">
|
|
12
12
|
<PageHeader title="Operations" description="Inspect the append-only operator event stream with actor and operation correlation."><template #actions><Button variant="secondary" :loading="loading()" @click="load"><span :if="!loading()" class="h-4 w-4 i-hugeicons-refresh"></span>Refresh</Button></template></PageHeader>
|
|
13
13
|
<OperationsNavigation active="audit" />
|
|
14
14
|
<section class="grid gap-3 sm:grid-cols-2 lg:grid-cols-4"><StatsCard title="Events" :value="String(data()?.summary.events || 0)" icon="i-hugeicons-activity-03" iconBg="primary" :loading="loading()" /><StatsCard title="Operators" :value="String(data()?.summary.operators || 0)" icon="i-hugeicons-user-group" iconBg="neutral" :loading="loading()" /><StatsCard title="Failures" :value="String(data()?.summary.failures || 0)" icon="i-hugeicons-alert-02" iconBg="warning" :loading="loading()" /><StatsCard title="Latest sequence" :value="String(data()?.summary.latestSequence || 0)" icon="i-hugeicons-list-view" iconBg="success" :loading="loading()" /></section>
|
|
@@ -32,7 +32,7 @@ async function decide(decision: 'approved' | 'rejected'): Promise<void> {
|
|
|
32
32
|
onMount(() => void load())
|
|
33
33
|
</script>
|
|
34
34
|
|
|
35
|
-
<div class="
|
|
35
|
+
<div class="flex flex-col gap-6">
|
|
36
36
|
<PageHeader title="Operations" description="Review application changes, safety signals, approvals, and active work in one place.">
|
|
37
37
|
<template #actions><Button variant="secondary" :loading="loading()" @click="load"><span :if="!loading()" class="h-4 w-4 i-hugeicons-refresh"></span>Refresh</Button></template>
|
|
38
38
|
</PageHeader>
|
|
@@ -25,7 +25,7 @@ function severityVariant(value: string): string { return value === 'critical' ?
|
|
|
25
25
|
onMount(() => void load())
|
|
26
26
|
</script>
|
|
27
27
|
|
|
28
|
-
<div class="
|
|
28
|
+
<div class="flex flex-col gap-6">
|
|
29
29
|
<PageHeader title="Operations" description="Triage application-wide alerts from native health rules and delivery routes."><template #actions><Button variant="secondary" :loading="loading()" @click="load"><span :if="!loading()" class="h-4 w-4 i-hugeicons-refresh"></span>Refresh</Button></template></PageHeader>
|
|
30
30
|
<OperationsNavigation active="incidents" />
|
|
31
31
|
<section class="grid gap-3 sm:grid-cols-2 lg:grid-cols-4"><StatsCard title="Firing" :value="String(data()?.summary.firing || 0)" icon="i-hugeicons-alert-02" iconBg="warning" :loading="loading()" /><StatsCard title="Critical" :value="String(data()?.summary.critical || 0)" icon="i-hugeicons-fire" iconBg="danger" :loading="loading()" /><StatsCard title="Acknowledged" :value="String(data()?.summary.acknowledged || 0)" icon="i-hugeicons-checkmark-circle-02" iconBg="success" :loading="loading()" /><StatsCard title="Active rules" :value="String(data()?.summary.rules || 0)" icon="i-hugeicons-radar-02" iconBg="neutral" :loading="loading()" /></section>
|
|
@@ -68,7 +68,7 @@ function statusClass(status: string): string {
|
|
|
68
68
|
onMount(() => void load())
|
|
69
69
|
</script>
|
|
70
70
|
|
|
71
|
-
<div class="
|
|
71
|
+
<div class="flex flex-col gap-6">
|
|
72
72
|
<PageHeader title="Operations" description="Review model-derived schema changes and migration ledger health before changing the database.">
|
|
73
73
|
<template #actions>
|
|
74
74
|
<Button variant="secondary" :loading="loading()" @click="load">
|
|
@@ -131,7 +131,7 @@ onMount(() => void load())
|
|
|
131
131
|
<OperationHistory :operations="data()?.operatorOperations || []" :loading="loading()" />
|
|
132
132
|
|
|
133
133
|
<Modal :isOpen="dialog() !== ''" :title="dialog() === 'apply' ? 'Apply migration plan' : 'Reconcile migration ledger'" size="md" @close="closeDialog">
|
|
134
|
-
<div class="
|
|
134
|
+
<div class="flex flex-col gap-4">
|
|
135
135
|
<div :if="dialog() === 'apply' && data()?.summary.destructive" role="alert" class="px-4 py-3 text-orange-800 text-sm dark:text-orange-200 bg-orange-50 dark:bg-orange-950/30 border border-orange-200 rounded-lg dark:border-orange-900">
|
|
136
136
|
This plan contains {{ data()?.summary.destructive }} destructive operation{{ data()?.summary.destructive === 1 ? '' : 's' }}. Confirm that a verified recovery point exists before continuing.
|
|
137
137
|
</div>
|
|
@@ -168,7 +168,7 @@ async function retention(): Promise<void> {
|
|
|
168
168
|
onMount(() => { void loadRecovery() })
|
|
169
169
|
</script>
|
|
170
170
|
|
|
171
|
-
<div class="
|
|
171
|
+
<div class="flex flex-col gap-6">
|
|
172
172
|
<PageHeader title="Operations" description="Backup coverage, independent verification, restore planning, and recovery drills from the native control plane.">
|
|
173
173
|
<template #actions>
|
|
174
174
|
<Button variant="outline" :disabled="isLoading()" @click="showDestination.set(true)">Connect destination</Button>
|
|
@@ -85,7 +85,7 @@ onMount(() => {
|
|
|
85
85
|
})
|
|
86
86
|
</script>
|
|
87
87
|
|
|
88
|
-
<div class="
|
|
88
|
+
<div class="flex flex-col gap-6">
|
|
89
89
|
<PageHeader title="Operations" description="Run and control application schedules through the same registry used by Buddy.">
|
|
90
90
|
<template #actions>
|
|
91
91
|
<Button variant="secondary" :loading="isLoading()" @click="loadOperations">
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script client>
|
|
2
2
|
import type { DashboardQueryCounts, DashboardQueryFilters, DashboardQueryLog, DashboardQueryResponse } from '../../../../functions/queries'
|
|
3
|
+
import { useServerList } from '../../../../functions/dashboard-list'
|
|
3
4
|
import { fetchDashboardQueries } from '../../../../functions/queries'
|
|
4
5
|
|
|
5
6
|
type QueryRange = DashboardQueryFilters['range']
|
|
@@ -10,8 +11,8 @@ type QueryStatus = DashboardQueryFilters['status']
|
|
|
10
11
|
const EMPTY_COUNTS: DashboardQueryCounts = { total: 0, reads: 0, writes: 0, slow: 0, failed: 0, averageDuration: 0 }
|
|
11
12
|
|
|
12
13
|
const mode = useReactiveProp<QueryMode>('mode', 'all')
|
|
13
|
-
//
|
|
14
|
-
//
|
|
14
|
+
// What the server says about the log beside its page of rows: whether it is
|
|
15
|
+
// on, the slow threshold, the counts the cards show and the connections.
|
|
15
16
|
const data = state<DashboardQueryResponse>({
|
|
16
17
|
enabled: false,
|
|
17
18
|
slowThreshold: 100,
|
|
@@ -26,13 +27,40 @@ const range = state<QueryRange>(mode() === 'history' ? 'week' : 'day')
|
|
|
26
27
|
const connection = state('all')
|
|
27
28
|
const type = state<QueryType>('all')
|
|
28
29
|
const status = state<QueryStatus>('all')
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
// One page of the log, chosen by the server (stacksjs/stacks#3204): the range,
|
|
31
|
+
// filters and paging are all its work, and useServerList keeps the request
|
|
32
|
+
// order and paging this page used to keep itself. The log has no order to
|
|
33
|
+
// choose, so no sort is sent.
|
|
34
|
+
const {
|
|
35
|
+
records: queries,
|
|
36
|
+
page: currentPage,
|
|
37
|
+
perPage: itemsPerPage,
|
|
38
|
+
loading,
|
|
39
|
+
loadError,
|
|
40
|
+
load,
|
|
41
|
+
changePage,
|
|
42
|
+
} = useServerList<DashboardQueryLog>({
|
|
43
|
+
fetch: async (query) => {
|
|
44
|
+
const result = await fetchDashboardQueries(query)
|
|
45
|
+
return { ...result, records: result.queries }
|
|
46
|
+
},
|
|
47
|
+
filters: () => ({
|
|
48
|
+
range: range(),
|
|
49
|
+
// The slow page lists slow queries whatever the status select last held.
|
|
50
|
+
status: mode() === 'slow' ? 'slow' : status(),
|
|
51
|
+
type: type(),
|
|
52
|
+
connection: connection(),
|
|
53
|
+
}),
|
|
54
|
+
perPage: 50,
|
|
55
|
+
onLoad: (result) => {
|
|
56
|
+
const page = result as DashboardQueryResponse
|
|
57
|
+
data.set({ ...page, counts: page.counts ?? EMPTY_COUNTS, connections: page.connections ?? [] })
|
|
58
|
+
// The log answers with what it could not read (logging off, say) beside
|
|
59
|
+
// whatever rows it has.
|
|
60
|
+
loadError.set(page.error || '')
|
|
61
|
+
},
|
|
62
|
+
})
|
|
34
63
|
|
|
35
|
-
const queries = derived(() => data().queries)
|
|
36
64
|
const counts = derived(() => data().counts)
|
|
37
65
|
const total = derived(() => counts().total)
|
|
38
66
|
const totalPages = derived(() => Math.max(1, Math.ceil(total() / itemsPerPage())))
|
|
@@ -47,25 +75,12 @@ const emptyTitle = derived(() => mode() === 'slow' ? 'No slow queries in this ra
|
|
|
47
75
|
const connections = derived(() => data().connections)
|
|
48
76
|
const averageDuration = derived(() => `${counts().averageDuration.toFixed(2)} ms`)
|
|
49
77
|
|
|
50
|
-
function filters(): DashboardQueryFilters {
|
|
51
|
-
return {
|
|
52
|
-
range: range(),
|
|
53
|
-
// The slow page lists slow queries whatever the status select last held.
|
|
54
|
-
status: mode() === 'slow' ? 'slow' : status(),
|
|
55
|
-
type: type(),
|
|
56
|
-
connection: connection() === 'all' ? '' : connection(),
|
|
57
|
-
page: currentPage(),
|
|
58
|
-
perPage: itemsPerPage(),
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
78
|
function setRange(value: QueryRange): void {
|
|
63
79
|
range.set(value)
|
|
64
80
|
}
|
|
65
81
|
|
|
66
82
|
function setCurrentPage(page: number): void {
|
|
67
|
-
|
|
68
|
-
void loadQueries()
|
|
83
|
+
changePage(Math.min(Math.max(1, page), totalPages()))
|
|
69
84
|
}
|
|
70
85
|
|
|
71
86
|
function formatQuery(query: string): string {
|
|
@@ -104,53 +119,16 @@ function statusClass(value: DashboardQueryLog['status']): string {
|
|
|
104
119
|
return 'text-green-700 dark:text-green-300'
|
|
105
120
|
}
|
|
106
121
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
// start one while another is still out.
|
|
110
|
-
const requestId = ++listRequestId
|
|
111
|
-
loading.set(true)
|
|
112
|
-
loadError.set('')
|
|
113
|
-
try {
|
|
114
|
-
const result = await fetchDashboardQueries(filters())
|
|
115
|
-
if (requestId !== listRequestId)
|
|
116
|
-
return
|
|
117
|
-
data.set({ ...result, counts: result.counts ?? EMPTY_COUNTS, connections: result.connections ?? [] })
|
|
118
|
-
// The server moves back to the last page when this one ran past the end.
|
|
119
|
-
currentPage.set(Number(result.page || 1))
|
|
120
|
-
loadError.set(result.error || '')
|
|
121
|
-
}
|
|
122
|
-
catch (error) {
|
|
123
|
-
if (requestId !== listRequestId)
|
|
124
|
-
return
|
|
125
|
-
loadError.set(error instanceof Error ? error.message : 'Query logs could not be loaded.')
|
|
126
|
-
}
|
|
127
|
-
finally {
|
|
128
|
-
if (requestId === listRequestId)
|
|
129
|
-
loading.set(false)
|
|
130
|
-
}
|
|
122
|
+
function loadQueries(): Promise<void> {
|
|
123
|
+
return load()
|
|
131
124
|
}
|
|
132
125
|
|
|
133
|
-
// The range buttons and the three selects change the query; any change asks
|
|
134
|
-
// the server for page 1. The selects stay plain x-model bindings.
|
|
135
|
-
let shownFilters = ''
|
|
136
|
-
effect(() => {
|
|
137
|
-
const key = [range(), connection(), type(), status()].join('|')
|
|
138
|
-
if (key === shownFilters)
|
|
139
|
-
return
|
|
140
|
-
const first = shownFilters === ''
|
|
141
|
-
shownFilters = key
|
|
142
|
-
if (first)
|
|
143
|
-
return
|
|
144
|
-
currentPage.set(1)
|
|
145
|
-
void loadQueries()
|
|
146
|
-
})
|
|
147
|
-
|
|
148
126
|
onMount(() => {
|
|
149
127
|
void loadQueries()
|
|
150
128
|
})
|
|
151
129
|
</script>
|
|
152
130
|
|
|
153
|
-
<div class="
|
|
131
|
+
<div class="flex flex-col gap-6">
|
|
154
132
|
<header class="flex flex-col gap-4 sm:flex-row sm:items-end sm:justify-between">
|
|
155
133
|
<div>
|
|
156
134
|
<h1 class="font-semibold text-2xl text-neutral-900 tracking-tight dark:text-white">{{ pageTitle() }}</h1>
|
|
@@ -201,9 +179,7 @@ onMount(() => {
|
|
|
201
179
|
<label for="query-connection" class="sr-only">Connection</label>
|
|
202
180
|
<select id="query-connection" x-model="connection" class="px-3 py-2 text-neutral-700 text-sm dark:text-neutral-200 bg-white dark:bg-neutral-800 border border-neutral-300 rounded-lg dark:border-neutral-700">
|
|
203
181
|
<option value="all">All connections</option>
|
|
204
|
-
<
|
|
205
|
-
<option :value="item">{{ item }}</option>
|
|
206
|
-
</template>
|
|
182
|
+
<option :for="item in connections()" :value="item">{{ item }}</option>
|
|
207
183
|
</select>
|
|
208
184
|
<label for="query-type" class="sr-only">Query type</label>
|
|
209
185
|
<select id="query-type" x-model="type" class="px-3 py-2 text-neutral-700 text-sm dark:text-neutral-200 bg-white dark:bg-neutral-800 border border-neutral-300 rounded-lg dark:border-neutral-700">
|
|
@@ -246,27 +222,25 @@ onMount(() => {
|
|
|
246
222
|
</tr>
|
|
247
223
|
</thead>
|
|
248
224
|
<tbody class="divide-neutral-100 divide-y dark:divide-neutral-700">
|
|
249
|
-
<
|
|
250
|
-
<
|
|
251
|
-
<
|
|
252
|
-
<
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
<
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
<
|
|
264
|
-
<
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
</tr>
|
|
269
|
-
</template>
|
|
225
|
+
<tr :for="query in queries">
|
|
226
|
+
<td class="pl-5 pr-4 py-3.5 max-w-2xl">
|
|
227
|
+
<div class="flex gap-2 items-start">
|
|
228
|
+
<span :class="'inline-flex flex-none items-center px-2 py-0.5 font-semibold text-[10px] rounded ' + typeClass(query.type)">{{ query.type }}</span>
|
|
229
|
+
<code class="block break-all font-mono text-neutral-800 text-xs dark:text-neutral-200">{{ formatQuery(query.query) }}</code>
|
|
230
|
+
</div>
|
|
231
|
+
</td>
|
|
232
|
+
<td class="px-4 py-3.5 text-neutral-500 text-sm dark:text-neutral-400">{{ query.connection }}</td>
|
|
233
|
+
<td class="px-4 py-3.5 font-mono text-neutral-700 text-right text-xs whitespace-nowrap dark:text-neutral-300">{{ formatDuration(query.duration) }}</td>
|
|
234
|
+
<td class="px-4 py-3.5">
|
|
235
|
+
<span :class="'font-medium text-xs capitalize ' + statusClass(query.status)">{{ query.status }}</span>
|
|
236
|
+
</td>
|
|
237
|
+
<td class="px-4 py-3.5 text-neutral-500 text-right text-xs whitespace-nowrap dark:text-neutral-400">{{ formatDate(query.executedAt) }}</td>
|
|
238
|
+
<td class="pr-5 py-3.5 text-right">
|
|
239
|
+
<a :href="queryDetailsPath(query.id)" :aria-label="'View query ' + query.id" class="inline-flex p-1.5 text-neutral-500 dark:text-neutral-400 hover:text-blue-600 dark:hover:text-blue-400 rounded-md">
|
|
240
|
+
<span class="h-4 w-4 i-hugeicons-arrow-right-01"></span>
|
|
241
|
+
</a>
|
|
242
|
+
</td>
|
|
243
|
+
</tr>
|
|
270
244
|
</tbody>
|
|
271
245
|
</table>
|
|
272
246
|
</div>
|
|
@@ -125,20 +125,16 @@ onMount(() => {
|
|
|
125
125
|
<div class="grid gap-4 grid-cols-1 lg:grid-cols-2">
|
|
126
126
|
<Card title="Affected tables">
|
|
127
127
|
<div :if="affectedTables().length > 0" class="flex flex-wrap gap-2">
|
|
128
|
-
<
|
|
129
|
-
<span class="px-2 py-1 font-medium text-blue-700 text-xs dark:text-blue-300 bg-blue-50 dark:bg-blue-950/40 rounded">{{ table }}</span>
|
|
130
|
-
</template>
|
|
128
|
+
<span :for="table in affectedTables()" class="px-2 py-1 font-medium text-blue-700 text-xs dark:text-blue-300 bg-blue-50 dark:bg-blue-950/40 rounded">{{ table }}</span>
|
|
131
129
|
</div>
|
|
132
130
|
<p :if="affectedTables().length === 0" class="text-neutral-500 text-sm dark:text-neutral-400">No affected tables were recorded.</p>
|
|
133
131
|
</Card>
|
|
134
132
|
<Card title="Optimization">
|
|
135
133
|
<ul :if="suggestions().length > 0" class="space-y-2">
|
|
136
|
-
<
|
|
137
|
-
<
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
</li>
|
|
141
|
-
</template>
|
|
134
|
+
<li :for="suggestion in suggestions()" class="flex gap-2 items-start text-neutral-700 text-sm dark:text-neutral-300">
|
|
135
|
+
<span class="flex-none mt-0.5 h-4 w-4 text-amber-500 i-hugeicons-bulb"></span>
|
|
136
|
+
{{ suggestion }}
|
|
137
|
+
</li>
|
|
142
138
|
</ul>
|
|
143
139
|
<p :if="suggestions().length === 0" class="text-neutral-500 text-sm dark:text-neutral-400">No optimization suggestions were recorded.</p>
|
|
144
140
|
</Card>
|
|
@@ -204,15 +204,13 @@ onDestroy(() => {
|
|
|
204
204
|
</div>
|
|
205
205
|
<div :if="inspectorEvents().length === 0" class="px-5 py-12 text-center text-gray-500 text-sm dark:text-neutral-400">Connect to an endpoint to inspect live messages.</div>
|
|
206
206
|
<div :if="inspectorEvents().length > 0" class="divide-gray-200 divide-y dark:divide-neutral-700">
|
|
207
|
-
<
|
|
208
|
-
<div
|
|
209
|
-
<
|
|
210
|
-
|
|
211
|
-
<p class="mt-1 break-all font-mono text-gray-500 text-xs dark:text-neutral-400">{{ event.detail }}</p>
|
|
212
|
-
</div>
|
|
213
|
-
<p class="text-gray-500 text-xs whitespace-nowrap dark:text-neutral-400">{{ formatDate(event.occurredAt) }}</p>
|
|
207
|
+
<div :for="event in inspectorEvents()" class="flex gap-4 items-start justify-between px-4 py-3">
|
|
208
|
+
<div>
|
|
209
|
+
<p class="font-medium text-gray-900 text-sm dark:text-white">{{ event.type }}</p>
|
|
210
|
+
<p class="mt-1 break-all font-mono text-gray-500 text-xs dark:text-neutral-400">{{ event.detail }}</p>
|
|
214
211
|
</div>
|
|
215
|
-
|
|
212
|
+
<p class="text-gray-500 text-xs whitespace-nowrap dark:text-neutral-400">{{ formatDate(event.occurredAt) }}</p>
|
|
213
|
+
</div>
|
|
216
214
|
</div>
|
|
217
215
|
</div>
|
|
218
216
|
</section>
|