@nivaro/react 0.3.113 → 0.3.115
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/dist/components/ScreenShareHost.js +24 -0
- package/dist/full.css +50 -2
- package/dist/hooks/useSessionRecorder.js +61 -60
- package/dist/index.d.ts +1727 -19
- package/dist/index.js +1091 -950
- package/dist/shared/components/ActivityEntry.js +209 -97
- package/dist/shared/components/AgentPresenceChip.js +51 -0
- package/dist/shared/components/AnnouncementBanner.js +56 -41
- package/dist/shared/components/AutolinkedText.js +98 -85
- package/dist/shared/components/BroadcastView.js +149 -141
- package/dist/shared/components/CacheStamp.js +78 -30
- package/dist/shared/components/CollectionBrowserView.js +4088 -3592
- package/dist/shared/components/ConfigChangeStrip.js +63 -0
- package/dist/shared/components/ConfigReachNote.js +107 -0
- package/dist/shared/components/ConformanceView.js +389 -319
- package/dist/shared/components/DataTable.js +544 -504
- package/dist/shared/components/DelegateCoverLine.js +164 -0
- package/dist/shared/components/EnvironmentNotice.js +56 -65
- package/dist/shared/components/FilePreviewLightbox.js +89 -43
- package/dist/shared/components/FindingFixedMark.js +23 -0
- package/dist/shared/components/GridPresenceLine.js +100 -0
- package/dist/shared/components/IdleReloadWatcher.js +82 -43
- package/dist/shared/components/InStep.js +46 -0
- package/dist/shared/components/ItemEditForm.js +5504 -4889
- package/dist/shared/components/LiveAnnouncer.js +62 -0
- package/dist/shared/components/LiveCount.js +54 -0
- package/dist/shared/components/LiveFigure.js +28 -0
- package/dist/shared/components/LiveListControls.js +114 -0
- package/dist/shared/components/LiveNewMatchesPill.js +25 -0
- package/dist/shared/components/LiveOffNote.js +44 -0
- package/dist/shared/components/LivePreferenceHost.js +42 -0
- package/dist/shared/components/LiveRowMark.js +25 -20
- package/dist/shared/components/LiveTraceView.js +257 -0
- package/dist/shared/components/MapView.js +30 -29
- package/dist/shared/components/MatrixEditor.js +497 -462
- package/dist/shared/components/MyWorkView.js +346 -272
- package/dist/shared/components/NotificationBell.js +215 -201
- package/dist/shared/components/PageRenderer.js +636 -599
- package/dist/shared/components/PresenceDot.js +21 -0
- package/dist/shared/components/ProfileView.js +656 -536
- package/dist/shared/components/RealtimeStatusBanner.js +25 -25
- package/dist/shared/components/RecentRecordsRail.js +51 -48
- package/dist/shared/components/RecordCompare.js +241 -150
- package/dist/shared/components/RecordDrilldownSheet.js +66 -64
- package/dist/shared/components/RecordGridEditor.js +350 -311
- package/dist/shared/components/RecordHoverCard.js +147 -0
- package/dist/shared/components/RecordPeekHost.js +111 -0
- package/dist/shared/components/RecordReadView.js +414 -412
- package/dist/shared/components/RelativeTime.js +16 -0
- package/dist/shared/components/ReportView.js +1396 -1304
- package/dist/shared/components/ScreenRefreshButton.js +77 -0
- package/dist/shared/components/TabCountHost.js +10 -0
- package/dist/shared/components/TickerNumber.js +19 -18
- package/dist/shared/components/TipLayer.js +70 -58
- package/dist/shared/components/WidgetImageMenu.js +59 -0
- package/dist/shared/components/WidgetSlot.js +571 -524
- package/dist/shared/components/activity/RecordActivityStream.js +317 -0
- package/dist/shared/components/bulk/BulkSelectionNotices.js +220 -0
- package/dist/shared/components/cbv/approval-changed.js +20 -0
- package/dist/shared/components/cbv/changed-by-others.js +251 -0
- package/dist/shared/components/cbv/column-totals.js +75 -67
- package/dist/shared/components/change-proposals/ChangeProposalsPanel.js +320 -0
- package/dist/shared/components/change-proposals/ProposalValue.js +28 -0
- package/dist/shared/components/change-proposals/ProposeChangeButton.js +44 -0
- package/dist/shared/components/change-proposals/ProposeChangeDialog.js +359 -0
- package/dist/shared/components/change-proposals/types.js +4 -0
- package/dist/shared/components/chat/ChatPanel.js +1571 -1528
- package/dist/shared/components/chat/Composer.js +276 -298
- package/dist/shared/components/chat/room-due.js +13 -0
- package/dist/shared/components/collections-directory/CollectionRow.js +76 -75
- package/dist/shared/components/collections-directory/CollectionsDirectory.js +415 -395
- package/dist/shared/components/collections-directory/directory-data.js +75 -63
- package/dist/shared/components/imports/ImportConsole.js +159 -155
- package/dist/shared/components/imports/ImportDuplicatesNotice.js +46 -31
- package/dist/shared/components/integrations/SendStatus.js +202 -0
- package/dist/shared/components/integrations/console/IntegrationsConsole.js +45 -36
- package/dist/shared/components/integrations/console/ReadyToSendView.js +453 -0
- package/dist/shared/components/integrations/console/api.js +161 -117
- package/dist/shared/components/integrations/console/tone.js +15 -12
- package/dist/shared/components/item-edit/CatalogPickerField.js +1353 -1245
- package/dist/shared/components/item-edit/ChangedAfterApprovalBadge.js +162 -0
- package/dist/shared/components/item-edit/CloneDialog.js +208 -206
- package/dist/shared/components/item-edit/DerivedCauseNote.js +57 -0
- package/dist/shared/components/item-edit/DraftRecoveryBanner.js +81 -70
- package/dist/shared/components/item-edit/DuplicateNotice.js +169 -101
- package/dist/shared/components/item-edit/FieldAffordances.js +294 -385
- package/dist/shared/components/item-edit/FieldComments.js +159 -116
- package/dist/shared/components/item-edit/FieldPointer.js +132 -0
- package/dist/shared/components/item-edit/FieldRenderer.js +277 -273
- package/dist/shared/components/item-edit/FieldRow.js +519 -439
- package/dist/shared/components/item-edit/FieldSourceBadge.js +88 -0
- package/dist/shared/components/item-edit/FilePickerField.js +454 -369
- package/dist/shared/components/item-edit/GroupSection.js +618 -567
- package/dist/shared/components/item-edit/HeldEditsChip.js +113 -0
- package/dist/shared/components/item-edit/InlineTableField.js +2891 -2723
- package/dist/shared/components/item-edit/ListNeighborNav.js +79 -0
- package/dist/shared/components/item-edit/LiveTraceSheet.js +26 -0
- package/dist/shared/components/item-edit/M2MCombobox.js +284 -273
- package/dist/shared/components/item-edit/OutboxReviewTray.js +313 -0
- package/dist/shared/components/item-edit/PickerBadges.js +52 -0
- package/dist/shared/components/item-edit/PlanGrid.js +434 -439
- package/dist/shared/components/item-edit/RecalcValue.js +55 -0
- package/dist/shared/components/item-edit/RecordChatActions.js +76 -64
- package/dist/shared/components/item-edit/RecordChatMentionsChip.js +103 -0
- package/dist/shared/components/item-edit/RecordGrantTools.js +87 -86
- package/dist/shared/components/item-edit/RecordHelpChip.js +70 -0
- package/dist/shared/components/item-edit/RecordLiveSync.js +230 -217
- package/dist/shared/components/item-edit/RecordOutbox.js +53 -52
- package/dist/shared/components/item-edit/RecordRecapStrip.js +109 -36
- package/dist/shared/components/item-edit/RelationCombobox.js +229 -217
- package/dist/shared/components/item-edit/RelationGroupedCombobox.js +105 -100
- package/dist/shared/components/item-edit/RemoteChangeUi.js +454 -0
- package/dist/shared/components/item-edit/RemoteUploads.js +55 -0
- package/dist/shared/components/item-edit/RemovedLineNote.js +92 -0
- package/dist/shared/components/item-edit/RichTextEditorImpl.js +298 -223
- package/dist/shared/components/item-edit/ScheduledChangeChip.js +244 -0
- package/dist/shared/components/item-edit/SectionPresence.js +78 -0
- package/dist/shared/components/item-edit/SplitLinesButton.js +166 -0
- package/dist/shared/components/item-edit/catalog-line-watch.js +94 -0
- package/dist/shared/components/item-edit/coedit/collab.js +84 -0
- package/dist/shared/components/item-edit/coedit/context.js +24 -0
- package/dist/shared/components/item-edit/coedit/cursors.js +103 -0
- package/dist/shared/components/item-edit/coedit/safe-link.js +15 -0
- package/dist/shared/components/item-edit/coedit/session.js +382 -0
- package/dist/shared/components/item-edit/coedit/useCoedit.js +49 -0
- package/dist/shared/components/item-edit/file-live.js +77 -0
- package/dist/shared/components/item-edit/file-processing.js +87 -0
- package/dist/shared/components/item-edit/layout-switch.js +148 -0
- package/dist/shared/components/item-edit/live-related.js +23 -0
- package/dist/shared/components/item-edit/live-title.js +66 -0
- package/dist/shared/components/item-edit/partner-needs.js +142 -0
- package/dist/shared/components/item-edit/removed-line.js +58 -0
- package/dist/shared/components/item-edit/render-stability.js +70 -59
- package/dist/shared/components/layout-editor/ChangeNote.js +36 -34
- package/dist/shared/components/layout-editor/CollabParts.js +72 -70
- package/dist/shared/components/layout-editor/LayoutEditor.js +306 -303
- package/dist/shared/components/list/InlineEdit.js +504 -208
- package/dist/shared/components/list/ListViewers.js +81 -0
- package/dist/shared/components/merge/MergeRecordsDialog.js +1227 -0
- package/dist/shared/components/merge/MergeWithFlow.js +290 -0
- package/dist/shared/components/merge/merge-values.js +110 -0
- package/dist/shared/components/monitoring/InactiveUserLinksView.js +285 -258
- package/dist/shared/components/notifications/NotificationCenterView.js +388 -321
- package/dist/shared/components/notifications/NotificationDetailBits.js +205 -130
- package/dist/shared/components/notifications/NotificationRulesEditor.js +72 -52
- package/dist/shared/components/notifications/bundles.js +21 -19
- package/dist/shared/components/notifications/resolved-line.js +25 -0
- package/dist/shared/components/ops/OpsTasksView.js +45 -44
- package/dist/shared/components/panels/AccessGrantedNote.js +85 -0
- package/dist/shared/components/panels/AlertBanners.js +132 -0
- package/dist/shared/components/panels/AsyncUserPicker.js +54 -45
- package/dist/shared/components/panels/BranchLanes.js +82 -54
- package/dist/shared/components/panels/CommentAwareness.js +332 -0
- package/dist/shared/components/panels/CommentImages.js +219 -0
- package/dist/shared/components/panels/CommentPanel.js +649 -530
- package/dist/shared/components/panels/ExternalRequestsChip.js +98 -80
- package/dist/shared/components/panels/NewSinceChip.js +16 -0
- package/dist/shared/components/panels/OwnerOpenedLine.js +85 -0
- package/dist/shared/components/panels/PipelinePanel.js +1644 -1494
- package/dist/shared/components/panels/ResubmissionDiff.js +293 -0
- package/dist/shared/components/panels/SlaBreachBanner.js +30 -29
- package/dist/shared/components/panels/SlaClock.js +130 -99
- package/dist/shared/components/panels/TaskPanel.js +308 -287
- package/dist/shared/components/panels/unseen-move-check.js +101 -0
- package/dist/shared/components/pipeline/OwnerMatrix.js +80 -71
- package/dist/shared/components/pipeline/OwnerMatrixSheet.js +495 -0
- package/dist/shared/components/pipeline/PipelineEditorView.js +1855 -1771
- package/dist/shared/components/profile/AgentNameField.js +141 -0
- package/dist/shared/components/profile/AgentsPanel.js +55 -46
- package/dist/shared/components/profile/PersonAccess.js +398 -330
- package/dist/shared/components/profile/PersonAdminTools.js +127 -113
- package/dist/shared/components/profile/PersonProfile.js +81 -73
- package/dist/shared/components/profile/SignInTroubleshooter.js +361 -0
- package/dist/shared/components/queue/QueueBulkBar.js +101 -84
- package/dist/shared/components/queue/QueueItemSheet.js +66 -66
- package/dist/shared/components/queue/QueueTeamStrip.js +279 -0
- package/dist/shared/components/queue/QueueWorklist.js +2076 -1686
- package/dist/shared/components/queue/queue-totals.js +92 -0
- package/dist/shared/components/queue/worklist-helpers.js +18 -14
- package/dist/shared/components/send-view/SendViewButton.js +136 -0
- package/dist/shared/components/send-view/SentViewCards.js +147 -0
- package/dist/shared/components/support/ReportProblem.js +1 -0
- package/dist/shared/components/support/ScreenShare.js +554 -0
- package/dist/shared/components/support/SupportView.js +160 -129
- package/dist/shared/components/support/TicketDetailSheet.js +101 -89
- package/dist/shared/components/watch-list/WatchDock.js +1044 -0
- package/dist/shared/components/watch-list/WatchExtras.js +723 -0
- package/dist/shared/components/watch-list/WatchListButton.js +46 -0
- package/dist/shared/components/watch-list/WatchPinButton.js +67 -0
- package/dist/shared/components/watch-list/WatchRows.js +348 -0
- package/dist/shared/lib/activity-sentence.js +87 -75
- package/dist/shared/lib/agent-presence.js +46 -0
- package/dist/shared/lib/approval-progress.js +49 -0
- package/dist/shared/lib/attention-prefs.js +27 -0
- package/dist/shared/lib/cell-locks.js +56 -0
- package/dist/shared/lib/co-edit.js +166 -0
- package/dist/shared/lib/coedit-registry.js +44 -0
- package/dist/shared/lib/comment-awareness.js +124 -0
- package/dist/shared/lib/comment-images.js +45 -0
- package/dist/shared/lib/config-watch.js +94 -0
- package/dist/shared/lib/copy-rules.js +65 -0
- package/dist/shared/lib/count-step.js +30 -0
- package/dist/shared/lib/deadline-ticker.js +68 -0
- package/dist/shared/lib/derived-causes.js +115 -0
- package/dist/shared/lib/draft-store.js +114 -85
- package/dist/shared/lib/error-hints.js +1 -0
- package/dist/shared/lib/field-merge.js +126 -0
- package/dist/shared/lib/filter-sentence.js +10 -10
- package/dist/shared/lib/focus-mode.js +16 -12
- package/dist/shared/lib/grid-cursors.js +77 -0
- package/dist/shared/lib/grid-presence.js +182 -0
- package/dist/shared/lib/idle-reload.js +100 -73
- package/dist/shared/lib/in-step.js +45 -0
- package/dist/shared/lib/integration-chip.js +19 -18
- package/dist/shared/lib/line-locks.js +141 -0
- package/dist/shared/lib/line-split.js +41 -0
- package/dist/shared/lib/linked-changes.js +150 -0
- package/dist/shared/lib/list-link.js +56 -50
- package/dist/shared/lib/list-return.js +231 -0
- package/dist/shared/lib/list-viewers.js +52 -0
- package/dist/shared/lib/live-announcer.js +86 -0
- package/dist/shared/lib/live-counts.js +85 -0
- package/dist/shared/lib/live-data-changed.js +108 -0
- package/dist/shared/lib/live-deltas.js +81 -0
- package/dist/shared/lib/live-findings.js +113 -0
- package/dist/shared/lib/live-groups.js +122 -0
- package/dist/shared/lib/live-link-labels.js +162 -0
- package/dist/shared/lib/live-list-flow.js +334 -0
- package/dist/shared/lib/live-list.js +143 -129
- package/dist/shared/lib/live-moves.js +51 -0
- package/dist/shared/lib/live-ops.js +26 -26
- package/dist/shared/lib/live-pickers.js +7 -0
- package/dist/shared/lib/live-preference.js +184 -0
- package/dist/shared/lib/live-queries.js +226 -181
- package/dist/shared/lib/live-screen.js +333 -0
- package/dist/shared/lib/live-search.js +108 -0
- package/dist/shared/lib/live-seen.js +35 -0
- package/dist/shared/lib/live-views.js +100 -0
- package/dist/shared/lib/live.js +159 -133
- package/dist/shared/lib/missed-updates.js +198 -0
- package/dist/shared/lib/newer-file.js +56 -0
- package/dist/shared/lib/notification-sound.js +42 -20
- package/dist/shared/lib/own-writes.js +59 -41
- package/dist/shared/lib/picker-badges.js +94 -0
- package/dist/shared/lib/presence-signals.js +131 -84
- package/dist/shared/lib/realtime.js +49 -24
- package/dist/shared/lib/record-gaps.js +85 -0
- package/dist/shared/lib/record-outbox.js +369 -222
- package/dist/shared/lib/record-peek.js +75 -0
- package/dist/shared/lib/record-tabs.js +92 -72
- package/dist/shared/lib/relative-ticker.js +42 -0
- package/dist/shared/lib/request-gate.js +119 -119
- package/dist/shared/lib/rollup-recalc.js +107 -0
- package/dist/shared/lib/room-gaps.js +40 -36
- package/dist/shared/lib/rum.js +137 -87
- package/dist/shared/lib/save-progress.js +20 -0
- package/dist/shared/lib/scheduled-countdown.js +67 -0
- package/dist/shared/lib/screen-refresh.js +160 -0
- package/dist/shared/lib/screen-share.js +234 -0
- package/dist/shared/lib/seen-since.js +74 -0
- package/dist/shared/lib/selection-watch.js +205 -0
- package/dist/shared/lib/send-status.js +132 -0
- package/dist/shared/lib/send-view.js +23 -0
- package/dist/shared/lib/socket-liveness.js +155 -0
- package/dist/shared/lib/socket-realtime.js +168 -140
- package/dist/shared/lib/state-census.js +53 -0
- package/dist/shared/lib/summary-mode.js +61 -39
- package/dist/shared/lib/tab-attention.js +143 -32
- package/dist/shared/lib/table-density.js +64 -0
- package/dist/shared/lib/track-travel.js +40 -0
- package/dist/shared/lib/unseen-changes.js +68 -0
- package/dist/shared/lib/upload-file.js +33 -0
- package/dist/shared/lib/upload-presence.js +127 -0
- package/dist/shared/lib/urgent-chime.js +65 -0
- package/dist/shared/lib/use-online-users.js +32 -11
- package/dist/shared/lib/user-sync.js +155 -39
- package/dist/shared/lib/waiting-count.js +44 -0
- package/dist/shared/lib/watch-desktop.js +83 -0
- package/dist/shared/lib/watch-list.js +447 -0
- package/dist/shared/lib/widget-image-render.js +64 -0
- package/dist/shared/lib/widget-image.js +111 -0
- package/dist/shared/lib/worker-socket.js +130 -104
- package/dist/shared/lib/write-to-screen.js +133 -0
- package/package.json +1 -1
- package/styles.css +49 -1
|
@@ -1,48 +1,31 @@
|
|
|
1
|
-
import { jsx as e, jsxs as o, Fragment as
|
|
2
|
-
import { saveReportFilterPreset as
|
|
3
|
-
import { useQuery as
|
|
4
|
-
import { X as
|
|
5
|
-
import { useState as
|
|
6
|
-
import { toast as
|
|
7
|
-
import { useNivaroClient as
|
|
8
|
-
import { get as
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const s = a.getBoundingClientRect(), c = a.cloneNode(!0);
|
|
30
|
-
c.setAttribute("width", String(s.width)), c.setAttribute("height", String(s.height));
|
|
31
|
-
const m = new XMLSerializer().serializeToString(c), h = URL.createObjectURL(new Blob([m], { type: "image/svg+xml;charset=utf-8" })), f = new Image();
|
|
32
|
-
await new Promise((W, p) => {
|
|
33
|
-
f.onload = () => W(), f.onerror = () => p(new Error("svg load failed")), f.src = h;
|
|
34
|
-
});
|
|
35
|
-
const u = 2, R = document.createElement("canvas");
|
|
36
|
-
R.width = Math.max(1, Math.round(s.width * u)), R.height = Math.max(1, Math.round(s.height * u) + 28 * u);
|
|
37
|
-
const M = R.getContext("2d");
|
|
38
|
-
if (!M) return;
|
|
39
|
-
M.fillStyle = "#ffffff", M.fillRect(0, 0, R.width, R.height), M.fillStyle = "#172940", M.font = `${12 * u}px system-ui, sans-serif`, M.fillText(n || "Chart", 8 * u, 18 * u), M.drawImage(f, 0, 28 * u, s.width * u, s.height * u), URL.revokeObjectURL(h);
|
|
40
|
-
const N = await new Promise((W) => R.toBlob(W, "image/png"));
|
|
41
|
-
N && await navigator.clipboard.write([new ClipboardItem({ "image/png": N })]);
|
|
42
|
-
} catch {
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
const Ce = (t) => Math.abs(t) >= 1e9 ? `${(t / 1e9).toFixed(1).replace(/\.0$/, "")}B` : Math.abs(t) >= 1e6 ? `${(t / 1e6).toFixed(1).replace(/\.0$/, "")}M` : Math.abs(t) >= 1e3 ? `${(t / 1e3).toFixed(1).replace(/\.0$/, "")}k` : String(t), tl = [
|
|
1
|
+
import { jsx as e, jsxs as o, Fragment as et } from "react/jsx-runtime";
|
|
2
|
+
import { saveReportFilterPreset as Et, listReportFilterPresets as ka, deleteReportFilterPreset as Na, readReport as jt, executeCustomQuery as wa, readItems as Sa, readReportFilterOptions as _a, aiReportFilters as Ca, readReportWidgetData as Ct, listReportAlerts as $a, createReportAlert as qa, toggleReportAlert as Aa, deleteReportAlert as Fa, readReportAlertLog as Ma, resolveReportAlert as Ra } from "@nivaro/sdk";
|
|
3
|
+
import { useQuery as Se, useQueryClient as lt, useMutation as Ae, isCancelledError as Ta, skipToken as La } from "@tanstack/react-query";
|
|
4
|
+
import { X as Te, Check as Ht, Plus as Xt, Camera as Lt, Bell as Zt, RefreshCw as At, ChevronsUpDown as It, Sparkles as Wt, Info as Oa, Table as Ka, Sigma as Da, StickyNote as Pa, Download as za, TrendingUp as ea, TrendingDown as ta, Trash2 as Ea } from "lucide-react";
|
|
5
|
+
import { useState as _, useEffect as Ze, useCallback as gt, useRef as Ie, useMemo as tt, Suspense as Rt, createContext as ja, lazy as Pt, memo as Wa, useContext as Ba } from "react";
|
|
6
|
+
import { toast as aa } from "sonner";
|
|
7
|
+
import { useNivaroClient as Le, useDrilldown as la, useOverlayState as Qa } from "../context.js";
|
|
8
|
+
import { get as bt, post as at, del as Ja, put as Ua } from "../lib/commands.js";
|
|
9
|
+
import { changedWidgetIds as Ya, useConfigWatch as Va } from "../lib/config-watch.js";
|
|
10
|
+
import { useAutoRefreshPref as Ga, useLiveStamp as Ha } from "../lib/live-data-changed.js";
|
|
11
|
+
import { useLiveWidget as Xa, liveWidgetInterval as Za } from "../lib/live-widgets.js";
|
|
12
|
+
import { serverErrorText as ra, loadErrorText as Ot } from "../lib/load-error.js";
|
|
13
|
+
import { restrictedScopeSelections as Ia, cascadeFilter as el, fetchCascadeRelations as tl } from "../lib/quick-filter-cascade.js";
|
|
14
|
+
import { buildReportTree as al } from "../lib/report-tree.js";
|
|
15
|
+
import { uniqueByValue as ll } from "../lib/unique-options.js";
|
|
16
|
+
import { useMyScopes as na, matchScopeDimension as rl, translateScopeValues as Bt, effectiveScopeSeedIds as nl } from "../lib/use-my-scopes.js";
|
|
17
|
+
import { cn as P, toLocalDateString as sa } from "../lib/utils.js";
|
|
18
|
+
import { BackgroundRunOffer as oa } from "./BackgroundRunOffer.js";
|
|
19
|
+
import { RechartsGate as Ke } from "./charts/RechartsGate.js";
|
|
20
|
+
import { LoadErrorNote as ia } from "./LoadErrorNote.js";
|
|
21
|
+
import { RecordDrilldownSheet as sl } from "./RecordDrilldownSheet.js";
|
|
22
|
+
import { TipLayer as ol } from "./TipLayer.js";
|
|
23
|
+
import { Command as il, CommandInput as dl, CommandList as cl, CommandEmpty as ul, CommandItem as ml } from "./ui/command.js";
|
|
24
|
+
import { Popover as da, PopoverTrigger as ca, PopoverContent as ua } from "./ui/popover.js";
|
|
25
|
+
import { SimpleSelect as $t } from "./ui/SimpleSelect.js";
|
|
26
|
+
import { Skeleton as De } from "./ui/skeleton.js";
|
|
27
|
+
import { WidgetImageMenu as pl } from "./WidgetImageMenu.js";
|
|
28
|
+
const Ce = (t) => Math.abs(t) >= 1e9 ? `${(t / 1e9).toFixed(1).replace(/\.0$/, "")}B` : Math.abs(t) >= 1e6 ? `${(t / 1e6).toFixed(1).replace(/\.0$/, "")}M` : Math.abs(t) >= 1e3 ? `${(t / 1e3).toFixed(1).replace(/\.0$/, "")}k` : String(t), hl = [
|
|
46
29
|
"Jan",
|
|
47
30
|
"Feb",
|
|
48
31
|
"Mar",
|
|
@@ -55,23 +38,23 @@ const Ce = (t) => Math.abs(t) >= 1e9 ? `${(t / 1e9).toFixed(1).replace(/\.0$/, "
|
|
|
55
38
|
"Oct",
|
|
56
39
|
"Nov",
|
|
57
40
|
"Dec"
|
|
58
|
-
],
|
|
41
|
+
], fl = (t) => {
|
|
59
42
|
const n = String(t ?? ""), a = /^(\d{4})-(\d{2})(?:-(\d{2}))?/.exec(n);
|
|
60
43
|
if (a) {
|
|
61
|
-
const s =
|
|
44
|
+
const s = hl[Number(a[2]) - 1] ?? a[2];
|
|
62
45
|
return a[3] ? `${s} ${Number(a[3])}` : `${s} '${a[1].slice(2)}`;
|
|
63
46
|
}
|
|
64
47
|
return n.length > 16 ? `${n.slice(0, 15)}…` : n;
|
|
65
|
-
},
|
|
48
|
+
}, Ft = (t) => ({
|
|
66
49
|
interval: t > 12 ? Math.ceil(t / 12) - 1 : 0,
|
|
67
|
-
tickFormatter:
|
|
50
|
+
tickFormatter: fl,
|
|
68
51
|
minTickGap: 4,
|
|
69
52
|
...t > 5 && t <= 12 ? { angle: -35, textAnchor: "end", height: 56 } : {}
|
|
70
|
-
}),
|
|
53
|
+
}), xl = (t) => {
|
|
71
54
|
const n = String(t ?? "");
|
|
72
55
|
return n.length > 22 ? `${n.slice(0, 21)}…` : n;
|
|
73
|
-
},
|
|
74
|
-
|
|
56
|
+
}, zt = () => import("./ReportEditMode.js"), bl = Pt(() => zt().then((t) => ({ default: t.AddWidgetBar }))), gl = Pt(() => zt().then((t) => ({ default: t.WidgetConfigSheet }))), vl = Pt(() => zt().then((t) => ({ default: t.WidgetEditBar }))), Xe = "rgb(var(--nvr-cyan-rgb, 0 206 255))", ce = [
|
|
57
|
+
Xe,
|
|
75
58
|
"#4f7cac",
|
|
76
59
|
// steel blue
|
|
77
60
|
"#c2703d",
|
|
@@ -90,7 +73,7 @@ const Ce = (t) => Math.abs(t) >= 1e9 ? `${(t / 1e9).toFixed(1).replace(/\.0$/, "
|
|
|
90
73
|
// olive
|
|
91
74
|
"#9c7b56"
|
|
92
75
|
// tan
|
|
93
|
-
],
|
|
76
|
+
], yl = [
|
|
94
77
|
{ id: "", label: "All time" },
|
|
95
78
|
{ id: "this_month", label: "This month" },
|
|
96
79
|
{ id: "last_30_days", label: "Last 30 days" },
|
|
@@ -107,98 +90,98 @@ function qe(t, n) {
|
|
|
107
90
|
}) : t.toLocaleString();
|
|
108
91
|
return `${(n == null ? void 0 : n.prefix) ?? ""}${a}${(n == null ? void 0 : n.suffix) ?? ""}`;
|
|
109
92
|
}
|
|
110
|
-
function
|
|
93
|
+
function Qt({ pct: t }) {
|
|
111
94
|
if (t == null) return null;
|
|
112
95
|
const n = t >= 0;
|
|
113
96
|
return /* @__PURE__ */ o(
|
|
114
97
|
"span",
|
|
115
98
|
{
|
|
116
|
-
className:
|
|
99
|
+
className: P(
|
|
117
100
|
"inline-flex items-center gap-0.5 rounded px-1 py-px text-[10.5px] font-medium",
|
|
118
101
|
n ? "bg-emerald-50 text-emerald-600 dark:bg-emerald-500/10 dark:text-emerald-400" : "bg-red-50 text-red-600 dark:bg-red-500/10 dark:text-red-400"
|
|
119
102
|
),
|
|
120
103
|
children: [
|
|
121
|
-
n ? /* @__PURE__ */ e(
|
|
104
|
+
n ? /* @__PURE__ */ e(ea, { className: "h-2.5 w-2.5" }) : /* @__PURE__ */ e(ta, { className: "h-2.5 w-2.5" }),
|
|
122
105
|
Math.abs(t),
|
|
123
106
|
"%"
|
|
124
107
|
]
|
|
125
108
|
}
|
|
126
109
|
);
|
|
127
110
|
}
|
|
128
|
-
function
|
|
111
|
+
function ma({
|
|
129
112
|
reportId: t,
|
|
130
113
|
field: n,
|
|
131
114
|
label: a,
|
|
132
115
|
optionSource: s,
|
|
133
116
|
selected: c,
|
|
134
|
-
onChange:
|
|
117
|
+
onChange: u,
|
|
135
118
|
allowedValues: h
|
|
136
119
|
}) {
|
|
137
|
-
const
|
|
138
|
-
queryKey: ["nivaro-report-filter-opts", t, n, s ?? null,
|
|
120
|
+
const g = Le(), p = lt(), [D, O] = _(!1), { scopes: y } = na(), Q = s ? Ia(s.collection, y) : [], { data: m = [] } = Se({
|
|
121
|
+
queryKey: ["nivaro-report-filter-opts", t, n, s ?? null, Q],
|
|
139
122
|
queryFn: async () => {
|
|
140
123
|
if (s) {
|
|
141
|
-
const F = s.value_field ?? "id",
|
|
124
|
+
const F = s.value_field ?? "id", H = s.label_field ?? F, z = Q.length ? el(
|
|
142
125
|
s.collection,
|
|
143
|
-
await
|
|
144
|
-
|
|
145
|
-
) : null,
|
|
146
|
-
|
|
147
|
-
fields: [.../* @__PURE__ */ new Set(["id", F,
|
|
148
|
-
...
|
|
126
|
+
await tl(g, p, s.collection),
|
|
127
|
+
Q
|
|
128
|
+
) : null, ue = await g.request(
|
|
129
|
+
Sa(s.collection, {
|
|
130
|
+
fields: [.../* @__PURE__ */ new Set(["id", F, H])],
|
|
131
|
+
...z ? { filter: z } : {},
|
|
149
132
|
sort: s.sort ? [s.sort] : void 0,
|
|
150
133
|
limit: 200
|
|
151
134
|
})
|
|
152
135
|
);
|
|
153
|
-
return
|
|
154
|
-
(
|
|
136
|
+
return ll(
|
|
137
|
+
(ue.data ?? []).map((J) => ({
|
|
155
138
|
value: String(J[F] ?? J.id),
|
|
156
|
-
label: String(J[
|
|
139
|
+
label: String(J[H] ?? J[F] ?? J.id)
|
|
157
140
|
})),
|
|
158
141
|
(J) => J.value
|
|
159
142
|
);
|
|
160
143
|
}
|
|
161
|
-
return
|
|
144
|
+
return g.request(_a(t, n)).then((F) => F.data);
|
|
162
145
|
},
|
|
163
|
-
enabled:
|
|
146
|
+
enabled: D,
|
|
164
147
|
staleTime: 12e4
|
|
165
|
-
}),
|
|
166
|
-
return /* @__PURE__ */ o(
|
|
167
|
-
/* @__PURE__ */ e(
|
|
148
|
+
}), k = h != null && h.length ? m.filter((F) => h.some((H) => String(H) === F.value)) : m, Z = c.length > 0;
|
|
149
|
+
return /* @__PURE__ */ o(da, { open: D, onOpenChange: O, children: [
|
|
150
|
+
/* @__PURE__ */ e(ca, { asChild: !0, children: /* @__PURE__ */ o(
|
|
168
151
|
"button",
|
|
169
152
|
{
|
|
170
153
|
type: "button",
|
|
171
|
-
className:
|
|
154
|
+
className: P(
|
|
172
155
|
"flex h-7 items-center gap-1.5 rounded-md border px-2 text-[12px]",
|
|
173
|
-
|
|
156
|
+
Z ? "border-nvr-cyan bg-accent font-medium text-nvr-navy dark:text-nvr-cyan" : "border-slate-200 text-slate-500 hover:border-slate-300 dark:border-border"
|
|
174
157
|
),
|
|
175
158
|
children: [
|
|
176
159
|
a,
|
|
177
|
-
|
|
178
|
-
/* @__PURE__ */ e(
|
|
160
|
+
Z && /* @__PURE__ */ e("span", { className: "rounded-full bg-white/60 px-1 text-[10px] dark:bg-black/20", children: c.length }),
|
|
161
|
+
/* @__PURE__ */ e(It, { className: "h-3 w-3 opacity-50" })
|
|
179
162
|
]
|
|
180
163
|
}
|
|
181
164
|
) }),
|
|
182
|
-
/* @__PURE__ */ e(
|
|
183
|
-
/* @__PURE__ */ e(
|
|
184
|
-
/* @__PURE__ */ o(
|
|
185
|
-
/* @__PURE__ */ e(
|
|
186
|
-
|
|
187
|
-
const
|
|
165
|
+
/* @__PURE__ */ e(ua, { className: "w-[240px] p-0", align: "start", children: /* @__PURE__ */ o(il, { children: [
|
|
166
|
+
/* @__PURE__ */ e(dl, { placeholder: `Filter ${a}…`, className: "h-8 text-[12.5px]" }),
|
|
167
|
+
/* @__PURE__ */ o(cl, { className: "max-h-52", children: [
|
|
168
|
+
/* @__PURE__ */ e(ul, { children: "No values." }),
|
|
169
|
+
k.map((F) => {
|
|
170
|
+
const H = c.some((z) => String(z) === F.value);
|
|
188
171
|
return /* @__PURE__ */ o(
|
|
189
|
-
|
|
172
|
+
ml,
|
|
190
173
|
{
|
|
191
174
|
value: F.label,
|
|
192
175
|
onSelect: () => {
|
|
193
|
-
const
|
|
194
|
-
var
|
|
195
|
-
return ((
|
|
176
|
+
const z = H ? c.filter((J) => String(J) !== F.value) : [...c, F.value], ue = (J) => {
|
|
177
|
+
var W;
|
|
178
|
+
return ((W = m.find((se) => se.value === String(J))) == null ? void 0 : W.label) ?? String(J);
|
|
196
179
|
};
|
|
197
|
-
|
|
180
|
+
u(z, z.map(ue));
|
|
198
181
|
},
|
|
199
182
|
className: "text-[12.5px]",
|
|
200
183
|
children: [
|
|
201
|
-
/* @__PURE__ */ e(
|
|
184
|
+
/* @__PURE__ */ e(Ht, { className: P("mr-1.5 h-3 w-3", H ? "opacity-100" : "opacity-0") }),
|
|
202
185
|
F.label
|
|
203
186
|
]
|
|
204
187
|
},
|
|
@@ -209,12 +192,12 @@ function ia({
|
|
|
209
192
|
] }) })
|
|
210
193
|
] });
|
|
211
194
|
}
|
|
212
|
-
function
|
|
195
|
+
function pa(t) {
|
|
213
196
|
if (!t) return null;
|
|
214
|
-
const n = /* @__PURE__ */ new Date(), a = (
|
|
215
|
-
const h = (
|
|
216
|
-
return `${
|
|
217
|
-
}, s = (
|
|
197
|
+
const n = /* @__PURE__ */ new Date(), a = (u) => {
|
|
198
|
+
const h = (g) => String(g).padStart(2, "0");
|
|
199
|
+
return `${u.getFullYear()}-${h(u.getMonth() + 1)}-${h(u.getDate())}`;
|
|
200
|
+
}, s = (u, h) => new Date(u, h, 1), c = (u) => new Date(u.getFullYear(), u.getMonth() + 1, 0);
|
|
218
201
|
switch (t.preset) {
|
|
219
202
|
case "this_month":
|
|
220
203
|
return { start: a(s(n.getFullYear(), n.getMonth())), end: a(c(n)) };
|
|
@@ -234,179 +217,179 @@ function oa(t) {
|
|
|
234
217
|
return null;
|
|
235
218
|
}
|
|
236
219
|
}
|
|
237
|
-
const
|
|
238
|
-
function
|
|
220
|
+
const kl = "No workflow number", Nl = /^undefined-\d+$/;
|
|
221
|
+
function ze(t, n, a) {
|
|
239
222
|
if (t == null || t === "") return "—";
|
|
240
|
-
if (typeof t == "string" &&
|
|
223
|
+
if (typeof t == "string" && Nl.test(t)) return kl;
|
|
241
224
|
if (n === "date" || n === "datetime") {
|
|
242
|
-
const
|
|
243
|
-
if (Number.isNaN(
|
|
244
|
-
const h =
|
|
245
|
-
return n === "date" ? h : `${h} ${
|
|
225
|
+
const u = new Date(String(t));
|
|
226
|
+
if (Number.isNaN(u.getTime())) return String(t);
|
|
227
|
+
const h = sa(u);
|
|
228
|
+
return n === "date" ? h : `${h} ${u.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" })}`;
|
|
246
229
|
}
|
|
247
230
|
const s = Number(t);
|
|
248
231
|
if (Number.isNaN(s)) return String(t);
|
|
249
|
-
const c = (
|
|
250
|
-
minimumFractionDigits: a ??
|
|
232
|
+
const c = (u, h) => s.toLocaleString(void 0, {
|
|
233
|
+
minimumFractionDigits: a ?? u,
|
|
251
234
|
maximumFractionDigits: a ?? h
|
|
252
235
|
});
|
|
253
236
|
return n === "currency" ? `$${c(0, 0)}` : n === "percent" ? `${c(0, 1)}%` : n === "days" ? `${c(0, 1)}d` : n === "integer" ? Math.round(s).toLocaleString() : n === "number" ? c(0, 2) : String(t);
|
|
254
237
|
}
|
|
255
|
-
const
|
|
238
|
+
const Pe = /* @__PURE__ */ new Set([
|
|
256
239
|
"currency",
|
|
257
240
|
"number",
|
|
258
241
|
"integer",
|
|
259
242
|
"percent",
|
|
260
243
|
"days"
|
|
261
244
|
]);
|
|
262
|
-
function
|
|
263
|
-
const s = {}, c =
|
|
264
|
-
for (const [
|
|
245
|
+
function Kt(t, n, a) {
|
|
246
|
+
const s = {}, c = pa(n);
|
|
247
|
+
for (const [u, h] of Object.entries(t.params ?? {})) {
|
|
265
248
|
if (h === "$date.start") {
|
|
266
|
-
c && (s[
|
|
249
|
+
c && (s[u] = c.start);
|
|
267
250
|
continue;
|
|
268
251
|
}
|
|
269
252
|
if (h === "$date.end") {
|
|
270
|
-
c && (s[
|
|
253
|
+
c && (s[u] = c.end);
|
|
271
254
|
continue;
|
|
272
255
|
}
|
|
273
|
-
const
|
|
274
|
-
if (
|
|
275
|
-
const
|
|
276
|
-
|
|
256
|
+
const g = /^\$filters\.([\w.]+?)(:values)?$/.exec(h);
|
|
257
|
+
if (g) {
|
|
258
|
+
const p = a.find((O) => O.field === g[1]), D = g[2] ? p == null ? void 0 : p.values : p != null && p.labels && p.labels.length > 0 ? p.labels : p == null ? void 0 : p.values;
|
|
259
|
+
D && D.length > 0 && (s[u] = D.join(","));
|
|
277
260
|
continue;
|
|
278
261
|
}
|
|
279
|
-
s[
|
|
262
|
+
s[u] = h;
|
|
280
263
|
}
|
|
281
264
|
return s;
|
|
282
265
|
}
|
|
283
|
-
const
|
|
266
|
+
const wl = (t) => `$${Ce(Math.round(t))}`, Sl = [
|
|
284
267
|
{ gte: 90, color: "#ef4444" },
|
|
285
268
|
{ gte: 70, color: "#f59e0b" },
|
|
286
269
|
{ gte: -1 / 0, color: "#10b981" }
|
|
287
270
|
];
|
|
288
|
-
function
|
|
271
|
+
function _l({
|
|
289
272
|
rows: t,
|
|
290
273
|
cfg: n,
|
|
291
274
|
onDrill: a
|
|
292
275
|
}) {
|
|
293
|
-
const s = n.tree, c = n.series && n.series.length > 0 ? n.series : Object.keys(t[0] ?? {}).filter((
|
|
294
|
-
var
|
|
295
|
-
return typeof ((
|
|
296
|
-
}).slice(0, 3).map((
|
|
297
|
-
() => s ?
|
|
276
|
+
const s = n.tree, c = n.series && n.series.length > 0 ? n.series : Object.keys(t[0] ?? {}).filter((m) => {
|
|
277
|
+
var k;
|
|
278
|
+
return typeof ((k = t[0]) == null ? void 0 : k[m]) == "number";
|
|
279
|
+
}).slice(0, 3).map((m) => ({ field: m, label: m })), u = tt(
|
|
280
|
+
() => s ? al(
|
|
298
281
|
t,
|
|
299
282
|
s,
|
|
300
|
-
c.map((
|
|
283
|
+
c.map((m) => m.field)
|
|
301
284
|
) : [],
|
|
302
285
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
303
286
|
[t, s]
|
|
304
|
-
), [h,
|
|
305
|
-
|
|
306
|
-
if (
|
|
307
|
-
const
|
|
308
|
-
for (const F of
|
|
309
|
-
(F.depth > 0 ||
|
|
287
|
+
), [h, g] = _(() => /* @__PURE__ */ new Set()), [p, D] = _(!1);
|
|
288
|
+
Ze(() => {
|
|
289
|
+
if (p || u.length === 0) return;
|
|
290
|
+
const m = /* @__PURE__ */ new Set(), k = (Z) => {
|
|
291
|
+
for (const F of Z)
|
|
292
|
+
(F.depth > 0 || u.length === 1) && m.add(F.key), k(F.children);
|
|
310
293
|
};
|
|
311
|
-
|
|
312
|
-
}, [
|
|
313
|
-
const
|
|
314
|
-
var
|
|
315
|
-
return
|
|
316
|
-
},
|
|
317
|
-
const
|
|
318
|
-
return /* @__PURE__ */ o("div", { style: { paddingLeft:
|
|
294
|
+
k(u), g(m), D(!0);
|
|
295
|
+
}, [u, p]);
|
|
296
|
+
const O = (s == null ? void 0 : s.thresholds) ?? Sl, y = (m) => {
|
|
297
|
+
var k;
|
|
298
|
+
return m == null ? void 0 : ((k = O.find((Z) => m >= Z.gte)) == null ? void 0 : k.color) ?? "#10b981";
|
|
299
|
+
}, Q = (m) => {
|
|
300
|
+
const k = m.children.length === 0, Z = h.has(m.key), F = y(m.pct), H = k && (s == null ? void 0 : s.drill) && m.drillId != null;
|
|
301
|
+
return /* @__PURE__ */ o("div", { style: { paddingLeft: m.depth === 0 ? 0 : 14 }, children: [
|
|
319
302
|
/* @__PURE__ */ o(
|
|
320
303
|
"div",
|
|
321
304
|
{
|
|
322
|
-
role:
|
|
323
|
-
tabIndex:
|
|
324
|
-
className:
|
|
305
|
+
role: H || !k ? "button" : void 0,
|
|
306
|
+
tabIndex: H || !k ? 0 : void 0,
|
|
307
|
+
className: P(
|
|
325
308
|
"group/tn rounded-md px-1.5 py-1",
|
|
326
|
-
(
|
|
309
|
+
(H || !k) && "cursor-pointer hover:bg-slate-50 dark:hover:bg-muted/40"
|
|
327
310
|
),
|
|
328
311
|
onClick: () => {
|
|
329
|
-
|
|
312
|
+
k ? H && (s != null && s.drill) && a({
|
|
330
313
|
collection: s.drill.collection,
|
|
331
|
-
itemId: String(
|
|
332
|
-
title:
|
|
333
|
-
}) :
|
|
334
|
-
const
|
|
335
|
-
return
|
|
314
|
+
itemId: String(m.drillId),
|
|
315
|
+
title: m.label
|
|
316
|
+
}) : g((z) => {
|
|
317
|
+
const ue = new Set(z);
|
|
318
|
+
return ue.has(m.key) ? ue.delete(m.key) : ue.add(m.key), ue;
|
|
336
319
|
});
|
|
337
320
|
},
|
|
338
|
-
onKeyDown: (
|
|
339
|
-
(
|
|
321
|
+
onKeyDown: (z) => {
|
|
322
|
+
(z.key === "Enter" || z.key === " ") && z.currentTarget.click();
|
|
340
323
|
},
|
|
341
324
|
children: [
|
|
342
325
|
/* @__PURE__ */ o("div", { className: "flex items-center gap-1.5", children: [
|
|
343
|
-
|
|
344
|
-
|
|
326
|
+
k ? /* @__PURE__ */ e("span", { className: "w-3 shrink-0" }) : /* @__PURE__ */ e(
|
|
327
|
+
It,
|
|
345
328
|
{
|
|
346
|
-
className:
|
|
329
|
+
className: P(
|
|
347
330
|
"h-3 w-3 shrink-0 text-slate-400 transition-transform",
|
|
348
|
-
|
|
331
|
+
Z && "rotate-180"
|
|
349
332
|
)
|
|
350
333
|
}
|
|
351
334
|
),
|
|
352
|
-
|
|
335
|
+
k && m.badge && /* @__PURE__ */ e("span", { className: "shrink-0 rounded bg-slate-100 px-1 py-px text-[9.5px] tabular-nums text-slate-500 dark:bg-muted dark:text-slate-400", children: m.badge }),
|
|
353
336
|
/* @__PURE__ */ e(
|
|
354
337
|
"span",
|
|
355
338
|
{
|
|
356
|
-
className:
|
|
339
|
+
className: P(
|
|
357
340
|
"min-w-0 flex-1 truncate",
|
|
358
|
-
|
|
341
|
+
m.depth === 0 ? "text-[12px] font-semibold text-slate-800 dark:text-slate-100" : m.depth === 1 ? "text-[11.5px] font-medium text-slate-700 dark:text-slate-200" : P(
|
|
359
342
|
"text-[11px] text-slate-600 dark:text-slate-300",
|
|
360
|
-
|
|
343
|
+
H && "group-hover/tn:underline"
|
|
361
344
|
)
|
|
362
345
|
),
|
|
363
|
-
children:
|
|
346
|
+
children: m.label
|
|
364
347
|
}
|
|
365
348
|
),
|
|
366
|
-
(s == null ? void 0 : s.pct) && (
|
|
349
|
+
(s == null ? void 0 : s.pct) && (m.pct == null ? /* @__PURE__ */ e("span", { className: "shrink-0 text-[10.5px] font-semibold tabular-nums text-slate-400", children: "—" }) : /* @__PURE__ */ o(
|
|
367
350
|
"span",
|
|
368
351
|
{
|
|
369
352
|
className: "shrink-0 text-[10.5px] font-semibold tabular-nums",
|
|
370
353
|
style: { color: F },
|
|
371
354
|
children: [
|
|
372
|
-
|
|
355
|
+
m.pct.toFixed(1),
|
|
373
356
|
"%"
|
|
374
357
|
]
|
|
375
358
|
}
|
|
376
359
|
))
|
|
377
360
|
] }),
|
|
378
|
-
(s == null ? void 0 : s.pct) &&
|
|
361
|
+
(s == null ? void 0 : s.pct) && m.pct != null && /* @__PURE__ */ e(
|
|
379
362
|
"div",
|
|
380
363
|
{
|
|
381
|
-
className:
|
|
364
|
+
className: P(
|
|
382
365
|
"ml-[18px] mt-0.5 overflow-hidden rounded-full bg-slate-100 dark:bg-muted",
|
|
383
|
-
|
|
366
|
+
m.depth === 0 ? "h-[5px]" : m.depth === 1 ? "h-[3px]" : "h-[2px]"
|
|
384
367
|
),
|
|
385
368
|
children: /* @__PURE__ */ e(
|
|
386
369
|
"div",
|
|
387
370
|
{
|
|
388
371
|
className: "h-full rounded-full transition-[width] duration-300",
|
|
389
|
-
style: { width: `${Math.min(Math.max(
|
|
372
|
+
style: { width: `${Math.min(Math.max(m.pct, 0), 100)}%`, background: F }
|
|
390
373
|
}
|
|
391
374
|
)
|
|
392
375
|
}
|
|
393
376
|
),
|
|
394
|
-
/* @__PURE__ */ e("div", { className: "ml-[18px] mt-0.5 flex flex-wrap gap-x-3 text-[10px] tabular-nums text-slate-400", children: c.map((
|
|
395
|
-
|
|
377
|
+
/* @__PURE__ */ e("div", { className: "ml-[18px] mt-0.5 flex flex-wrap gap-x-3 text-[10px] tabular-nums text-slate-400", children: c.map((z) => /* @__PURE__ */ o("span", { children: [
|
|
378
|
+
z.label ?? z.field,
|
|
396
379
|
" ",
|
|
397
|
-
/* @__PURE__ */ e("span", { className: "font-medium text-slate-500 dark:text-slate-300", children:
|
|
398
|
-
] },
|
|
380
|
+
/* @__PURE__ */ e("span", { className: "font-medium text-slate-500 dark:text-slate-300", children: m.sums[z.field] == null ? z.empty_label ?? "—" : n.value_format === "currency" ? wl(m.sums[z.field]) : m.sums[z.field].toLocaleString() })
|
|
381
|
+
] }, z.field)) })
|
|
399
382
|
]
|
|
400
383
|
}
|
|
401
384
|
),
|
|
402
|
-
|
|
403
|
-
] },
|
|
385
|
+
Z && m.children.map(Q)
|
|
386
|
+
] }, m.key);
|
|
404
387
|
};
|
|
405
|
-
return !s ||
|
|
388
|
+
return !s || u.length === 0 ? /* @__PURE__ */ e("p", { className: "px-1 text-[12px] text-slate-400", children: "No data." }) : /* @__PURE__ */ e("div", { className: "min-h-0 flex-1 space-y-0.5 overflow-y-auto pr-1", children: u.map(Q) });
|
|
406
389
|
}
|
|
407
|
-
function
|
|
408
|
-
const [n, a] =
|
|
409
|
-
return
|
|
390
|
+
function Cl(t) {
|
|
391
|
+
const [n, a] = _(() => typeof IntersectionObserver > "u");
|
|
392
|
+
return Ze(() => {
|
|
410
393
|
if (n) return;
|
|
411
394
|
const s = t.current;
|
|
412
395
|
if (!s) {
|
|
@@ -415,25 +398,25 @@ function pl(t) {
|
|
|
415
398
|
}
|
|
416
399
|
const c = new IntersectionObserver(
|
|
417
400
|
(h) => {
|
|
418
|
-
h.some((
|
|
401
|
+
h.some((g) => g.isIntersecting) && a(!0);
|
|
419
402
|
},
|
|
420
403
|
{ rootMargin: "600px 0px" }
|
|
421
404
|
);
|
|
422
405
|
c.observe(s);
|
|
423
|
-
const
|
|
424
|
-
return window.addEventListener("beforeprint",
|
|
425
|
-
c.disconnect(), window.removeEventListener("beforeprint",
|
|
406
|
+
const u = () => a(!0);
|
|
407
|
+
return window.addEventListener("beforeprint", u), () => {
|
|
408
|
+
c.disconnect(), window.removeEventListener("beforeprint", u);
|
|
426
409
|
};
|
|
427
410
|
}, [n, t]), n;
|
|
428
411
|
}
|
|
429
|
-
function
|
|
430
|
-
const n =
|
|
412
|
+
function $l(t) {
|
|
413
|
+
const n = Le(), a = Ie(!1);
|
|
431
414
|
return async (s) => {
|
|
432
415
|
if (!(!t || a.current)) {
|
|
433
416
|
a.current = !0;
|
|
434
417
|
try {
|
|
435
|
-
const
|
|
436
|
-
|
|
418
|
+
const u = (await n.request(at("/report-studio/drill-row", { values: s }))).data;
|
|
419
|
+
u != null && u.collection && u.item_id && t({ collection: u.collection, itemId: u.item_id });
|
|
437
420
|
} catch {
|
|
438
421
|
} finally {
|
|
439
422
|
a.current = !1;
|
|
@@ -441,166 +424,221 @@ function hl(t) {
|
|
|
441
424
|
}
|
|
442
425
|
};
|
|
443
426
|
}
|
|
444
|
-
function
|
|
427
|
+
function ha(t, n) {
|
|
445
428
|
let a = n;
|
|
446
429
|
if (t.group_rows && t.x_field) {
|
|
447
430
|
const s = /* @__PURE__ */ new Map(), c = new Set(
|
|
448
|
-
(t.series ?? []).map((
|
|
431
|
+
(t.series ?? []).map((u) => u.field).length > 0 ? (t.series ?? []).map((u) => u.field) : Object.keys(a[0] ?? {}).filter((u) => {
|
|
449
432
|
var h;
|
|
450
|
-
return typeof ((h = a[0]) == null ? void 0 : h[
|
|
433
|
+
return typeof ((h = a[0]) == null ? void 0 : h[u]) == "number";
|
|
451
434
|
})
|
|
452
435
|
);
|
|
453
|
-
for (const
|
|
454
|
-
const h = String(
|
|
455
|
-
for (const
|
|
456
|
-
s.set(h,
|
|
436
|
+
for (const u of a) {
|
|
437
|
+
const h = String(u[t.x_field] ?? "Unknown"), g = s.get(h) ?? { [t.x_field]: h };
|
|
438
|
+
for (const p of c) g[p] = (Number(g[p]) || 0) + (Number(u[p]) || 0);
|
|
439
|
+
s.set(h, g);
|
|
457
440
|
}
|
|
458
441
|
a = [...s.values()];
|
|
459
442
|
}
|
|
460
443
|
if (t.sort) {
|
|
461
444
|
const s = t.sort.startsWith("-"), c = s ? t.sort.slice(1) : t.sort;
|
|
462
|
-
a = [...a].sort((
|
|
463
|
-
const
|
|
464
|
-
return s ? -
|
|
445
|
+
a = [...a].sort((u, h) => {
|
|
446
|
+
const g = u[c], p = h[c], D = typeof g == "number" && typeof p == "number" ? g - p : String(g ?? "").localeCompare(String(p ?? ""));
|
|
447
|
+
return s ? -D : D;
|
|
465
448
|
});
|
|
466
449
|
}
|
|
467
450
|
return t.limit && t.limit > 0 && (a = a.slice(0, t.limit)), a;
|
|
468
451
|
}
|
|
469
|
-
function
|
|
470
|
-
const c =
|
|
471
|
-
return t.request(s ? { ...c, _signal: s } : c).then((
|
|
452
|
+
function fa(t, n, a, s) {
|
|
453
|
+
const c = wa(n, a);
|
|
454
|
+
return t.request(s ? { ...c, _signal: s } : c).then((u) => (ba(n, a, u), u.data ?? []));
|
|
472
455
|
}
|
|
473
|
-
|
|
456
|
+
const qt = /* @__PURE__ */ new Map(), xa = (t, n) => `${t}\0${JSON.stringify(n)}`;
|
|
457
|
+
function ba(t, n, a) {
|
|
458
|
+
const s = a;
|
|
459
|
+
!s || typeof s != "object" || (qt.size > 200 && qt.clear(), qt.set(xa(t, n), {
|
|
460
|
+
cached_at: s.cached_at ?? null,
|
|
461
|
+
executed_at: s.executed_at ?? null,
|
|
462
|
+
freshness_sources: s.freshness_sources ?? null
|
|
463
|
+
}));
|
|
464
|
+
}
|
|
465
|
+
const ga = ja(void 0);
|
|
466
|
+
function ql({
|
|
467
|
+
slug: t,
|
|
468
|
+
params: n,
|
|
469
|
+
scope: a
|
|
470
|
+
}) {
|
|
471
|
+
const s = Le(), c = lt(), u = Ba(ga), h = ["nivaro-report-query", t, n], { dataUpdatedAt: g } = Se({ queryKey: h, queryFn: La }), [p, D] = _(!1), O = JSON.stringify(h), y = tt(
|
|
472
|
+
() => qt.get(xa(t, n)),
|
|
473
|
+
[t, O, g]
|
|
474
|
+
), Q = gt(() => {
|
|
475
|
+
D(!0), s.request(at(`/custom-queries/${t}/execute`, { params: n, refresh: !0 })).then((k) => {
|
|
476
|
+
ba(t, n, k), c.setQueryData(h, k.data ?? []);
|
|
477
|
+
}).catch(() => {
|
|
478
|
+
}).finally(() => D(!1));
|
|
479
|
+
}, [s, c, t, O]);
|
|
480
|
+
return Ha({ envelope: y, scope: a, refresh: Q, autoOverride: u }).changed ? /* @__PURE__ */ o(
|
|
481
|
+
"div",
|
|
482
|
+
{
|
|
483
|
+
className: "mt-1 flex items-center gap-1.5 text-[11px] text-muted-foreground",
|
|
484
|
+
"data-report-data-changed": !0,
|
|
485
|
+
children: [
|
|
486
|
+
/* @__PURE__ */ e(
|
|
487
|
+
"span",
|
|
488
|
+
{
|
|
489
|
+
role: "status",
|
|
490
|
+
className: "rounded bg-[#fef3c7] px-1 py-px text-[10.5px] font-medium text-amber-800 dark:bg-[#4a3a10] dark:text-amber-200",
|
|
491
|
+
children: "Data changed since run"
|
|
492
|
+
}
|
|
493
|
+
),
|
|
494
|
+
/* @__PURE__ */ o(
|
|
495
|
+
"button",
|
|
496
|
+
{
|
|
497
|
+
type: "button",
|
|
498
|
+
onClick: Q,
|
|
499
|
+
disabled: p,
|
|
500
|
+
className: "inline-flex items-center gap-1 rounded px-1 py-0.5 hover:bg-muted disabled:opacity-50",
|
|
501
|
+
children: [
|
|
502
|
+
/* @__PURE__ */ e(At, { className: P("h-3 w-3", p && "animate-spin") }),
|
|
503
|
+
p ? "Refreshing" : "Refresh"
|
|
504
|
+
]
|
|
505
|
+
}
|
|
506
|
+
)
|
|
507
|
+
]
|
|
508
|
+
}
|
|
509
|
+
) : null;
|
|
510
|
+
}
|
|
511
|
+
function Al({
|
|
474
512
|
cfg: t,
|
|
475
513
|
dateRange: n,
|
|
476
514
|
entityFilters: a,
|
|
477
515
|
refetchInterval: s,
|
|
478
516
|
onStatus: c,
|
|
479
|
-
onDrill:
|
|
517
|
+
onDrill: u,
|
|
480
518
|
deferred: h = !1
|
|
481
519
|
}) {
|
|
482
|
-
var re,
|
|
483
|
-
const
|
|
484
|
-
queryKey: ["nivaro-report-query", t.slug,
|
|
485
|
-
queryFn: ({ signal:
|
|
520
|
+
var re, ae;
|
|
521
|
+
const g = Le(), p = $l(u), [D, O] = _(""), [y, Q] = _(0), [m, k] = _(null), Z = Kt(t, n, a), { data: F, isLoading: H, error: z, isFetching: ue, refetch: J } = Se({
|
|
522
|
+
queryKey: ["nivaro-report-query", t.slug, Z],
|
|
523
|
+
queryFn: ({ signal: N }) => fa(g, t.slug, Z, N),
|
|
486
524
|
enabled: !h,
|
|
487
525
|
staleTime: 6e4,
|
|
488
526
|
refetchInterval: s,
|
|
489
527
|
retry: !1
|
|
490
528
|
});
|
|
491
|
-
if (
|
|
492
|
-
c == null || c({ isFetching:
|
|
493
|
-
}, [
|
|
529
|
+
if (Ze(() => {
|
|
530
|
+
c == null || c({ isFetching: ue, refetch: () => void J() });
|
|
531
|
+
}, [ue]), h && F === void 0)
|
|
494
532
|
return /* @__PURE__ */ e("p", { className: "px-1 text-[12px] text-slate-300", children: "Loading…" });
|
|
495
|
-
if (
|
|
533
|
+
if (H)
|
|
496
534
|
return /* @__PURE__ */ o("div", { className: "flex flex-col gap-2 px-1", children: [
|
|
497
535
|
/* @__PURE__ */ e("p", { className: "text-[12px] text-slate-300", children: "Loading…" }),
|
|
498
536
|
/* @__PURE__ */ e(
|
|
499
|
-
|
|
537
|
+
oa,
|
|
500
538
|
{
|
|
501
539
|
pending: !0,
|
|
502
540
|
request: {
|
|
503
541
|
method: "POST",
|
|
504
542
|
url: `/custom-queries/${t.slug}/execute`,
|
|
505
|
-
body: { params:
|
|
543
|
+
body: { params: Z }
|
|
506
544
|
},
|
|
507
545
|
label: `Query ${t.slug}`,
|
|
508
|
-
queryKey: ["nivaro-report-query", t.slug,
|
|
509
|
-
select: (
|
|
546
|
+
queryKey: ["nivaro-report-query", t.slug, Z],
|
|
547
|
+
select: (N) => (N == null ? void 0 : N.data) ?? []
|
|
510
548
|
}
|
|
511
549
|
)
|
|
512
550
|
] });
|
|
513
|
-
if (
|
|
551
|
+
if (z)
|
|
514
552
|
return /* @__PURE__ */ e(
|
|
515
|
-
|
|
553
|
+
ia,
|
|
516
554
|
{
|
|
517
555
|
className: "px-1",
|
|
518
|
-
message:
|
|
556
|
+
message: ra(z) ?? Ot(z, "this query"),
|
|
519
557
|
onRetry: () => void J()
|
|
520
558
|
}
|
|
521
559
|
);
|
|
522
|
-
const
|
|
523
|
-
if (
|
|
524
|
-
const se = t.columns && t.columns.length > 0 ? t.columns : Object.keys(
|
|
560
|
+
const W = ha(t, F ?? []);
|
|
561
|
+
if (W.length === 0) return /* @__PURE__ */ e("p", { className: "px-1 text-[12px] text-slate-400", children: "No data." });
|
|
562
|
+
const se = t.columns && t.columns.length > 0 ? t.columns : Object.keys(W[0] ?? {}).map((N) => ({ field: N }));
|
|
525
563
|
if (t.display === "kpis") {
|
|
526
|
-
const
|
|
527
|
-
var
|
|
564
|
+
const N = t.x_field ? W.map((R, Y) => {
|
|
565
|
+
var E, oe, me, ge, S;
|
|
528
566
|
return {
|
|
529
|
-
label: String(
|
|
530
|
-
value:
|
|
531
|
-
color: ((
|
|
567
|
+
label: String(R[t.x_field] ?? ""),
|
|
568
|
+
value: R[((oe = (E = t.series) == null ? void 0 : E[0]) == null ? void 0 : oe.field) ?? ((me = se.find((j) => j.field !== t.x_field)) == null ? void 0 : me.field) ?? ""],
|
|
569
|
+
color: ((S = (ge = t.series) == null ? void 0 : ge[0]) == null ? void 0 : S.color) ?? ce[Y % ce.length],
|
|
532
570
|
format: t.value_format
|
|
533
571
|
};
|
|
534
|
-
}) : se.map((
|
|
535
|
-
var
|
|
572
|
+
}) : se.map((R, Y) => {
|
|
573
|
+
var E;
|
|
536
574
|
return {
|
|
537
|
-
label:
|
|
538
|
-
value: (
|
|
539
|
-
color: ce[
|
|
540
|
-
format:
|
|
575
|
+
label: R.label ?? R.field,
|
|
576
|
+
value: (E = W[0]) == null ? void 0 : E[R.field],
|
|
577
|
+
color: ce[Y % ce.length],
|
|
578
|
+
format: R.format ?? t.value_format
|
|
541
579
|
};
|
|
542
580
|
});
|
|
543
581
|
return /* @__PURE__ */ e(
|
|
544
582
|
"div",
|
|
545
583
|
{
|
|
546
584
|
className: "grid gap-2",
|
|
547
|
-
style: { gridTemplateColumns: `repeat(${Math.min(6, Math.max(1,
|
|
548
|
-
children:
|
|
585
|
+
style: { gridTemplateColumns: `repeat(${Math.min(6, Math.max(1, N.length))}, 1fr)` },
|
|
586
|
+
children: N.map((R) => /* @__PURE__ */ o(
|
|
549
587
|
"div",
|
|
550
588
|
{
|
|
551
589
|
className: "flex flex-col justify-center rounded-md border border-slate-100 px-3 py-2 dark:border-border/60",
|
|
552
|
-
style: { borderTopColor:
|
|
590
|
+
style: { borderTopColor: R.color, borderTopWidth: 2 },
|
|
553
591
|
children: [
|
|
554
|
-
/* @__PURE__ */ e("p", { className: "truncate text-[10.5px] uppercase tracking-wide text-slate-400", children:
|
|
555
|
-
/* @__PURE__ */ e("p", { className: "text-[19px] font-semibold leading-tight text-slate-900 dark:text-foreground", children:
|
|
592
|
+
/* @__PURE__ */ e("p", { className: "truncate text-[10.5px] uppercase tracking-wide text-slate-400", children: R.label }),
|
|
593
|
+
/* @__PURE__ */ e("p", { className: "text-[19px] font-semibold leading-tight text-slate-900 dark:text-foreground", children: ze(R.value, R.format ?? "integer") })
|
|
556
594
|
]
|
|
557
595
|
},
|
|
558
|
-
|
|
596
|
+
R.label
|
|
559
597
|
))
|
|
560
598
|
}
|
|
561
599
|
);
|
|
562
600
|
}
|
|
563
601
|
if (t.display === "tree")
|
|
564
|
-
return /* @__PURE__ */ e(
|
|
602
|
+
return /* @__PURE__ */ e(_l, { rows: W, cfg: t, onDrill: (N) => u == null ? void 0 : u(N) });
|
|
565
603
|
if (t.display === "table") {
|
|
566
|
-
const
|
|
567
|
-
(
|
|
568
|
-
(
|
|
604
|
+
const N = se.filter((S) => Pe.has(S.format ?? "")), R = D.trim().toLowerCase(), Y = R ? W.filter(
|
|
605
|
+
(S) => Object.values(S).some(
|
|
606
|
+
(j) => String(j ?? "").toLowerCase().includes(R)
|
|
569
607
|
)
|
|
570
|
-
) :
|
|
608
|
+
) : W, E = 12, oe = Math.max(1, Math.ceil(Y.length / E)), me = Math.min(y, oe - 1), ge = Y.length > E ? Y.slice(me * E, me * E + E) : Y;
|
|
571
609
|
return /* @__PURE__ */ o("div", { className: "flex min-h-0 flex-1 flex-col", children: [
|
|
572
|
-
|
|
610
|
+
W.length > E && /* @__PURE__ */ o("div", { className: "mb-1 flex items-center gap-2", children: [
|
|
573
611
|
/* @__PURE__ */ e(
|
|
574
612
|
"input",
|
|
575
613
|
{
|
|
576
|
-
value:
|
|
577
|
-
onChange: (
|
|
578
|
-
|
|
614
|
+
value: D,
|
|
615
|
+
onChange: (S) => {
|
|
616
|
+
O(S.target.value), Q(0);
|
|
579
617
|
},
|
|
580
618
|
placeholder: "Search rows…",
|
|
581
619
|
className: "h-6 w-40 rounded border border-slate-200 bg-white px-1.5 text-[11px] dark:border-border dark:bg-card dark:text-slate-200"
|
|
582
620
|
}
|
|
583
621
|
),
|
|
584
|
-
|
|
622
|
+
oe > 1 && /* @__PURE__ */ o("span", { className: "ml-auto flex items-center gap-1 text-[10.5px] text-slate-400", children: [
|
|
585
623
|
/* @__PURE__ */ e(
|
|
586
624
|
"button",
|
|
587
625
|
{
|
|
588
626
|
type: "button",
|
|
589
|
-
disabled:
|
|
590
|
-
onClick: () =>
|
|
627
|
+
disabled: me <= 0,
|
|
628
|
+
onClick: () => Q(me - 1),
|
|
591
629
|
className: "rounded px-1 disabled:opacity-30",
|
|
592
630
|
children: "←"
|
|
593
631
|
}
|
|
594
632
|
),
|
|
595
|
-
|
|
633
|
+
me + 1,
|
|
596
634
|
"/",
|
|
597
|
-
|
|
635
|
+
oe,
|
|
598
636
|
/* @__PURE__ */ e(
|
|
599
637
|
"button",
|
|
600
638
|
{
|
|
601
639
|
type: "button",
|
|
602
|
-
disabled:
|
|
603
|
-
onClick: () =>
|
|
640
|
+
disabled: me >= oe - 1,
|
|
641
|
+
onClick: () => Q(me + 1),
|
|
604
642
|
className: "rounded px-1 disabled:opacity-30",
|
|
605
643
|
children: "→"
|
|
606
644
|
}
|
|
@@ -608,119 +646,119 @@ function fl({
|
|
|
608
646
|
] })
|
|
609
647
|
] }),
|
|
610
648
|
/* @__PURE__ */ e("div", { className: "min-h-0 flex-1 overflow-auto", children: /* @__PURE__ */ o("table", { className: "w-full text-[11.5px]", children: [
|
|
611
|
-
/* @__PURE__ */ e("thead", { className: "sticky top-0 z-[1] bg-white dark:bg-card", children: /* @__PURE__ */ e("tr", { children: se.map((
|
|
649
|
+
/* @__PURE__ */ e("thead", { className: "sticky top-0 z-[1] bg-white dark:bg-card", children: /* @__PURE__ */ e("tr", { children: se.map((S) => /* @__PURE__ */ e(
|
|
612
650
|
"th",
|
|
613
651
|
{
|
|
614
|
-
className:
|
|
652
|
+
className: P(
|
|
615
653
|
"whitespace-nowrap border-b border-slate-100 px-1.5 py-1 text-left font-medium text-slate-400 dark:border-border",
|
|
616
|
-
|
|
654
|
+
Pe.has(S.format ?? "") && "text-right"
|
|
617
655
|
),
|
|
618
|
-
children:
|
|
656
|
+
children: S.label ?? S.field
|
|
619
657
|
},
|
|
620
|
-
|
|
658
|
+
S.field
|
|
621
659
|
)) }) }),
|
|
622
|
-
/* @__PURE__ */ e("tbody", { children:
|
|
660
|
+
/* @__PURE__ */ e("tbody", { children: ge.map((S, j) => /* @__PURE__ */ e(
|
|
623
661
|
"tr",
|
|
624
662
|
{
|
|
625
|
-
className:
|
|
626
|
-
onClick: () => void
|
|
627
|
-
title:
|
|
628
|
-
children: se.map((
|
|
663
|
+
className: u ? "cursor-pointer hover:bg-slate-50 dark:hover:bg-muted/60" : void 0,
|
|
664
|
+
onClick: () => void p(S),
|
|
665
|
+
title: u ? "Open the record behind this row" : void 0,
|
|
666
|
+
children: se.map((he) => /* @__PURE__ */ e(
|
|
629
667
|
"td",
|
|
630
668
|
{
|
|
631
|
-
className:
|
|
669
|
+
className: P(
|
|
632
670
|
"max-w-[220px] truncate border-b border-slate-50 px-1.5 py-1 text-slate-700 dark:border-border/40 dark:text-slate-300",
|
|
633
|
-
|
|
671
|
+
Pe.has(he.format ?? "") && "text-right tabular-nums"
|
|
634
672
|
),
|
|
635
|
-
children:
|
|
673
|
+
children: ze(S[he.field], he.format, he.decimals)
|
|
636
674
|
},
|
|
637
|
-
|
|
675
|
+
he.field
|
|
638
676
|
))
|
|
639
677
|
},
|
|
640
|
-
|
|
678
|
+
j
|
|
641
679
|
)) }),
|
|
642
|
-
t.totals &&
|
|
680
|
+
t.totals && N.length > 0 && /* @__PURE__ */ e("tfoot", { className: "sticky bottom-0 bg-white dark:bg-card", children: /* @__PURE__ */ e("tr", { children: se.map((S, j) => /* @__PURE__ */ e(
|
|
643
681
|
"td",
|
|
644
682
|
{
|
|
645
|
-
className:
|
|
683
|
+
className: P(
|
|
646
684
|
"border-t border-slate-200 px-1.5 py-1 font-semibold text-slate-800 dark:border-border dark:text-slate-200",
|
|
647
|
-
|
|
685
|
+
Pe.has(S.format ?? "") && "text-right tabular-nums"
|
|
648
686
|
),
|
|
649
|
-
children:
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
687
|
+
children: j === 0 && !Pe.has(S.format ?? "") ? "Total" : Pe.has(S.format ?? "") ? ze(
|
|
688
|
+
W.reduce((he, ve) => he + (Number(ve[S.field]) || 0), 0),
|
|
689
|
+
S.format,
|
|
690
|
+
S.decimals
|
|
653
691
|
) : ""
|
|
654
692
|
},
|
|
655
|
-
|
|
693
|
+
S.field
|
|
656
694
|
)) }) })
|
|
657
695
|
] }) })
|
|
658
696
|
] });
|
|
659
697
|
}
|
|
660
|
-
const xe = t.x_field ?? ((re = se[0]) == null ? void 0 : re.field) ?? "",
|
|
661
|
-
var
|
|
662
|
-
return
|
|
663
|
-
}).slice(0, 3).map((
|
|
664
|
-
const
|
|
665
|
-
for (const
|
|
666
|
-
return
|
|
667
|
-
}), $e = (
|
|
668
|
-
if (!
|
|
669
|
-
const
|
|
670
|
-
|
|
671
|
-
},
|
|
698
|
+
const xe = t.x_field ?? ((re = se[0]) == null ? void 0 : re.field) ?? "", Ne = t.series && t.series.length > 0 ? t.series : se.filter((N) => {
|
|
699
|
+
var R;
|
|
700
|
+
return N.field !== xe && typeof ((R = W[0]) == null ? void 0 : R[N.field]) == "number";
|
|
701
|
+
}).slice(0, 3).map((N) => ({ field: N.field, label: N.label ?? N.field })), we = W.map((N) => {
|
|
702
|
+
const R = { [xe]: N[xe] };
|
|
703
|
+
for (const Y of Ne) R[Y.field] = Number(N[Y.field]) || 0;
|
|
704
|
+
return R;
|
|
705
|
+
}), $e = (N) => t.value_format === "currency" ? `$${Ce(N)}` : Ce(N), f = (N) => ze(N, t.value_format ?? "number"), X = t.display === "hbar" || t.display === "stacked_bar" && t.horizontal, te = (N) => {
|
|
706
|
+
if (!u) return;
|
|
707
|
+
const R = (F ?? []).filter((Y) => String(Y[xe] ?? "") === N);
|
|
708
|
+
R.length > 0 && k({ label: N, rows: R });
|
|
709
|
+
}, U = m ? /* @__PURE__ */ e(
|
|
672
710
|
"div",
|
|
673
711
|
{
|
|
674
712
|
className: "fixed inset-0 z-[126] flex items-center justify-center bg-black/30 p-6",
|
|
675
|
-
onClick: () =>
|
|
713
|
+
onClick: () => k(null),
|
|
676
714
|
children: /* @__PURE__ */ o(
|
|
677
715
|
"div",
|
|
678
716
|
{
|
|
679
717
|
className: "flex max-h-[70vh] w-full max-w-2xl flex-col overflow-hidden rounded-xl border border-slate-200 bg-white shadow-2xl dark:border-border dark:bg-card",
|
|
680
|
-
onClick: (
|
|
718
|
+
onClick: (N) => N.stopPropagation(),
|
|
681
719
|
children: [
|
|
682
720
|
/* @__PURE__ */ o("div", { className: "flex items-center gap-2 border-b border-slate-100 px-4 py-2.5 dark:border-border", children: [
|
|
683
|
-
/* @__PURE__ */ e("p", { className: "min-w-0 flex-1 truncate text-[13px] font-semibold text-slate-800 dark:text-slate-100", children:
|
|
721
|
+
/* @__PURE__ */ e("p", { className: "min-w-0 flex-1 truncate text-[13px] font-semibold text-slate-800 dark:text-slate-100", children: m.label }),
|
|
684
722
|
/* @__PURE__ */ o("span", { className: "text-[11.5px] text-slate-400", children: [
|
|
685
|
-
|
|
723
|
+
m.rows.length,
|
|
686
724
|
" rows — click one to open its record"
|
|
687
725
|
] }),
|
|
688
726
|
/* @__PURE__ */ e(
|
|
689
727
|
"button",
|
|
690
728
|
{
|
|
691
729
|
type: "button",
|
|
692
|
-
onClick: () =>
|
|
730
|
+
onClick: () => k(null),
|
|
693
731
|
className: "rounded p-1 text-slate-400 hover:text-slate-600",
|
|
694
|
-
children: /* @__PURE__ */ e(
|
|
732
|
+
children: /* @__PURE__ */ e(Te, { className: "h-4 w-4" })
|
|
695
733
|
}
|
|
696
734
|
)
|
|
697
735
|
] }),
|
|
698
736
|
/* @__PURE__ */ e("div", { className: "min-h-0 flex-1 overflow-auto p-2", children: /* @__PURE__ */ o("table", { className: "w-full text-[11px]", children: [
|
|
699
|
-
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ e("tr", { children: Object.keys(
|
|
737
|
+
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ e("tr", { children: Object.keys(m.rows[0] ?? {}).slice(0, 7).map((N) => /* @__PURE__ */ e(
|
|
700
738
|
"th",
|
|
701
739
|
{
|
|
702
740
|
className: "border-b border-slate-100 px-1.5 py-1 text-left font-medium text-slate-400 dark:border-border",
|
|
703
|
-
children:
|
|
741
|
+
children: N
|
|
704
742
|
},
|
|
705
|
-
|
|
743
|
+
N
|
|
706
744
|
)) }) }),
|
|
707
|
-
/* @__PURE__ */ e("tbody", { children:
|
|
745
|
+
/* @__PURE__ */ e("tbody", { children: m.rows.slice(0, 100).map((N, R) => /* @__PURE__ */ e(
|
|
708
746
|
"tr",
|
|
709
747
|
{
|
|
710
748
|
className: "cursor-pointer hover:bg-slate-50 dark:hover:bg-muted/60",
|
|
711
749
|
onClick: () => {
|
|
712
|
-
|
|
750
|
+
k(null), p(N);
|
|
713
751
|
},
|
|
714
|
-
children: Object.keys(
|
|
752
|
+
children: Object.keys(m.rows[0] ?? {}).slice(0, 7).map((Y) => /* @__PURE__ */ e(
|
|
715
753
|
"td",
|
|
716
754
|
{
|
|
717
755
|
className: "max-w-[160px] truncate border-b border-slate-50 px-1.5 py-1 text-slate-600 dark:border-border/40 dark:text-slate-300",
|
|
718
|
-
children: String(
|
|
756
|
+
children: String(N[Y] ?? "")
|
|
719
757
|
},
|
|
720
|
-
|
|
758
|
+
Y
|
|
721
759
|
))
|
|
722
760
|
},
|
|
723
|
-
|
|
761
|
+
R
|
|
724
762
|
)) })
|
|
725
763
|
] }) })
|
|
726
764
|
]
|
|
@@ -729,31 +767,31 @@ function fl({
|
|
|
729
767
|
}
|
|
730
768
|
) : null;
|
|
731
769
|
if (t.display === "donut") {
|
|
732
|
-
const
|
|
770
|
+
const N = ((ae = Ne[0]) == null ? void 0 : ae.field) ?? "", R = we.map((E) => ({ dim: String(E[xe]), value: Number(E[N]) || 0 })), Y = R.reduce((E, oe) => E + oe.value, 0);
|
|
733
771
|
return /* @__PURE__ */ o("div", { className: "flex min-h-0 flex-1 items-stretch gap-3", children: [
|
|
734
772
|
/* @__PURE__ */ o("div", { className: "relative min-h-[110px] min-w-0 flex-1", children: [
|
|
735
|
-
/* @__PURE__ */ e(
|
|
773
|
+
/* @__PURE__ */ e(Ke, { fallback: /* @__PURE__ */ e(De, { className: "h-full w-full", "aria-busy": "true" }), children: ({ Cell: E, Pie: oe, PieChart: me, ResponsiveContainer: ge, Tooltip: S }) => /* @__PURE__ */ e(ge, { width: "100%", height: "100%", children: /* @__PURE__ */ o(me, { children: [
|
|
736
774
|
/* @__PURE__ */ e(
|
|
737
|
-
|
|
775
|
+
oe,
|
|
738
776
|
{
|
|
739
|
-
data:
|
|
777
|
+
data: R,
|
|
740
778
|
dataKey: "value",
|
|
741
779
|
nameKey: "dim",
|
|
742
780
|
innerRadius: "58%",
|
|
743
781
|
outerRadius: "88%",
|
|
744
782
|
paddingAngle: 2,
|
|
745
783
|
strokeWidth: 0,
|
|
746
|
-
className:
|
|
747
|
-
onClick: (
|
|
784
|
+
className: u ? "cursor-pointer" : void 0,
|
|
785
|
+
onClick: (j) => {
|
|
748
786
|
var ve;
|
|
749
|
-
const
|
|
750
|
-
|
|
787
|
+
const he = (ve = j == null ? void 0 : j.payload) == null ? void 0 : ve.dim;
|
|
788
|
+
he && te(String(he));
|
|
751
789
|
},
|
|
752
|
-
children:
|
|
790
|
+
children: R.map((j, he) => /* @__PURE__ */ e(E, { fill: ce[he % ce.length] }, j.dim))
|
|
753
791
|
}
|
|
754
792
|
),
|
|
755
793
|
/* @__PURE__ */ e(
|
|
756
|
-
|
|
794
|
+
S,
|
|
757
795
|
{
|
|
758
796
|
contentStyle: {
|
|
759
797
|
fontSize: 12,
|
|
@@ -764,44 +802,44 @@ function fl({
|
|
|
764
802
|
},
|
|
765
803
|
labelStyle: { color: "#f1f5f9" },
|
|
766
804
|
itemStyle: { color: "#e2e8f0" },
|
|
767
|
-
formatter: (
|
|
805
|
+
formatter: (j) => f(j)
|
|
768
806
|
}
|
|
769
807
|
)
|
|
770
808
|
] }) }) }),
|
|
771
809
|
/* @__PURE__ */ o("div", { className: "pointer-events-none absolute inset-0 flex flex-col items-center justify-center", children: [
|
|
772
|
-
/* @__PURE__ */ e("span", { className: "text-[17px] font-semibold leading-none text-slate-900 dark:text-foreground", children:
|
|
810
|
+
/* @__PURE__ */ e("span", { className: "text-[17px] font-semibold leading-none text-slate-900 dark:text-foreground", children: ze(Y, t.value_format ?? "integer") }),
|
|
773
811
|
/* @__PURE__ */ e("span", { className: "text-[9.5px] text-slate-400", children: "total" })
|
|
774
812
|
] })
|
|
775
813
|
] }),
|
|
776
|
-
/* @__PURE__ */ e("div", { className: "max-h-full w-[40%] shrink-0 space-y-0.5 self-center overflow-y-auto pr-1", children:
|
|
814
|
+
/* @__PURE__ */ e("div", { className: "max-h-full w-[40%] shrink-0 space-y-0.5 self-center overflow-y-auto pr-1", children: R.slice(0, 12).map((E, oe) => /* @__PURE__ */ o("div", { className: "flex items-center gap-1.5 text-[10.5px]", children: [
|
|
777
815
|
/* @__PURE__ */ e(
|
|
778
816
|
"span",
|
|
779
817
|
{
|
|
780
818
|
className: "h-2 w-2 shrink-0 rounded-sm",
|
|
781
|
-
style: { background: ce[
|
|
819
|
+
style: { background: ce[oe % ce.length] }
|
|
782
820
|
}
|
|
783
821
|
),
|
|
784
|
-
/* @__PURE__ */ e("span", { className: "truncate text-slate-600 dark:text-slate-300", children:
|
|
785
|
-
/* @__PURE__ */ e("span", { className: "ml-auto tabular-nums text-slate-400", children:
|
|
786
|
-
] },
|
|
787
|
-
|
|
822
|
+
/* @__PURE__ */ e("span", { className: "truncate text-slate-600 dark:text-slate-300", children: E.dim }),
|
|
823
|
+
/* @__PURE__ */ e("span", { className: "ml-auto tabular-nums text-slate-400", children: f(E.value) })
|
|
824
|
+
] }, E.dim)) }),
|
|
825
|
+
U
|
|
788
826
|
] });
|
|
789
827
|
}
|
|
790
828
|
if (t.display === "line" || t.display === "area")
|
|
791
829
|
return /* @__PURE__ */ o("div", { className: "min-h-[110px] min-w-0 flex-1", children: [
|
|
792
|
-
/* @__PURE__ */ e(
|
|
830
|
+
/* @__PURE__ */ e(Ke, { fallback: /* @__PURE__ */ e(De, { className: "h-full w-full", "aria-busy": "true" }), children: ({ Area: N, AreaChart: R, Legend: Y, ResponsiveContainer: E, Tooltip: oe, XAxis: me, YAxis: ge }) => /* @__PURE__ */ e(E, { width: "100%", height: "100%", children: /* @__PURE__ */ o(R, { data: we, margin: { top: 6, right: 8, left: -6, bottom: 0 }, children: [
|
|
793
831
|
/* @__PURE__ */ e(
|
|
794
|
-
|
|
832
|
+
me,
|
|
795
833
|
{
|
|
796
834
|
dataKey: xe,
|
|
797
835
|
tick: { fontSize: 10 },
|
|
798
836
|
stroke: "#94a3b8",
|
|
799
|
-
...
|
|
837
|
+
...Ft(we.length)
|
|
800
838
|
}
|
|
801
839
|
),
|
|
802
|
-
/* @__PURE__ */ e(
|
|
840
|
+
/* @__PURE__ */ e(ge, { tick: { fontSize: 10 }, stroke: "#94a3b8", tickFormatter: $e, width: 48 }),
|
|
803
841
|
/* @__PURE__ */ e(
|
|
804
|
-
|
|
842
|
+
oe,
|
|
805
843
|
{
|
|
806
844
|
contentStyle: {
|
|
807
845
|
fontSize: 12,
|
|
@@ -812,39 +850,39 @@ function fl({
|
|
|
812
850
|
},
|
|
813
851
|
labelStyle: { color: "#f1f5f9" },
|
|
814
852
|
itemStyle: { color: "#e2e8f0" },
|
|
815
|
-
formatter: (
|
|
853
|
+
formatter: (S) => f(S)
|
|
816
854
|
}
|
|
817
855
|
),
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
856
|
+
Ne.length > 1 && /* @__PURE__ */ e(Y, { wrapperStyle: { fontSize: 11 } }),
|
|
857
|
+
Ne.map((S, j) => /* @__PURE__ */ e(
|
|
858
|
+
N,
|
|
821
859
|
{
|
|
822
860
|
type: "monotone",
|
|
823
|
-
dataKey:
|
|
824
|
-
name:
|
|
825
|
-
stroke:
|
|
861
|
+
dataKey: S.field,
|
|
862
|
+
name: S.label ?? S.field,
|
|
863
|
+
stroke: S.color ?? ce[j % ce.length],
|
|
826
864
|
strokeWidth: 2,
|
|
827
|
-
strokeDasharray:
|
|
828
|
-
fill:
|
|
829
|
-
fillOpacity: t.display === "area" && !
|
|
865
|
+
strokeDasharray: S.dash ? "4 3" : void 0,
|
|
866
|
+
fill: S.color ?? ce[j % ce.length],
|
|
867
|
+
fillOpacity: t.display === "area" && !S.dash ? 0.12 : 0
|
|
830
868
|
},
|
|
831
|
-
|
|
869
|
+
S.field
|
|
832
870
|
))
|
|
833
871
|
] }) }) }),
|
|
834
|
-
|
|
872
|
+
U
|
|
835
873
|
] });
|
|
836
|
-
const
|
|
874
|
+
const fe = t.display === "stacked_bar";
|
|
837
875
|
return /* @__PURE__ */ o("div", { className: "min-h-[110px] min-w-0 flex-1", children: [
|
|
838
|
-
/* @__PURE__ */ e(
|
|
839
|
-
|
|
876
|
+
/* @__PURE__ */ e(Ke, { fallback: /* @__PURE__ */ e(De, { className: "h-full w-full", "aria-busy": "true" }), children: ({ Bar: N, BarChart: R, Cell: Y, Legend: E, ResponsiveContainer: oe, Tooltip: me, XAxis: ge, YAxis: S }) => /* @__PURE__ */ e(oe, { width: "100%", height: "100%", children: /* @__PURE__ */ o(
|
|
877
|
+
R,
|
|
840
878
|
{
|
|
841
|
-
data:
|
|
842
|
-
layout:
|
|
843
|
-
margin: { top: 6, right: 8, left:
|
|
879
|
+
data: we,
|
|
880
|
+
layout: X ? "vertical" : "horizontal",
|
|
881
|
+
margin: { top: 6, right: 8, left: X ? 30 : -6, bottom: 0 },
|
|
844
882
|
children: [
|
|
845
|
-
|
|
883
|
+
X ? /* @__PURE__ */ o(et, { children: [
|
|
846
884
|
/* @__PURE__ */ e(
|
|
847
|
-
|
|
885
|
+
ge,
|
|
848
886
|
{
|
|
849
887
|
type: "number",
|
|
850
888
|
tick: { fontSize: 10 },
|
|
@@ -853,7 +891,7 @@ function fl({
|
|
|
853
891
|
}
|
|
854
892
|
),
|
|
855
893
|
/* @__PURE__ */ e(
|
|
856
|
-
|
|
894
|
+
S,
|
|
857
895
|
{
|
|
858
896
|
type: "category",
|
|
859
897
|
dataKey: xe,
|
|
@@ -861,23 +899,23 @@ function fl({
|
|
|
861
899
|
stroke: "#94a3b8",
|
|
862
900
|
width: 140,
|
|
863
901
|
interval: 0,
|
|
864
|
-
tickFormatter:
|
|
902
|
+
tickFormatter: Pl
|
|
865
903
|
}
|
|
866
904
|
)
|
|
867
|
-
] }) : /* @__PURE__ */ o(
|
|
905
|
+
] }) : /* @__PURE__ */ o(et, { children: [
|
|
868
906
|
/* @__PURE__ */ e(
|
|
869
|
-
|
|
907
|
+
ge,
|
|
870
908
|
{
|
|
871
909
|
dataKey: xe,
|
|
872
910
|
tick: { fontSize: 10 },
|
|
873
911
|
stroke: "#94a3b8",
|
|
874
|
-
...
|
|
912
|
+
...Ft(we.length)
|
|
875
913
|
}
|
|
876
914
|
),
|
|
877
|
-
/* @__PURE__ */ e(
|
|
915
|
+
/* @__PURE__ */ e(S, { tick: { fontSize: 10 }, stroke: "#94a3b8", tickFormatter: $e, width: 48 })
|
|
878
916
|
] }),
|
|
879
917
|
/* @__PURE__ */ e(
|
|
880
|
-
|
|
918
|
+
me,
|
|
881
919
|
{
|
|
882
920
|
contentStyle: {
|
|
883
921
|
fontSize: 12,
|
|
@@ -888,45 +926,45 @@ function fl({
|
|
|
888
926
|
},
|
|
889
927
|
labelStyle: { color: "#f1f5f9" },
|
|
890
928
|
itemStyle: { color: "#e2e8f0" },
|
|
891
|
-
formatter: (
|
|
929
|
+
formatter: (j) => f(j)
|
|
892
930
|
}
|
|
893
931
|
),
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
932
|
+
Ne.length > 1 && /* @__PURE__ */ e(E, { wrapperStyle: { fontSize: 11 } }),
|
|
933
|
+
Ne.map((j, he) => /* @__PURE__ */ e(
|
|
934
|
+
N,
|
|
897
935
|
{
|
|
898
|
-
className:
|
|
936
|
+
className: u ? "cursor-pointer" : void 0,
|
|
899
937
|
onClick: (ve) => {
|
|
900
|
-
var
|
|
901
|
-
const
|
|
902
|
-
|
|
938
|
+
var Me;
|
|
939
|
+
const Fe = (Me = ve == null ? void 0 : ve.payload) == null ? void 0 : Me[xe];
|
|
940
|
+
Fe != null && te(String(Fe));
|
|
903
941
|
},
|
|
904
|
-
dataKey:
|
|
905
|
-
name:
|
|
906
|
-
stackId:
|
|
907
|
-
fill:
|
|
908
|
-
radius:
|
|
909
|
-
children:
|
|
942
|
+
dataKey: j.field,
|
|
943
|
+
name: j.label ?? j.field,
|
|
944
|
+
stackId: fe ? "stack" : void 0,
|
|
945
|
+
fill: j.color ?? ce[he % ce.length],
|
|
946
|
+
radius: fe ? 0 : X ? [0, 3, 3, 0] : [3, 3, 0, 0],
|
|
947
|
+
children: Ne.length === 1 && !j.color && we.map((ve, Fe) => /* @__PURE__ */ e(Y, { fill: ce[Fe % ce.length] }, Fe))
|
|
910
948
|
},
|
|
911
|
-
|
|
949
|
+
j.field
|
|
912
950
|
))
|
|
913
951
|
]
|
|
914
952
|
}
|
|
915
953
|
) }) }),
|
|
916
|
-
|
|
954
|
+
U
|
|
917
955
|
] });
|
|
918
956
|
}
|
|
919
|
-
const
|
|
920
|
-
function
|
|
921
|
-
var s, c,
|
|
957
|
+
const Fl = ["gt", "gte", "lt", "lte", "eq"], va = { gt: ">", gte: "≥", lt: "<", lte: "≤", eq: "=" }, Ml = ["sum", "avg", "max", "min"];
|
|
958
|
+
function Rl(t) {
|
|
959
|
+
var s, c, u;
|
|
922
960
|
const n = [
|
|
923
961
|
{ value: "value", label: "Value (widget metric)" },
|
|
924
962
|
{ value: "row_count", label: "Row count" }
|
|
925
963
|
], a = (s = t.config) == null ? void 0 : s.query;
|
|
926
964
|
if (t.type === "query" && a) {
|
|
927
|
-
const h = a.columns && a.columns.length > 0 ? a.columns.map((
|
|
928
|
-
value:
|
|
929
|
-
label:
|
|
965
|
+
const h = a.columns && a.columns.length > 0 ? a.columns.map((g) => ({ value: g.field, label: g.label ?? g.field, aggregatable: !0 })) : (a.series ?? []).map((g) => ({
|
|
966
|
+
value: g.field,
|
|
967
|
+
label: g.label ?? g.field,
|
|
930
968
|
aggregatable: !0
|
|
931
969
|
}));
|
|
932
970
|
return [...n, ...h];
|
|
@@ -940,23 +978,23 @@ function gl(t) {
|
|
|
940
978
|
}))
|
|
941
979
|
];
|
|
942
980
|
if (t.type === "table") {
|
|
943
|
-
const h = (((
|
|
981
|
+
const h = (((u = t.config) == null ? void 0 : u.columns) ?? []).map((g) => typeof g == "string" ? { field: g } : g).map((g) => ({ value: g.field, label: g.label ?? g.field, aggregatable: !0 }));
|
|
944
982
|
return [...n, ...h];
|
|
945
983
|
}
|
|
946
984
|
return n;
|
|
947
985
|
}
|
|
948
|
-
function
|
|
986
|
+
function Jt(t, n) {
|
|
949
987
|
var h;
|
|
950
|
-
const a = /^(sum|avg|max|min|tile):(.+)$/.exec(t.field), s = a ? a[2] : t.field, c = ((h = n.find((
|
|
951
|
-
return `${a && a[1] !== "sum" && a[1] !== "tile" ? `${a[1]} ` : ""}${c} ${
|
|
988
|
+
const a = /^(sum|avg|max|min|tile):(.+)$/.exec(t.field), s = a ? a[2] : t.field, c = ((h = n.find((g) => g.value === t.field || g.value === s)) == null ? void 0 : h.label) ?? s;
|
|
989
|
+
return `${a && a[1] !== "sum" && a[1] !== "tile" ? `${a[1]} ` : ""}${c} ${va[t.op] ?? t.op} ${t.value.toLocaleString()}`;
|
|
952
990
|
}
|
|
953
|
-
function
|
|
954
|
-
const a =
|
|
991
|
+
function Tl({ reportId: t, alert: n }) {
|
|
992
|
+
const a = Le(), s = lt(), { data: c = [] } = Se({
|
|
955
993
|
queryKey: ["nivaro-report-alert-log", t, n.id],
|
|
956
|
-
queryFn: () => a.request(
|
|
994
|
+
queryFn: () => a.request(Ma(t, n.id)).then((h) => h.data),
|
|
957
995
|
staleTime: 3e4
|
|
958
|
-
}),
|
|
959
|
-
mutationFn: () => a.request(
|
|
996
|
+
}), u = Ae({
|
|
997
|
+
mutationFn: () => a.request(Ra(t, n.id)),
|
|
960
998
|
onSuccess: () => {
|
|
961
999
|
s.invalidateQueries({ queryKey: ["nivaro-report-alert-log", t, n.id] }), s.invalidateQueries({ queryKey: ["nivaro-report-alerts", t] });
|
|
962
1000
|
}
|
|
@@ -965,13 +1003,13 @@ function vl({ reportId: t, alert: n }) {
|
|
|
965
1003
|
/* @__PURE__ */ e(
|
|
966
1004
|
"span",
|
|
967
1005
|
{
|
|
968
|
-
className:
|
|
1006
|
+
className: P(
|
|
969
1007
|
"h-1.5 w-1.5 shrink-0 rounded-full",
|
|
970
1008
|
h.status === "firing" ? "bg-amber-500" : "bg-emerald-500"
|
|
971
1009
|
)
|
|
972
1010
|
}
|
|
973
1011
|
),
|
|
974
|
-
/* @__PURE__ */ e("span", { className:
|
|
1012
|
+
/* @__PURE__ */ e("span", { className: P(h.status === "firing" ? "text-amber-600" : "text-slate-500"), children: h.status === "firing" ? "Firing" : "Resolved" }),
|
|
975
1013
|
/* @__PURE__ */ o("span", { className: "min-w-0 flex-1 truncate text-slate-400", children: [
|
|
976
1014
|
new Date(h.fired_at).toLocaleString(),
|
|
977
1015
|
h.resolved_at ? ` → ${new Date(h.resolved_at).toLocaleString()}` : ""
|
|
@@ -981,70 +1019,70 @@ function vl({ reportId: t, alert: n }) {
|
|
|
981
1019
|
{
|
|
982
1020
|
type: "button",
|
|
983
1021
|
className: "shrink-0 text-[10px] text-slate-400 underline hover:text-emerald-600",
|
|
984
|
-
onClick: () =>
|
|
1022
|
+
onClick: () => u.mutate(),
|
|
985
1023
|
children: "Mark resolved"
|
|
986
1024
|
}
|
|
987
1025
|
)
|
|
988
1026
|
] }, h.id)) });
|
|
989
1027
|
}
|
|
990
|
-
function
|
|
1028
|
+
function Ll({
|
|
991
1029
|
reportId: t,
|
|
992
1030
|
widget: n,
|
|
993
1031
|
filterBar: a
|
|
994
1032
|
}) {
|
|
995
|
-
const s =
|
|
1033
|
+
const s = Le(), c = lt(), [u, h] = _(!1), [g, p] = _(""), [D, O] = _([
|
|
996
1034
|
{ field: "value", agg: "sum", op: "gt", value: "" }
|
|
997
|
-
]), [
|
|
1035
|
+
]), [y, Q] = _([]), [m, k] = _(!1), [Z, F] = _(null), H = Rl(n), { data: z = [] } = Se({
|
|
998
1036
|
queryKey: ["nivaro-report-alerts", t],
|
|
999
|
-
queryFn: () => s.request(
|
|
1000
|
-
enabled:
|
|
1037
|
+
queryFn: () => s.request($a(t)).then((f) => f.data),
|
|
1038
|
+
enabled: u,
|
|
1001
1039
|
staleTime: 3e4
|
|
1002
|
-
}),
|
|
1003
|
-
const
|
|
1004
|
-
return { field:
|
|
1005
|
-
}), se =
|
|
1040
|
+
}), ue = z.filter((f) => f.widget === n.id), J = () => void c.invalidateQueries({ queryKey: ["nivaro-report-alerts", t] }), W = () => D.filter((f) => f.value.trim() !== "" && !Number.isNaN(Number(f.value))).map((f) => {
|
|
1041
|
+
const X = H.find((U) => U.value === f.field);
|
|
1042
|
+
return { field: X != null && X.aggregatable && f.agg !== "sum" ? `${f.agg}:${f.field}` : f.field, op: f.op, value: Number(f.value) };
|
|
1043
|
+
}), se = Ae({
|
|
1006
1044
|
mutationFn: () => {
|
|
1007
|
-
const
|
|
1045
|
+
const f = W(), X = f.map((te) => Jt(te, H)).join(" & ");
|
|
1008
1046
|
return s.request(
|
|
1009
|
-
|
|
1047
|
+
qa(t, {
|
|
1010
1048
|
widget: n.id,
|
|
1011
|
-
name:
|
|
1012
|
-
conditions:
|
|
1013
|
-
filters:
|
|
1014
|
-
delivery_email:
|
|
1049
|
+
name: g.trim() || X.slice(0, 120),
|
|
1050
|
+
conditions: f,
|
|
1051
|
+
filters: y.filter((te) => te.values.length > 0),
|
|
1052
|
+
delivery_email: m,
|
|
1015
1053
|
delivery_inapp: !0
|
|
1016
1054
|
})
|
|
1017
1055
|
);
|
|
1018
1056
|
},
|
|
1019
1057
|
onSuccess: () => {
|
|
1020
|
-
|
|
1058
|
+
p(""), O([{ field: "value", agg: "sum", op: "gt", value: "" }]), Q([]), J();
|
|
1021
1059
|
}
|
|
1022
|
-
}), xe =
|
|
1023
|
-
mutationFn: (
|
|
1060
|
+
}), xe = Ae({
|
|
1061
|
+
mutationFn: (f) => s.request(Aa(t, f.id, !f.is_active)),
|
|
1024
1062
|
onSuccess: J
|
|
1025
|
-
}),
|
|
1026
|
-
mutationFn: (
|
|
1063
|
+
}), Ne = Ae({
|
|
1064
|
+
mutationFn: (f) => s.request(Fa(t, f.id)),
|
|
1027
1065
|
onSuccess: J
|
|
1028
|
-
}),
|
|
1029
|
-
return /* @__PURE__ */ o(
|
|
1030
|
-
/* @__PURE__ */ e(
|
|
1066
|
+
}), we = W().length > 0, $e = ue.some((f) => f.firing);
|
|
1067
|
+
return /* @__PURE__ */ o(da, { open: u, onOpenChange: h, children: [
|
|
1068
|
+
/* @__PURE__ */ e(ca, { asChild: !0, children: /* @__PURE__ */ e(
|
|
1031
1069
|
"button",
|
|
1032
1070
|
{
|
|
1033
1071
|
type: "button",
|
|
1034
1072
|
title: "Alerts on this widget",
|
|
1035
|
-
className:
|
|
1073
|
+
className: P(
|
|
1036
1074
|
"rounded p-0.5",
|
|
1037
1075
|
$e ? "text-amber-500" : "text-slate-300 hover:text-amber-500 dark:text-slate-600"
|
|
1038
1076
|
),
|
|
1039
|
-
children: /* @__PURE__ */ e(
|
|
1077
|
+
children: /* @__PURE__ */ e(Zt, { className: "h-3 w-3" })
|
|
1040
1078
|
}
|
|
1041
1079
|
) }),
|
|
1042
|
-
/* @__PURE__ */ o(
|
|
1080
|
+
/* @__PURE__ */ o(ua, { className: "w-[380px] p-3", align: "end", children: [
|
|
1043
1081
|
/* @__PURE__ */ o("p", { className: "mb-2 text-[12px] font-semibold text-slate-700 dark:text-slate-200", children: [
|
|
1044
1082
|
"Alerts · ",
|
|
1045
1083
|
n.title
|
|
1046
1084
|
] }),
|
|
1047
|
-
|
|
1085
|
+
ue.length > 0 && /* @__PURE__ */ e("div", { className: "mb-2 space-y-1.5", children: ue.map((f) => /* @__PURE__ */ o(
|
|
1048
1086
|
"div",
|
|
1049
1087
|
{
|
|
1050
1088
|
className: "rounded-md border border-slate-100 px-2 py-1.5 dark:border-border/60",
|
|
@@ -1053,19 +1091,19 @@ function yl({
|
|
|
1053
1091
|
/* @__PURE__ */ e(
|
|
1054
1092
|
"span",
|
|
1055
1093
|
{
|
|
1056
|
-
className:
|
|
1094
|
+
className: P(
|
|
1057
1095
|
"h-1.5 w-1.5 shrink-0 rounded-full",
|
|
1058
|
-
|
|
1096
|
+
f.firing ? "bg-amber-500" : f.is_active ? "bg-emerald-500" : "bg-slate-300"
|
|
1059
1097
|
)
|
|
1060
1098
|
}
|
|
1061
1099
|
),
|
|
1062
|
-
/* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate font-medium text-slate-700 dark:text-slate-200", children:
|
|
1100
|
+
/* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate font-medium text-slate-700 dark:text-slate-200", children: f.name }),
|
|
1063
1101
|
/* @__PURE__ */ e(
|
|
1064
1102
|
"button",
|
|
1065
1103
|
{
|
|
1066
1104
|
type: "button",
|
|
1067
1105
|
className: "text-[10.5px] text-slate-400 hover:text-slate-600",
|
|
1068
|
-
onClick: () => F(
|
|
1106
|
+
onClick: () => F(Z === f.id ? null : f.id),
|
|
1069
1107
|
children: "History"
|
|
1070
1108
|
}
|
|
1071
1109
|
),
|
|
@@ -1074,8 +1112,8 @@ function yl({
|
|
|
1074
1112
|
{
|
|
1075
1113
|
type: "button",
|
|
1076
1114
|
className: "text-[10.5px] text-slate-400 hover:text-slate-600",
|
|
1077
|
-
onClick: () => xe.mutate(
|
|
1078
|
-
children:
|
|
1115
|
+
onClick: () => xe.mutate(f),
|
|
1116
|
+
children: f.is_active ? "Pause" : "Resume"
|
|
1079
1117
|
}
|
|
1080
1118
|
),
|
|
1081
1119
|
/* @__PURE__ */ e(
|
|
@@ -1083,67 +1121,67 @@ function yl({
|
|
|
1083
1121
|
{
|
|
1084
1122
|
type: "button",
|
|
1085
1123
|
className: "text-slate-300 hover:text-red-500",
|
|
1086
|
-
onClick: () =>
|
|
1087
|
-
children: /* @__PURE__ */ e(
|
|
1124
|
+
onClick: () => Ne.mutate(f),
|
|
1125
|
+
children: /* @__PURE__ */ e(Ea, { className: "h-3 w-3" })
|
|
1088
1126
|
}
|
|
1089
1127
|
)
|
|
1090
1128
|
] }),
|
|
1091
1129
|
/* @__PURE__ */ o("p", { className: "mt-0.5 truncate pl-3 text-[10.5px] text-slate-400", children: [
|
|
1092
|
-
(
|
|
1093
|
-
|
|
1130
|
+
(f.conditions ?? []).map((X) => Jt(X, H)).join(" & "),
|
|
1131
|
+
f.filters && f.filters.length > 0 && ` · scoped: ${f.filters.map((X) => (X.labels ?? X.values).join("/")).join(", ")}`,
|
|
1094
1132
|
" · ",
|
|
1095
|
-
|
|
1133
|
+
f.delivery_email ? "In-app + Email" : "In-app",
|
|
1096
1134
|
" · Last fired: ",
|
|
1097
|
-
|
|
1135
|
+
f.last_fired ? new Date(f.last_fired).toLocaleString() : "Never"
|
|
1098
1136
|
] }),
|
|
1099
|
-
|
|
1137
|
+
Z === f.id && /* @__PURE__ */ e(Tl, { reportId: t, alert: f })
|
|
1100
1138
|
]
|
|
1101
1139
|
},
|
|
1102
|
-
|
|
1140
|
+
f.id
|
|
1103
1141
|
)) }),
|
|
1104
1142
|
/* @__PURE__ */ o("div", { className: "space-y-1.5 border-t border-slate-100 pt-2 dark:border-border", children: [
|
|
1105
1143
|
/* @__PURE__ */ e(
|
|
1106
1144
|
"input",
|
|
1107
1145
|
{
|
|
1108
|
-
value:
|
|
1109
|
-
onChange: (
|
|
1146
|
+
value: g,
|
|
1147
|
+
onChange: (f) => p(f.target.value),
|
|
1110
1148
|
placeholder: "Alert name (optional)",
|
|
1111
1149
|
className: "h-7 w-full rounded-md border border-slate-200 bg-white px-2 text-[11.5px] dark:border-border dark:bg-card"
|
|
1112
1150
|
}
|
|
1113
1151
|
),
|
|
1114
|
-
|
|
1115
|
-
const
|
|
1152
|
+
D.map((f, X) => {
|
|
1153
|
+
const te = H.find((U) => U.value === f.field);
|
|
1116
1154
|
return /* @__PURE__ */ o("div", { className: "flex items-center gap-1", children: [
|
|
1117
1155
|
/* @__PURE__ */ e(
|
|
1118
|
-
|
|
1156
|
+
$t,
|
|
1119
1157
|
{
|
|
1120
|
-
value:
|
|
1121
|
-
onChange: (
|
|
1122
|
-
options:
|
|
1158
|
+
value: f.field,
|
|
1159
|
+
onChange: (U) => O((fe) => fe.map((re, ae) => ae === X ? { ...re, field: U } : re)),
|
|
1160
|
+
options: H.map((U) => ({ value: U.value, label: U.label })),
|
|
1123
1161
|
ariaLabel: "Alert metric field",
|
|
1124
1162
|
className: "h-7 min-w-0 flex-1 rounded-md px-1.5 py-0 text-[11.5px] dark:border-border dark:bg-card"
|
|
1125
1163
|
}
|
|
1126
1164
|
),
|
|
1127
|
-
(
|
|
1128
|
-
|
|
1165
|
+
(te == null ? void 0 : te.aggregatable) && /* @__PURE__ */ e(
|
|
1166
|
+
$t,
|
|
1129
1167
|
{
|
|
1130
|
-
value:
|
|
1131
|
-
onChange: (
|
|
1132
|
-
(
|
|
1168
|
+
value: f.agg,
|
|
1169
|
+
onChange: (U) => O(
|
|
1170
|
+
(fe) => fe.map((re, ae) => ae === X ? { ...re, agg: U } : re)
|
|
1133
1171
|
),
|
|
1134
|
-
options:
|
|
1172
|
+
options: Ml.map((U) => ({ value: U, label: U })),
|
|
1135
1173
|
ariaLabel: "Aggregate",
|
|
1136
1174
|
className: "h-7 w-[62px] rounded-md px-1.5 py-0 text-[11.5px] dark:border-border dark:bg-card"
|
|
1137
1175
|
}
|
|
1138
1176
|
),
|
|
1139
1177
|
/* @__PURE__ */ e(
|
|
1140
|
-
|
|
1178
|
+
$t,
|
|
1141
1179
|
{
|
|
1142
|
-
value:
|
|
1143
|
-
onChange: (
|
|
1144
|
-
(
|
|
1180
|
+
value: f.op,
|
|
1181
|
+
onChange: (U) => O(
|
|
1182
|
+
(fe) => fe.map((re, ae) => ae === X ? { ...re, op: U } : re)
|
|
1145
1183
|
),
|
|
1146
|
-
options:
|
|
1184
|
+
options: Fl.map((U) => ({ value: U, label: va[U] })),
|
|
1147
1185
|
ariaLabel: "Operator",
|
|
1148
1186
|
className: "h-7 w-[52px] rounded-md px-1.5 py-0 text-[11.5px] dark:border-border dark:bg-card"
|
|
1149
1187
|
}
|
|
@@ -1151,53 +1189,53 @@ function yl({
|
|
|
1151
1189
|
/* @__PURE__ */ e(
|
|
1152
1190
|
"input",
|
|
1153
1191
|
{
|
|
1154
|
-
value:
|
|
1155
|
-
onChange: (
|
|
1156
|
-
(
|
|
1192
|
+
value: f.value,
|
|
1193
|
+
onChange: (U) => O(
|
|
1194
|
+
(fe) => fe.map((re, ae) => ae === X ? { ...re, value: U.target.value } : re)
|
|
1157
1195
|
),
|
|
1158
1196
|
placeholder: "0",
|
|
1159
1197
|
inputMode: "decimal",
|
|
1160
1198
|
className: "h-7 w-[64px] rounded-md border border-slate-200 bg-white px-2 text-right text-[11.5px] tabular-nums dark:border-border dark:bg-card"
|
|
1161
1199
|
}
|
|
1162
1200
|
),
|
|
1163
|
-
|
|
1201
|
+
D.length > 1 && /* @__PURE__ */ e(
|
|
1164
1202
|
"button",
|
|
1165
1203
|
{
|
|
1166
1204
|
type: "button",
|
|
1167
1205
|
className: "text-slate-300 hover:text-red-500",
|
|
1168
|
-
onClick: () =>
|
|
1169
|
-
children: /* @__PURE__ */ e(
|
|
1206
|
+
onClick: () => O((U) => U.filter((fe, re) => re !== X)),
|
|
1207
|
+
children: /* @__PURE__ */ e(Te, { className: "h-3 w-3" })
|
|
1170
1208
|
}
|
|
1171
1209
|
)
|
|
1172
|
-
] },
|
|
1210
|
+
] }, X);
|
|
1173
1211
|
}),
|
|
1174
1212
|
/* @__PURE__ */ e(
|
|
1175
1213
|
"button",
|
|
1176
1214
|
{
|
|
1177
1215
|
type: "button",
|
|
1178
1216
|
className: "text-[10.5px] text-slate-400 hover:text-nvr-navy dark:hover:text-nvr-cyan",
|
|
1179
|
-
onClick: () =>
|
|
1217
|
+
onClick: () => O((f) => [...f, { field: "value", agg: "sum", op: "gt", value: "" }]),
|
|
1180
1218
|
children: "+ condition (all must match)"
|
|
1181
1219
|
}
|
|
1182
1220
|
),
|
|
1183
1221
|
a.length > 0 && /* @__PURE__ */ o("div", { children: [
|
|
1184
1222
|
/* @__PURE__ */ e("p", { className: "mb-1 text-[10.5px] font-medium uppercase tracking-wide text-slate-400", children: "Alert scope (optional)" }),
|
|
1185
|
-
/* @__PURE__ */ e("div", { className: "flex flex-wrap gap-1", children: a.map((
|
|
1186
|
-
var
|
|
1223
|
+
/* @__PURE__ */ e("div", { className: "flex flex-wrap gap-1", children: a.map((f) => {
|
|
1224
|
+
var X;
|
|
1187
1225
|
return /* @__PURE__ */ e(
|
|
1188
|
-
|
|
1226
|
+
ma,
|
|
1189
1227
|
{
|
|
1190
1228
|
reportId: t,
|
|
1191
|
-
field:
|
|
1192
|
-
label:
|
|
1193
|
-
optionSource:
|
|
1194
|
-
selected: ((
|
|
1195
|
-
onChange: (
|
|
1196
|
-
...
|
|
1197
|
-
...
|
|
1229
|
+
field: f.field,
|
|
1230
|
+
label: f.label,
|
|
1231
|
+
optionSource: f.options,
|
|
1232
|
+
selected: ((X = y.find((te) => te.field === f.field)) == null ? void 0 : X.values) ?? [],
|
|
1233
|
+
onChange: (te, U) => Q((fe) => [
|
|
1234
|
+
...fe.filter((re) => re.field !== f.field),
|
|
1235
|
+
...te.length > 0 ? [{ field: f.field, values: te, labels: U }] : []
|
|
1198
1236
|
])
|
|
1199
1237
|
},
|
|
1200
|
-
|
|
1238
|
+
f.field
|
|
1201
1239
|
);
|
|
1202
1240
|
}) })
|
|
1203
1241
|
] }),
|
|
@@ -1207,8 +1245,8 @@ function yl({
|
|
|
1207
1245
|
"input",
|
|
1208
1246
|
{
|
|
1209
1247
|
type: "checkbox",
|
|
1210
|
-
checked:
|
|
1211
|
-
onChange: (
|
|
1248
|
+
checked: m,
|
|
1249
|
+
onChange: (f) => k(f.target.checked),
|
|
1212
1250
|
className: "h-3 w-3 accent-nvr-cyan"
|
|
1213
1251
|
}
|
|
1214
1252
|
),
|
|
@@ -1218,11 +1256,11 @@ function yl({
|
|
|
1218
1256
|
"button",
|
|
1219
1257
|
{
|
|
1220
1258
|
type: "button",
|
|
1221
|
-
disabled: !
|
|
1259
|
+
disabled: !we || se.isPending,
|
|
1222
1260
|
onClick: () => se.mutate(),
|
|
1223
1261
|
className: "inline-flex h-7 items-center gap-1 rounded-md bg-nvr-cyan px-2 text-[11.5px] font-semibold text-white disabled:opacity-50",
|
|
1224
1262
|
children: [
|
|
1225
|
-
/* @__PURE__ */ e(
|
|
1263
|
+
/* @__PURE__ */ e(Xt, { className: "h-3 w-3" }),
|
|
1226
1264
|
" Add alert"
|
|
1227
1265
|
]
|
|
1228
1266
|
}
|
|
@@ -1233,7 +1271,7 @@ function yl({
|
|
|
1233
1271
|
] })
|
|
1234
1272
|
] });
|
|
1235
1273
|
}
|
|
1236
|
-
const
|
|
1274
|
+
const Ol = {
|
|
1237
1275
|
eq: "_eq",
|
|
1238
1276
|
neq: "_neq",
|
|
1239
1277
|
gt: "_gt",
|
|
@@ -1245,104 +1283,104 @@ const kl = {
|
|
|
1245
1283
|
null: "_null",
|
|
1246
1284
|
nnull: "_nnull"
|
|
1247
1285
|
};
|
|
1248
|
-
function
|
|
1249
|
-
var
|
|
1250
|
-
const c = t.config ?? {},
|
|
1251
|
-
for (const
|
|
1252
|
-
const
|
|
1253
|
-
if (!
|
|
1254
|
-
let
|
|
1255
|
-
|
|
1286
|
+
function Tt(t, n, a, s) {
|
|
1287
|
+
var D, O;
|
|
1288
|
+
const c = t.config ?? {}, u = [];
|
|
1289
|
+
for (const y of c.filters ?? []) {
|
|
1290
|
+
const Q = Ol[y.op];
|
|
1291
|
+
if (!Q) continue;
|
|
1292
|
+
let m = y.value;
|
|
1293
|
+
y.op === "in" && typeof m == "string" && (m = m.split(",").map((k) => k.trim())), u.push({ path: [y.field], op: Q, value: m });
|
|
1256
1294
|
}
|
|
1257
|
-
for (const
|
|
1258
|
-
(
|
|
1259
|
-
const h = c.date_field || ((
|
|
1260
|
-
|
|
1261
|
-
const
|
|
1262
|
-
if (s !== void 0 && (
|
|
1263
|
-
if (
|
|
1264
|
-
const
|
|
1265
|
-
if (/^\d{4}-\d{2}-\d{2}$/.test(
|
|
1266
|
-
|
|
1267
|
-
else if (/^\d{4}-\d{2}$/.test(
|
|
1268
|
-
const [
|
|
1269
|
-
|
|
1270
|
-
path: [
|
|
1295
|
+
for (const y of n)
|
|
1296
|
+
(D = y.values) != null && D.length && u.push({ path: [y.field], op: "_in", value: y.values });
|
|
1297
|
+
const h = c.date_field || ((O = c.dimension) != null && O.bucket ? c.dimension.field : null), g = pa(a);
|
|
1298
|
+
g && h && (u.push({ path: [h], op: "_gte", value: g.start }), u.push({ path: [h], op: "_lte", value: `${g.end}T23:59:59` }));
|
|
1299
|
+
const p = c.dimension;
|
|
1300
|
+
if (s !== void 0 && (p != null && p.field))
|
|
1301
|
+
if (p.bucket) {
|
|
1302
|
+
const y = String(s);
|
|
1303
|
+
if (/^\d{4}-\d{2}-\d{2}$/.test(y))
|
|
1304
|
+
u.push({ path: [p.field], op: "_gte", value: y }), u.push({ path: [p.field], op: "_lte", value: `${y}T23:59:59` });
|
|
1305
|
+
else if (/^\d{4}-\d{2}$/.test(y)) {
|
|
1306
|
+
const [Q, m] = y.split("-").map(Number), k = new Date(Q, m, 0).getDate();
|
|
1307
|
+
u.push({ path: [p.field], op: "_gte", value: `${y}-01` }), u.push({
|
|
1308
|
+
path: [p.field],
|
|
1271
1309
|
op: "_lte",
|
|
1272
|
-
value: `${
|
|
1310
|
+
value: `${y}-${String(k).padStart(2, "0")}T23:59:59`
|
|
1273
1311
|
});
|
|
1274
1312
|
}
|
|
1275
|
-
} else s === null ?
|
|
1276
|
-
return
|
|
1313
|
+
} else s === null ? u.push({ path: [p.field], op: "_null", value: !0 }) : u.push({ path: [p.field], op: "_eq", value: s });
|
|
1314
|
+
return u;
|
|
1277
1315
|
}
|
|
1278
|
-
function
|
|
1316
|
+
function Ut(t) {
|
|
1279
1317
|
const n = t.config ?? {}, a = [], s = n.query;
|
|
1280
1318
|
if (t.type === "query" && (s != null && s.slug))
|
|
1281
1319
|
a.push(`Custom query: ${s.slug}`);
|
|
1282
1320
|
else if (t.collection) {
|
|
1283
|
-
const c = n.metric,
|
|
1321
|
+
const c = n.metric, u = (c == null ? void 0 : c.aggregate) ?? "count";
|
|
1284
1322
|
a.push(
|
|
1285
|
-
`${
|
|
1323
|
+
`${u === "count" ? "Count of" : `${u.toUpperCase()} of ${(c == null ? void 0 : c.field) ?? "?"} on`} ${t.collection.replace(/_/g, " ")}`
|
|
1286
1324
|
);
|
|
1287
1325
|
const h = n.dimension;
|
|
1288
1326
|
h != null && h.field && a.push(`by ${h.field}${h.bucket ? ` (${h.bucket})` : ""}`);
|
|
1289
|
-
const
|
|
1290
|
-
for (const
|
|
1327
|
+
const g = n.filters ?? [];
|
|
1328
|
+
for (const p of g) a.push(`${p.field} ${p.op} ${String(p.value ?? "")}`);
|
|
1291
1329
|
n.date_field && a.push(`dated by ${n.date_field}`), n.compare && a.push(`compared to ${String(n.compare).replace(/_/g, " ")}`);
|
|
1292
1330
|
}
|
|
1293
1331
|
return a.length > 0 ? a.join(" · ") : "No configuration details";
|
|
1294
1332
|
}
|
|
1295
|
-
function
|
|
1333
|
+
function Kl(t) {
|
|
1296
1334
|
var n, a;
|
|
1297
1335
|
return t ? t.value != null ? Number(t.value) : t.series ? t.series.reduce((s, c) => s + (Number(c.value) || 0), 0) : (n = t.tiles) != null && n.length ? Number(((a = t.tiles[0]) == null ? void 0 : a.value) ?? 0) : t.row_count != null ? Number(t.row_count) : null : null;
|
|
1298
1336
|
}
|
|
1299
|
-
function
|
|
1300
|
-
var
|
|
1337
|
+
function Yt(t, n, a) {
|
|
1338
|
+
var O, y, Q;
|
|
1301
1339
|
const s = a ? [...a] : [];
|
|
1302
|
-
if (s.length === 0 && ((
|
|
1303
|
-
for (const
|
|
1340
|
+
if (s.length === 0 && ((O = n == null ? void 0 : n.rows) != null && O.length) && s.push(...n.rows), s.length === 0 && ((y = n == null ? void 0 : n.series) != null && y.length))
|
|
1341
|
+
for (const m of n.series)
|
|
1304
1342
|
s.push({
|
|
1305
|
-
dim:
|
|
1306
|
-
value:
|
|
1307
|
-
...
|
|
1308
|
-
...
|
|
1343
|
+
dim: m.dim,
|
|
1344
|
+
value: m.value,
|
|
1345
|
+
...m.prev != null ? { previous: m.prev } : {},
|
|
1346
|
+
...m.value2 != null ? { value2: m.value2 } : {}
|
|
1309
1347
|
});
|
|
1310
|
-
if (s.length === 0 && ((
|
|
1311
|
-
for (const
|
|
1348
|
+
if (s.length === 0 && ((Q = n == null ? void 0 : n.tiles) != null && Q.length))
|
|
1349
|
+
for (const m of n.tiles) s.push({ label: m.label, value: m.value });
|
|
1312
1350
|
if (s.length === 0 && (n == null ? void 0 : n.value) != null && s.push({ value: n.value }), s.length === 0) {
|
|
1313
|
-
|
|
1351
|
+
aa.info("Nothing to download yet", {
|
|
1314
1352
|
description: "This widget has no rows for these filters."
|
|
1315
1353
|
});
|
|
1316
1354
|
return;
|
|
1317
1355
|
}
|
|
1318
|
-
const c = [...new Set(s.flatMap((
|
|
1319
|
-
const
|
|
1320
|
-
return /[",\n]/.test(
|
|
1321
|
-
}, h = [c.join(","), ...s.map((
|
|
1356
|
+
const c = [...new Set(s.flatMap((m) => Object.keys(m)))], u = (m) => {
|
|
1357
|
+
const k = String(m ?? "");
|
|
1358
|
+
return /[",\n]/.test(k) ? `"${k.replace(/"/g, '""')}"` : k;
|
|
1359
|
+
}, h = [c.join(","), ...s.map((m) => c.map((k) => u(m[k])).join(","))].join(
|
|
1322
1360
|
`
|
|
1323
1361
|
`
|
|
1324
|
-
),
|
|
1325
|
-
|
|
1326
|
-
const
|
|
1327
|
-
setTimeout(() => URL.revokeObjectURL(
|
|
1362
|
+
), g = new Blob([h], { type: "text/csv;charset=utf-8" }), p = document.createElement("a");
|
|
1363
|
+
p.href = URL.createObjectURL(g), p.download = `${(t.title || "widget").replace(/[^\w-]+/g, "_")}.csv`, p.click();
|
|
1364
|
+
const D = p.href;
|
|
1365
|
+
setTimeout(() => URL.revokeObjectURL(D), 1e4);
|
|
1328
1366
|
}
|
|
1329
|
-
function
|
|
1367
|
+
function Dl({
|
|
1330
1368
|
collection: t,
|
|
1331
1369
|
conditions: n,
|
|
1332
1370
|
title: a,
|
|
1333
1371
|
onClose: s,
|
|
1334
1372
|
onOpen: c,
|
|
1335
|
-
crossFilter:
|
|
1373
|
+
crossFilter: u
|
|
1336
1374
|
}) {
|
|
1337
|
-
const h =
|
|
1375
|
+
const h = Le(), { data: g, isLoading: p } = Se({
|
|
1338
1376
|
queryKey: ["nvr-report-drill", t, JSON.stringify(n)],
|
|
1339
1377
|
queryFn: () => h.request(
|
|
1340
|
-
|
|
1378
|
+
bt(`/items/${t}`, { limit: 50, conditions: JSON.stringify(n) })
|
|
1341
1379
|
),
|
|
1342
1380
|
staleTime: 3e4,
|
|
1343
1381
|
retry: !1
|
|
1344
|
-
}),
|
|
1345
|
-
for (const
|
|
1382
|
+
}), D = (g == null ? void 0 : g.data) ?? [], O = (y) => {
|
|
1383
|
+
for (const m of [
|
|
1346
1384
|
"title",
|
|
1347
1385
|
"name",
|
|
1348
1386
|
"label",
|
|
@@ -1351,13 +1389,13 @@ function wl({
|
|
|
1351
1389
|
"project_id",
|
|
1352
1390
|
"description"
|
|
1353
1391
|
]) {
|
|
1354
|
-
const
|
|
1355
|
-
if (typeof
|
|
1392
|
+
const k = y[m];
|
|
1393
|
+
if (typeof k == "string" && k.trim()) return k.slice(0, 90);
|
|
1356
1394
|
}
|
|
1357
|
-
const
|
|
1358
|
-
([
|
|
1395
|
+
const Q = Object.entries(y).find(
|
|
1396
|
+
([m, k]) => m !== "id" && typeof k == "string" && k.trim()
|
|
1359
1397
|
);
|
|
1360
|
-
return
|
|
1398
|
+
return Q ? String(Q[1]).slice(0, 90) : `#${y.id}`;
|
|
1361
1399
|
};
|
|
1362
1400
|
return /* @__PURE__ */ e(
|
|
1363
1401
|
"div",
|
|
@@ -1368,16 +1406,16 @@ function wl({
|
|
|
1368
1406
|
"div",
|
|
1369
1407
|
{
|
|
1370
1408
|
className: "flex max-h-[70vh] w-full max-w-xl flex-col overflow-hidden rounded-xl border border-slate-200 bg-white shadow-2xl dark:border-border dark:bg-card",
|
|
1371
|
-
onClick: (
|
|
1409
|
+
onClick: (y) => y.stopPropagation(),
|
|
1372
1410
|
children: [
|
|
1373
1411
|
/* @__PURE__ */ o("div", { className: "flex items-center gap-2 border-b border-slate-100 px-4 py-2.5 dark:border-border", children: [
|
|
1374
1412
|
/* @__PURE__ */ e("p", { className: "min-w-0 flex-1 truncate text-[13px] font-semibold text-slate-800 dark:text-slate-100", children: a }),
|
|
1375
|
-
/* @__PURE__ */ e("span", { className: "text-[11.5px] tabular-nums text-slate-400", children:
|
|
1376
|
-
|
|
1413
|
+
/* @__PURE__ */ e("span", { className: "text-[11.5px] tabular-nums text-slate-400", children: g ? `${D.length}${(g.total ?? 0) > D.length ? ` of ${g.total.toLocaleString()}` : ""} records` : "" }),
|
|
1414
|
+
u && /* @__PURE__ */ e(
|
|
1377
1415
|
"button",
|
|
1378
1416
|
{
|
|
1379
1417
|
type: "button",
|
|
1380
|
-
onClick:
|
|
1418
|
+
onClick: u,
|
|
1381
1419
|
title: "Apply this value as a filter across the whole report",
|
|
1382
1420
|
className: "shrink-0 rounded-md border border-nvr-cyan/40 bg-nvr-cyan/[0.08] px-2 py-0.5 text-[11px] font-medium text-[#007a99] hover:brightness-105 dark:text-nvr-cyan",
|
|
1383
1421
|
children: "Filter report"
|
|
@@ -1389,22 +1427,22 @@ function wl({
|
|
|
1389
1427
|
type: "button",
|
|
1390
1428
|
onClick: s,
|
|
1391
1429
|
className: "rounded p-1 text-slate-400 hover:text-slate-600",
|
|
1392
|
-
children: /* @__PURE__ */ e(
|
|
1430
|
+
children: /* @__PURE__ */ e(Te, { className: "h-4 w-4" })
|
|
1393
1431
|
}
|
|
1394
1432
|
)
|
|
1395
1433
|
] }),
|
|
1396
1434
|
/* @__PURE__ */ o("div", { className: "min-h-0 flex-1 overflow-y-auto p-1.5", children: [
|
|
1397
|
-
|
|
1398
|
-
!
|
|
1399
|
-
|
|
1435
|
+
p && /* @__PURE__ */ e("p", { className: "px-2.5 py-3 text-[12px] text-slate-400", children: "Loading…" }),
|
|
1436
|
+
!p && D.length === 0 && /* @__PURE__ */ e("p", { className: "px-2.5 py-3 text-[12px] text-slate-400", children: "No records match." }),
|
|
1437
|
+
D.map((y) => /* @__PURE__ */ e(
|
|
1400
1438
|
"button",
|
|
1401
1439
|
{
|
|
1402
1440
|
type: "button",
|
|
1403
|
-
onClick: () => c({ collection: t, itemId: String(
|
|
1441
|
+
onClick: () => c({ collection: t, itemId: String(y.id) }),
|
|
1404
1442
|
className: "block w-full truncate rounded-md px-2.5 py-1.5 text-left text-[12.5px] text-slate-700 hover:bg-slate-50 dark:text-slate-200 dark:hover:bg-muted",
|
|
1405
|
-
children:
|
|
1443
|
+
children: O(y)
|
|
1406
1444
|
},
|
|
1407
|
-
String(
|
|
1445
|
+
String(y.id)
|
|
1408
1446
|
))
|
|
1409
1447
|
] })
|
|
1410
1448
|
]
|
|
@@ -1413,7 +1451,7 @@ function wl({
|
|
|
1413
1451
|
}
|
|
1414
1452
|
);
|
|
1415
1453
|
}
|
|
1416
|
-
const
|
|
1454
|
+
const Vt = {
|
|
1417
1455
|
red: {
|
|
1418
1456
|
cell: "bg-red-50 text-red-700 dark:bg-red-500/15 dark:text-red-300",
|
|
1419
1457
|
row: "bg-red-50/70 dark:bg-red-500/10"
|
|
@@ -1431,69 +1469,70 @@ const Bt = {
|
|
|
1431
1469
|
row: "bg-sky-50/70 dark:bg-sky-500/10"
|
|
1432
1470
|
}
|
|
1433
1471
|
};
|
|
1434
|
-
function
|
|
1472
|
+
function Gt(t, n) {
|
|
1435
1473
|
const a = Number(n);
|
|
1436
1474
|
return Number.isFinite(a) ? t.op === "gt" ? a > t.value : t.op === "gte" ? a >= t.value : t.op === "lt" ? a < t.value : t.op === "lte" ? a <= t.value : a === t.value : !1;
|
|
1437
1475
|
}
|
|
1438
|
-
const
|
|
1476
|
+
const Dt = Wa(function({
|
|
1439
1477
|
reportId: n,
|
|
1440
1478
|
widget: a,
|
|
1441
1479
|
dateRange: s,
|
|
1442
1480
|
entityFilters: c,
|
|
1443
|
-
refetchInterval:
|
|
1481
|
+
refetchInterval: u,
|
|
1444
1482
|
filterBar: h = [],
|
|
1445
|
-
onDrill:
|
|
1446
|
-
snapshot:
|
|
1447
|
-
asOf:
|
|
1448
|
-
annotations:
|
|
1449
|
-
onAddAnnotation:
|
|
1450
|
-
onDeleteAnnotation:
|
|
1451
|
-
onCrossFilter:
|
|
1452
|
-
reportUrl:
|
|
1453
|
-
currentFilters:
|
|
1483
|
+
onDrill: g,
|
|
1484
|
+
snapshot: p,
|
|
1485
|
+
asOf: D,
|
|
1486
|
+
annotations: O,
|
|
1487
|
+
onAddAnnotation: y,
|
|
1488
|
+
onDeleteAnnotation: Q,
|
|
1489
|
+
onCrossFilter: m,
|
|
1490
|
+
reportUrl: k,
|
|
1491
|
+
currentFilters: Z
|
|
1454
1492
|
}) {
|
|
1455
|
-
var
|
|
1456
|
-
const F =
|
|
1457
|
-
|
|
1493
|
+
var yt, Je, kt, Ue, Nt, wt, dt, St, Ye, ct, Ve, ut, mt, pt, ne, _t, Ge, He, ht, ft;
|
|
1494
|
+
const F = Le(), [H, z] = _(""), [ue, J] = _(0), [W, se] = _(null), [xe, Ne] = _(!1), [we, $e] = _(""), [f, X] = _(""), [te, U] = _(!1), [fe, re] = _(!1), [ae, N] = _([]), R = Ie(null), Y = Ie(null), E = Cl(R), [oe, me] = _(!1), [ge, S] = _(null), [j, he] = _(!1), [ve, Fe] = _(null), Me = ["bar", "line", "donut", "pareto", "area"].includes(a.type) || a.type === "kpi" && !!((yt = a.config) != null && yt.compare || (Je = a.config) != null && Je.sparkline), rt = lt(), [be, Ee] = _(!1), _e = async () => {
|
|
1495
|
+
Ee(!0);
|
|
1458
1496
|
try {
|
|
1459
1497
|
const l = await F.request(
|
|
1460
|
-
|
|
1498
|
+
Ct(n, a.id, {
|
|
1461
1499
|
date_range: s,
|
|
1462
1500
|
entity_filters: c,
|
|
1463
1501
|
fresh: 1
|
|
1464
1502
|
})
|
|
1465
1503
|
);
|
|
1466
|
-
|
|
1504
|
+
rt.setQueryData(
|
|
1467
1505
|
["nivaro-report-widget", n, a.id, s, c],
|
|
1468
1506
|
l.data
|
|
1469
1507
|
);
|
|
1470
1508
|
} catch {
|
|
1471
1509
|
}
|
|
1472
|
-
|
|
1473
|
-
},
|
|
1510
|
+
Ee(!1);
|
|
1511
|
+
}, Re = tt(
|
|
1474
1512
|
() => ({ date_range: s ?? null, entity_filters: c }),
|
|
1475
1513
|
[s, c]
|
|
1476
|
-
),
|
|
1514
|
+
), nt = Xa({
|
|
1477
1515
|
kind: "report",
|
|
1478
1516
|
widget: a.id,
|
|
1479
1517
|
report: n,
|
|
1480
|
-
params:
|
|
1481
|
-
enabled:
|
|
1482
|
-
onData: (l) =>
|
|
1518
|
+
params: Re,
|
|
1519
|
+
enabled: E && a.type !== "divider" && a.type !== "query",
|
|
1520
|
+
onData: (l) => rt.setQueryData(
|
|
1483
1521
|
["nivaro-report-widget", n, a.id, s, c],
|
|
1484
1522
|
l
|
|
1485
1523
|
),
|
|
1486
|
-
onStale: () => void
|
|
1524
|
+
onStale: () => void ot()
|
|
1487
1525
|
}), {
|
|
1488
|
-
data:
|
|
1489
|
-
isLoading:
|
|
1490
|
-
error:
|
|
1491
|
-
refetch:
|
|
1492
|
-
isFetching:
|
|
1493
|
-
|
|
1526
|
+
data: je,
|
|
1527
|
+
isLoading: st,
|
|
1528
|
+
error: We,
|
|
1529
|
+
refetch: ot,
|
|
1530
|
+
isFetching: Mt,
|
|
1531
|
+
dataUpdatedAt: Oe
|
|
1532
|
+
} = Se({
|
|
1494
1533
|
queryKey: ["nivaro-report-widget", n, a.id, s, c],
|
|
1495
1534
|
queryFn: () => F.request(
|
|
1496
|
-
|
|
1535
|
+
Ct(n, a.id, {
|
|
1497
1536
|
date_range: s,
|
|
1498
1537
|
entity_filters: c
|
|
1499
1538
|
})
|
|
@@ -1501,63 +1540,63 @@ const Rt = La(function({
|
|
|
1501
1540
|
// Query widgets resolve client-side in QueryWidgetBody — but when a
|
|
1502
1541
|
// snapshot comparison is active, the server-resolved value (the same
|
|
1503
1542
|
// number the snapshot stored) is fetched so the delta badge can render.
|
|
1504
|
-
enabled:
|
|
1543
|
+
enabled: E && a.type !== "divider" && (a.type !== "query" || !!p),
|
|
1505
1544
|
staleTime: 6e4,
|
|
1506
1545
|
// Per-widget auto-refresh (#168) overrides the report-level interval.
|
|
1507
|
-
refetchInterval:
|
|
1508
|
-
|
|
1509
|
-
Number((
|
|
1546
|
+
refetchInterval: Za(
|
|
1547
|
+
nt,
|
|
1548
|
+
Number((kt = a.config) == null ? void 0 : kt.refresh_secs) >= 10 ? Number(a.config.refresh_secs) * 1e3 : u
|
|
1510
1549
|
),
|
|
1511
1550
|
retry: !1
|
|
1512
|
-
}), Be = (((
|
|
1551
|
+
}), Be = (((Ue = a.config) == null ? void 0 : Ue.drill_levels) ?? []).filter(
|
|
1513
1552
|
(l) => typeof l == "string" && l
|
|
1514
|
-
), { data:
|
|
1515
|
-
queryKey: ["nvr-report-drill", n, a.id,
|
|
1553
|
+
), { data: vt } = Se({
|
|
1554
|
+
queryKey: ["nvr-report-drill", n, a.id, ae, s, c],
|
|
1516
1555
|
queryFn: () => F.request(
|
|
1517
|
-
|
|
1556
|
+
Ct(n, a.id, {
|
|
1518
1557
|
date_range: s,
|
|
1519
1558
|
entity_filters: [
|
|
1520
1559
|
...c,
|
|
1521
|
-
...
|
|
1560
|
+
...ae.map((l) => ({ field: l.field, values: [l.value] }))
|
|
1522
1561
|
],
|
|
1523
|
-
dimension_override: Be[
|
|
1562
|
+
dimension_override: Be[ae.length - 1]
|
|
1524
1563
|
})
|
|
1525
1564
|
).then((l) => l.data),
|
|
1526
|
-
enabled:
|
|
1565
|
+
enabled: ae.length > 0 && Be.length > 0,
|
|
1527
1566
|
staleTime: 6e4,
|
|
1528
1567
|
retry: !1
|
|
1529
|
-
}),
|
|
1568
|
+
}), T = ae.length > 0 && vt ? vt : je, ie = (Nt = a.config) == null ? void 0 : Nt.format, it = {
|
|
1530
1569
|
gridColumn: `${Math.max(1, (a.x ?? 0) + 1)} / span ${Math.min(12, Math.max(2, a.w || 4))}`,
|
|
1531
1570
|
gridRow: `span ${Math.max(1, a.h || 3)}`
|
|
1532
1571
|
};
|
|
1533
1572
|
if (a.type === "divider")
|
|
1534
|
-
return /* @__PURE__ */ e("div", { style:
|
|
1535
|
-
const Qe = a.type === "query" ? (
|
|
1573
|
+
return /* @__PURE__ */ e("div", { style: it, className: "self-end border-b border-slate-200 pb-1 dark:border-border", children: /* @__PURE__ */ e("h3", { className: "text-[13px] font-semibold text-slate-700 dark:text-slate-200", children: a.title }) });
|
|
1574
|
+
const Qe = a.type === "query" ? (wt = a.config) == null ? void 0 : wt.query : null, ye = Qe ? {
|
|
1536
1575
|
...Qe,
|
|
1537
1576
|
slug: Qe.slug || Qe.query_slug || ""
|
|
1538
1577
|
} : null;
|
|
1539
|
-
let
|
|
1540
|
-
if (
|
|
1541
|
-
|
|
1542
|
-
|
|
1578
|
+
let V = null;
|
|
1579
|
+
if (ye != null && ye.slug)
|
|
1580
|
+
V = /* @__PURE__ */ e(
|
|
1581
|
+
Al,
|
|
1543
1582
|
{
|
|
1544
|
-
cfg:
|
|
1583
|
+
cfg: ye,
|
|
1545
1584
|
dateRange: s,
|
|
1546
1585
|
entityFilters: c,
|
|
1547
|
-
refetchInterval:
|
|
1548
|
-
onDrill:
|
|
1549
|
-
deferred: !
|
|
1586
|
+
refetchInterval: u,
|
|
1587
|
+
onDrill: g,
|
|
1588
|
+
deferred: !E
|
|
1550
1589
|
}
|
|
1551
1590
|
);
|
|
1552
1591
|
else if (a.type === "query")
|
|
1553
|
-
|
|
1554
|
-
else if (!
|
|
1555
|
-
|
|
1556
|
-
else if (
|
|
1557
|
-
|
|
1592
|
+
V = /* @__PURE__ */ e("p", { className: "px-1 text-[12px] text-slate-400", children: "No query configured." });
|
|
1593
|
+
else if (!E && T === void 0)
|
|
1594
|
+
V = /* @__PURE__ */ e("p", { className: "px-1 text-[12px] text-slate-300", children: "Loading…" });
|
|
1595
|
+
else if (st)
|
|
1596
|
+
V = /* @__PURE__ */ o("div", { className: "flex flex-col gap-2 px-1", children: [
|
|
1558
1597
|
/* @__PURE__ */ e("p", { className: "text-[12px] text-slate-300", children: "Loading…" }),
|
|
1559
1598
|
/* @__PURE__ */ e(
|
|
1560
|
-
|
|
1599
|
+
oa,
|
|
1561
1600
|
{
|
|
1562
1601
|
pending: !0,
|
|
1563
1602
|
request: {
|
|
@@ -1571,75 +1610,75 @@ const Rt = La(function({
|
|
|
1571
1610
|
}
|
|
1572
1611
|
)
|
|
1573
1612
|
] });
|
|
1574
|
-
else if (
|
|
1575
|
-
|
|
1576
|
-
|
|
1613
|
+
else if (We)
|
|
1614
|
+
V = /* @__PURE__ */ e(
|
|
1615
|
+
ia,
|
|
1577
1616
|
{
|
|
1578
1617
|
className: "px-1",
|
|
1579
|
-
message:
|
|
1580
|
-
onRetry: () => void
|
|
1618
|
+
message: ra(We) ?? Ot(We, "this widget"),
|
|
1619
|
+
onRetry: () => void ot()
|
|
1581
1620
|
}
|
|
1582
1621
|
);
|
|
1583
|
-
else if (
|
|
1622
|
+
else if (T)
|
|
1584
1623
|
if (a.type === "queue") {
|
|
1585
|
-
const l =
|
|
1586
|
-
(
|
|
1624
|
+
const l = T.series ?? [], i = Math.max(...l.map((L) => L.value), 1), b = Math.min(...l.map((L) => L.value), 0), C = Math.max(i - b, 1), $ = l.map(
|
|
1625
|
+
(L, le) => `${le / Math.max(1, l.length - 1) * 100},${28 - (L.value - b) / C * 26}`
|
|
1587
1626
|
).join(" ");
|
|
1588
|
-
|
|
1589
|
-
/* @__PURE__ */ e("p", { className: "text-[28px] font-semibold leading-none tracking-tight tabular-nums text-slate-900 dark:text-foreground", children:
|
|
1627
|
+
V = /* @__PURE__ */ o("div", { className: "flex min-h-0 flex-1 flex-col justify-center", children: [
|
|
1628
|
+
/* @__PURE__ */ e("p", { className: "text-[28px] font-semibold leading-none tracking-tight tabular-nums text-slate-900 dark:text-foreground", children: T.value == null ? "—" : Number(T.value).toLocaleString() }),
|
|
1590
1629
|
l.length >= 3 && /* @__PURE__ */ e("svg", { viewBox: "0 0 100 30", preserveAspectRatio: "none", className: "mt-1.5 h-7 w-full", children: /* @__PURE__ */ e(
|
|
1591
1630
|
"polyline",
|
|
1592
1631
|
{
|
|
1593
1632
|
points: $,
|
|
1594
1633
|
fill: "none",
|
|
1595
|
-
stroke:
|
|
1634
|
+
stroke: Xe,
|
|
1596
1635
|
strokeWidth: "2",
|
|
1597
1636
|
vectorEffect: "non-scaling-stroke"
|
|
1598
1637
|
}
|
|
1599
1638
|
) }),
|
|
1600
1639
|
/* @__PURE__ */ o("p", { className: "mt-0.5 text-[10.5px] text-slate-400", children: [
|
|
1601
|
-
((
|
|
1640
|
+
((dt = a.config) == null ? void 0 : dt.metric) ?? "total",
|
|
1602
1641
|
" · daily snapshots"
|
|
1603
1642
|
] })
|
|
1604
1643
|
] });
|
|
1605
1644
|
} else if (a.type === "kpi" || a.type === "calc") {
|
|
1606
|
-
if (
|
|
1645
|
+
if (V = /* @__PURE__ */ o("div", { className: "flex items-baseline gap-2", children: [
|
|
1607
1646
|
/* @__PURE__ */ e(
|
|
1608
1647
|
"p",
|
|
1609
1648
|
{
|
|
1610
|
-
className:
|
|
1649
|
+
className: P(
|
|
1611
1650
|
"text-[28px] font-semibold leading-none tracking-tight text-slate-900 dark:text-foreground",
|
|
1612
1651
|
a.collection && "cursor-pointer decoration-dotted underline-offset-4 hover:underline",
|
|
1613
1652
|
// KPI threshold colors (#211): first matching gte-descending rule wins.
|
|
1614
1653
|
(() => {
|
|
1615
|
-
var
|
|
1616
|
-
const l = (
|
|
1617
|
-
if (!(l != null && l.length) ||
|
|
1618
|
-
const i = [...l].filter((
|
|
1654
|
+
var b;
|
|
1655
|
+
const l = (b = a.config) == null ? void 0 : b.thresholds;
|
|
1656
|
+
if (!(l != null && l.length) || T.value == null) return null;
|
|
1657
|
+
const i = [...l].filter((C) => Number.isFinite(C.gte)).sort((C, $) => $.gte - C.gte).find((C) => T.value >= C.gte);
|
|
1619
1658
|
return (i == null ? void 0 : i.color) === "red" ? "!text-red-600 dark:!text-red-400" : (i == null ? void 0 : i.color) === "amber" ? "!text-amber-600 dark:!text-amber-400" : (i == null ? void 0 : i.color) === "green" ? "!text-emerald-600 dark:!text-emerald-400" : null;
|
|
1620
1659
|
})()
|
|
1621
1660
|
),
|
|
1622
1661
|
title: a.collection ? "See the records behind this number" : void 0,
|
|
1623
1662
|
onClick: () => {
|
|
1624
1663
|
a.collection && se({
|
|
1625
|
-
conditions:
|
|
1664
|
+
conditions: Tt(a, c, s),
|
|
1626
1665
|
title: a.title || a.collection
|
|
1627
1666
|
});
|
|
1628
1667
|
},
|
|
1629
|
-
children: qe(
|
|
1668
|
+
children: qe(T.value, ie)
|
|
1630
1669
|
}
|
|
1631
1670
|
),
|
|
1632
|
-
/* @__PURE__ */ e(
|
|
1633
|
-
] }),
|
|
1634
|
-
const l =
|
|
1635
|
-
|
|
1636
|
-
|
|
1671
|
+
/* @__PURE__ */ e(Qt, { pct: T.change_pct })
|
|
1672
|
+
] }), T.spark && T.spark.length >= 3) {
|
|
1673
|
+
const l = T.spark, i = Math.max(...l.map((L) => L.value), 1), b = Math.min(...l.map((L) => L.value), 0), C = Math.max(i - b, 1), $ = l.map((L, le) => `${le / (l.length - 1) * 100},${28 - (L.value - b) / C * 26}`).join(" ");
|
|
1674
|
+
V = /* @__PURE__ */ o("div", { className: "flex min-h-0 flex-1 flex-col justify-center", children: [
|
|
1675
|
+
V,
|
|
1637
1676
|
/* @__PURE__ */ e("svg", { viewBox: "0 0 100 30", preserveAspectRatio: "none", className: "mt-1.5 h-7 w-full", children: /* @__PURE__ */ e(
|
|
1638
1677
|
"polyline",
|
|
1639
1678
|
{
|
|
1640
1679
|
points: $,
|
|
1641
1680
|
fill: "none",
|
|
1642
|
-
stroke:
|
|
1681
|
+
stroke: Xe,
|
|
1643
1682
|
strokeWidth: "2",
|
|
1644
1683
|
vectorEffect: "non-scaling-stroke"
|
|
1645
1684
|
}
|
|
@@ -1647,25 +1686,25 @@ const Rt = La(function({
|
|
|
1647
1686
|
] });
|
|
1648
1687
|
}
|
|
1649
1688
|
} else if (a.type === "kpi_group") {
|
|
1650
|
-
const l =
|
|
1651
|
-
|
|
1689
|
+
const l = T.tiles ?? [];
|
|
1690
|
+
V = /* @__PURE__ */ e(
|
|
1652
1691
|
"div",
|
|
1653
1692
|
{
|
|
1654
1693
|
className: "grid gap-2",
|
|
1655
1694
|
style: { gridTemplateColumns: `repeat(${Math.max(1, l.length)}, 1fr)` },
|
|
1656
|
-
children: l.map((i,
|
|
1695
|
+
children: l.map((i, b) => /* @__PURE__ */ o(
|
|
1657
1696
|
"div",
|
|
1658
1697
|
{
|
|
1659
1698
|
className: "flex flex-col justify-center rounded-md border border-slate-100 px-3 py-2 dark:border-border/60",
|
|
1660
1699
|
style: {
|
|
1661
|
-
borderTopColor: i.color ?? ce[
|
|
1700
|
+
borderTopColor: i.color ?? ce[b % ce.length],
|
|
1662
1701
|
borderTopWidth: 2
|
|
1663
1702
|
},
|
|
1664
1703
|
children: [
|
|
1665
1704
|
/* @__PURE__ */ e("p", { className: "truncate text-[10.5px] uppercase tracking-wide text-slate-400", children: i.label }),
|
|
1666
1705
|
/* @__PURE__ */ o("div", { className: "flex items-baseline gap-1.5", children: [
|
|
1667
1706
|
/* @__PURE__ */ e("p", { className: "text-[19px] font-semibold leading-tight text-slate-900 dark:text-foreground", children: qe(i.value, i.format) }),
|
|
1668
|
-
/* @__PURE__ */ e(
|
|
1707
|
+
/* @__PURE__ */ e(Qt, { pct: i.change_pct })
|
|
1669
1708
|
] })
|
|
1670
1709
|
]
|
|
1671
1710
|
},
|
|
@@ -1674,66 +1713,66 @@ const Rt = La(function({
|
|
|
1674
1713
|
}
|
|
1675
1714
|
);
|
|
1676
1715
|
} else if (a.type === "narrative")
|
|
1677
|
-
|
|
1716
|
+
V = /* @__PURE__ */ e("div", { className: "min-h-0 flex-1 overflow-y-auto whitespace-pre-wrap text-[12.5px] leading-relaxed text-slate-700 dark:text-slate-300", children: (T.narrative ?? "").split(/(\*\*[^*]+\*\*)/g).map(
|
|
1678
1717
|
(l, i) => l.startsWith("**") && l.endsWith("**") ? /* @__PURE__ */ e("strong", { className: "font-semibold text-slate-900 dark:text-foreground", children: l.slice(2, -2) }, i) : /* @__PURE__ */ e("span", { children: l }, i)
|
|
1679
1718
|
) });
|
|
1680
1719
|
else if (a.type === "heatmap") {
|
|
1681
|
-
const l =
|
|
1682
|
-
|
|
1720
|
+
const l = T.cells ?? [], i = [...new Set(l.map((L) => L.dim))], b = [...new Set(l.map((L) => L.dim2))], C = Math.max(1, ...l.map((L) => L.value)), $ = (L, le) => l.find((I) => I.dim === L && I.dim2 === le);
|
|
1721
|
+
V = l.length === 0 ? /* @__PURE__ */ e("p", { className: "px-1 text-[12px] text-slate-400", children: "No data." }) : /* @__PURE__ */ e("div", { className: "min-h-0 flex-1 overflow-auto", children: /* @__PURE__ */ o("table", { className: "w-full text-[10.5px]", children: [
|
|
1683
1722
|
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ o("tr", { children: [
|
|
1684
1723
|
/* @__PURE__ */ e("th", {}),
|
|
1685
|
-
|
|
1724
|
+
b.map((L) => /* @__PURE__ */ e(
|
|
1686
1725
|
"th",
|
|
1687
1726
|
{
|
|
1688
1727
|
className: "max-w-[80px] truncate px-1 pb-1 text-left font-medium text-slate-400",
|
|
1689
|
-
children:
|
|
1728
|
+
children: L
|
|
1690
1729
|
},
|
|
1691
|
-
|
|
1730
|
+
L
|
|
1692
1731
|
))
|
|
1693
1732
|
] }) }),
|
|
1694
|
-
/* @__PURE__ */ e("tbody", { children: i.map((
|
|
1695
|
-
/* @__PURE__ */ e("td", { className: "max-w-[110px] truncate pr-1.5 text-slate-500 dark:text-slate-400", children:
|
|
1696
|
-
|
|
1697
|
-
const
|
|
1733
|
+
/* @__PURE__ */ e("tbody", { children: i.map((L) => /* @__PURE__ */ o("tr", { children: [
|
|
1734
|
+
/* @__PURE__ */ e("td", { className: "max-w-[110px] truncate pr-1.5 text-slate-500 dark:text-slate-400", children: L }),
|
|
1735
|
+
b.map((le) => {
|
|
1736
|
+
const I = $(L, le), M = I ? I.value / C : 0;
|
|
1698
1737
|
return /* @__PURE__ */ e("td", { className: "p-0.5", children: /* @__PURE__ */ e(
|
|
1699
1738
|
"div",
|
|
1700
1739
|
{
|
|
1701
|
-
"data-tip":
|
|
1740
|
+
"data-tip": I ? `${L} × ${le}: ${I.value.toLocaleString()}` : void 0,
|
|
1702
1741
|
className: "flex h-6 items-center justify-center rounded text-[9.5px] tabular-nums",
|
|
1703
1742
|
style: {
|
|
1704
|
-
backgroundColor:
|
|
1705
|
-
color:
|
|
1706
|
-
border:
|
|
1743
|
+
backgroundColor: I ? `rgba(0, 165, 204, ${0.08 + M * 0.85})` : "transparent",
|
|
1744
|
+
color: M > 0.55 ? "#fff" : void 0,
|
|
1745
|
+
border: I ? void 0 : "1px dashed rgba(148,163,184,0.25)"
|
|
1707
1746
|
},
|
|
1708
|
-
children:
|
|
1747
|
+
children: I ? Ce(Math.round(I.value)) : ""
|
|
1709
1748
|
}
|
|
1710
|
-
) },
|
|
1749
|
+
) }, le);
|
|
1711
1750
|
})
|
|
1712
|
-
] },
|
|
1751
|
+
] }, L)) })
|
|
1713
1752
|
] }) });
|
|
1714
1753
|
} else if (a.type === "ai_insight") {
|
|
1715
|
-
const l =
|
|
1716
|
-
|
|
1754
|
+
const l = T.narrative ?? "";
|
|
1755
|
+
V = /* @__PURE__ */ o("div", { className: "flex min-h-0 flex-1 flex-col", children: [
|
|
1717
1756
|
/* @__PURE__ */ o("div", { className: "mb-1 flex items-center gap-1.5", children: [
|
|
1718
|
-
/* @__PURE__ */ e(
|
|
1757
|
+
/* @__PURE__ */ e(Wt, { className: "h-3.5 w-3.5 text-[#00a5cc]" }),
|
|
1719
1758
|
/* @__PURE__ */ e("span", { className: "text-[10px] uppercase tracking-wide text-slate-400", children: "AI-generated" }),
|
|
1720
1759
|
/* @__PURE__ */ e(
|
|
1721
1760
|
"button",
|
|
1722
1761
|
{
|
|
1723
1762
|
type: "button",
|
|
1724
1763
|
title: "Regenerate this summary",
|
|
1725
|
-
disabled:
|
|
1726
|
-
onClick: () => void
|
|
1764
|
+
disabled: be,
|
|
1765
|
+
onClick: () => void _e(),
|
|
1727
1766
|
className: "ml-auto rounded p-0.5 text-slate-300 hover:text-[#00a5cc] disabled:opacity-50",
|
|
1728
|
-
children: /* @__PURE__ */ e(
|
|
1767
|
+
children: /* @__PURE__ */ e(At, { className: P("h-3 w-3", be && "animate-spin") })
|
|
1729
1768
|
}
|
|
1730
1769
|
)
|
|
1731
1770
|
] }),
|
|
1732
|
-
/* @__PURE__ */ e("div", { className: "min-h-0 flex-1 overflow-y-auto whitespace-pre-wrap text-[12.5px] leading-relaxed text-slate-700 dark:text-slate-300", children:
|
|
1771
|
+
/* @__PURE__ */ e("div", { className: "min-h-0 flex-1 overflow-y-auto whitespace-pre-wrap text-[12.5px] leading-relaxed text-slate-700 dark:text-slate-300", children: be ? "Regenerating…" : l })
|
|
1733
1772
|
] });
|
|
1734
1773
|
} else if (a.type === "pivot") {
|
|
1735
|
-
const l =
|
|
1736
|
-
|
|
1774
|
+
const l = T.pivot;
|
|
1775
|
+
V = !l || l.rows.length === 0 ? /* @__PURE__ */ e("p", { className: "px-1 text-[12px] text-slate-400", children: "No data." }) : /* @__PURE__ */ o("div", { className: "flex min-h-0 flex-1 flex-col", children: [
|
|
1737
1776
|
/* @__PURE__ */ e("div", { className: "min-h-0 flex-1 overflow-auto", children: /* @__PURE__ */ o("table", { className: "w-full border-collapse text-[10.5px]", children: [
|
|
1738
1777
|
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ o("tr", { children: [
|
|
1739
1778
|
/* @__PURE__ */ e("th", { className: "sticky left-0 top-0 z-[2] bg-white dark:bg-card" }),
|
|
@@ -1749,19 +1788,19 @@ const Rt = La(function({
|
|
|
1749
1788
|
] }) }),
|
|
1750
1789
|
/* @__PURE__ */ e("tbody", { children: l.rows.map((i) => /* @__PURE__ */ o("tr", { className: "hover:bg-muted", children: [
|
|
1751
1790
|
/* @__PURE__ */ e("td", { className: "sticky left-0 z-[1] max-w-[150px] truncate bg-white pr-1.5 text-slate-500 dark:bg-card dark:text-slate-400", children: i }),
|
|
1752
|
-
l.cols.map((
|
|
1791
|
+
l.cols.map((b) => {
|
|
1753
1792
|
var $;
|
|
1754
|
-
const
|
|
1793
|
+
const C = ($ = l.cells[i]) == null ? void 0 : $[b];
|
|
1755
1794
|
return /* @__PURE__ */ e(
|
|
1756
1795
|
"td",
|
|
1757
1796
|
{
|
|
1758
1797
|
className: "px-1.5 py-0.5 text-right tabular-nums text-slate-700 dark:text-slate-300",
|
|
1759
|
-
children:
|
|
1798
|
+
children: C == null ? "" : qe(C, ie)
|
|
1760
1799
|
},
|
|
1761
|
-
|
|
1800
|
+
b
|
|
1762
1801
|
);
|
|
1763
1802
|
}),
|
|
1764
|
-
/* @__PURE__ */ e("td", { className: "px-1.5 py-0.5 text-right font-semibold tabular-nums text-slate-800 dark:text-slate-200", children: qe(l.row_totals[i] ?? 0,
|
|
1803
|
+
/* @__PURE__ */ e("td", { className: "px-1.5 py-0.5 text-right font-semibold tabular-nums text-slate-800 dark:text-slate-200", children: qe(l.row_totals[i] ?? 0, ie) })
|
|
1765
1804
|
] }, i)) }),
|
|
1766
1805
|
/* @__PURE__ */ e("tfoot", { children: /* @__PURE__ */ o("tr", { className: "border-t border-slate-200 dark:border-border", children: [
|
|
1767
1806
|
/* @__PURE__ */ e("td", { className: "sticky left-0 z-[1] bg-white pr-1.5 font-semibold text-slate-600 dark:bg-card dark:text-slate-300", children: "Total" }),
|
|
@@ -1769,11 +1808,11 @@ const Rt = La(function({
|
|
|
1769
1808
|
"td",
|
|
1770
1809
|
{
|
|
1771
1810
|
className: "px-1.5 py-0.5 text-right font-semibold tabular-nums text-slate-800 dark:text-slate-200",
|
|
1772
|
-
children: qe(l.col_totals[i] ?? 0,
|
|
1811
|
+
children: qe(l.col_totals[i] ?? 0, ie)
|
|
1773
1812
|
},
|
|
1774
1813
|
i
|
|
1775
1814
|
)),
|
|
1776
|
-
/* @__PURE__ */ e("td", { className: "px-1.5 py-0.5 text-right font-semibold tabular-nums text-slate-900 dark:text-foreground", children: qe(l.grand_total,
|
|
1815
|
+
/* @__PURE__ */ e("td", { className: "px-1.5 py-0.5 text-right font-semibold tabular-nums text-slate-900 dark:text-foreground", children: qe(l.grand_total, ie) })
|
|
1777
1816
|
] }) })
|
|
1778
1817
|
] }) }),
|
|
1779
1818
|
(l.truncated_rows > 0 || l.truncated_cols > 0) && /* @__PURE__ */ o("p", { className: "mt-1 shrink-0 px-1 text-[10px] text-amber-600 dark:text-amber-400", children: [
|
|
@@ -1792,34 +1831,34 @@ const Rt = La(function({
|
|
|
1792
1831
|
] })
|
|
1793
1832
|
] });
|
|
1794
1833
|
} else if (a.type === "waterfall") {
|
|
1795
|
-
const l =
|
|
1796
|
-
|
|
1834
|
+
const l = T.waterfall;
|
|
1835
|
+
V = l ? (() => {
|
|
1797
1836
|
const i = [];
|
|
1798
1837
|
i.push({ label: "Previous", from: 0, to: l.start, kind: "total" });
|
|
1799
|
-
let
|
|
1838
|
+
let b = l.start;
|
|
1800
1839
|
for (const $ of l.steps)
|
|
1801
1840
|
i.push({
|
|
1802
1841
|
label: $.dim,
|
|
1803
|
-
from:
|
|
1804
|
-
to:
|
|
1842
|
+
from: b,
|
|
1843
|
+
to: b + $.delta,
|
|
1805
1844
|
kind: $.delta >= 0 ? "up" : "down"
|
|
1806
|
-
}),
|
|
1845
|
+
}), b += $.delta;
|
|
1807
1846
|
i.push({ label: "Current", from: 0, to: l.end, kind: "total" });
|
|
1808
|
-
const
|
|
1809
|
-
return /* @__PURE__ */ e("div", { className: "flex min-h-0 flex-1 items-end gap-1 overflow-x-auto px-1 pb-4", children: i.map(($,
|
|
1810
|
-
const
|
|
1847
|
+
const C = Math.max(1, ...i.map(($) => Math.max($.from, $.to)));
|
|
1848
|
+
return /* @__PURE__ */ e("div", { className: "flex min-h-0 flex-1 items-end gap-1 overflow-x-auto px-1 pb-4", children: i.map(($, L) => {
|
|
1849
|
+
const le = Math.max($.from, $.to) / C * 100, I = Math.abs($.to - $.from) / C * 100;
|
|
1811
1850
|
return /* @__PURE__ */ o(
|
|
1812
1851
|
"div",
|
|
1813
1852
|
{
|
|
1814
1853
|
className: "relative flex h-full min-w-[46px] flex-1 flex-col justify-end",
|
|
1815
1854
|
children: [
|
|
1816
|
-
/* @__PURE__ */ e("div", { style: { height: `${Math.max(
|
|
1855
|
+
/* @__PURE__ */ e("div", { style: { height: `${Math.max(le, 0.5)}%` }, className: "relative w-full", children: /* @__PURE__ */ e(
|
|
1817
1856
|
"div",
|
|
1818
1857
|
{
|
|
1819
1858
|
"data-tip": `${$.label}: ${($.to - $.from).toLocaleString()}`,
|
|
1820
1859
|
className: "absolute inset-x-0 top-0 rounded-sm",
|
|
1821
1860
|
style: {
|
|
1822
|
-
height: `${Math.max(
|
|
1861
|
+
height: `${Math.max(I / Math.max(le, 1e-3) * 100, 2)}%`,
|
|
1823
1862
|
backgroundColor: $.kind === "total" ? "#172940" : $.kind === "up" ? "#10b981" : "#ef4444"
|
|
1824
1863
|
}
|
|
1825
1864
|
}
|
|
@@ -1827,63 +1866,63 @@ const Rt = La(function({
|
|
|
1827
1866
|
/* @__PURE__ */ e("p", { className: "absolute -bottom-4 left-0 right-0 truncate text-center text-[9px] text-slate-400", children: $.label })
|
|
1828
1867
|
]
|
|
1829
1868
|
},
|
|
1830
|
-
|
|
1869
|
+
L
|
|
1831
1870
|
);
|
|
1832
1871
|
}) });
|
|
1833
1872
|
})() : /* @__PURE__ */ e("p", { className: "px-1 text-[12px] text-slate-400", children: "No data." });
|
|
1834
1873
|
} else if (a.type === "stats") {
|
|
1835
|
-
const l =
|
|
1836
|
-
|
|
1874
|
+
const l = T.rows ?? [];
|
|
1875
|
+
V = l.length === 0 ? /* @__PURE__ */ e("p", { className: "px-1 text-[12px] text-slate-400", children: "No data." }) : /* @__PURE__ */ e("div", { className: "grid min-h-0 flex-1 grid-cols-2 content-start gap-x-4 gap-y-1.5 overflow-auto px-1", children: l.map((i) => /* @__PURE__ */ o(
|
|
1837
1876
|
"div",
|
|
1838
1877
|
{
|
|
1839
1878
|
className: "flex items-baseline justify-between border-b border-slate-100 pb-1 dark:border-border/50",
|
|
1840
1879
|
children: [
|
|
1841
1880
|
/* @__PURE__ */ e("span", { className: "text-[11px] text-slate-500", children: i.stat }),
|
|
1842
|
-
/* @__PURE__ */ e("span", { className: "text-[13px] font-semibold tabular-nums text-slate-800 dark:text-slate-100", children: i.value == null ? "—" : qe(i.value,
|
|
1881
|
+
/* @__PURE__ */ e("span", { className: "text-[13px] font-semibold tabular-nums text-slate-800 dark:text-slate-100", children: i.value == null ? "—" : qe(i.value, ie) })
|
|
1843
1882
|
]
|
|
1844
1883
|
},
|
|
1845
1884
|
i.stat
|
|
1846
1885
|
)) });
|
|
1847
1886
|
} else if (a.type === "hot_records") {
|
|
1848
|
-
const l =
|
|
1849
|
-
|
|
1887
|
+
const l = T.rows ?? [], i = Math.max(1, ...l.map((b) => b.views));
|
|
1888
|
+
V = l.length === 0 ? /* @__PURE__ */ e("p", { className: "px-1 text-[12px] text-slate-400", children: "No views recorded in the window." }) : /* @__PURE__ */ e("div", { className: "min-h-0 flex-1 space-y-1 overflow-auto px-1", children: l.map((b) => /* @__PURE__ */ o(
|
|
1850
1889
|
"button",
|
|
1851
1890
|
{
|
|
1852
1891
|
type: "button",
|
|
1853
|
-
onClick: () => a.collection && (
|
|
1892
|
+
onClick: () => a.collection && (g == null ? void 0 : g({ collection: a.collection, itemId: String(b.id), title: b.label })),
|
|
1854
1893
|
className: "group flex w-full items-center gap-2 rounded px-1 py-0.5 text-left hover:bg-muted",
|
|
1855
1894
|
children: [
|
|
1856
|
-
/* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate text-[12px] text-slate-700 group-hover:text-[#0284c7] dark:text-slate-200", children:
|
|
1895
|
+
/* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate text-[12px] text-slate-700 group-hover:text-[#0284c7] dark:text-slate-200", children: b.label }),
|
|
1857
1896
|
/* @__PURE__ */ e("span", { className: "relative h-2 w-20 overflow-hidden rounded-full bg-slate-100 dark:bg-white/10", children: /* @__PURE__ */ e(
|
|
1858
1897
|
"span",
|
|
1859
1898
|
{
|
|
1860
1899
|
className: "absolute inset-y-0 left-0 rounded-full bg-[#00a5cc]",
|
|
1861
|
-
style: { width: `${
|
|
1900
|
+
style: { width: `${b.views / i * 100}%` }
|
|
1862
1901
|
}
|
|
1863
1902
|
) }),
|
|
1864
|
-
/* @__PURE__ */ e("span", { className: "w-8 text-right text-[11px] tabular-nums text-slate-400", children:
|
|
1903
|
+
/* @__PURE__ */ e("span", { className: "w-8 text-right text-[11px] tabular-nums text-slate-400", children: b.views })
|
|
1865
1904
|
]
|
|
1866
1905
|
},
|
|
1867
|
-
|
|
1906
|
+
b.id
|
|
1868
1907
|
)) });
|
|
1869
1908
|
} else if (a.type === "scatter") {
|
|
1870
|
-
const l =
|
|
1871
|
-
|
|
1872
|
-
const i = l.length,
|
|
1873
|
-
{ x:
|
|
1874
|
-
{ x:
|
|
1909
|
+
const l = T.rows ?? [];
|
|
1910
|
+
V = l.length === 0 ? /* @__PURE__ */ e("p", { className: "px-1 text-[12px] text-slate-400", children: "No data." }) : (() => {
|
|
1911
|
+
const i = l.length, b = l.reduce((ee, r) => ee + r.x, 0), C = l.reduce((ee, r) => ee + r.y, 0), $ = l.reduce((ee, r) => ee + r.x * r.x, 0), L = l.reduce((ee, r) => ee + r.x * r.y, 0), le = i * $ - b * b, I = le !== 0 ? (i * L - b * C) / le : 0, M = i > 0 ? (C - I * b) / i : 0, G = l.map((ee) => ee.x), B = Math.min(...G), K = Math.max(...G), pe = [
|
|
1912
|
+
{ x: B, y: M + I * B },
|
|
1913
|
+
{ x: K, y: M + I * K }
|
|
1875
1914
|
];
|
|
1876
|
-
return /* @__PURE__ */ e("div", { className: "min-h-0 flex-1", children: /* @__PURE__ */ e(
|
|
1877
|
-
ComposedChart:
|
|
1878
|
-
Line:
|
|
1915
|
+
return /* @__PURE__ */ e("div", { className: "min-h-0 flex-1", children: /* @__PURE__ */ e(Ke, { fallback: /* @__PURE__ */ e(De, { className: "h-full w-full", "aria-busy": "true" }), children: ({
|
|
1916
|
+
ComposedChart: ee,
|
|
1917
|
+
Line: r,
|
|
1879
1918
|
ResponsiveContainer: d,
|
|
1880
|
-
Scatter:
|
|
1881
|
-
Tooltip:
|
|
1882
|
-
XAxis:
|
|
1883
|
-
YAxis:
|
|
1884
|
-
}) => /* @__PURE__ */ e(d, { width: "100%", height: "100%", children: /* @__PURE__ */ o(
|
|
1919
|
+
Scatter: x,
|
|
1920
|
+
Tooltip: v,
|
|
1921
|
+
XAxis: q,
|
|
1922
|
+
YAxis: w
|
|
1923
|
+
}) => /* @__PURE__ */ e(d, { width: "100%", height: "100%", children: /* @__PURE__ */ o(ee, { data: l, margin: { top: 6, right: 8, left: -6, bottom: 0 }, children: [
|
|
1885
1924
|
/* @__PURE__ */ e(
|
|
1886
|
-
|
|
1925
|
+
q,
|
|
1887
1926
|
{
|
|
1888
1927
|
dataKey: "x",
|
|
1889
1928
|
type: "number",
|
|
@@ -1892,9 +1931,9 @@ const Rt = La(function({
|
|
|
1892
1931
|
domain: ["dataMin", "dataMax"]
|
|
1893
1932
|
}
|
|
1894
1933
|
),
|
|
1895
|
-
/* @__PURE__ */ e(
|
|
1934
|
+
/* @__PURE__ */ e(w, { tick: { fontSize: 10 }, tickFormatter: Ce }),
|
|
1896
1935
|
/* @__PURE__ */ e(
|
|
1897
|
-
|
|
1936
|
+
v,
|
|
1898
1937
|
{
|
|
1899
1938
|
contentStyle: {
|
|
1900
1939
|
fontSize: 12,
|
|
@@ -1905,11 +1944,11 @@ const Rt = La(function({
|
|
|
1905
1944
|
}
|
|
1906
1945
|
}
|
|
1907
1946
|
),
|
|
1908
|
-
/* @__PURE__ */ e(
|
|
1947
|
+
/* @__PURE__ */ e(x, { data: l, dataKey: "y", fill: "#00a5cc", opacity: 0.7 }),
|
|
1909
1948
|
/* @__PURE__ */ e(
|
|
1910
|
-
|
|
1949
|
+
r,
|
|
1911
1950
|
{
|
|
1912
|
-
data:
|
|
1951
|
+
data: pe,
|
|
1913
1952
|
dataKey: "y",
|
|
1914
1953
|
stroke: "#f59e0b",
|
|
1915
1954
|
strokeWidth: 2,
|
|
@@ -1920,10 +1959,10 @@ const Rt = La(function({
|
|
|
1920
1959
|
] }) }) }) });
|
|
1921
1960
|
})();
|
|
1922
1961
|
} else if (a.type === "pareto") {
|
|
1923
|
-
const l =
|
|
1924
|
-
|
|
1962
|
+
const l = T.series ?? [];
|
|
1963
|
+
V = l.length === 0 ? /* @__PURE__ */ e("p", { className: "px-1 text-[12px] text-slate-400", children: "No data." }) : /* @__PURE__ */ e("div", { className: "min-h-0 flex-1", children: /* @__PURE__ */ e(Ke, { fallback: /* @__PURE__ */ e(De, { className: "h-full w-full", "aria-busy": "true" }), children: ({ Bar: i, ComposedChart: b, Line: C, ResponsiveContainer: $, Tooltip: L, XAxis: le, YAxis: I }) => /* @__PURE__ */ e($, { width: "100%", height: "100%", children: /* @__PURE__ */ o(b, { data: l, margin: { top: 6, right: 4, left: -10, bottom: 0 }, children: [
|
|
1925
1964
|
/* @__PURE__ */ e(
|
|
1926
|
-
|
|
1965
|
+
le,
|
|
1927
1966
|
{
|
|
1928
1967
|
dataKey: "dim",
|
|
1929
1968
|
tick: { fontSize: 10 },
|
|
@@ -1933,19 +1972,19 @@ const Rt = La(function({
|
|
|
1933
1972
|
height: 42
|
|
1934
1973
|
}
|
|
1935
1974
|
),
|
|
1936
|
-
/* @__PURE__ */ e(
|
|
1975
|
+
/* @__PURE__ */ e(I, { yAxisId: "v", tick: { fontSize: 10 }, tickFormatter: Ce }),
|
|
1937
1976
|
/* @__PURE__ */ e(
|
|
1938
|
-
|
|
1977
|
+
I,
|
|
1939
1978
|
{
|
|
1940
1979
|
yAxisId: "pct",
|
|
1941
1980
|
orientation: "right",
|
|
1942
1981
|
domain: [0, 100],
|
|
1943
1982
|
tick: { fontSize: 10 },
|
|
1944
|
-
tickFormatter: (
|
|
1983
|
+
tickFormatter: (M) => `${M}%`
|
|
1945
1984
|
}
|
|
1946
1985
|
),
|
|
1947
1986
|
/* @__PURE__ */ e(
|
|
1948
|
-
|
|
1987
|
+
L,
|
|
1949
1988
|
{
|
|
1950
1989
|
contentStyle: {
|
|
1951
1990
|
fontSize: 12,
|
|
@@ -1967,7 +2006,7 @@ const Rt = La(function({
|
|
|
1967
2006
|
}
|
|
1968
2007
|
),
|
|
1969
2008
|
/* @__PURE__ */ e(
|
|
1970
|
-
|
|
2009
|
+
C,
|
|
1971
2010
|
{
|
|
1972
2011
|
yAxisId: "pct",
|
|
1973
2012
|
dataKey: "cum_pct",
|
|
@@ -1979,13 +2018,13 @@ const Rt = La(function({
|
|
|
1979
2018
|
)
|
|
1980
2019
|
] }) }) }) });
|
|
1981
2020
|
} else if (a.type === "metric")
|
|
1982
|
-
|
|
1983
|
-
/* @__PURE__ */ e("p", { className: "text-[26px] font-bold tabular-nums text-slate-900 dark:text-slate-50", children:
|
|
1984
|
-
/* @__PURE__ */ e("p", { className: "text-[11px] text-slate-400", children: String(((
|
|
2021
|
+
V = /* @__PURE__ */ o("div", { className: "flex min-h-0 flex-1 flex-col justify-center px-1", children: [
|
|
2022
|
+
/* @__PURE__ */ e("p", { className: "text-[26px] font-bold tabular-nums text-slate-900 dark:text-slate-50", children: T.value == null ? "—" : qe(T.value, ie) }),
|
|
2023
|
+
/* @__PURE__ */ e("p", { className: "text-[11px] text-slate-400", children: String(((St = a.config) == null ? void 0 : St.metric_key) ?? "") })
|
|
1985
2024
|
] });
|
|
1986
2025
|
else if (a.type === "movers") {
|
|
1987
|
-
const l =
|
|
1988
|
-
|
|
2026
|
+
const l = T.rows ?? [];
|
|
2027
|
+
V = l.length === 0 ? /* @__PURE__ */ e("p", { className: "px-1 text-[12px] text-slate-400", children: "No movement in this window." }) : /* @__PURE__ */ e("div", { className: "min-h-0 flex-1 space-y-0.5 overflow-y-auto", children: l.map((i) => /* @__PURE__ */ o("div", { className: "flex items-center gap-2 text-[11.5px]", children: [
|
|
1989
2028
|
/* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate text-slate-600 dark:text-slate-300", children: i.dim }),
|
|
1990
2029
|
/* @__PURE__ */ o("span", { className: "tabular-nums text-slate-400", children: [
|
|
1991
2030
|
i.previous.toLocaleString(),
|
|
@@ -1995,7 +2034,7 @@ const Rt = La(function({
|
|
|
1995
2034
|
/* @__PURE__ */ o(
|
|
1996
2035
|
"span",
|
|
1997
2036
|
{
|
|
1998
|
-
className:
|
|
2037
|
+
className: P(
|
|
1999
2038
|
"w-[74px] shrink-0 text-right font-semibold tabular-nums",
|
|
2000
2039
|
i.delta > 0 ? "text-emerald-600 dark:text-emerald-400" : "text-red-500"
|
|
2001
2040
|
),
|
|
@@ -2012,61 +2051,61 @@ const Rt = La(function({
|
|
|
2012
2051
|
)
|
|
2013
2052
|
] }, i.dim)) });
|
|
2014
2053
|
} else if (a.type === "table") {
|
|
2015
|
-
const l =
|
|
2016
|
-
var
|
|
2017
|
-
for (const
|
|
2018
|
-
if ((
|
|
2019
|
-
return ((
|
|
2054
|
+
const l = T.rows ?? [], i = (Ye = a.config) != null && Ye.columns && a.config.columns.length > 0 ? a.config.columns.map((d) => typeof d == "string" ? { field: d } : d) : l[0] ? Object.keys(l[0]).filter((d) => d !== "id").map((d) => ({ field: d })) : [], b = i.map((d) => d.field), C = (d) => i.find((x) => x.field === d), $ = ((ct = a.config) == null ? void 0 : ct.format_rules) ?? [], L = (d) => {
|
|
2055
|
+
var x;
|
|
2056
|
+
for (const v of $)
|
|
2057
|
+
if ((v.scope ?? "cell") === "row" && Gt(v, d[v.field]))
|
|
2058
|
+
return ((x = Vt[v.color]) == null ? void 0 : x.row) ?? null;
|
|
2020
2059
|
return null;
|
|
2021
|
-
},
|
|
2022
|
-
var
|
|
2023
|
-
for (const
|
|
2024
|
-
if ((
|
|
2025
|
-
return ((
|
|
2060
|
+
}, le = (d, x) => {
|
|
2061
|
+
var v;
|
|
2062
|
+
for (const q of $)
|
|
2063
|
+
if ((q.scope ?? "cell") === "cell" && q.field === x && Gt(q, d[x]))
|
|
2064
|
+
return ((v = Vt[q.color]) == null ? void 0 : v.cell) ?? null;
|
|
2026
2065
|
return null;
|
|
2027
|
-
},
|
|
2028
|
-
(d) =>
|
|
2029
|
-
const
|
|
2030
|
-
return Number.isFinite(
|
|
2066
|
+
}, I = H.trim().toLowerCase(), M = a.config, G = M != null && M.suppress_zero ? l.filter(
|
|
2067
|
+
(d) => b.some((x) => {
|
|
2068
|
+
const v = Number(d[x]);
|
|
2069
|
+
return Number.isFinite(v) && v !== 0;
|
|
2031
2070
|
})
|
|
2032
|
-
) : l,
|
|
2071
|
+
) : l, B = I ? G.filter(
|
|
2033
2072
|
(d) => Object.values(d).some(
|
|
2034
|
-
(
|
|
2073
|
+
(x) => String(x ?? "").toLowerCase().includes(I)
|
|
2035
2074
|
)
|
|
2036
|
-
) :
|
|
2037
|
-
|
|
2038
|
-
l.length >
|
|
2075
|
+
) : G, K = 12, pe = Math.max(1, Math.ceil(B.length / K)), ee = Math.min(ue, pe - 1), r = B.length > K ? B.slice(ee * K, ee * K + K) : B;
|
|
2076
|
+
V = l.length === 0 ? /* @__PURE__ */ e("p", { className: "px-1 text-[12px] text-slate-400", children: "No rows." }) : /* @__PURE__ */ o("div", { className: "flex min-h-0 flex-1 flex-col", children: [
|
|
2077
|
+
l.length > K && /* @__PURE__ */ o("div", { className: "mb-1 flex items-center gap-2", children: [
|
|
2039
2078
|
/* @__PURE__ */ e(
|
|
2040
2079
|
"input",
|
|
2041
2080
|
{
|
|
2042
|
-
value:
|
|
2081
|
+
value: H,
|
|
2043
2082
|
onChange: (d) => {
|
|
2044
|
-
|
|
2083
|
+
z(d.target.value), J(0);
|
|
2045
2084
|
},
|
|
2046
2085
|
placeholder: "Search rows…",
|
|
2047
2086
|
className: "h-6 w-40 rounded border border-slate-200 bg-white px-1.5 text-[11px] dark:border-border dark:bg-card dark:text-slate-200"
|
|
2048
2087
|
}
|
|
2049
2088
|
),
|
|
2050
|
-
|
|
2089
|
+
pe > 1 && /* @__PURE__ */ o("span", { className: "ml-auto flex items-center gap-1 text-[10.5px] text-slate-400", children: [
|
|
2051
2090
|
/* @__PURE__ */ e(
|
|
2052
2091
|
"button",
|
|
2053
2092
|
{
|
|
2054
2093
|
type: "button",
|
|
2055
|
-
disabled:
|
|
2056
|
-
onClick: () => J(
|
|
2094
|
+
disabled: ee <= 0,
|
|
2095
|
+
onClick: () => J(ee - 1),
|
|
2057
2096
|
className: "rounded px-1 disabled:opacity-30",
|
|
2058
2097
|
children: "←"
|
|
2059
2098
|
}
|
|
2060
2099
|
),
|
|
2061
|
-
|
|
2100
|
+
ee + 1,
|
|
2062
2101
|
"/",
|
|
2063
|
-
|
|
2102
|
+
pe,
|
|
2064
2103
|
/* @__PURE__ */ e(
|
|
2065
2104
|
"button",
|
|
2066
2105
|
{
|
|
2067
2106
|
type: "button",
|
|
2068
|
-
disabled:
|
|
2069
|
-
onClick: () => J(
|
|
2107
|
+
disabled: ee >= pe - 1,
|
|
2108
|
+
onClick: () => J(ee + 1),
|
|
2070
2109
|
className: "rounded px-1 disabled:opacity-30",
|
|
2071
2110
|
children: "→"
|
|
2072
2111
|
}
|
|
@@ -2074,56 +2113,56 @@ const Rt = La(function({
|
|
|
2074
2113
|
] })
|
|
2075
2114
|
] }),
|
|
2076
2115
|
/* @__PURE__ */ e("div", { className: "min-h-0 flex-1 overflow-auto", children: /* @__PURE__ */ o("table", { className: "w-full text-[11.5px]", children: [
|
|
2077
|
-
/* @__PURE__ */ e("thead", { className: "sticky top-0 bg-white dark:bg-card", children: /* @__PURE__ */ e("tr", { children:
|
|
2078
|
-
var
|
|
2116
|
+
/* @__PURE__ */ e("thead", { className: "sticky top-0 bg-white dark:bg-card", children: /* @__PURE__ */ e("tr", { children: b.map((d) => {
|
|
2117
|
+
var x;
|
|
2079
2118
|
return /* @__PURE__ */ e(
|
|
2080
2119
|
"th",
|
|
2081
2120
|
{
|
|
2082
2121
|
className: "border-b border-slate-100 px-1.5 py-1 text-left font-medium text-slate-400 dark:border-border",
|
|
2083
|
-
children: ((
|
|
2122
|
+
children: ((x = C(d)) == null ? void 0 : x.label) ?? d
|
|
2084
2123
|
},
|
|
2085
2124
|
d
|
|
2086
2125
|
);
|
|
2087
2126
|
}) }) }),
|
|
2088
|
-
/* @__PURE__ */ e("tbody", { children:
|
|
2127
|
+
/* @__PURE__ */ e("tbody", { children: r.map((d) => /* @__PURE__ */ e(
|
|
2089
2128
|
"tr",
|
|
2090
2129
|
{
|
|
2091
|
-
className:
|
|
2092
|
-
|
|
2130
|
+
className: P(
|
|
2131
|
+
L(d),
|
|
2093
2132
|
a.collection && d.id != null && "cursor-pointer hover:bg-slate-50 dark:hover:bg-muted/60"
|
|
2094
2133
|
),
|
|
2095
2134
|
onClick: () => {
|
|
2096
|
-
a.collection && d.id != null && (
|
|
2135
|
+
a.collection && d.id != null && (g == null || g({ collection: a.collection, itemId: String(d.id) }));
|
|
2097
2136
|
},
|
|
2098
|
-
children:
|
|
2099
|
-
var
|
|
2137
|
+
children: b.map((x) => {
|
|
2138
|
+
var v, q, w, A;
|
|
2100
2139
|
return /* @__PURE__ */ e(
|
|
2101
2140
|
"td",
|
|
2102
2141
|
{
|
|
2103
|
-
className:
|
|
2142
|
+
className: P(
|
|
2104
2143
|
"max-w-[180px] truncate border-b border-slate-50 px-1.5 py-1 text-slate-700 dark:border-border/40 dark:text-slate-300",
|
|
2105
|
-
(typeof d[
|
|
2106
|
-
|
|
2144
|
+
(typeof d[x] == "number" || Pe.has(((v = C(x)) == null ? void 0 : v.format) ?? "")) && "text-right tabular-nums",
|
|
2145
|
+
le(d, x)
|
|
2107
2146
|
),
|
|
2108
|
-
children: (
|
|
2147
|
+
children: (q = C(x)) != null && q.format ? ze(d[x], (w = C(x)) == null ? void 0 : w.format, (A = C(x)) == null ? void 0 : A.decimals) : String(d[x] ?? "")
|
|
2109
2148
|
},
|
|
2110
|
-
|
|
2149
|
+
x
|
|
2111
2150
|
);
|
|
2112
2151
|
})
|
|
2113
2152
|
},
|
|
2114
2153
|
String(d.id)
|
|
2115
2154
|
)) }),
|
|
2116
|
-
(
|
|
2117
|
-
var
|
|
2118
|
-
const
|
|
2155
|
+
(M == null ? void 0 : M.grand_total) && B.length > 1 && /* @__PURE__ */ e("tfoot", { children: /* @__PURE__ */ e("tr", { className: "border-t border-slate-200 font-semibold dark:border-border", children: b.map((d, x) => {
|
|
2156
|
+
var A, de, ke;
|
|
2157
|
+
const v = B.map((xt) => Number(xt[d])).filter((xt) => Number.isFinite(xt)), q = v.length > B.length / 2, w = v.reduce((xt, ya) => xt + ya, 0);
|
|
2119
2158
|
return /* @__PURE__ */ e(
|
|
2120
2159
|
"td",
|
|
2121
2160
|
{
|
|
2122
|
-
className:
|
|
2161
|
+
className: P(
|
|
2123
2162
|
"px-1.5 py-1 text-slate-800 dark:text-slate-100",
|
|
2124
|
-
|
|
2163
|
+
q && "text-right tabular-nums"
|
|
2125
2164
|
),
|
|
2126
|
-
children:
|
|
2165
|
+
children: x === 0 && !q ? "Total" : q ? (A = C(d)) != null && A.format ? ze(w, (de = C(d)) == null ? void 0 : de.format, (ke = C(d)) == null ? void 0 : ke.decimals) : w.toLocaleString() : ""
|
|
2127
2166
|
},
|
|
2128
2167
|
d
|
|
2129
2168
|
);
|
|
@@ -2131,38 +2170,38 @@ const Rt = La(function({
|
|
|
2131
2170
|
] }) })
|
|
2132
2171
|
] });
|
|
2133
2172
|
} else {
|
|
2134
|
-
let l =
|
|
2135
|
-
const i = !!((
|
|
2136
|
-
if (
|
|
2137
|
-
if (
|
|
2138
|
-
const
|
|
2139
|
-
return { ...
|
|
2140
|
-
})),
|
|
2141
|
-
let
|
|
2142
|
-
l = l.map((
|
|
2143
|
-
...
|
|
2144
|
-
value:
|
|
2145
|
-
...
|
|
2146
|
-
...
|
|
2173
|
+
let l = T.series ?? [];
|
|
2174
|
+
const i = !!((ut = (Ve = a.config) == null ? void 0 : Ve.dimension) != null && ut.bucket), b = Number((mt = a.config) == null ? void 0 : mt.rolling_avg) || 0;
|
|
2175
|
+
if (b >= 2 && i && !te && l.length >= b && (l = l.map((M, G) => {
|
|
2176
|
+
if (G < b - 1) return M;
|
|
2177
|
+
const B = l.slice(G - b + 1, G + 1);
|
|
2178
|
+
return { ...M, ma: B.reduce((K, pe) => K + pe.value, 0) / b };
|
|
2179
|
+
})), te && i) {
|
|
2180
|
+
let M = 0, G = 0, B = 0;
|
|
2181
|
+
l = l.map((K) => (M += K.value, G += K.prev ?? 0, B += K.value2 ?? 0, {
|
|
2182
|
+
...K,
|
|
2183
|
+
value: M,
|
|
2184
|
+
...K.prev != null ? { prev: G } : {},
|
|
2185
|
+
...K.value2 != null ? { value2: B } : {}
|
|
2147
2186
|
}));
|
|
2148
2187
|
}
|
|
2149
|
-
const
|
|
2150
|
-
if (!i ||
|
|
2151
|
-
const
|
|
2152
|
-
return
|
|
2153
|
-
l.filter((
|
|
2188
|
+
const C = l.some((M) => M.value2 != null), $ = ((ne = (pt = a.config) == null ? void 0 : pt.metric2) == null ? void 0 : ne.label) ?? "secondary", L = l.some((M) => M.band != null), le = (() => {
|
|
2189
|
+
if (!i || te || l.length < 8) return /* @__PURE__ */ new Set();
|
|
2190
|
+
const M = l.map((K) => K.value), G = M.reduce((K, pe) => K + pe, 0) / M.length, B = Math.sqrt(M.reduce((K, pe) => K + (pe - G) ** 2, 0) / M.length);
|
|
2191
|
+
return B === 0 ? /* @__PURE__ */ new Set() : new Set(
|
|
2192
|
+
l.filter((K) => Math.abs(K.value - G) > 2 * B).map((K) => K.dim)
|
|
2154
2193
|
);
|
|
2155
|
-
})(),
|
|
2156
|
-
(
|
|
2194
|
+
})(), I = (O ?? []).filter(
|
|
2195
|
+
(M) => M.anchor_date && l.some((G) => G.dim === M.anchor_date)
|
|
2157
2196
|
);
|
|
2158
|
-
if (l.length === 0)
|
|
2197
|
+
if (l.length === 0) V = /* @__PURE__ */ e("p", { className: "px-1 text-[12px] text-slate-400", children: "No data." });
|
|
2159
2198
|
else if (a.type === "donut") {
|
|
2160
|
-
const
|
|
2161
|
-
|
|
2199
|
+
const M = l.reduce((G, B) => G + B.value, 0);
|
|
2200
|
+
V = /* @__PURE__ */ o("div", { className: "flex min-h-0 flex-1 items-stretch gap-3", children: [
|
|
2162
2201
|
/* @__PURE__ */ o("div", { className: "relative min-h-[110px] min-w-0 flex-1", children: [
|
|
2163
|
-
/* @__PURE__ */ e(
|
|
2202
|
+
/* @__PURE__ */ e(Ke, { fallback: /* @__PURE__ */ e(De, { className: "h-full w-full", "aria-busy": "true" }), children: ({ Cell: G, Pie: B, PieChart: K, ResponsiveContainer: pe, Tooltip: ee }) => /* @__PURE__ */ e(pe, { width: "100%", height: "100%", children: /* @__PURE__ */ o(K, { children: [
|
|
2164
2203
|
/* @__PURE__ */ e(
|
|
2165
|
-
|
|
2204
|
+
B,
|
|
2166
2205
|
{
|
|
2167
2206
|
data: l,
|
|
2168
2207
|
dataKey: "value",
|
|
@@ -2172,46 +2211,46 @@ const Rt = La(function({
|
|
|
2172
2211
|
paddingAngle: 2,
|
|
2173
2212
|
strokeWidth: 0,
|
|
2174
2213
|
className: a.collection ? "cursor-pointer" : void 0,
|
|
2175
|
-
onClick: (
|
|
2176
|
-
var
|
|
2214
|
+
onClick: (r) => {
|
|
2215
|
+
var v, q, w, A;
|
|
2177
2216
|
if (!a.collection) return;
|
|
2178
|
-
const d =
|
|
2217
|
+
const d = r == null ? void 0 : r.payload;
|
|
2179
2218
|
if (d != null && d.other) return;
|
|
2180
|
-
if (Be.length >
|
|
2181
|
-
const
|
|
2182
|
-
if (
|
|
2183
|
-
|
|
2184
|
-
...
|
|
2185
|
-
{ field:
|
|
2219
|
+
if (Be.length > ae.length) {
|
|
2220
|
+
const de = ae.length === 0 ? (q = (v = a.config) == null ? void 0 : v.dimension) == null ? void 0 : q.field : Be[ae.length - 1];
|
|
2221
|
+
if (de) {
|
|
2222
|
+
N((ke) => [
|
|
2223
|
+
...ke,
|
|
2224
|
+
{ field: de, value: String((d == null ? void 0 : d.raw) ?? (d == null ? void 0 : d.dim) ?? "") }
|
|
2186
2225
|
]);
|
|
2187
2226
|
return;
|
|
2188
2227
|
}
|
|
2189
2228
|
}
|
|
2190
|
-
const
|
|
2229
|
+
const x = (A = (w = a.config) == null ? void 0 : w.dimension) == null ? void 0 : A.field;
|
|
2191
2230
|
se({
|
|
2192
|
-
conditions:
|
|
2231
|
+
conditions: Tt(
|
|
2193
2232
|
a,
|
|
2194
2233
|
c,
|
|
2195
2234
|
s,
|
|
2196
2235
|
(d == null ? void 0 : d.raw) ?? (d == null ? void 0 : d.dim)
|
|
2197
2236
|
),
|
|
2198
2237
|
title: `${a.title || a.collection} — ${(d == null ? void 0 : d.dim) ?? ""}`,
|
|
2199
|
-
dimField:
|
|
2238
|
+
dimField: x,
|
|
2200
2239
|
dimRaw: (d == null ? void 0 : d.raw) ?? (d == null ? void 0 : d.dim),
|
|
2201
2240
|
dimLabel: d == null ? void 0 : d.dim
|
|
2202
2241
|
});
|
|
2203
2242
|
},
|
|
2204
|
-
children: l.map((
|
|
2205
|
-
|
|
2243
|
+
children: l.map((r, d) => /* @__PURE__ */ e(
|
|
2244
|
+
G,
|
|
2206
2245
|
{
|
|
2207
|
-
fill:
|
|
2246
|
+
fill: r.other ? "#94a3b8" : ce[d % ce.length]
|
|
2208
2247
|
},
|
|
2209
|
-
|
|
2248
|
+
r.dim
|
|
2210
2249
|
))
|
|
2211
2250
|
}
|
|
2212
2251
|
),
|
|
2213
2252
|
/* @__PURE__ */ e(
|
|
2214
|
-
|
|
2253
|
+
ee,
|
|
2215
2254
|
{
|
|
2216
2255
|
contentStyle: {
|
|
2217
2256
|
fontSize: 12,
|
|
@@ -2226,47 +2265,47 @@ const Rt = La(function({
|
|
|
2226
2265
|
)
|
|
2227
2266
|
] }) }) }),
|
|
2228
2267
|
/* @__PURE__ */ o("div", { className: "pointer-events-none absolute inset-0 flex flex-col items-center justify-center", children: [
|
|
2229
|
-
/* @__PURE__ */ e("span", { className: "text-[17px] font-semibold leading-none text-slate-900 dark:text-foreground", children:
|
|
2268
|
+
/* @__PURE__ */ e("span", { className: "text-[17px] font-semibold leading-none text-slate-900 dark:text-foreground", children: M.toLocaleString() }),
|
|
2230
2269
|
/* @__PURE__ */ e("span", { className: "text-[9.5px] text-slate-400", children: "total" })
|
|
2231
2270
|
] })
|
|
2232
2271
|
] }),
|
|
2233
|
-
/* @__PURE__ */ e("div", { className: "max-h-full w-[40%] shrink-0 space-y-0.5 self-center overflow-y-auto pr-1", children: l.slice(0, 10).map((
|
|
2272
|
+
/* @__PURE__ */ e("div", { className: "max-h-full w-[40%] shrink-0 space-y-0.5 self-center overflow-y-auto pr-1", children: l.slice(0, 10).map((G, B) => /* @__PURE__ */ o("div", { className: "flex items-center gap-1.5 text-[10.5px]", children: [
|
|
2234
2273
|
/* @__PURE__ */ e(
|
|
2235
2274
|
"span",
|
|
2236
2275
|
{
|
|
2237
2276
|
className: "h-2 w-2 shrink-0 rounded-sm",
|
|
2238
|
-
style: { background: ce[
|
|
2277
|
+
style: { background: ce[B % ce.length] }
|
|
2239
2278
|
}
|
|
2240
2279
|
),
|
|
2241
|
-
/* @__PURE__ */ e("span", { className: "truncate text-slate-600 dark:text-slate-300", children:
|
|
2242
|
-
/* @__PURE__ */ e("span", { className: "ml-auto tabular-nums text-slate-400", children:
|
|
2243
|
-
] },
|
|
2280
|
+
/* @__PURE__ */ e("span", { className: "truncate text-slate-600 dark:text-slate-300", children: G.dim }),
|
|
2281
|
+
/* @__PURE__ */ e("span", { className: "ml-auto tabular-nums text-slate-400", children: G.value.toLocaleString() })
|
|
2282
|
+
] }, G.dim)) })
|
|
2244
2283
|
] });
|
|
2245
2284
|
} else if (a.type === "line")
|
|
2246
|
-
|
|
2247
|
-
Area:
|
|
2248
|
-
ComposedChart:
|
|
2249
|
-
Line:
|
|
2250
|
-
ReferenceLine:
|
|
2251
|
-
ResponsiveContainer:
|
|
2252
|
-
Tooltip:
|
|
2253
|
-
XAxis:
|
|
2285
|
+
V = /* @__PURE__ */ e("div", { className: "min-h-[110px] flex-1", children: /* @__PURE__ */ e(Ke, { fallback: /* @__PURE__ */ e(De, { className: "h-full w-full", "aria-busy": "true" }), children: ({
|
|
2286
|
+
Area: M,
|
|
2287
|
+
ComposedChart: G,
|
|
2288
|
+
Line: B,
|
|
2289
|
+
ReferenceLine: K,
|
|
2290
|
+
ResponsiveContainer: pe,
|
|
2291
|
+
Tooltip: ee,
|
|
2292
|
+
XAxis: r,
|
|
2254
2293
|
YAxis: d
|
|
2255
2294
|
}) => {
|
|
2256
|
-
var
|
|
2257
|
-
return /* @__PURE__ */ e(
|
|
2258
|
-
|
|
2295
|
+
var x;
|
|
2296
|
+
return /* @__PURE__ */ e(pe, { width: "100%", height: "100%", children: /* @__PURE__ */ o(
|
|
2297
|
+
G,
|
|
2259
2298
|
{
|
|
2260
2299
|
data: l,
|
|
2261
|
-
margin: { top: 6, right:
|
|
2300
|
+
margin: { top: 6, right: C ? 4 : 8, left: -10, bottom: 0 },
|
|
2262
2301
|
children: [
|
|
2263
2302
|
/* @__PURE__ */ e(
|
|
2264
|
-
|
|
2303
|
+
r,
|
|
2265
2304
|
{
|
|
2266
2305
|
dataKey: "dim",
|
|
2267
2306
|
tick: { fontSize: 10 },
|
|
2268
2307
|
stroke: "#94a3b8",
|
|
2269
|
-
...
|
|
2308
|
+
...Ft(l.length)
|
|
2270
2309
|
}
|
|
2271
2310
|
),
|
|
2272
2311
|
/* @__PURE__ */ e(
|
|
@@ -2278,7 +2317,7 @@ const Rt = La(function({
|
|
|
2278
2317
|
width: 44
|
|
2279
2318
|
}
|
|
2280
2319
|
),
|
|
2281
|
-
|
|
2320
|
+
C && /* @__PURE__ */ e(
|
|
2282
2321
|
d,
|
|
2283
2322
|
{
|
|
2284
2323
|
yAxisId: "right",
|
|
@@ -2289,18 +2328,18 @@ const Rt = La(function({
|
|
|
2289
2328
|
width: 44
|
|
2290
2329
|
}
|
|
2291
2330
|
),
|
|
2292
|
-
|
|
2293
|
-
|
|
2331
|
+
I.map((v) => /* @__PURE__ */ e(
|
|
2332
|
+
K,
|
|
2294
2333
|
{
|
|
2295
|
-
x:
|
|
2334
|
+
x: v.anchor_date,
|
|
2296
2335
|
stroke: "#f59e0b",
|
|
2297
2336
|
strokeDasharray: "4 3",
|
|
2298
2337
|
label: { value: "✎", position: "top", fontSize: 11, fill: "#f59e0b" }
|
|
2299
2338
|
},
|
|
2300
|
-
|
|
2339
|
+
v.id
|
|
2301
2340
|
)),
|
|
2302
2341
|
/* @__PURE__ */ e(
|
|
2303
|
-
|
|
2342
|
+
ee,
|
|
2304
2343
|
{
|
|
2305
2344
|
contentStyle: {
|
|
2306
2345
|
fontSize: 12,
|
|
@@ -2313,8 +2352,8 @@ const Rt = La(function({
|
|
|
2313
2352
|
itemStyle: { color: "#e2e8f0" }
|
|
2314
2353
|
}
|
|
2315
2354
|
),
|
|
2316
|
-
|
|
2317
|
-
|
|
2355
|
+
L && /* @__PURE__ */ e(
|
|
2356
|
+
M,
|
|
2318
2357
|
{
|
|
2319
2358
|
type: "monotone",
|
|
2320
2359
|
dataKey: "band",
|
|
@@ -2325,8 +2364,8 @@ const Rt = La(function({
|
|
|
2325
2364
|
activeDot: !1
|
|
2326
2365
|
}
|
|
2327
2366
|
),
|
|
2328
|
-
((
|
|
2329
|
-
|
|
2367
|
+
((x = a.config) == null ? void 0 : x.compare) && /* @__PURE__ */ e(
|
|
2368
|
+
B,
|
|
2330
2369
|
{
|
|
2331
2370
|
type: "monotone",
|
|
2332
2371
|
dataKey: "prev",
|
|
@@ -2338,31 +2377,31 @@ const Rt = La(function({
|
|
|
2338
2377
|
}
|
|
2339
2378
|
),
|
|
2340
2379
|
/* @__PURE__ */ e(
|
|
2341
|
-
|
|
2380
|
+
B,
|
|
2342
2381
|
{
|
|
2343
2382
|
type: "monotone",
|
|
2344
2383
|
dataKey: "value",
|
|
2345
|
-
stroke:
|
|
2384
|
+
stroke: Xe,
|
|
2346
2385
|
strokeWidth: 2,
|
|
2347
|
-
dot: (
|
|
2348
|
-
var
|
|
2349
|
-
return
|
|
2386
|
+
dot: (v) => {
|
|
2387
|
+
var q, w, A;
|
|
2388
|
+
return le.has(((q = v.payload) == null ? void 0 : q.dim) ?? "") ? /* @__PURE__ */ e(
|
|
2350
2389
|
"circle",
|
|
2351
2390
|
{
|
|
2352
|
-
cx:
|
|
2353
|
-
cy:
|
|
2391
|
+
cx: v.cx,
|
|
2392
|
+
cy: v.cy,
|
|
2354
2393
|
r: 3.5,
|
|
2355
2394
|
fill: "#ef4444",
|
|
2356
2395
|
stroke: "#fff",
|
|
2357
2396
|
strokeWidth: 1
|
|
2358
2397
|
},
|
|
2359
|
-
(
|
|
2360
|
-
) : /* @__PURE__ */ e("g", {}, (
|
|
2398
|
+
(w = v.payload) == null ? void 0 : w.dim
|
|
2399
|
+
) : /* @__PURE__ */ e("g", {}, (A = v.payload) == null ? void 0 : A.dim);
|
|
2361
2400
|
}
|
|
2362
2401
|
}
|
|
2363
2402
|
),
|
|
2364
|
-
|
|
2365
|
-
|
|
2403
|
+
C && /* @__PURE__ */ e(
|
|
2404
|
+
B,
|
|
2366
2405
|
{
|
|
2367
2406
|
yAxisId: "right",
|
|
2368
2407
|
type: "monotone",
|
|
@@ -2373,8 +2412,8 @@ const Rt = La(function({
|
|
|
2373
2412
|
name: $
|
|
2374
2413
|
}
|
|
2375
2414
|
),
|
|
2376
|
-
|
|
2377
|
-
|
|
2415
|
+
b >= 2 && /* @__PURE__ */ e(
|
|
2416
|
+
B,
|
|
2378
2417
|
{
|
|
2379
2418
|
type: "monotone",
|
|
2380
2419
|
dataKey: "ma",
|
|
@@ -2382,7 +2421,7 @@ const Rt = La(function({
|
|
|
2382
2421
|
strokeWidth: 1.5,
|
|
2383
2422
|
strokeDasharray: "5 3",
|
|
2384
2423
|
dot: !1,
|
|
2385
|
-
name: `${
|
|
2424
|
+
name: `${b}-bucket avg`,
|
|
2386
2425
|
isAnimationActive: !1
|
|
2387
2426
|
}
|
|
2388
2427
|
)
|
|
@@ -2391,52 +2430,52 @@ const Rt = La(function({
|
|
|
2391
2430
|
) });
|
|
2392
2431
|
} }) });
|
|
2393
2432
|
else {
|
|
2394
|
-
const
|
|
2395
|
-
|
|
2396
|
-
Bar:
|
|
2397
|
-
Cell:
|
|
2398
|
-
ComposedChart:
|
|
2399
|
-
Line:
|
|
2400
|
-
ReferenceLine:
|
|
2401
|
-
ResponsiveContainer:
|
|
2433
|
+
const M = ((_t = a.config) == null ? void 0 : _t.orientation) === "horizontal";
|
|
2434
|
+
V = /* @__PURE__ */ e("div", { className: "min-h-[110px] flex-1", children: /* @__PURE__ */ e(Ke, { fallback: /* @__PURE__ */ e(De, { className: "h-full w-full", "aria-busy": "true" }), children: ({
|
|
2435
|
+
Bar: G,
|
|
2436
|
+
Cell: B,
|
|
2437
|
+
ComposedChart: K,
|
|
2438
|
+
Line: pe,
|
|
2439
|
+
ReferenceLine: ee,
|
|
2440
|
+
ResponsiveContainer: r,
|
|
2402
2441
|
Tooltip: d,
|
|
2403
|
-
XAxis:
|
|
2404
|
-
YAxis:
|
|
2442
|
+
XAxis: x,
|
|
2443
|
+
YAxis: v
|
|
2405
2444
|
}) => {
|
|
2406
|
-
var
|
|
2407
|
-
return /* @__PURE__ */ e(
|
|
2408
|
-
|
|
2445
|
+
var q;
|
|
2446
|
+
return /* @__PURE__ */ e(r, { width: "100%", height: "100%", children: /* @__PURE__ */ o(
|
|
2447
|
+
K,
|
|
2409
2448
|
{
|
|
2410
2449
|
data: l,
|
|
2411
|
-
layout:
|
|
2412
|
-
margin: { top: 6, right: 8, left:
|
|
2450
|
+
layout: M ? "vertical" : "horizontal",
|
|
2451
|
+
margin: { top: 6, right: 8, left: M ? 10 : -10, bottom: 0 },
|
|
2413
2452
|
children: [
|
|
2414
|
-
|
|
2415
|
-
/* @__PURE__ */ e(
|
|
2453
|
+
M ? /* @__PURE__ */ o(et, { children: [
|
|
2454
|
+
/* @__PURE__ */ e(x, { type: "number", tick: { fontSize: 10 }, stroke: "#94a3b8" }),
|
|
2416
2455
|
/* @__PURE__ */ e(
|
|
2417
|
-
|
|
2456
|
+
v,
|
|
2418
2457
|
{
|
|
2419
2458
|
type: "category",
|
|
2420
2459
|
dataKey: "dim",
|
|
2421
2460
|
tick: { fontSize: 10 },
|
|
2422
2461
|
stroke: "#94a3b8",
|
|
2423
|
-
tickFormatter:
|
|
2462
|
+
tickFormatter: xl,
|
|
2424
2463
|
interval: 0,
|
|
2425
2464
|
width: 140
|
|
2426
2465
|
}
|
|
2427
2466
|
)
|
|
2428
|
-
] }) : /* @__PURE__ */ o(
|
|
2467
|
+
] }) : /* @__PURE__ */ o(et, { children: [
|
|
2429
2468
|
/* @__PURE__ */ e(
|
|
2430
|
-
|
|
2469
|
+
x,
|
|
2431
2470
|
{
|
|
2432
2471
|
dataKey: "dim",
|
|
2433
2472
|
tick: { fontSize: 10 },
|
|
2434
2473
|
stroke: "#94a3b8",
|
|
2435
|
-
...
|
|
2474
|
+
...Ft(l.length)
|
|
2436
2475
|
}
|
|
2437
2476
|
),
|
|
2438
2477
|
/* @__PURE__ */ e(
|
|
2439
|
-
|
|
2478
|
+
v,
|
|
2440
2479
|
{
|
|
2441
2480
|
tick: { fontSize: 10 },
|
|
2442
2481
|
stroke: "#94a3b8",
|
|
@@ -2444,8 +2483,8 @@ const Rt = La(function({
|
|
|
2444
2483
|
width: 44
|
|
2445
2484
|
}
|
|
2446
2485
|
),
|
|
2447
|
-
|
|
2448
|
-
|
|
2486
|
+
C && /* @__PURE__ */ e(
|
|
2487
|
+
v,
|
|
2449
2488
|
{
|
|
2450
2489
|
yAxisId: "right",
|
|
2451
2490
|
orientation: "right",
|
|
@@ -2456,15 +2495,15 @@ const Rt = La(function({
|
|
|
2456
2495
|
}
|
|
2457
2496
|
)
|
|
2458
2497
|
] }),
|
|
2459
|
-
!
|
|
2460
|
-
|
|
2498
|
+
!M && I.map((w) => /* @__PURE__ */ e(
|
|
2499
|
+
ee,
|
|
2461
2500
|
{
|
|
2462
|
-
x:
|
|
2501
|
+
x: w.anchor_date,
|
|
2463
2502
|
stroke: "#f59e0b",
|
|
2464
2503
|
strokeDasharray: "4 3",
|
|
2465
2504
|
label: { value: "✎", position: "top", fontSize: 11, fill: "#f59e0b" }
|
|
2466
2505
|
},
|
|
2467
|
-
|
|
2506
|
+
w.id
|
|
2468
2507
|
)),
|
|
2469
2508
|
/* @__PURE__ */ e(
|
|
2470
2509
|
d,
|
|
@@ -2480,40 +2519,40 @@ const Rt = La(function({
|
|
|
2480
2519
|
itemStyle: { color: "#e2e8f0" }
|
|
2481
2520
|
}
|
|
2482
2521
|
),
|
|
2483
|
-
((
|
|
2522
|
+
((q = a.config) == null ? void 0 : q.compare) && /* @__PURE__ */ e(G, { dataKey: "prev", fill: "#cbd5e1", radius: [3, 3, 0, 0], name: "previous" }),
|
|
2484
2523
|
/* @__PURE__ */ e(
|
|
2485
|
-
|
|
2524
|
+
G,
|
|
2486
2525
|
{
|
|
2487
2526
|
dataKey: "value",
|
|
2488
|
-
fill:
|
|
2527
|
+
fill: Xe,
|
|
2489
2528
|
radius: [3, 3, 0, 0],
|
|
2490
2529
|
className: a.collection ? "cursor-pointer" : void 0,
|
|
2491
|
-
onClick: (
|
|
2492
|
-
var
|
|
2530
|
+
onClick: (w) => {
|
|
2531
|
+
var ke;
|
|
2493
2532
|
if (!a.collection) return;
|
|
2494
|
-
const
|
|
2495
|
-
if (
|
|
2496
|
-
const
|
|
2533
|
+
const A = w == null ? void 0 : w.payload;
|
|
2534
|
+
if (A != null && A.other) return;
|
|
2535
|
+
const de = (ke = a.config) == null ? void 0 : ke.dimension;
|
|
2497
2536
|
se({
|
|
2498
|
-
conditions:
|
|
2537
|
+
conditions: Tt(
|
|
2499
2538
|
a,
|
|
2500
2539
|
c,
|
|
2501
2540
|
s,
|
|
2502
|
-
(
|
|
2541
|
+
(A == null ? void 0 : A.raw) ?? (A == null ? void 0 : A.dim)
|
|
2503
2542
|
),
|
|
2504
|
-
title: `${a.title || a.collection} — ${(
|
|
2505
|
-
dimField:
|
|
2506
|
-
dimRaw: (
|
|
2507
|
-
dimLabel:
|
|
2543
|
+
title: `${a.title || a.collection} — ${(A == null ? void 0 : A.dim) ?? ""}`,
|
|
2544
|
+
dimField: de != null && de.bucket || de == null ? void 0 : de.field,
|
|
2545
|
+
dimRaw: (A == null ? void 0 : A.raw) ?? (A == null ? void 0 : A.dim),
|
|
2546
|
+
dimLabel: A == null ? void 0 : A.dim
|
|
2508
2547
|
});
|
|
2509
2548
|
},
|
|
2510
|
-
children: l.map((
|
|
2549
|
+
children: l.map((w) => /* @__PURE__ */ e(B, { fill: w.other ? "#94a3b8" : Xe }, w.dim))
|
|
2511
2550
|
}
|
|
2512
2551
|
),
|
|
2513
|
-
|
|
2514
|
-
|
|
2552
|
+
C && /* @__PURE__ */ e(
|
|
2553
|
+
pe,
|
|
2515
2554
|
{
|
|
2516
|
-
yAxisId:
|
|
2555
|
+
yAxisId: M ? void 0 : "right",
|
|
2517
2556
|
type: "monotone",
|
|
2518
2557
|
dataKey: "value2",
|
|
2519
2558
|
stroke: "#8b5cf6",
|
|
@@ -2528,32 +2567,33 @@ const Rt = La(function({
|
|
|
2528
2567
|
} }) });
|
|
2529
2568
|
}
|
|
2530
2569
|
}
|
|
2531
|
-
return
|
|
2532
|
-
/* @__PURE__ */ e("p", { className: "text-[26px] font-bold tabular-nums text-amber-700 dark:text-amber-400", children:
|
|
2570
|
+
return D && p && (V = /* @__PURE__ */ o("div", { className: "flex min-h-0 flex-1 flex-col justify-center px-1", children: [
|
|
2571
|
+
/* @__PURE__ */ e("p", { className: "text-[26px] font-bold tabular-nums text-amber-700 dark:text-amber-400", children: p.value == null ? "—" : qe(p.value, ie) }),
|
|
2533
2572
|
/* @__PURE__ */ o("p", { className: "text-[10.5px] text-slate-400", children: [
|
|
2534
2573
|
"As of ",
|
|
2535
|
-
|
|
2536
|
-
|
|
2574
|
+
p.name,
|
|
2575
|
+
p.value == null ? " — no metric stored for this widget" : ""
|
|
2537
2576
|
] })
|
|
2538
2577
|
] })), /* @__PURE__ */ o(
|
|
2539
2578
|
"div",
|
|
2540
2579
|
{
|
|
2580
|
+
ref: Y,
|
|
2541
2581
|
className: "flex min-h-0 flex-col overflow-hidden rounded-lg border border-slate-200 bg-white p-3 dark:border-border dark:bg-card",
|
|
2542
|
-
style:
|
|
2582
|
+
style: it,
|
|
2543
2583
|
children: [
|
|
2544
|
-
/* @__PURE__ */ o("div", { className: "mb-1.5 flex items-center gap-1.5", children: [
|
|
2584
|
+
/* @__PURE__ */ o("div", { className: "mb-1.5 flex items-center gap-1.5", "data-widget-image-ignore": "", children: [
|
|
2545
2585
|
(() => {
|
|
2546
2586
|
var i;
|
|
2547
2587
|
const l = (i = a.config) == null ? void 0 : i.link_report;
|
|
2548
|
-
return l != null && l.report_id &&
|
|
2588
|
+
return l != null && l.report_id && k ? /* @__PURE__ */ o(
|
|
2549
2589
|
"a",
|
|
2550
2590
|
{
|
|
2551
|
-
href:
|
|
2591
|
+
href: k(l.report_id),
|
|
2552
2592
|
onClick: () => {
|
|
2553
2593
|
try {
|
|
2554
2594
|
sessionStorage.setItem(
|
|
2555
2595
|
`nvr-report-xf:${l.report_id}`,
|
|
2556
|
-
JSON.stringify(
|
|
2596
|
+
JSON.stringify(Z ?? [])
|
|
2557
2597
|
);
|
|
2558
2598
|
} catch {
|
|
2559
2599
|
}
|
|
@@ -2570,75 +2610,80 @@ const Rt = La(function({
|
|
|
2570
2610
|
/* @__PURE__ */ e(
|
|
2571
2611
|
"span",
|
|
2572
2612
|
{
|
|
2573
|
-
"data-tip":
|
|
2613
|
+
"data-tip": Ut(a),
|
|
2574
2614
|
className: "shrink-0 cursor-help text-slate-300 hover:text-slate-500",
|
|
2575
|
-
children: /* @__PURE__ */ e(
|
|
2615
|
+
children: /* @__PURE__ */ e(Oa, { className: "h-3 w-3" })
|
|
2576
2616
|
}
|
|
2577
2617
|
),
|
|
2578
2618
|
/* @__PURE__ */ o("span", { className: "ml-auto flex items-center gap-0.5", children: [
|
|
2619
|
+
/* @__PURE__ */ e(
|
|
2620
|
+
pl,
|
|
2621
|
+
{
|
|
2622
|
+
getTarget: () => Y.current,
|
|
2623
|
+
label: () => {
|
|
2624
|
+
var l;
|
|
2625
|
+
return {
|
|
2626
|
+
title: a.title || a.collection || "Report widget",
|
|
2627
|
+
asOf: Oe || Date.now(),
|
|
2628
|
+
dateRange: s,
|
|
2629
|
+
entityFilters: c,
|
|
2630
|
+
widgetRules: (l = a.config) == null ? void 0 : l.filters
|
|
2631
|
+
};
|
|
2632
|
+
},
|
|
2633
|
+
className: "h-5 w-5 text-slate-300 hover:text-[#00a5cc]"
|
|
2634
|
+
}
|
|
2635
|
+
),
|
|
2579
2636
|
["bar", "line", "donut", "pareto"].includes(a.type) && /* @__PURE__ */ e(
|
|
2580
2637
|
"button",
|
|
2581
2638
|
{
|
|
2582
2639
|
type: "button",
|
|
2583
|
-
title:
|
|
2584
|
-
className:
|
|
2640
|
+
title: fe ? "Back to the chart" : "View as table (#383)",
|
|
2641
|
+
className: P(
|
|
2585
2642
|
"rounded p-0.5",
|
|
2586
|
-
|
|
2643
|
+
fe ? "text-[#00a5cc]" : "text-slate-300 hover:text-[#00a5cc]"
|
|
2587
2644
|
),
|
|
2588
2645
|
onClick: () => re((l) => !l),
|
|
2589
|
-
children: /* @__PURE__ */ e(
|
|
2590
|
-
}
|
|
2591
|
-
),
|
|
2592
|
-
["bar", "line", "donut", "pareto", "scatter", "heatmap", "waterfall"].includes(
|
|
2593
|
-
a.type
|
|
2594
|
-
) && /* @__PURE__ */ e(
|
|
2595
|
-
"button",
|
|
2596
|
-
{
|
|
2597
|
-
type: "button",
|
|
2598
|
-
title: "Copy chart as image",
|
|
2599
|
-
className: "rounded p-0.5 text-slate-300 hover:text-[#00a5cc]",
|
|
2600
|
-
onClick: () => void el(T.current, a.title),
|
|
2601
|
-
children: /* @__PURE__ */ e(St, { className: "h-3 w-3" })
|
|
2646
|
+
children: /* @__PURE__ */ e(Ka, { className: "h-3 w-3" })
|
|
2602
2647
|
}
|
|
2603
2648
|
),
|
|
2604
2649
|
/* @__PURE__ */ e(
|
|
2605
2650
|
"button",
|
|
2606
2651
|
{
|
|
2607
2652
|
type: "button",
|
|
2608
|
-
title:
|
|
2609
|
-
"data-explain-trend":
|
|
2653
|
+
title: Me ? "Explain the trend" : "Explain this number",
|
|
2654
|
+
"data-explain-trend": Me ? "1" : void 0,
|
|
2610
2655
|
className: "rounded p-0.5 text-slate-300 hover:text-[#00a5cc]",
|
|
2611
2656
|
onClick: () => {
|
|
2612
|
-
if (
|
|
2613
|
-
|
|
2657
|
+
if (oe) {
|
|
2658
|
+
me(!1);
|
|
2614
2659
|
return;
|
|
2615
2660
|
}
|
|
2616
|
-
if (
|
|
2617
|
-
if (
|
|
2661
|
+
if (me(!0), ge || j) return;
|
|
2662
|
+
if (he(!0), Me) {
|
|
2618
2663
|
F.request(
|
|
2619
|
-
|
|
2664
|
+
at(`/report-studio/${n}/widgets/${a.id}/explain-trend`, {
|
|
2620
2665
|
date_range: s,
|
|
2621
2666
|
entity_filters: c
|
|
2622
2667
|
})
|
|
2623
2668
|
).then((i) => {
|
|
2624
|
-
|
|
2669
|
+
S(i.data.explanation || "No explanation available."), Fe(i.data.movers ?? null);
|
|
2625
2670
|
}).catch(
|
|
2626
|
-
(i) =>
|
|
2671
|
+
(i) => S(
|
|
2627
2672
|
(i == null ? void 0 : i.status) === 503 ? "AI is not configured on this instance." : (i == null ? void 0 : i.status) === 400 ? i.message ?? "Not enough data to describe a trend." : "AI is not configured or unavailable."
|
|
2628
2673
|
)
|
|
2629
|
-
).finally(() =>
|
|
2674
|
+
).finally(() => he(!1));
|
|
2630
2675
|
return;
|
|
2631
2676
|
}
|
|
2632
|
-
(
|
|
2633
|
-
|
|
2677
|
+
(T ? Promise.resolve(T) : F.request(
|
|
2678
|
+
Ct(n, a.id, {
|
|
2634
2679
|
date_range: s,
|
|
2635
2680
|
entity_filters: c
|
|
2636
2681
|
})
|
|
2637
2682
|
).then((i) => i.data).catch(() => {
|
|
2638
2683
|
})).then((i) => {
|
|
2639
|
-
const
|
|
2684
|
+
const b = {
|
|
2640
2685
|
widget: a.title,
|
|
2641
|
-
how_computed:
|
|
2686
|
+
how_computed: Ut(a),
|
|
2642
2687
|
value: (i == null ? void 0 : i.value) ?? null,
|
|
2643
2688
|
previous_value: (i == null ? void 0 : i.prev_value) ?? null,
|
|
2644
2689
|
change_pct: (i == null ? void 0 : i.change_pct) ?? null,
|
|
@@ -2646,49 +2691,49 @@ const Rt = La(function({
|
|
|
2646
2691
|
series: ((i == null ? void 0 : i.series) ?? []).slice(0, 15),
|
|
2647
2692
|
rows: ((i == null ? void 0 : i.rows) ?? []).slice(0, 10),
|
|
2648
2693
|
tiles: (i == null ? void 0 : i.tiles) ?? null
|
|
2649
|
-
},
|
|
2694
|
+
}, C = (i == null ? void 0 : i.prev_value) != null || ((i == null ? void 0 : i.series) ?? []).some(($) => $.prev != null);
|
|
2650
2695
|
return F.request(
|
|
2651
|
-
|
|
2652
|
-
context: JSON.stringify(
|
|
2696
|
+
at("/ai/brief", {
|
|
2697
|
+
context: JSON.stringify(b),
|
|
2653
2698
|
// `template` picks the server's prompt; `instructions` (the same
|
|
2654
2699
|
// text) keeps an older API answering the same way.
|
|
2655
|
-
template:
|
|
2656
|
-
instructions:
|
|
2700
|
+
template: C ? "report-compare" : "report-explain",
|
|
2701
|
+
instructions: C ? "Compare the current period against the previous one in 2-4 plain sentences: overall direction, the biggest movers up and down, and anything anomalous. No preamble." : "In 2-3 plain sentences, explain what this report metric shows and what stands out (biggest contributor, direction of change). No preamble."
|
|
2657
2702
|
})
|
|
2658
2703
|
);
|
|
2659
2704
|
}).then((i) => {
|
|
2660
|
-
var
|
|
2661
|
-
const
|
|
2662
|
-
|
|
2663
|
-
}).catch(() =>
|
|
2705
|
+
var C, $;
|
|
2706
|
+
const b = ((C = i.data) == null ? void 0 : C.brief) ?? (($ = i.data) == null ? void 0 : $.text) ?? null;
|
|
2707
|
+
S(b || "No explanation available.");
|
|
2708
|
+
}).catch(() => S("AI is not configured or unavailable.")).finally(() => he(!1));
|
|
2664
2709
|
},
|
|
2665
|
-
children: /* @__PURE__ */ e(
|
|
2710
|
+
children: /* @__PURE__ */ e(Wt, { className: "h-3 w-3" })
|
|
2666
2711
|
}
|
|
2667
2712
|
),
|
|
2668
|
-
((
|
|
2713
|
+
((He = (Ge = a.config) == null ? void 0 : Ge.dimension) == null ? void 0 : He.bucket) && /* @__PURE__ */ e(
|
|
2669
2714
|
"button",
|
|
2670
2715
|
{
|
|
2671
2716
|
type: "button",
|
|
2672
|
-
title:
|
|
2673
|
-
className:
|
|
2717
|
+
title: te ? "Show per-period values" : "Show running total",
|
|
2718
|
+
className: P(
|
|
2674
2719
|
"rounded p-0.5",
|
|
2675
|
-
|
|
2720
|
+
te ? "text-[#00a5cc]" : "text-slate-300 hover:text-slate-500"
|
|
2676
2721
|
),
|
|
2677
|
-
onClick: () =>
|
|
2678
|
-
children: /* @__PURE__ */ e(
|
|
2722
|
+
onClick: () => U((l) => !l),
|
|
2723
|
+
children: /* @__PURE__ */ e(Da, { className: "h-3 w-3" })
|
|
2679
2724
|
}
|
|
2680
2725
|
),
|
|
2681
|
-
|
|
2726
|
+
y && /* @__PURE__ */ e(
|
|
2682
2727
|
"button",
|
|
2683
2728
|
{
|
|
2684
2729
|
type: "button",
|
|
2685
2730
|
title: "Notes on this widget",
|
|
2686
|
-
className:
|
|
2731
|
+
className: P(
|
|
2687
2732
|
"relative rounded p-0.5",
|
|
2688
|
-
((
|
|
2733
|
+
((O == null ? void 0 : O.length) ?? 0) > 0 ? "text-amber-500" : "text-slate-300 hover:text-slate-500"
|
|
2689
2734
|
),
|
|
2690
|
-
onClick: () =>
|
|
2691
|
-
children: /* @__PURE__ */ e(
|
|
2735
|
+
onClick: () => Ne((l) => !l),
|
|
2736
|
+
children: /* @__PURE__ */ e(Pa, { className: "h-3 w-3" })
|
|
2692
2737
|
}
|
|
2693
2738
|
),
|
|
2694
2739
|
/* @__PURE__ */ e(
|
|
@@ -2698,37 +2743,37 @@ const Rt = La(function({
|
|
|
2698
2743
|
title: "Download as CSV",
|
|
2699
2744
|
className: "rounded p-0.5 text-slate-300 hover:text-slate-500",
|
|
2700
2745
|
onClick: () => {
|
|
2701
|
-
if (!(
|
|
2702
|
-
|
|
2746
|
+
if (!(ye != null && ye.slug)) {
|
|
2747
|
+
Yt(a, T);
|
|
2703
2748
|
return;
|
|
2704
2749
|
}
|
|
2705
|
-
const l =
|
|
2706
|
-
|
|
2750
|
+
const l = ye, i = Kt(l, s, c);
|
|
2751
|
+
rt.fetchQuery({
|
|
2707
2752
|
queryKey: ["nivaro-report-query", l.slug, i],
|
|
2708
|
-
queryFn: () =>
|
|
2753
|
+
queryFn: () => fa(F, l.slug, i),
|
|
2709
2754
|
staleTime: 6e4
|
|
2710
|
-
}).then((
|
|
2711
|
-
|
|
2755
|
+
}).then((b) => Yt(a, void 0, ha(l, b))).catch((b) => {
|
|
2756
|
+
Ta(b) || aa.error(Ot(b, "this widget"));
|
|
2712
2757
|
});
|
|
2713
2758
|
},
|
|
2714
|
-
children: /* @__PURE__ */ e(
|
|
2759
|
+
children: /* @__PURE__ */ e(za, { className: "h-3 w-3" })
|
|
2715
2760
|
}
|
|
2716
2761
|
),
|
|
2717
|
-
/* @__PURE__ */ e(
|
|
2762
|
+
/* @__PURE__ */ e(Ll, { reportId: n, widget: a, filterBar: h }),
|
|
2718
2763
|
/* @__PURE__ */ e(
|
|
2719
2764
|
"button",
|
|
2720
2765
|
{
|
|
2721
2766
|
type: "button",
|
|
2722
2767
|
title: "Refresh",
|
|
2723
2768
|
className: "rounded p-0.5 text-slate-300 hover:text-slate-500",
|
|
2724
|
-
onClick: () =>
|
|
2725
|
-
children: /* @__PURE__ */ e(
|
|
2769
|
+
onClick: () => ot(),
|
|
2770
|
+
children: /* @__PURE__ */ e(At, { className: P("h-3 w-3", Mt && "animate-spin") })
|
|
2726
2771
|
}
|
|
2727
2772
|
)
|
|
2728
2773
|
] })
|
|
2729
2774
|
] }),
|
|
2730
2775
|
xe && /* @__PURE__ */ o("div", { className: "mb-1.5 space-y-1 rounded-md border border-amber-200 bg-amber-50/60 p-2 dark:border-amber-500/30 dark:bg-amber-500/10", children: [
|
|
2731
|
-
(
|
|
2776
|
+
(O ?? []).map((l) => /* @__PURE__ */ o(
|
|
2732
2777
|
"div",
|
|
2733
2778
|
{
|
|
2734
2779
|
className: "group/note flex items-start gap-1.5 text-[11px] text-slate-600 dark:text-slate-300",
|
|
@@ -2742,25 +2787,25 @@ const Rt = La(function({
|
|
|
2742
2787
|
l.note,
|
|
2743
2788
|
/* @__PURE__ */ e("span", { className: "ml-1 text-[10px] text-slate-400", children: l.created_by_name ?? "" })
|
|
2744
2789
|
] }),
|
|
2745
|
-
|
|
2790
|
+
Q && /* @__PURE__ */ e(
|
|
2746
2791
|
"button",
|
|
2747
2792
|
{
|
|
2748
2793
|
type: "button",
|
|
2749
|
-
onClick: () =>
|
|
2794
|
+
onClick: () => Q(l.id),
|
|
2750
2795
|
className: "shrink-0 rounded p-0.5 text-slate-300 opacity-0 hover:text-red-500 group-hover/note:opacity-100",
|
|
2751
|
-
children: /* @__PURE__ */ e(
|
|
2796
|
+
children: /* @__PURE__ */ e(Te, { className: "h-2.5 w-2.5" })
|
|
2752
2797
|
}
|
|
2753
2798
|
)
|
|
2754
2799
|
]
|
|
2755
2800
|
},
|
|
2756
2801
|
l.id
|
|
2757
2802
|
)),
|
|
2758
|
-
(
|
|
2759
|
-
|
|
2803
|
+
(O ?? []).length === 0 && /* @__PURE__ */ e("p", { className: "text-[11px] text-slate-400", children: "No notes yet — record why a number moved." }),
|
|
2804
|
+
y && /* @__PURE__ */ o("div", { className: "flex items-center gap-1 pt-0.5", children: [
|
|
2760
2805
|
/* @__PURE__ */ e(
|
|
2761
2806
|
"input",
|
|
2762
2807
|
{
|
|
2763
|
-
value:
|
|
2808
|
+
value: we,
|
|
2764
2809
|
onChange: (l) => $e(l.target.value),
|
|
2765
2810
|
placeholder: "Add a note…",
|
|
2766
2811
|
className: "h-6 min-w-0 flex-1 rounded border border-amber-200 bg-white px-1.5 text-[11px] dark:border-amber-500/30 dark:bg-card dark:text-slate-200"
|
|
@@ -2769,8 +2814,8 @@ const Rt = La(function({
|
|
|
2769
2814
|
/* @__PURE__ */ e(
|
|
2770
2815
|
"input",
|
|
2771
2816
|
{
|
|
2772
|
-
value:
|
|
2773
|
-
onChange: (l) =>
|
|
2817
|
+
value: f,
|
|
2818
|
+
onChange: (l) => X(l.target.value),
|
|
2774
2819
|
placeholder: "2026-03",
|
|
2775
2820
|
title: "Optional chart anchor (YYYY-MM or YYYY-MM-DD bucket key)",
|
|
2776
2821
|
className: "h-6 w-[76px] rounded border border-amber-200 bg-white px-1.5 text-[10.5px] dark:border-amber-500/30 dark:bg-card dark:text-slate-200"
|
|
@@ -2780,9 +2825,9 @@ const Rt = La(function({
|
|
|
2780
2825
|
"button",
|
|
2781
2826
|
{
|
|
2782
2827
|
type: "button",
|
|
2783
|
-
disabled: !
|
|
2828
|
+
disabled: !we.trim(),
|
|
2784
2829
|
onClick: () => {
|
|
2785
|
-
|
|
2830
|
+
y(a.id, we.trim(), f.trim() || null), $e(""), X("");
|
|
2786
2831
|
},
|
|
2787
2832
|
className: "h-6 rounded bg-amber-500 px-2 text-[11px] font-medium text-white hover:brightness-105 disabled:opacity-40",
|
|
2788
2833
|
children: "Add"
|
|
@@ -2790,14 +2835,14 @@ const Rt = La(function({
|
|
|
2790
2835
|
)
|
|
2791
2836
|
] })
|
|
2792
2837
|
] }),
|
|
2793
|
-
|
|
2794
|
-
const l =
|
|
2838
|
+
p && (() => {
|
|
2839
|
+
const l = Kl(T), i = p.value;
|
|
2795
2840
|
if (l == null || i == null) return null;
|
|
2796
|
-
const
|
|
2841
|
+
const b = i === 0 ? null : (l - i) / Math.abs(i) * 100;
|
|
2797
2842
|
return /* @__PURE__ */ o("p", { className: "mb-1 flex items-center gap-1 text-[10.5px] text-slate-400", children: [
|
|
2798
|
-
/* @__PURE__ */ e(
|
|
2843
|
+
/* @__PURE__ */ e(Lt, { className: "h-2.5 w-2.5" }),
|
|
2799
2844
|
"vs ",
|
|
2800
|
-
|
|
2845
|
+
p.name,
|
|
2801
2846
|
": ",
|
|
2802
2847
|
i.toLocaleString(),
|
|
2803
2848
|
" →",
|
|
@@ -2805,33 +2850,33 @@ const Rt = La(function({
|
|
|
2805
2850
|
/* @__PURE__ */ e(
|
|
2806
2851
|
"span",
|
|
2807
2852
|
{
|
|
2808
|
-
className:
|
|
2853
|
+
className: P(
|
|
2809
2854
|
"font-semibold",
|
|
2810
|
-
|
|
2811
|
-
|
|
2855
|
+
b != null && b > 0 && "text-emerald-600 dark:text-emerald-400",
|
|
2856
|
+
b != null && b < 0 && "text-red-500"
|
|
2812
2857
|
),
|
|
2813
|
-
children:
|
|
2858
|
+
children: b == null ? "—" : `${b > 0 ? "+" : ""}${b.toFixed(1)}%`
|
|
2814
2859
|
}
|
|
2815
2860
|
)
|
|
2816
2861
|
] });
|
|
2817
2862
|
})(),
|
|
2818
|
-
|
|
2863
|
+
oe && /* @__PURE__ */ o(
|
|
2819
2864
|
"div",
|
|
2820
2865
|
{
|
|
2821
2866
|
className: "mb-1.5 rounded-md border border-nvr-cyan/25 bg-nvr-cyan/5 px-2.5 py-1.5 text-[11.5px] leading-snug text-slate-600 dark:text-slate-300",
|
|
2822
|
-
"data-explain-panel":
|
|
2867
|
+
"data-explain-panel": Me ? "trend" : "number",
|
|
2823
2868
|
children: [
|
|
2824
|
-
|
|
2825
|
-
!
|
|
2869
|
+
j ? "Thinking…" : ge,
|
|
2870
|
+
!j && ve && ve.length > 0 && /* @__PURE__ */ e("div", { className: "mt-1.5 flex flex-wrap gap-1", "data-explain-movers": !0, children: ve.slice(0, 4).map((l) => /* @__PURE__ */ o(
|
|
2826
2871
|
"span",
|
|
2827
2872
|
{
|
|
2828
|
-
className:
|
|
2873
|
+
className: P(
|
|
2829
2874
|
"inline-flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-[10.5px] tabular-nums",
|
|
2830
2875
|
l.delta == null ? "border-slate-200 text-slate-500 dark:border-border dark:text-slate-400" : l.delta >= 0 ? "border-emerald-200 text-emerald-700 dark:border-emerald-500/30 dark:text-emerald-300" : "border-red-200 text-red-700 dark:border-red-500/30 dark:text-red-300"
|
|
2831
2876
|
),
|
|
2832
2877
|
"data-explain-mover": l.label,
|
|
2833
2878
|
children: [
|
|
2834
|
-
l.delta != null && (l.delta >= 0 ? /* @__PURE__ */ e(
|
|
2879
|
+
l.delta != null && (l.delta >= 0 ? /* @__PURE__ */ e(ea, { className: "h-3 w-3" }) : /* @__PURE__ */ e(ta, { className: "h-3 w-3" })),
|
|
2835
2880
|
/* @__PURE__ */ e("span", { className: "font-medium", children: l.label }),
|
|
2836
2881
|
l.delta != null ? /* @__PURE__ */ o("span", { children: [
|
|
2837
2882
|
l.delta >= 0 ? "+" : "",
|
|
@@ -2848,55 +2893,63 @@ const Rt = La(function({
|
|
|
2848
2893
|
]
|
|
2849
2894
|
}
|
|
2850
2895
|
),
|
|
2851
|
-
|
|
2896
|
+
ae.length > 0 && /* @__PURE__ */ o("div", { className: "mb-1 flex flex-wrap items-center gap-1 text-[10.5px] text-slate-500", children: [
|
|
2852
2897
|
/* @__PURE__ */ e(
|
|
2853
2898
|
"button",
|
|
2854
2899
|
{
|
|
2855
2900
|
type: "button",
|
|
2856
|
-
onClick: () =>
|
|
2901
|
+
onClick: () => N([]),
|
|
2857
2902
|
className: "rounded px-1 hover:bg-muted",
|
|
2858
2903
|
children: "⌂ All"
|
|
2859
2904
|
}
|
|
2860
2905
|
),
|
|
2861
|
-
|
|
2906
|
+
ae.map((l, i) => /* @__PURE__ */ o("span", { className: "flex items-center gap-1", children: [
|
|
2862
2907
|
/* @__PURE__ */ e("span", { className: "text-slate-300", children: "›" }),
|
|
2863
2908
|
/* @__PURE__ */ e(
|
|
2864
2909
|
"button",
|
|
2865
2910
|
{
|
|
2866
2911
|
type: "button",
|
|
2867
|
-
onClick: () =>
|
|
2912
|
+
onClick: () => N(ae.slice(0, i + 1)),
|
|
2868
2913
|
className: "rounded bg-nvr-cyan/[0.08] px-1.5 py-0.5 font-medium text-[#007a99] dark:text-nvr-cyan",
|
|
2869
2914
|
children: l.value
|
|
2870
2915
|
}
|
|
2871
2916
|
)
|
|
2872
2917
|
] }, `${l.field}-${i}`))
|
|
2873
2918
|
] }),
|
|
2874
|
-
/* @__PURE__ */ e("div", { ref:
|
|
2919
|
+
/* @__PURE__ */ e("div", { ref: R, className: "flex min-h-0 flex-1 flex-col", children: fe && ((ht = T == null ? void 0 : T.series) != null && ht.length) ? /* @__PURE__ */ e("div", { className: "min-h-0 flex-1 overflow-auto", children: /* @__PURE__ */ o("table", { className: "w-full text-[11.5px]", children: [
|
|
2875
2920
|
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ o("tr", { className: "text-left text-[10px] uppercase tracking-wide text-slate-400", children: [
|
|
2876
2921
|
/* @__PURE__ */ e("th", { className: "px-1.5 pb-1", children: "Dimension" }),
|
|
2877
2922
|
/* @__PURE__ */ e("th", { className: "px-1.5 pb-1 text-right", children: "Value" })
|
|
2878
2923
|
] }) }),
|
|
2879
|
-
/* @__PURE__ */ e("tbody", { children: (
|
|
2924
|
+
/* @__PURE__ */ e("tbody", { children: (T.series ?? []).map((l) => /* @__PURE__ */ o("tr", { className: "border-b border-slate-50 dark:border-border/40", children: [
|
|
2880
2925
|
/* @__PURE__ */ e("td", { className: "max-w-[220px] truncate px-1.5 py-1 text-slate-700 dark:text-slate-300", children: l.dim }),
|
|
2881
|
-
/* @__PURE__ */ e("td", { className: "px-1.5 py-1 text-right tabular-nums text-slate-800 dark:text-slate-100", children: qe(l.value,
|
|
2926
|
+
/* @__PURE__ */ e("td", { className: "px-1.5 py-1 text-right tabular-nums text-slate-800 dark:text-slate-100", children: qe(l.value, ie) })
|
|
2882
2927
|
] }, l.dim)) })
|
|
2883
|
-
] }) }) :
|
|
2884
|
-
(
|
|
2885
|
-
|
|
2886
|
-
|
|
2928
|
+
] }) }) : V }),
|
|
2929
|
+
(ye == null ? void 0 : ye.slug) && E && /* @__PURE__ */ e(
|
|
2930
|
+
ql,
|
|
2931
|
+
{
|
|
2932
|
+
slug: ye.slug,
|
|
2933
|
+
params: Kt(ye, s, c),
|
|
2934
|
+
scope: `report:${n}`
|
|
2935
|
+
}
|
|
2936
|
+
),
|
|
2937
|
+
((ft = a.config) == null ? void 0 : ft.footnote) && /* @__PURE__ */ e("p", { className: "mt-1 border-t border-slate-100 pt-1 text-[10.5px] leading-snug text-slate-400 dark:border-border/50", children: a.config.footnote }),
|
|
2938
|
+
W && /* @__PURE__ */ e(
|
|
2939
|
+
Dl,
|
|
2887
2940
|
{
|
|
2888
2941
|
collection: a.collection ?? "",
|
|
2889
|
-
conditions:
|
|
2890
|
-
title:
|
|
2942
|
+
conditions: W.conditions,
|
|
2943
|
+
title: W.title,
|
|
2891
2944
|
onClose: () => se(null),
|
|
2892
2945
|
onOpen: (l) => {
|
|
2893
|
-
se(null),
|
|
2946
|
+
se(null), g == null || g(l);
|
|
2894
2947
|
},
|
|
2895
|
-
crossFilter:
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2948
|
+
crossFilter: m && W.dimField && W.dimRaw != null ? () => {
|
|
2949
|
+
m(
|
|
2950
|
+
W.dimField,
|
|
2951
|
+
W.dimRaw,
|
|
2952
|
+
W.dimLabel ?? String(W.dimRaw)
|
|
2900
2953
|
), se(null);
|
|
2901
2954
|
} : void 0
|
|
2902
2955
|
}
|
|
@@ -2905,61 +2958,61 @@ const Rt = La(function({
|
|
|
2905
2958
|
}
|
|
2906
2959
|
);
|
|
2907
2960
|
});
|
|
2908
|
-
function
|
|
2961
|
+
function pr({
|
|
2909
2962
|
reportId: t,
|
|
2910
2963
|
widget: n,
|
|
2911
2964
|
dateRange: a = null,
|
|
2912
2965
|
entityFilters: s = []
|
|
2913
2966
|
}) {
|
|
2914
|
-
const c =
|
|
2915
|
-
(
|
|
2967
|
+
const c = la(), u = gt(
|
|
2968
|
+
(g) => c == null ? void 0 : c.open(g),
|
|
2916
2969
|
[c]
|
|
2917
|
-
), h =
|
|
2970
|
+
), h = tt(() => ({ ...n, x: 0 }), [n]);
|
|
2918
2971
|
return /* @__PURE__ */ e(
|
|
2919
|
-
|
|
2972
|
+
Dt,
|
|
2920
2973
|
{
|
|
2921
2974
|
reportId: t,
|
|
2922
2975
|
widget: h,
|
|
2923
2976
|
dateRange: a,
|
|
2924
2977
|
entityFilters: s,
|
|
2925
|
-
onDrill: c ?
|
|
2978
|
+
onDrill: c ? u : void 0
|
|
2926
2979
|
}
|
|
2927
2980
|
);
|
|
2928
2981
|
}
|
|
2929
|
-
function
|
|
2982
|
+
function Pl(t) {
|
|
2930
2983
|
const n = t == null ? "" : String(t);
|
|
2931
2984
|
return n.length > 24 ? `${n.slice(0, 23)}…` : n;
|
|
2932
2985
|
}
|
|
2933
|
-
function
|
|
2986
|
+
function zl(t) {
|
|
2934
2987
|
const n = t;
|
|
2935
2988
|
return !(n != null && n.admin) || !n.access_scope_label ? null : `(your access scope: ${n.access_scope_label})`;
|
|
2936
2989
|
}
|
|
2937
|
-
function
|
|
2990
|
+
function hr({
|
|
2938
2991
|
reportId: t,
|
|
2939
2992
|
showFilterBar: n = !0,
|
|
2940
2993
|
dateRange: a,
|
|
2941
2994
|
initialEntityFilters: s = [],
|
|
2942
2995
|
refetchInterval: c,
|
|
2943
|
-
className:
|
|
2996
|
+
className: u,
|
|
2944
2997
|
emptyState: h,
|
|
2945
|
-
reportUrl:
|
|
2998
|
+
reportUrl: g
|
|
2946
2999
|
}) {
|
|
2947
|
-
var
|
|
2948
|
-
const
|
|
2949
|
-
(r) =>
|
|
2950
|
-
[
|
|
2951
|
-
), [
|
|
3000
|
+
var pe, ee;
|
|
3001
|
+
const p = Le(), D = la(), O = Qa("drill.report"), y = O.value, Q = gt(
|
|
3002
|
+
(r) => D ? D.open(r) : O.push([r]),
|
|
3003
|
+
[D, O.push]
|
|
3004
|
+
), [m, k] = _(void 0), [Z, F] = _(s), [H, z] = _(void 0), [ue, J] = _(s), { scopes: W, ready: se } = na(), [xe, Ne] = _(!1), [we, $e] = _({}), f = lt(), { data: X = [] } = Se({
|
|
2952
3005
|
queryKey: ["nivaro-report-presets", t],
|
|
2953
3006
|
queryFn: async () => {
|
|
2954
3007
|
try {
|
|
2955
3008
|
const r = JSON.parse(localStorage.getItem(`nvr-report-presets:${t}`) ?? "[]");
|
|
2956
3009
|
if (Array.isArray(r) && r.length > 0) {
|
|
2957
|
-
for (const
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
name: String(
|
|
2961
|
-
date_range:
|
|
2962
|
-
entity_filters:
|
|
3010
|
+
for (const d of r)
|
|
3011
|
+
d != null && d.name && await p.request(
|
|
3012
|
+
Et(t, {
|
|
3013
|
+
name: String(d.name),
|
|
3014
|
+
date_range: d.date_range ?? null,
|
|
3015
|
+
entity_filters: d.entity_filters ?? []
|
|
2963
3016
|
})
|
|
2964
3017
|
).catch(() => {
|
|
2965
3018
|
});
|
|
@@ -2967,221 +3020,242 @@ function Xl({
|
|
|
2967
3020
|
}
|
|
2968
3021
|
} catch {
|
|
2969
3022
|
}
|
|
2970
|
-
return
|
|
3023
|
+
return p.request(ka(t)).then((r) => r.data);
|
|
2971
3024
|
},
|
|
2972
3025
|
staleTime: 6e4
|
|
2973
|
-
}),
|
|
2974
|
-
mutationFn: (r) =>
|
|
2975
|
-
|
|
3026
|
+
}), te = () => void f.invalidateQueries({ queryKey: ["nivaro-report-presets", t] }), U = Ae({
|
|
3027
|
+
mutationFn: (r) => p.request(
|
|
3028
|
+
Et(t, {
|
|
2976
3029
|
name: r,
|
|
2977
|
-
date_range:
|
|
2978
|
-
entity_filters:
|
|
3030
|
+
date_range: ht.current ?? null,
|
|
3031
|
+
entity_filters: ft.current
|
|
2979
3032
|
})
|
|
2980
3033
|
),
|
|
2981
|
-
onSuccess:
|
|
2982
|
-
}),
|
|
2983
|
-
mutationFn: (r) =>
|
|
2984
|
-
onSuccess:
|
|
2985
|
-
}), [re,
|
|
3034
|
+
onSuccess: te
|
|
3035
|
+
}), fe = Ae({
|
|
3036
|
+
mutationFn: (r) => p.request(Na(t, r)),
|
|
3037
|
+
onSuccess: te
|
|
3038
|
+
}), [re, ae] = _(""), [N, R] = _(!1), [Y, E] = _(null), [oe, me] = _(!1), { data: ge = [] } = Se({
|
|
2986
3039
|
queryKey: ["nvr-report-snaps", t],
|
|
2987
|
-
queryFn: () =>
|
|
2988
|
-
|
|
3040
|
+
queryFn: () => p.request(
|
|
3041
|
+
bt(`/report-studio/${t}/snapshots`)
|
|
2989
3042
|
).then((r) => r.data ?? []),
|
|
2990
3043
|
staleTime: 6e4,
|
|
2991
3044
|
retry: !1
|
|
2992
|
-
}), { data:
|
|
2993
|
-
queryKey: ["nvr-report-snap", t,
|
|
2994
|
-
queryFn: () =>
|
|
2995
|
-
|
|
3045
|
+
}), { data: S } = Se({
|
|
3046
|
+
queryKey: ["nvr-report-snap", t, Y],
|
|
3047
|
+
queryFn: () => p.request(
|
|
3048
|
+
bt(`/report-studio/${t}/snapshots/${Y}`)
|
|
2996
3049
|
).then((r) => r.data),
|
|
2997
|
-
enabled:
|
|
3050
|
+
enabled: Y != null,
|
|
2998
3051
|
staleTime: 5 * 6e4,
|
|
2999
3052
|
retry: !1
|
|
3000
|
-
}),
|
|
3001
|
-
mutationFn: () =>
|
|
3002
|
-
onSuccess: () => void
|
|
3003
|
-
}), { data:
|
|
3053
|
+
}), j = Ae({
|
|
3054
|
+
mutationFn: () => p.request(at(`/report-studio/${t}/snapshots`, {})),
|
|
3055
|
+
onSuccess: () => void f.invalidateQueries({ queryKey: ["nvr-report-snaps", t] })
|
|
3056
|
+
}), { data: he = [] } = Se({
|
|
3004
3057
|
queryKey: ["nvr-report-notes", t],
|
|
3005
|
-
queryFn: () =>
|
|
3058
|
+
queryFn: () => p.request(bt(`/report-studio/${t}/annotations`)).then((r) => r.data ?? []),
|
|
3006
3059
|
staleTime: 6e4,
|
|
3007
3060
|
retry: !1
|
|
3008
|
-
}), ve = () => void
|
|
3009
|
-
mutationFn: (r) =>
|
|
3061
|
+
}), ve = () => void f.invalidateQueries({ queryKey: ["nvr-report-notes", t] }), Fe = Ae({
|
|
3062
|
+
mutationFn: (r) => p.request(at(`/report-studio/${t}/annotations`, r)),
|
|
3010
3063
|
onSuccess: ve
|
|
3011
|
-
}),
|
|
3012
|
-
mutationFn: (r) =>
|
|
3064
|
+
}), Me = Ae({
|
|
3065
|
+
mutationFn: (r) => p.request(Ja(`/report-studio/${t}/annotations/${r}`)),
|
|
3013
3066
|
onSuccess: ve
|
|
3014
|
-
}),
|
|
3015
|
-
const
|
|
3067
|
+
}), rt = gt((r, d, x) => {
|
|
3068
|
+
const v = {
|
|
3016
3069
|
field: r,
|
|
3017
|
-
values: [
|
|
3018
|
-
labels: [
|
|
3070
|
+
values: [d],
|
|
3071
|
+
labels: [x]
|
|
3019
3072
|
};
|
|
3020
|
-
F((
|
|
3021
|
-
}, []), [
|
|
3022
|
-
mutationFn: (r) =>
|
|
3023
|
-
|
|
3024
|
-
widgets: r.map((
|
|
3073
|
+
F((q) => [...q.filter((w) => w.field !== r), v]), J((q) => [...q.filter((w) => w.field !== r), v]);
|
|
3074
|
+
}, []), [be, Ee] = _(!1), [_e, Re] = _(null), [nt, je] = _(null), st = Ae({
|
|
3075
|
+
mutationFn: (r) => p.request(
|
|
3076
|
+
Ua(`/report-studio/${t}/widgets`, {
|
|
3077
|
+
widgets: r.map((d, x) => ({ ...d, sort: x }))
|
|
3025
3078
|
})
|
|
3026
3079
|
),
|
|
3027
3080
|
onSuccess: () => {
|
|
3028
|
-
|
|
3081
|
+
Ee(!1), Re(null), je(null), f.invalidateQueries({ queryKey: ["nivaro-report", t] }), f.invalidateQueries({ queryKey: ["nivaro-report-widget"] });
|
|
3029
3082
|
}
|
|
3030
|
-
}), We = (r) => [...r].sort((
|
|
3031
|
-
|
|
3032
|
-
}, { data:
|
|
3083
|
+
}), We = (r) => [...r].sort((d, x) => (d.y ?? 0) - (x.y ?? 0) || (d.x ?? 0) - (x.x ?? 0)), [ot, Mt] = _(() => /* @__PURE__ */ new Date()), [Oe, Be] = Ga(`report:${t}`), vt = () => {
|
|
3084
|
+
f.invalidateQueries({ queryKey: ["nivaro-report-widget", t] }), f.invalidateQueries({ queryKey: ["nivaro-report-query"] }), Mt(/* @__PURE__ */ new Date());
|
|
3085
|
+
}, { data: T = [] } = Se({
|
|
3033
3086
|
queryKey: ["nvr-report-firing", t],
|
|
3034
|
-
queryFn: () =>
|
|
3087
|
+
queryFn: () => p.request(bt(`/report-studio/${t}/firing`)).then((r) => r.data ?? []).catch(() => []),
|
|
3035
3088
|
staleTime: 6e4,
|
|
3036
3089
|
refetchInterval: 5 * 6e4,
|
|
3037
3090
|
retry: !1
|
|
3038
|
-
}), [
|
|
3039
|
-
|
|
3091
|
+
}), [ie, it] = _(null), [Qe, ye] = _(!1), [V, yt] = _(""), [Je, kt] = _(""), [Ue, Nt] = _("");
|
|
3092
|
+
Ze(() => {
|
|
3040
3093
|
try {
|
|
3041
3094
|
const r = sessionStorage.getItem(`nvr-report-xf:${t}`);
|
|
3042
3095
|
if (r) {
|
|
3043
3096
|
sessionStorage.removeItem(`nvr-report-xf:${t}`);
|
|
3044
|
-
const
|
|
3045
|
-
Array.isArray(
|
|
3097
|
+
const d = JSON.parse(r);
|
|
3098
|
+
Array.isArray(d) && d.length > 0 && (F(d), J(d));
|
|
3046
3099
|
}
|
|
3047
3100
|
} catch {
|
|
3048
3101
|
}
|
|
3049
3102
|
}, [t]);
|
|
3050
|
-
const
|
|
3051
|
-
|
|
3052
|
-
},
|
|
3053
|
-
const
|
|
3054
|
-
if (
|
|
3055
|
-
const
|
|
3056
|
-
return
|
|
3057
|
-
}), [
|
|
3103
|
+
const wt = () => {
|
|
3104
|
+
Re(We((ne == null ? void 0 : ne.widgets) ?? [])), Ee(!0), window.__nvrReportId = t;
|
|
3105
|
+
}, dt = (r) => Re((d) => (d ?? []).map((x) => x.id === r.id ? r : x)), St = (r, d) => Re((x) => {
|
|
3106
|
+
const v = [...x ?? []], q = v.findIndex((ke) => ke.id === r), w = q + d;
|
|
3107
|
+
if (q < 0 || w < 0 || w >= v.length) return v;
|
|
3108
|
+
const A = v[q], de = v[w];
|
|
3109
|
+
return v[q] = { ...de, x: A.x, y: A.y }, v[w] = { ...A, x: de.x, y: de.y }, v;
|
|
3110
|
+
}), [Ye, ct] = _(""), [Ve, ut] = _(!1), [mt, pt] = _(null), { data: ne, isLoading: _t } = Se({
|
|
3058
3111
|
queryKey: ["nivaro-report", t],
|
|
3059
|
-
queryFn: () =>
|
|
3112
|
+
queryFn: () => p.request(jt(t)).then((r) => r.data),
|
|
3060
3113
|
staleTime: 3e4
|
|
3061
|
-
}),
|
|
3062
|
-
|
|
3063
|
-
|
|
3114
|
+
}), Ge = Ie(!1), He = gt(async () => {
|
|
3115
|
+
var x;
|
|
3116
|
+
const r = (x = f.getQueryData(["nivaro-report", t])) == null ? void 0 : x.widgets, d = await f.fetchQuery({
|
|
3117
|
+
queryKey: ["nivaro-report", t],
|
|
3118
|
+
queryFn: () => p.request(jt(t)).then((v) => v.data),
|
|
3119
|
+
staleTime: 0
|
|
3120
|
+
}).catch(() => null);
|
|
3121
|
+
if (d)
|
|
3122
|
+
for (const v of Ya(
|
|
3123
|
+
r,
|
|
3124
|
+
d.widgets
|
|
3125
|
+
))
|
|
3126
|
+
f.invalidateQueries({ queryKey: ["nivaro-report-widget", t, v] });
|
|
3127
|
+
}, [f, p, t]);
|
|
3128
|
+
Va("report", t, {
|
|
3129
|
+
onChange: () => {
|
|
3130
|
+
be ? Ge.current = !0 : He();
|
|
3131
|
+
}
|
|
3132
|
+
}), Ze(() => {
|
|
3133
|
+
!be && Ge.current && (Ge.current = !1, He());
|
|
3134
|
+
}, [be, He]);
|
|
3135
|
+
const ht = Ie(null), ft = Ie([]), l = ((pe = ne == null ? void 0 : ne.global_filters) == null ? void 0 : pe.date_range) ?? null, i = tt(() => m !== void 0 ? m : a !== void 0 ? a : l, [m, a, l]);
|
|
3136
|
+
ht.current = i ?? null, ft.current = Z;
|
|
3137
|
+
const b = tt(
|
|
3064
3138
|
() => {
|
|
3065
3139
|
var r;
|
|
3066
3140
|
return ((r = ne == null ? void 0 : ne.global_filters) == null ? void 0 : r.filter_bar) ?? [];
|
|
3067
3141
|
},
|
|
3068
|
-
[(
|
|
3142
|
+
[(ee = ne == null ? void 0 : ne.global_filters) == null ? void 0 : ee.filter_bar]
|
|
3069
3143
|
);
|
|
3070
|
-
|
|
3144
|
+
Ze(() => {
|
|
3071
3145
|
if (!xe && !(!se || !ne)) {
|
|
3072
|
-
if (!
|
|
3073
|
-
|
|
3146
|
+
if (!W || b.length === 0) {
|
|
3147
|
+
Ne(!0);
|
|
3074
3148
|
return;
|
|
3075
3149
|
}
|
|
3076
3150
|
(async () => {
|
|
3077
|
-
var
|
|
3078
|
-
const r = [],
|
|
3079
|
-
for (const
|
|
3080
|
-
const
|
|
3081
|
-
key:
|
|
3082
|
-
collection: (
|
|
3151
|
+
var x;
|
|
3152
|
+
const r = [], d = {};
|
|
3153
|
+
for (const v of b) {
|
|
3154
|
+
const q = rl(W, {
|
|
3155
|
+
key: v.field,
|
|
3156
|
+
collection: (x = v.options) == null ? void 0 : x.collection
|
|
3083
3157
|
});
|
|
3084
|
-
if (!
|
|
3085
|
-
const
|
|
3086
|
-
if (
|
|
3087
|
-
const
|
|
3158
|
+
if (!q) continue;
|
|
3159
|
+
const w = v.options ? v.options.value_field ?? "id" : "id", A = W.restricted[q.name] ?? [];
|
|
3160
|
+
if (A.length > 0) {
|
|
3161
|
+
const ke = await Bt(p, q, A, w).catch(
|
|
3088
3162
|
() => []
|
|
3089
3163
|
);
|
|
3090
|
-
|
|
3164
|
+
ke.length > 0 && (d[v.field] = ke);
|
|
3091
3165
|
}
|
|
3092
|
-
const
|
|
3093
|
-
if (
|
|
3094
|
-
const
|
|
3166
|
+
const de = nl(W, q.name);
|
|
3167
|
+
if (de.length > 0) {
|
|
3168
|
+
const ke = await Bt(p, q, de, w).catch(
|
|
3095
3169
|
() => []
|
|
3096
3170
|
);
|
|
3097
|
-
|
|
3171
|
+
ke.length > 0 && r.push({ field: v.field, values: ke, labels: ke.map(String) });
|
|
3098
3172
|
}
|
|
3099
3173
|
}
|
|
3100
|
-
if (Object.keys(
|
|
3101
|
-
const
|
|
3102
|
-
const
|
|
3103
|
-
for (const
|
|
3104
|
-
return
|
|
3174
|
+
if (Object.keys(d).length > 0 && $e(d), r.length > 0) {
|
|
3175
|
+
const v = (q) => {
|
|
3176
|
+
const w = [...q];
|
|
3177
|
+
for (const A of r) w.some((de) => de.field === A.field) || w.push(A);
|
|
3178
|
+
return w;
|
|
3105
3179
|
};
|
|
3106
|
-
J(
|
|
3180
|
+
J(v), F(v);
|
|
3107
3181
|
}
|
|
3108
|
-
|
|
3182
|
+
Ne(!0);
|
|
3109
3183
|
})();
|
|
3110
3184
|
}
|
|
3111
|
-
}, [xe, se, ne,
|
|
3112
|
-
const
|
|
3113
|
-
F(
|
|
3114
|
-
},
|
|
3115
|
-
J([]), F([]),
|
|
3116
|
-
},
|
|
3117
|
-
J(r.entity_filters), F(r.entity_filters),
|
|
3118
|
-
},
|
|
3119
|
-
var
|
|
3120
|
-
const r =
|
|
3121
|
-
if (!(!r ||
|
|
3122
|
-
|
|
3185
|
+
}, [xe, se, ne, W, b]);
|
|
3186
|
+
const C = (ne == null ? void 0 : ne.widgets) ?? [], $ = H !== void 0 ? H : i, L = Z.filter((r) => r.values.length > 0).length + (i ? 1 : 0), le = JSON.stringify(ue) !== JSON.stringify(Z) || H !== void 0, I = () => {
|
|
3187
|
+
F(ue), H !== void 0 && (k(H), z(void 0));
|
|
3188
|
+
}, M = () => {
|
|
3189
|
+
J([]), F([]), k(null), z(void 0);
|
|
3190
|
+
}, G = (r) => {
|
|
3191
|
+
J(r.entity_filters), F(r.entity_filters), k(r.date_range), z(void 0);
|
|
3192
|
+
}, B = async () => {
|
|
3193
|
+
var d, x;
|
|
3194
|
+
const r = Ye.trim();
|
|
3195
|
+
if (!(!r || Ve)) {
|
|
3196
|
+
ut(!0), pt(null);
|
|
3123
3197
|
try {
|
|
3124
|
-
const
|
|
3125
|
-
|
|
3198
|
+
const v = await p.request(
|
|
3199
|
+
Ca(
|
|
3126
3200
|
t,
|
|
3127
3201
|
r,
|
|
3128
|
-
|
|
3202
|
+
b.map((w) => ({ field: w.field, label: w.label }))
|
|
3129
3203
|
)
|
|
3130
|
-
),
|
|
3131
|
-
var
|
|
3132
|
-
return
|
|
3133
|
-
}).map((
|
|
3134
|
-
J(
|
|
3135
|
-
} catch (
|
|
3136
|
-
|
|
3137
|
-
((
|
|
3204
|
+
), q = (v.data.entity_filters ?? []).filter((w) => {
|
|
3205
|
+
var A;
|
|
3206
|
+
return b.some((de) => de.field === w.field) && ((A = w.values) == null ? void 0 : A.length) > 0;
|
|
3207
|
+
}).map((w) => ({ field: w.field, values: w.values, labels: w.values.map(String) }));
|
|
3208
|
+
J(q), F(q), k(v.data.date_range ?? null), z(void 0), ct("");
|
|
3209
|
+
} catch (v) {
|
|
3210
|
+
pt(
|
|
3211
|
+
((x = (d = v.response) == null ? void 0 : d.data) == null ? void 0 : x.error) ?? "Could not parse that"
|
|
3138
3212
|
);
|
|
3139
3213
|
} finally {
|
|
3140
|
-
|
|
3214
|
+
ut(!1);
|
|
3141
3215
|
}
|
|
3142
3216
|
}
|
|
3143
3217
|
};
|
|
3144
|
-
if (
|
|
3145
|
-
return /* @__PURE__ */ e("div", { className:
|
|
3218
|
+
if (_t || !xe)
|
|
3219
|
+
return /* @__PURE__ */ e("div", { className: P("p-6 text-[13px] text-slate-400", u), children: "Loading report…" });
|
|
3146
3220
|
if (!ne)
|
|
3147
|
-
return /* @__PURE__ */ e("div", { className:
|
|
3148
|
-
const
|
|
3149
|
-
return /* @__PURE__ */ o("div", { className:
|
|
3150
|
-
|
|
3151
|
-
n && (
|
|
3221
|
+
return /* @__PURE__ */ e("div", { className: P("p-6 text-[13px] text-slate-400", u), children: "Report not found." });
|
|
3222
|
+
const K = zl(W);
|
|
3223
|
+
return /* @__PURE__ */ e(ga.Provider, { value: Oe, children: /* @__PURE__ */ o("div", { className: P("flex flex-col gap-3", u), children: [
|
|
3224
|
+
K && (!n || C.length === 0 && b.length === 0) && /* @__PURE__ */ e("p", { className: "text-[11.5px] text-amber-700 dark:text-amber-300", children: K }),
|
|
3225
|
+
n && (C.length > 0 || b.length > 0) && /* @__PURE__ */ o("div", { className: "space-y-1.5", children: [
|
|
3152
3226
|
/* @__PURE__ */ o("div", { className: "flex flex-wrap items-center gap-1.5", children: [
|
|
3153
3227
|
/* @__PURE__ */ o("span", { className: "flex items-center gap-1.5 text-[11.5px] font-semibold text-slate-500 dark:text-slate-300", children: [
|
|
3154
3228
|
"Filters",
|
|
3155
|
-
|
|
3156
|
-
|
|
3229
|
+
K && /* @__PURE__ */ e("span", { className: "font-normal text-amber-700 dark:text-amber-300", children: K }),
|
|
3230
|
+
L > 0 && /* @__PURE__ */ o("span", { className: "rounded-full bg-emerald-50 px-1.5 py-px text-[10px] font-semibold text-emerald-600 dark:bg-emerald-500/10 dark:text-emerald-400", children: [
|
|
3157
3231
|
"Active · ",
|
|
3158
|
-
|
|
3232
|
+
L
|
|
3159
3233
|
] })
|
|
3160
3234
|
] }),
|
|
3161
3235
|
/* @__PURE__ */ e(
|
|
3162
|
-
|
|
3236
|
+
$t,
|
|
3163
3237
|
{
|
|
3164
|
-
value: (
|
|
3165
|
-
onChange: (r) =>
|
|
3166
|
-
options:
|
|
3238
|
+
value: ($ == null ? void 0 : $.preset) ?? "",
|
|
3239
|
+
onChange: (r) => z(r ? { preset: r } : null),
|
|
3240
|
+
options: yl.map((r) => ({ value: r.id, label: r.label })),
|
|
3167
3241
|
ariaLabel: "Date range",
|
|
3168
3242
|
className: "h-7 w-auto rounded-md px-1.5 py-0 text-[12px] text-slate-600 dark:border-border dark:bg-card dark:text-slate-300"
|
|
3169
3243
|
}
|
|
3170
3244
|
),
|
|
3171
|
-
|
|
3172
|
-
var
|
|
3245
|
+
b.map((r) => {
|
|
3246
|
+
var d;
|
|
3173
3247
|
return /* @__PURE__ */ e(
|
|
3174
|
-
|
|
3248
|
+
ma,
|
|
3175
3249
|
{
|
|
3176
3250
|
reportId: t,
|
|
3177
3251
|
field: r.field,
|
|
3178
3252
|
label: r.label,
|
|
3179
3253
|
optionSource: r.options,
|
|
3180
|
-
allowedValues:
|
|
3181
|
-
selected: ((
|
|
3182
|
-
onChange: (
|
|
3183
|
-
...
|
|
3184
|
-
...
|
|
3254
|
+
allowedValues: we[r.field],
|
|
3255
|
+
selected: ((d = ue.find((x) => x.field === r.field)) == null ? void 0 : d.values) ?? [],
|
|
3256
|
+
onChange: (x, v) => J((q) => [
|
|
3257
|
+
...q.filter((w) => w.field !== r.field),
|
|
3258
|
+
...x.length > 0 ? [{ field: r.field, values: x, labels: v }] : []
|
|
3185
3259
|
])
|
|
3186
3260
|
},
|
|
3187
3261
|
r.field
|
|
@@ -3191,61 +3265,61 @@ function Xl({
|
|
|
3191
3265
|
"button",
|
|
3192
3266
|
{
|
|
3193
3267
|
type: "button",
|
|
3194
|
-
disabled:
|
|
3195
|
-
onClick:
|
|
3196
|
-
className:
|
|
3268
|
+
disabled: !le,
|
|
3269
|
+
onClick: I,
|
|
3270
|
+
className: P(
|
|
3197
3271
|
"inline-flex h-7 items-center gap-1 rounded-md px-2.5 text-[11.5px] font-semibold",
|
|
3198
|
-
|
|
3272
|
+
le ? "bg-nvr-cyan text-white" : "bg-slate-100 text-slate-400 dark:bg-muted dark:text-slate-500"
|
|
3199
3273
|
),
|
|
3200
3274
|
children: [
|
|
3201
|
-
/* @__PURE__ */ e(
|
|
3275
|
+
/* @__PURE__ */ e(Ht, { className: "h-3 w-3" }),
|
|
3202
3276
|
" Apply"
|
|
3203
3277
|
]
|
|
3204
3278
|
}
|
|
3205
3279
|
),
|
|
3206
|
-
(
|
|
3280
|
+
(L > 0 || le) && /* @__PURE__ */ o(
|
|
3207
3281
|
"button",
|
|
3208
3282
|
{
|
|
3209
3283
|
type: "button",
|
|
3210
3284
|
className: "flex items-center gap-1 text-[11.5px] text-slate-400 hover:text-red-500",
|
|
3211
|
-
onClick:
|
|
3285
|
+
onClick: M,
|
|
3212
3286
|
children: [
|
|
3213
|
-
/* @__PURE__ */ e(
|
|
3287
|
+
/* @__PURE__ */ e(Te, { className: "h-3 w-3" }),
|
|
3214
3288
|
" Clear"
|
|
3215
3289
|
]
|
|
3216
3290
|
}
|
|
3217
3291
|
)
|
|
3218
3292
|
] }),
|
|
3219
3293
|
/* @__PURE__ */ o("div", { className: "flex flex-wrap items-center gap-1.5", children: [
|
|
3220
|
-
|
|
3294
|
+
X.map((r) => /* @__PURE__ */ o(
|
|
3221
3295
|
"span",
|
|
3222
3296
|
{
|
|
3223
3297
|
className: "group/preset inline-flex h-6 items-center gap-1 rounded-full border border-slate-200 pl-2 pr-1 text-[11px] text-slate-500 hover:border-nvr-cyan hover:text-nvr-navy dark:border-border dark:hover:text-nvr-cyan",
|
|
3224
3298
|
children: [
|
|
3225
|
-
/* @__PURE__ */ e("button", { type: "button", onClick: () =>
|
|
3299
|
+
/* @__PURE__ */ e("button", { type: "button", onClick: () => G(r), children: r.name }),
|
|
3226
3300
|
/* @__PURE__ */ e(
|
|
3227
3301
|
"button",
|
|
3228
3302
|
{
|
|
3229
3303
|
type: "button",
|
|
3230
3304
|
title: "Delete preset",
|
|
3231
3305
|
className: "rounded-full p-0.5 text-slate-300 opacity-0 hover:text-red-500 group-hover/preset:opacity-100",
|
|
3232
|
-
onClick: () =>
|
|
3233
|
-
children: /* @__PURE__ */ e(
|
|
3306
|
+
onClick: () => fe.mutate(r.id),
|
|
3307
|
+
children: /* @__PURE__ */ e(Te, { className: "h-2.5 w-2.5" })
|
|
3234
3308
|
}
|
|
3235
3309
|
)
|
|
3236
3310
|
]
|
|
3237
3311
|
},
|
|
3238
3312
|
r.name
|
|
3239
3313
|
)),
|
|
3240
|
-
|
|
3314
|
+
N ? /* @__PURE__ */ e("span", { className: "inline-flex items-center gap-1", children: /* @__PURE__ */ e(
|
|
3241
3315
|
"input",
|
|
3242
3316
|
{
|
|
3243
3317
|
value: re,
|
|
3244
|
-
onChange: (r) =>
|
|
3318
|
+
onChange: (r) => ae(r.target.value),
|
|
3245
3319
|
placeholder: "Preset name",
|
|
3246
3320
|
autoFocus: !0,
|
|
3247
3321
|
onKeyDown: (r) => {
|
|
3248
|
-
r.key === "Enter" && re.trim() && (
|
|
3322
|
+
r.key === "Enter" && re.trim() && (U.mutate(re.trim()), ae(""), R(!1)), r.key === "Escape" && R(!1);
|
|
3249
3323
|
},
|
|
3250
3324
|
className: "h-6 w-[130px] rounded-md border border-slate-200 bg-white px-2 text-[11px] dark:border-border dark:bg-card"
|
|
3251
3325
|
}
|
|
@@ -3254,9 +3328,9 @@ function Xl({
|
|
|
3254
3328
|
{
|
|
3255
3329
|
type: "button",
|
|
3256
3330
|
className: "inline-flex h-6 items-center gap-1 rounded-full border border-dashed border-slate-200 px-2 text-[11px] text-slate-400 hover:border-slate-300 hover:text-slate-600 dark:border-border",
|
|
3257
|
-
onClick: () =>
|
|
3331
|
+
onClick: () => R(!0),
|
|
3258
3332
|
children: [
|
|
3259
|
-
/* @__PURE__ */ e(
|
|
3333
|
+
/* @__PURE__ */ e(Xt, { className: "h-2.5 w-2.5" }),
|
|
3260
3334
|
" Save preset"
|
|
3261
3335
|
]
|
|
3262
3336
|
}
|
|
@@ -3267,44 +3341,44 @@ function Xl({
|
|
|
3267
3341
|
{
|
|
3268
3342
|
type: "button",
|
|
3269
3343
|
title: "Save the current numbers as a snapshot to compare against later",
|
|
3270
|
-
disabled:
|
|
3271
|
-
onClick: () =>
|
|
3344
|
+
disabled: j.isPending,
|
|
3345
|
+
onClick: () => j.mutate(),
|
|
3272
3346
|
className: "inline-flex h-6 items-center gap-1 rounded-full border border-dashed border-slate-200 px-2 text-[11px] text-slate-400 hover:border-slate-300 hover:text-slate-600 disabled:opacity-40 dark:border-border",
|
|
3273
3347
|
children: [
|
|
3274
|
-
/* @__PURE__ */ e(
|
|
3348
|
+
/* @__PURE__ */ e(Lt, { className: "h-2.5 w-2.5" }),
|
|
3275
3349
|
" ",
|
|
3276
|
-
|
|
3350
|
+
j.isPending ? "Saving…" : "Snapshot"
|
|
3277
3351
|
]
|
|
3278
3352
|
}
|
|
3279
3353
|
),
|
|
3280
|
-
|
|
3354
|
+
ge.map((r) => /* @__PURE__ */ o(
|
|
3281
3355
|
"button",
|
|
3282
3356
|
{
|
|
3283
3357
|
type: "button",
|
|
3284
|
-
title: `Compare against ${r.name} (${
|
|
3285
|
-
onClick: () =>
|
|
3286
|
-
className:
|
|
3358
|
+
title: `Compare against ${r.name} (${sa(r.taken_at)})`,
|
|
3359
|
+
onClick: () => E((d) => d === r.id ? null : r.id),
|
|
3360
|
+
className: P(
|
|
3287
3361
|
"inline-flex h-6 items-center gap-1 rounded-full border px-2 text-[11px]",
|
|
3288
|
-
|
|
3362
|
+
Y === r.id ? "border-nvr-cyan/40 bg-nvr-cyan/[0.08] font-medium text-[#007a99] dark:text-nvr-cyan" : "border-slate-200 text-slate-400 hover:text-slate-600 dark:border-border"
|
|
3289
3363
|
),
|
|
3290
3364
|
children: [
|
|
3291
|
-
/* @__PURE__ */ e(
|
|
3365
|
+
/* @__PURE__ */ e(Lt, { className: "h-2.5 w-2.5" }),
|
|
3292
3366
|
" ",
|
|
3293
3367
|
r.name,
|
|
3294
|
-
|
|
3368
|
+
Y === r.id && /* @__PURE__ */ e(Te, { className: "h-2.5 w-2.5" })
|
|
3295
3369
|
]
|
|
3296
3370
|
},
|
|
3297
3371
|
r.id
|
|
3298
3372
|
)),
|
|
3299
|
-
|
|
3373
|
+
Y != null && /* @__PURE__ */ e(
|
|
3300
3374
|
"button",
|
|
3301
3375
|
{
|
|
3302
3376
|
type: "button",
|
|
3303
3377
|
title: "Time machine (#404): show the snapshot values AS the numbers, not as delta badges",
|
|
3304
|
-
onClick: () =>
|
|
3305
|
-
className:
|
|
3378
|
+
onClick: () => me((r) => !r),
|
|
3379
|
+
className: P(
|
|
3306
3380
|
"inline-flex h-6 items-center gap-1 rounded-full border px-2 text-[11px]",
|
|
3307
|
-
|
|
3381
|
+
oe ? "border-amber-400 bg-amber-50 font-medium text-amber-700 dark:bg-amber-400/10 dark:text-amber-400" : "border-dashed border-slate-200 text-slate-400 hover:text-slate-600 dark:border-border"
|
|
3308
3382
|
),
|
|
3309
3383
|
children: "As of"
|
|
3310
3384
|
}
|
|
@@ -3315,10 +3389,10 @@ function Xl({
|
|
|
3315
3389
|
/* @__PURE__ */ e(
|
|
3316
3390
|
"input",
|
|
3317
3391
|
{
|
|
3318
|
-
value:
|
|
3319
|
-
onChange: (r) =>
|
|
3392
|
+
value: Ye,
|
|
3393
|
+
onChange: (r) => ct(r.target.value),
|
|
3320
3394
|
onKeyDown: (r) => {
|
|
3321
|
-
r.key === "Enter" &&
|
|
3395
|
+
r.key === "Enter" && B();
|
|
3322
3396
|
},
|
|
3323
3397
|
placeholder: 'Describe filters… e.g. "Zone 1 CRAN this year"',
|
|
3324
3398
|
className: "h-full min-w-0 flex-1 bg-transparent text-[11.5px] outline-none placeholder:text-slate-300 dark:text-slate-200"
|
|
@@ -3328,55 +3402,73 @@ function Xl({
|
|
|
3328
3402
|
"button",
|
|
3329
3403
|
{
|
|
3330
3404
|
type: "button",
|
|
3331
|
-
disabled:
|
|
3332
|
-
onClick: () => void
|
|
3405
|
+
disabled: Ve || !Ye.trim(),
|
|
3406
|
+
onClick: () => void B(),
|
|
3333
3407
|
className: "text-[11px] font-semibold text-nvr-navy disabled:opacity-40 dark:text-nvr-cyan",
|
|
3334
|
-
children:
|
|
3408
|
+
children: Ve ? "…" : "Set"
|
|
3335
3409
|
}
|
|
3336
3410
|
)
|
|
3337
3411
|
] }),
|
|
3338
|
-
|
|
3412
|
+
mt && /* @__PURE__ */ e("span", { className: "text-[10.5px] text-red-400", children: mt })
|
|
3339
3413
|
] })
|
|
3340
3414
|
] }),
|
|
3341
|
-
|
|
3342
|
-
/* @__PURE__ */ e(
|
|
3343
|
-
/* @__PURE__ */ e("p", { className: "min-w-0 flex-1 truncate text-[12px] text-red-700 dark:text-red-300", children:
|
|
3415
|
+
T.length > 0 && /* @__PURE__ */ o("div", { className: "mb-2 flex items-center gap-2 rounded-lg border border-red-300 bg-red-50 px-3 py-2 dark:border-red-500/40 dark:bg-red-500/10", children: [
|
|
3416
|
+
/* @__PURE__ */ e(Zt, { className: "h-3.5 w-3.5 shrink-0 text-red-500" }),
|
|
3417
|
+
/* @__PURE__ */ e("p", { className: "min-w-0 flex-1 truncate text-[12px] text-red-700 dark:text-red-300", children: T.length === 1 ? `Alert firing: ${T[0].name}` : `${T.length} alerts firing: ${T.map((r) => r.name).join(" · ")}` })
|
|
3344
3418
|
] }),
|
|
3345
3419
|
/* @__PURE__ */ o("div", { className: "mb-2 flex flex-wrap items-center gap-2", children: [
|
|
3346
3420
|
/* @__PURE__ */ o("span", { className: "text-[10.5px] text-slate-400", children: [
|
|
3347
3421
|
"Data as of ",
|
|
3348
|
-
|
|
3422
|
+
ot.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" })
|
|
3349
3423
|
] }),
|
|
3350
3424
|
/* @__PURE__ */ o(
|
|
3351
3425
|
"button",
|
|
3352
3426
|
{
|
|
3353
3427
|
type: "button",
|
|
3354
|
-
onClick:
|
|
3428
|
+
onClick: vt,
|
|
3355
3429
|
className: "inline-flex items-center gap-1 rounded-md border border-slate-200 px-2 py-0.5 text-[11px] text-slate-500 hover:text-slate-700 dark:border-border dark:text-slate-400",
|
|
3356
3430
|
children: [
|
|
3357
|
-
/* @__PURE__ */ e(
|
|
3431
|
+
/* @__PURE__ */ e(At, { className: "h-2.5 w-2.5" }),
|
|
3358
3432
|
" Refresh all"
|
|
3359
3433
|
]
|
|
3360
3434
|
}
|
|
3361
3435
|
),
|
|
3436
|
+
C.some((r) => r.type === "query") && /* @__PURE__ */ o(
|
|
3437
|
+
"button",
|
|
3438
|
+
{
|
|
3439
|
+
type: "button",
|
|
3440
|
+
onClick: () => Be(!Oe),
|
|
3441
|
+
"aria-pressed": Oe,
|
|
3442
|
+
"data-report-auto-refresh": !0,
|
|
3443
|
+
"data-tip": Oe ? "Query widgets re-run on their own when the data they read changes. Click to stop." : "Re-run query widgets on their own when the data they read changes",
|
|
3444
|
+
className: P(
|
|
3445
|
+
"inline-flex items-center gap-1 rounded-md border px-2 py-0.5 text-[11px]",
|
|
3446
|
+
Oe ? "border-nvr-cyan/40 bg-nvr-cyan/[0.08] font-medium text-[#007a99] dark:text-nvr-cyan" : "border-slate-200 text-slate-500 hover:text-slate-700 dark:border-border dark:text-slate-400"
|
|
3447
|
+
),
|
|
3448
|
+
children: [
|
|
3449
|
+
"Auto-refresh",
|
|
3450
|
+
Oe ? " on" : ""
|
|
3451
|
+
]
|
|
3452
|
+
}
|
|
3453
|
+
),
|
|
3362
3454
|
/* @__PURE__ */ o("span", { className: "relative", children: [
|
|
3363
3455
|
/* @__PURE__ */ o(
|
|
3364
3456
|
"button",
|
|
3365
3457
|
{
|
|
3366
3458
|
type: "button",
|
|
3367
|
-
onClick: () =>
|
|
3368
|
-
className:
|
|
3459
|
+
onClick: () => ye((r) => !r),
|
|
3460
|
+
className: P(
|
|
3369
3461
|
"inline-flex items-center gap-1 rounded-md border px-2 py-0.5 text-[11px]",
|
|
3370
|
-
|
|
3462
|
+
ie ? "border-nvr-cyan/40 bg-nvr-cyan/[0.08] font-medium text-[#007a99] dark:text-nvr-cyan" : "border-slate-200 text-slate-500 hover:text-slate-700 dark:border-border dark:text-slate-400"
|
|
3371
3463
|
),
|
|
3372
3464
|
children: [
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3465
|
+
ie ? `Comparing ${ie.a} vs ${ie.b}` : "Compare A/B",
|
|
3466
|
+
ie && /* @__PURE__ */ e(
|
|
3467
|
+
Te,
|
|
3376
3468
|
{
|
|
3377
3469
|
className: "h-2.5 w-2.5",
|
|
3378
3470
|
onClick: (r) => {
|
|
3379
|
-
r.stopPropagation(),
|
|
3471
|
+
r.stopPropagation(), it(null);
|
|
3380
3472
|
}
|
|
3381
3473
|
}
|
|
3382
3474
|
)
|
|
@@ -3387,8 +3479,8 @@ function Xl({
|
|
|
3387
3479
|
/* @__PURE__ */ e(
|
|
3388
3480
|
"input",
|
|
3389
3481
|
{
|
|
3390
|
-
value:
|
|
3391
|
-
onChange: (r) =>
|
|
3482
|
+
value: V,
|
|
3483
|
+
onChange: (r) => yt(r.target.value),
|
|
3392
3484
|
placeholder: "Filter field (e.g. division)",
|
|
3393
3485
|
className: "h-7 rounded-md border border-slate-200 bg-white px-2 text-[12px] dark:border-border dark:bg-card dark:text-slate-200"
|
|
3394
3486
|
}
|
|
@@ -3397,8 +3489,8 @@ function Xl({
|
|
|
3397
3489
|
/* @__PURE__ */ e(
|
|
3398
3490
|
"input",
|
|
3399
3491
|
{
|
|
3400
|
-
value:
|
|
3401
|
-
onChange: (r) =>
|
|
3492
|
+
value: Je,
|
|
3493
|
+
onChange: (r) => kt(r.target.value),
|
|
3402
3494
|
placeholder: "Value A",
|
|
3403
3495
|
className: "h-7 min-w-0 flex-1 rounded-md border border-slate-200 bg-white px-2 text-[12px] dark:border-border dark:bg-card dark:text-slate-200"
|
|
3404
3496
|
}
|
|
@@ -3406,8 +3498,8 @@ function Xl({
|
|
|
3406
3498
|
/* @__PURE__ */ e(
|
|
3407
3499
|
"input",
|
|
3408
3500
|
{
|
|
3409
|
-
value:
|
|
3410
|
-
onChange: (r) =>
|
|
3501
|
+
value: Ue,
|
|
3502
|
+
onChange: (r) => Nt(r.target.value),
|
|
3411
3503
|
placeholder: "Value B",
|
|
3412
3504
|
className: "h-7 min-w-0 flex-1 rounded-md border border-slate-200 bg-white px-2 text-[12px] dark:border-border dark:bg-card dark:text-slate-200"
|
|
3413
3505
|
}
|
|
@@ -3417,9 +3509,9 @@ function Xl({
|
|
|
3417
3509
|
"button",
|
|
3418
3510
|
{
|
|
3419
3511
|
type: "button",
|
|
3420
|
-
disabled: !
|
|
3512
|
+
disabled: !V.trim() || !Je.trim() || !Ue.trim(),
|
|
3421
3513
|
onClick: () => {
|
|
3422
|
-
|
|
3514
|
+
it({ field: V.trim(), a: Je.trim(), b: Ue.trim() }), ye(!1);
|
|
3423
3515
|
},
|
|
3424
3516
|
className: "h-7 rounded-md bg-nvr-cyan text-[11.5px] font-semibold text-white hover:brightness-110 disabled:opacity-40",
|
|
3425
3517
|
children: "Compare"
|
|
@@ -3428,7 +3520,7 @@ function Xl({
|
|
|
3428
3520
|
] })
|
|
3429
3521
|
] })
|
|
3430
3522
|
] }),
|
|
3431
|
-
|
|
3523
|
+
Z.filter((r) => !b.some((d) => d.field === r.field)).length > 0 && /* @__PURE__ */ e("div", { className: "flex flex-wrap items-center gap-1.5 px-1 pb-2", children: Z.filter((r) => !b.some((d) => d.field === r.field)).map((r) => /* @__PURE__ */ o(
|
|
3432
3524
|
"span",
|
|
3433
3525
|
{
|
|
3434
3526
|
className: "inline-flex items-center gap-1.5 rounded-full border border-nvr-cyan/40 bg-nvr-cyan/[0.08] py-0.5 pl-2.5 pr-1 text-[11.5px] text-[#007a99] dark:text-nvr-cyan",
|
|
@@ -3442,25 +3534,25 @@ function Xl({
|
|
|
3442
3534
|
type: "button",
|
|
3443
3535
|
"aria-label": "Remove filter",
|
|
3444
3536
|
onClick: () => {
|
|
3445
|
-
F((
|
|
3537
|
+
F((d) => d.filter((x) => x.field !== r.field)), J((d) => d.filter((x) => x.field !== r.field));
|
|
3446
3538
|
},
|
|
3447
3539
|
className: "rounded-full p-0.5 hover:bg-nvr-cyan/[0.16]",
|
|
3448
|
-
children: /* @__PURE__ */ e(
|
|
3540
|
+
children: /* @__PURE__ */ e(Te, { className: "h-2.5 w-2.5" })
|
|
3449
3541
|
}
|
|
3450
3542
|
)
|
|
3451
3543
|
]
|
|
3452
3544
|
},
|
|
3453
3545
|
r.field
|
|
3454
3546
|
)) }),
|
|
3455
|
-
(ne == null ? void 0 : ne.editable) && /* @__PURE__ */ e("div", { className: "mb-2 flex items-center gap-1.5", children:
|
|
3547
|
+
(ne == null ? void 0 : ne.editable) && /* @__PURE__ */ e("div", { className: "mb-2 flex items-center gap-1.5", children: be ? /* @__PURE__ */ o(et, { children: [
|
|
3456
3548
|
/* @__PURE__ */ e(
|
|
3457
3549
|
"button",
|
|
3458
3550
|
{
|
|
3459
3551
|
type: "button",
|
|
3460
|
-
disabled:
|
|
3461
|
-
onClick: () =>
|
|
3552
|
+
disabled: st.isPending,
|
|
3553
|
+
onClick: () => _e && st.mutate(_e),
|
|
3462
3554
|
className: "rounded-md bg-nvr-cyan px-3 py-1 text-[12px] font-semibold text-white hover:brightness-110 disabled:opacity-40",
|
|
3463
|
-
children:
|
|
3555
|
+
children: st.isPending ? "Saving…" : "Save layout"
|
|
3464
3556
|
}
|
|
3465
3557
|
),
|
|
3466
3558
|
/* @__PURE__ */ e(
|
|
@@ -3468,7 +3560,7 @@ function Xl({
|
|
|
3468
3560
|
{
|
|
3469
3561
|
type: "button",
|
|
3470
3562
|
onClick: () => {
|
|
3471
|
-
|
|
3563
|
+
Ee(!1), Re(null), je(null);
|
|
3472
3564
|
},
|
|
3473
3565
|
className: "rounded-md border border-slate-200 px-3 py-1 text-[12px] text-slate-500 dark:border-border",
|
|
3474
3566
|
children: "Cancel"
|
|
@@ -3479,90 +3571,90 @@ function Xl({
|
|
|
3479
3571
|
"button",
|
|
3480
3572
|
{
|
|
3481
3573
|
type: "button",
|
|
3482
|
-
onClick:
|
|
3574
|
+
onClick: wt,
|
|
3483
3575
|
className: "rounded-md border border-slate-200 px-3 py-1 text-[12px] font-medium text-slate-500 hover:text-slate-700 dark:border-border dark:text-slate-400",
|
|
3484
3576
|
children: "Edit report"
|
|
3485
3577
|
}
|
|
3486
3578
|
) }),
|
|
3487
|
-
|
|
3488
|
-
|
|
3579
|
+
be && _e && /* @__PURE__ */ e("div", { className: "mb-3", children: /* @__PURE__ */ e(Rt, { fallback: null, children: /* @__PURE__ */ e(
|
|
3580
|
+
bl,
|
|
3489
3581
|
{
|
|
3490
|
-
maxY: Math.max(0, ...
|
|
3491
|
-
onAdd: (r) =>
|
|
3582
|
+
maxY: Math.max(0, ..._e.map((r) => (r.y ?? 0) + (r.h ?? 1))),
|
|
3583
|
+
onAdd: (r) => Re((d) => [...d ?? [], r])
|
|
3492
3584
|
}
|
|
3493
3585
|
) }) }),
|
|
3494
|
-
|
|
3586
|
+
C.length === 0 && !be ? /* @__PURE__ */ e("div", { className: "p-6 text-[13px] text-slate-400", children: h ?? "This report has no widgets yet." }) : /* @__PURE__ */ e(
|
|
3495
3587
|
"div",
|
|
3496
3588
|
{
|
|
3497
3589
|
className: "grid gap-3",
|
|
3498
3590
|
style: {
|
|
3499
3591
|
gridTemplateColumns: "repeat(12, minmax(0, 1fr))",
|
|
3500
|
-
gridAutoRows:
|
|
3592
|
+
gridAutoRows: be ? void 0 : "72px"
|
|
3501
3593
|
},
|
|
3502
|
-
children: We(
|
|
3503
|
-
var
|
|
3594
|
+
children: We(be && _e ? _e : C).map((r) => {
|
|
3595
|
+
var d;
|
|
3504
3596
|
return /* @__PURE__ */ e(
|
|
3505
3597
|
"div",
|
|
3506
3598
|
{
|
|
3507
3599
|
style: {
|
|
3508
|
-
gridColumn:
|
|
3600
|
+
gridColumn: ie ? "1 / -1" : `${Math.max(1, (r.x ?? 0) + 1)} / span ${Math.min(12, Math.max(2, r.w || 4))}`,
|
|
3509
3601
|
gridRow: void 0
|
|
3510
3602
|
},
|
|
3511
|
-
className:
|
|
3512
|
-
children:
|
|
3603
|
+
className: be || ie ? "" : "contents",
|
|
3604
|
+
children: ie && !be && r.type !== "divider" ? /* @__PURE__ */ e("div", { className: "grid grid-cols-2 gap-3", children: [ie.a, ie.b].map((x, v) => /* @__PURE__ */ o("div", { className: "flex min-h-[160px] flex-col", children: [
|
|
3513
3605
|
/* @__PURE__ */ o("p", { className: "mb-1 text-[10.5px] font-semibold uppercase tracking-wide text-[#007a99] dark:text-nvr-cyan", children: [
|
|
3514
|
-
|
|
3606
|
+
ie.field.replace(/_/g, " "),
|
|
3515
3607
|
": ",
|
|
3516
|
-
|
|
3608
|
+
x
|
|
3517
3609
|
] }),
|
|
3518
3610
|
/* @__PURE__ */ e(
|
|
3519
|
-
|
|
3611
|
+
Dt,
|
|
3520
3612
|
{
|
|
3521
3613
|
reportId: t,
|
|
3522
3614
|
widget: r,
|
|
3523
|
-
dateRange:
|
|
3615
|
+
dateRange: i,
|
|
3524
3616
|
entityFilters: [
|
|
3525
|
-
...
|
|
3526
|
-
{ field:
|
|
3617
|
+
...Z.filter((q) => q.field !== ie.field),
|
|
3618
|
+
{ field: ie.field, values: [x], labels: [x] }
|
|
3527
3619
|
],
|
|
3528
3620
|
refetchInterval: c,
|
|
3529
|
-
filterBar:
|
|
3530
|
-
onDrill:
|
|
3621
|
+
filterBar: b,
|
|
3622
|
+
onDrill: Q
|
|
3531
3623
|
}
|
|
3532
3624
|
)
|
|
3533
|
-
] },
|
|
3534
|
-
|
|
3535
|
-
|
|
3625
|
+
] }, v)) }) : /* @__PURE__ */ o(et, { children: [
|
|
3626
|
+
be && /* @__PURE__ */ e(Rt, { fallback: null, children: /* @__PURE__ */ e(
|
|
3627
|
+
vl,
|
|
3536
3628
|
{
|
|
3537
3629
|
widget: r,
|
|
3538
|
-
onConfigure: () =>
|
|
3539
|
-
onDelete: () =>
|
|
3540
|
-
onResize: (
|
|
3630
|
+
onConfigure: () => je(r.id),
|
|
3631
|
+
onDelete: () => Re((x) => (x ?? []).filter((v) => v.id !== r.id)),
|
|
3632
|
+
onResize: (x, v) => dt({
|
|
3541
3633
|
...r,
|
|
3542
|
-
w: Math.min(12, Math.max(2, (r.w || 4) +
|
|
3543
|
-
h: Math.min(8, Math.max(1, (r.h || 2) +
|
|
3634
|
+
w: Math.min(12, Math.max(2, (r.w || 4) + x)),
|
|
3635
|
+
h: Math.min(8, Math.max(1, (r.h || 2) + v))
|
|
3544
3636
|
}),
|
|
3545
|
-
onMove: (
|
|
3637
|
+
onMove: (x) => St(r.id, x)
|
|
3546
3638
|
}
|
|
3547
3639
|
) }),
|
|
3548
3640
|
/* @__PURE__ */ e(
|
|
3549
|
-
|
|
3641
|
+
Dt,
|
|
3550
3642
|
{
|
|
3551
3643
|
reportId: t,
|
|
3552
3644
|
widget: r,
|
|
3553
|
-
dateRange:
|
|
3554
|
-
entityFilters:
|
|
3645
|
+
dateRange: i,
|
|
3646
|
+
entityFilters: Z,
|
|
3555
3647
|
refetchInterval: c,
|
|
3556
|
-
filterBar:
|
|
3557
|
-
onDrill:
|
|
3558
|
-
snapshot:
|
|
3559
|
-
asOf:
|
|
3560
|
-
annotations:
|
|
3561
|
-
onAddAnnotation: (
|
|
3562
|
-
onDeleteAnnotation: (
|
|
3563
|
-
onCrossFilter:
|
|
3564
|
-
reportUrl:
|
|
3565
|
-
currentFilters:
|
|
3648
|
+
filterBar: b,
|
|
3649
|
+
onDrill: Q,
|
|
3650
|
+
snapshot: S && S.data[r.id] !== void 0 ? { name: S.name, value: ((d = S.data[r.id]) == null ? void 0 : d.value) ?? null } : null,
|
|
3651
|
+
asOf: oe,
|
|
3652
|
+
annotations: he.filter((x) => x.widget === r.id),
|
|
3653
|
+
onAddAnnotation: (x, v, q) => Fe.mutate({ widget: x, note: v, anchor_date: q }),
|
|
3654
|
+
onDeleteAnnotation: (x) => Me.mutate(x),
|
|
3655
|
+
onCrossFilter: rt,
|
|
3656
|
+
reportUrl: g,
|
|
3657
|
+
currentFilters: Z
|
|
3566
3658
|
}
|
|
3567
3659
|
)
|
|
3568
3660
|
] })
|
|
@@ -3572,40 +3664,40 @@ function Xl({
|
|
|
3572
3664
|
})
|
|
3573
3665
|
}
|
|
3574
3666
|
),
|
|
3575
|
-
|
|
3576
|
-
|
|
3667
|
+
be && nt && (_e == null ? void 0 : _e.some((r) => r.id === nt)) && /* @__PURE__ */ e(Rt, { fallback: null, children: /* @__PURE__ */ e(
|
|
3668
|
+
gl,
|
|
3577
3669
|
{
|
|
3578
|
-
widget:
|
|
3579
|
-
allWidgets:
|
|
3580
|
-
onChange:
|
|
3581
|
-
onClose: () =>
|
|
3670
|
+
widget: _e.find((r) => r.id === nt),
|
|
3671
|
+
allWidgets: _e,
|
|
3672
|
+
onChange: dt,
|
|
3673
|
+
onClose: () => je(null)
|
|
3582
3674
|
}
|
|
3583
3675
|
) }),
|
|
3584
|
-
/* @__PURE__ */ e(
|
|
3585
|
-
!
|
|
3586
|
-
|
|
3676
|
+
/* @__PURE__ */ e(ol, {}),
|
|
3677
|
+
!D && (y != null && y.length) ? /* @__PURE__ */ e(
|
|
3678
|
+
sl,
|
|
3587
3679
|
{
|
|
3588
|
-
collection:
|
|
3589
|
-
itemId:
|
|
3590
|
-
title:
|
|
3680
|
+
collection: y[0].collection,
|
|
3681
|
+
itemId: y[0].itemId,
|
|
3682
|
+
title: y[0].title,
|
|
3591
3683
|
width: "72%",
|
|
3592
|
-
stack:
|
|
3593
|
-
onPush: (r) =>
|
|
3594
|
-
onPop: () =>
|
|
3595
|
-
onClose: () =>
|
|
3684
|
+
stack: y,
|
|
3685
|
+
onPush: (r) => O.push([...y, r]),
|
|
3686
|
+
onPop: () => O.back(),
|
|
3687
|
+
onClose: () => O.back(y.length)
|
|
3596
3688
|
}
|
|
3597
3689
|
) : null
|
|
3598
|
-
] });
|
|
3690
|
+
] }) });
|
|
3599
3691
|
}
|
|
3600
3692
|
export {
|
|
3601
|
-
|
|
3693
|
+
Ll as AlertBell,
|
|
3602
3694
|
ce as CHART_COLORS,
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3695
|
+
kl as NO_WORKFLOW_NUMBER,
|
|
3696
|
+
Al as QueryWidgetBody,
|
|
3697
|
+
hr as ReportView,
|
|
3698
|
+
pr as ReportWidgetCard,
|
|
3699
|
+
zl as adminAccessScopeNote,
|
|
3700
|
+
ze as fmtCell,
|
|
3701
|
+
ha as shapeQueryRows,
|
|
3702
|
+
Pl as shortCategoryLabel
|
|
3611
3703
|
};
|