react-semaphor 0.1.229 → 0.1.230
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/chunks/dashboard-controls-CIGGC81u.js +47 -0
- package/dist/chunks/dashboard-controls-uZZf2_Ms.js +1837 -0
- package/dist/chunks/{dashboard-json-Bb4sPs1-.js → dashboard-json-BPOoq2o2.js} +1 -1
- package/dist/chunks/{dashboard-json-C6i1R8Wf.js → dashboard-json-BSpSg-pF.js} +1 -1
- package/dist/chunks/{dashboard-summary-settings-dialog-B-EIaEfz.js → dashboard-summary-settings-dialog-BBOnX1vh.js} +1 -1
- package/dist/chunks/{dashboard-summary-settings-dialog-B5oZC5Et.js → dashboard-summary-settings-dialog-Dd-wAZsI.js} +23 -23
- package/dist/chunks/{edit-dashboard-visual-BhqnGTNb.js → edit-dashboard-visual-CmKLavr8.js} +459 -459
- package/dist/chunks/{edit-dashboard-visual-BrR2eN_x.js → edit-dashboard-visual-D0myN7lC.js} +1 -1
- package/dist/chunks/{editor-action-buttons-DZHYde-x.js → editor-action-buttons-DicV0M4e.js} +1 -1
- package/dist/chunks/{editor-action-buttons-BuGSShg4.js → editor-action-buttons-ujerALSP.js} +42 -42
- package/dist/chunks/{index--t-xJkFo.js → index-BKtY-D8Y.js} +161 -161
- package/dist/chunks/{index-C_FfPMsT.js → index-SLQXKi01.js} +5658 -5645
- package/dist/chunks/{notification-bell-BUK6qo6E.js → notification-bell-BlKABlIE.js} +1 -1
- package/dist/chunks/{notification-bell-BJx5GZ0K.js → notification-bell-D83sUTTI.js} +60 -60
- package/dist/chunks/resource-management-panel-CJXZMjqO.js +920 -0
- package/dist/chunks/resource-management-panel-TqjX5FH0.js +6 -0
- package/dist/chunks/{use-visual-utils-CckIJVB_.js → use-visual-utils-CjUf9Xns.js} +1 -1
- package/dist/chunks/{use-visual-utils-C-1MadD0.js → use-visual-utils-DNfxkGiH.js} +33 -33
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +44 -44
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunks/dashboard-controls-C4Yq0TiH.js +0 -1764
- package/dist/chunks/dashboard-controls-DUVPeEnP.js +0 -47
- package/dist/chunks/resource-management-panel-C--Zp8ix.js +0 -6
- package/dist/chunks/resource-management-panel-CliUOxsc.js +0 -913
- package/dist/chunks/use-role-aware-display-preferences-Dza-JBu0.js +0 -29
- package/dist/chunks/use-role-aware-display-preferences-YdbXXiO7.js +0 -1
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("./index-BKtY-D8Y.js"),h=require("react"),re=require("./use-visual-utils-CjUf9Xns.js");/**
|
|
2
|
+
* @license lucide-react v0.453.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const ie=t.createLucideIcon("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);function ae(s,g={}){const{enabled:x=!0,eventType:d="mousedown"}=g,i=h.useRef(null);return h.useEffect(()=>{const m=j=>{const o=j.target;i.current&&i.current.contains(o)||o instanceof Element&&(o.closest("[data-radix-popper-content-wrapper]")||o.closest("[data-radix-select-content]")||o.closest("[data-radix-popover-content]")||o.closest("[data-radix-dropdown-menu-content]")||o.closest("[data-radix-tooltip-content]")||o.closest('[role="listbox"]')||o.closest('[role="option"]')||o.closest('[role="combobox"]'))||o instanceof Element&&o.hasAttribute("data-radix-")||s()};return x&&document.addEventListener(d,m),()=>{document.removeEventListener(d,m)}},[s,x,d]),i}function ne(){return e.jsx("div",{className:"space-y-1.5 py-1",children:[...Array(5)].map((s,g)=>e.jsxs("div",{className:"flex animate-pulse items-start gap-3 rounded-xl border border-transparent px-2.5 py-2.5",children:[e.jsx("div",{className:"mt-0.5 h-4 w-4 flex-shrink-0 rounded bg-muted/60"}),e.jsxs("div",{className:"flex-1 space-y-1.5",children:[e.jsx("div",{className:"h-4 w-3/5 rounded bg-muted/60"}),e.jsx("div",{className:"h-3 w-4/5 rounded bg-muted/40"})]})]},g))})}const de=s=>{const g=t.useDashboardStore(i=>i.isVisualEditing),x=t.useDashboardStore(i=>i.selectedFrameId),d=t.useEditorStore(i=>i.frame);return!!(g&&x&&(d==null?void 0:d.visualId)===s)};function le({visual:s,isDeleting:g,isDuplicating:x,onAddVisual:d,onOpenVisual:i,onEditDetails:m,onDeleteClick:j,onDuplicateVisual:o,onShareVisual:D,formatDate:N}){var O,T,U,P;const{selectVisual:p}=t.useManagementActions(),c=t.useIsVisualSelected(s.id),u=de(s.id),A=t.useDashboardStore(a=>a.isVisualEditing),{isConsoleMode:R}=t.useDashboardPreferences(),b=h.useRef(null),[C,S]=h.useState(!1),[E,L]=h.useState(!1);h.useEffect(()=>{x?(S(!0),L(!0)):E&&(S(!1),L(!1))},[x,E]),h.useEffect(()=>{u&&b.current&&b.current.scrollIntoView({behavior:"smooth",block:"center"})},[u]);const y=()=>{p(s),i==null||i(s)},v=a=>{a.currentTarget===a.target&&(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),y())};return e.jsxs("div",{ref:b,className:t.cn("group flex cursor-pointer items-start gap-2 rounded-xl border border-transparent px-2.5 py-2.5 transition-[background-color,border-color,box-shadow] hover:border-border/50 hover:bg-muted/35 focus-within:ring-2 focus-within:ring-inset focus-within:ring-ring/40",u?"border-primary/30 bg-primary/10":c&&"border-border/60 bg-muted/50"),onClick:y,children:[e.jsxs("div",{role:"button",tabIndex:0,className:"min-w-0 flex-1 cursor-pointer focus-visible:outline-none",onKeyDown:v,children:[e.jsx("p",{className:"truncate text-sm font-medium text-foreground",title:s.title||"Untitled Visual",children:s.title||"Untitled Visual"}),e.jsx("p",{className:"truncate text-xs text-muted-foreground",title:s.description||"No description",children:(O=s.description)!=null&&O.trim()?s.description:"No description"})]}),e.jsx("div",{className:t.cn("flex flex-shrink-0 items-center gap-1 transition-opacity",c||u||C?"pointer-events-auto opacity-100":"pointer-events-none opacity-0 group-hover:pointer-events-auto group-hover:opacity-100 group-focus-within:pointer-events-auto group-focus-within:opacity-100"),onClick:a=>a.stopPropagation(),children:e.jsxs("div",{className:"inline-flex items-center overflow-hidden rounded-lg border border-border/60 bg-background/95 shadow-sm",children:[e.jsxs(t.Button,{size:"sm",variant:"ghost",className:"h-7 gap-1 rounded-none border-0 px-2 text-xs font-medium shadow-none hover:bg-muted/50",disabled:A,onClick:a=>{a.stopPropagation(),d(s)},"aria-label":`Add ${s.title||"visual"}`,children:[e.jsx(t.Plus,{className:"h-3.5 w-3.5"}),"Add"]}),e.jsxs(t.DropdownMenu,{modal:!1,open:C,onOpenChange:S,children:[e.jsx(t.DropdownMenuTrigger,{asChild:!0,children:e.jsx(t.Button,{size:"sm",variant:"ghost",className:"h-7 w-7 rounded-none border-0 border-l border-border/60 p-0 shadow-none hover:bg-muted/50","aria-label":"Open visual actions",children:e.jsx(t.EllipsisVertical,{className:"h-3 w-3"})})}),e.jsxs(t.DropdownMenuContent,{align:"end",className:"z-[51] w-44 rounded-xl border border-border/60 p-1 shadow-sm",children:[e.jsxs(t.DropdownMenuItem,{onClick:a=>{a.stopPropagation(),d(s)},disabled:A,children:[e.jsx(t.Plus,{className:"mr-2 h-3 w-3"}),"Add"]}),e.jsxs(t.DropdownMenuItem,{onClick:a=>{a.stopPropagation(),i==null||i(s)},children:[e.jsx(ie,{className:"mr-2 h-3 w-3"}),"Open"]}),e.jsxs(t.DropdownMenuItem,{onClick:a=>{a.preventDefault(),a.stopPropagation(),o(s.id)},disabled:x,children:[x?e.jsx(t.LoaderCircle,{className:"mr-2 h-3 w-3 animate-spin"}):e.jsx(t.Copy,{className:"mr-2 h-3 w-3"}),x?"Duplicating...":"Duplicate"]}),s.ownership.isOwner&&e.jsxs(e.Fragment,{children:[e.jsxs(t.DropdownMenuItem,{onClick:a=>{a.stopPropagation(),m==null||m(s)},children:[e.jsx(t.PenLine,{className:"mr-2 h-3 w-3"}),"Edit details"]}),e.jsxs(t.DropdownMenuItem,{onClick:a=>{a.stopPropagation(),D(s)},children:[e.jsx(t.Users,{className:"mr-2 h-3 w-3"}),"Share"]}),e.jsx(t.DropdownMenuSeparator,{}),e.jsxs(t.DropdownMenuItem,{onClick:a=>{a.stopPropagation(),j(s)},className:"text-destructive",disabled:g,children:[e.jsx(t.Trash2,{className:"mr-2 h-3 w-3"}),g?"Deleting...":"Delete"]})]}),e.jsx(t.DropdownMenuSeparator,{}),e.jsxs("div",{className:"space-y-1 px-2 py-2 text-xs text-muted-foreground",children:[(((T=s.ownership.createdBy)==null?void 0:T.type)==="tenant"||((U=s.ownership.createdBy)==null?void 0:U.type)==="organization"&&R)&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(t.User,{className:"h-3 w-3"}),e.jsx("span",{children:((P=s.ownership.createdBy)==null?void 0:P.name)||"Unknown"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(t.Calendar,{className:"h-3 w-3"}),e.jsx("span",{children:N(s.lastModified)})]})]})]})]})]})})]})}function ce({searchQuery:s}){const[g,x]=h.useState(!1),[d,i]=h.useState(null),[m,j]=h.useState(!1),[o,D]=h.useState(null),[N,p]=h.useState(null),[c,u]=h.useState(null),{handleEditLibraryVisual:A,handleAddLibraryVisual:R}=re.useVisualUtils(),{resources:b,isLoading:C,isError:S,updateResource:E,deleteResource:L,duplicateResource:y,isDeleting:v}=t.useVisualManagement(()=>{j(!1),D(null)}),O=b.filter(n=>{var M,l;return((M=n==null?void 0:n.title)==null?void 0:M.toLowerCase().includes(s.toLowerCase()))||((l=n==null?void 0:n.description)==null?void 0:l.toLowerCase().includes(s.toLowerCase()))}),T=n=>new Date(n).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),U=n=>{D(n),j(!0)},P=()=>{o&&L(o.id)},{startUpdating:a,stopUpdating:_,isUpdating:F}=t.useResourceUpdateState(),V=(n,M,l)=>{var X;const B=Object.fromEntries(Object.entries(M).filter(([,I])=>I!==void 0));if(Object.keys(B).length===0){(X=l==null?void 0:l.onSuccess)==null||X.call(l);return}const w=Object.keys(B),H=w.length===1?w[0]:void 0;a(n,H),E({resourceId:n,data:B},{onSuccess:()=>{var I;_(n,H),(I=l==null?void 0:l.onSuccess)==null||I.call(l)},onError:()=>{var I;_(n,H),(I=l==null?void 0:l.onError)==null||I.call(l)}})},$=n=>{p(n),y(n,{onSettled:()=>p(null)})},z=n=>{A(n)},G=n=>{R(n)},W=n=>{i(n),x(!0)},Y=n=>{u(n)},J=()=>{u(null)},Q=({title:n,description:M})=>{if(!c)return;const l={};n!==c.title&&(l.title=n),(c.description||"")!==M&&(l.description=M),V(c.id,l,{onSuccess:()=>{u(null)}})};return C?e.jsx(ne,{}):S?e.jsx(t.ScrollArea,{className:"w-full flex-1 pr-2",children:e.jsxs("div",{className:"rounded-xl border border-dashed border-border/60 bg-muted/20 px-4 py-8 text-center text-muted-foreground",children:[e.jsx("p",{className:"text-sm text-destructive",children:"Failed to load visuals"}),e.jsx(t.Button,{variant:"outline",size:"sm",className:"mt-2",onClick:()=>window.location.reload(),children:"Retry"})]})}):e.jsxs("div",{className:"flex h-full flex-1 flex-col",children:[e.jsx("div",{className:"flex flex-1 basis-0 flex-col gap-1.5 overflow-y-auto px-0.5",children:O.length===0?e.jsxs("div",{className:"rounded-xl border border-dashed border-border/60 bg-muted/20 px-4 py-8 text-center",children:[e.jsx("div",{className:"mb-3",children:e.jsx(t.Grid3x3,{className:"mx-auto h-12 w-12 text-muted-foreground/50"})}),e.jsx("h3",{className:"mb-1 font-medium text-foreground",children:s?"No visuals found":"No visuals yet"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s?"Try adjusting your search":'Click "New" above to add your first visual'})]}):O.map(n=>e.jsx(le,{visual:n,onAddVisual:G,onOpenVisual:z,onEditDetails:Y,onDeleteClick:U,onDuplicateVisual:$,onShareVisual:W,isDeleting:v,isDuplicating:N===n.id,formatDate:T},n.id))}),g&&d&&e.jsx(t.ShareDialog,{resource:d,resourceType:t.ResourceType.VISUAL,onClose:()=>{x(!1),i(null)}}),c&&e.jsx(t.ResourceEditDialog,{open:!!c,resourceLabel:"Visual",initialTitle:c.title||"",initialDescription:c.description||"",onClose:J,onSave:Q,isSaving:F(c.id)}),e.jsx(t.AlertDialog,{open:m,onOpenChange:n=>{!n&&v||(j(n),n||D(null))},children:e.jsxs(t.AlertDialogContent,{children:[e.jsxs(t.AlertDialogHeader,{children:[e.jsx(t.AlertDialogTitle,{children:"Delete Visual"}),e.jsxs(t.AlertDialogDescription,{children:['Are you sure you want to delete "',o==null?void 0:o.title,'"? This action cannot be undone.']})]}),e.jsxs(t.AlertDialogFooter,{children:[e.jsx(t.AlertDialogCancel,{disabled:v,children:"Cancel"}),e.jsxs(t.AlertDialogAction,{onClick:n=>{n.preventDefault(),n.stopPropagation(),P()},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",disabled:v,children:[v?e.jsx(t.LoaderCircle,{className:"mr-2 h-3.5 w-3.5 animate-spin"}):e.jsx(t.Trash2,{className:"mr-2 h-3.5 w-3.5"}),v?"Deleting...":"Delete"]})]})]})})]})}function ue({dashboard:s,isDeleting:g,isDuplicating:x,onLoadDashboard:d,onEditDetails:i,onDeleteClick:m,onDuplicateDashboard:j,onShareDashboard:o,formatDate:D,onDashboardItemClick:N}){var E,L;const{selectDashboard:p}=t.useManagementActions(),c=t.useIsDashboardSelected(s.id),{userContext:u,isLoading:A}=t.useCurrentUserInfo(),R=((E=u==null?void 0:u.permissions)==null?void 0:E.canEdit)??!1,b=A||!R,C=()=>{p(s),d(s.id),N==null||N(s.id)},S=y=>{y.currentTarget===y.target&&(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),C())};return e.jsxs("div",{className:t.cn("group flex cursor-pointer items-start gap-2 rounded-xl border border-transparent px-2.5 py-2.5 transition-[background-color,border-color,box-shadow] hover:border-border/50 hover:bg-muted/35 focus-within:ring-2 focus-within:ring-inset focus-within:ring-ring/40",c&&"border-border/60 bg-muted/50"),onClick:C,children:[e.jsxs("div",{role:"button",tabIndex:0,className:"min-w-0 flex-1 cursor-pointer focus-visible:outline-none",onKeyDown:S,children:[e.jsx("p",{className:"truncate text-sm font-medium text-foreground",title:s.title||"Untitled Dashboard",children:s.title||"Untitled Dashboard"}),e.jsx("p",{className:"truncate text-xs text-muted-foreground",title:s.description||"No description",children:(L=s.description)!=null&&L.trim()?s.description:"No description"})]}),e.jsx("div",{className:t.cn("flex-shrink-0 transition-opacity",c?"opacity-100":"opacity-0 group-hover:opacity-100 group-focus-within:opacity-100"),children:e.jsx(t.DashboardActionsMenu,{dashboard:s,isDeleting:g,isDuplicating:x,shouldHideActions:b,onEditDetails:i,onDeleteClick:m,onDuplicateDashboard:j,onShareDashboard:o,formatDate:D})})]})}function he({onRetry:s}){return e.jsx(t.ScrollArea,{className:"w-full flex-1 pr-2",children:e.jsxs("div",{className:"rounded-xl border border-dashed border-border/60 bg-muted/20 px-4 py-8 text-center text-muted-foreground",children:[e.jsx("p",{className:"text-sm text-destructive",children:"Failed to load dashboards"}),e.jsx(t.Button,{variant:"outline",size:"sm",className:"mt-2",onClick:s,children:"Retry"})]})})}function me(s){var ee;const{searchQuery:g,onLoadDashboard:x,onEditDashboard:d,onDashboardItemClick:i}=s,[m,j]=h.useState(!1),[o,D]=h.useState(null),[N,p]=h.useState(!1),[c,u]=h.useState(null),[A,R]=h.useState(null),[b,C]=h.useState(null),S=t.useManagementStore(r=>r.lastSelectedDashboard),E=t.useManagementStore(r=>r.selectedDashboard),L=t.useManagementStore(r=>r.actions.selectDashboard),y=t.useManagementStore(r=>r.actions.clearSelectedDashboard),{tokenProps:v,id:O}=t.useSemaphorContext(),{resources:T,isLoading:U,isError:P,updateResource:a,deleteResource:_,duplicateResource:F,isDeleting:V}=t.useDashboardManagement(()=>{p(!1);const r=c==null?void 0:c.id;u(null),(E==null?void 0:E.id)===r&&(!(v!=null&&v.dashboard_id)&&!O?y():S&&S.id!==r&&L(S))}),{userContext:$}=t.useCurrentUserInfo(),z=((ee=$==null?void 0:$.permissions)==null?void 0:ee.canCreateDashboard)??!1,G=T.filter(r=>{var K,f;return((K=r==null?void 0:r.title)==null?void 0:K.toLowerCase().includes(g.toLowerCase()))||((f=r==null?void 0:r.description)==null?void 0:f.toLowerCase().includes(g.toLowerCase()))}),W=r=>new Date(r).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Y=r=>{x==null||x(r)},J=r=>{u(r),p(!0)},Q=()=>{c&&_(c.id)},n=r=>{R(r),F(r,{onSettled:()=>R(null)})},{startUpdating:M,stopUpdating:l,isUpdating:B}=t.useResourceUpdateState(),w=(r,K,f)=>{var se;const Z=Object.fromEntries(Object.entries(K).filter(([,q])=>q!==void 0));if(Object.keys(Z).length===0){(se=f==null?void 0:f.onSuccess)==null||se.call(f);return}const te=Object.keys(Z),k=te.length===1?te[0]:void 0;M(r,k),a({resourceId:r,data:Z},{onSuccess:()=>{var q;l(r,k),(q=f==null?void 0:f.onSuccess)==null||q.call(f)},onError:()=>{var q;l(r,k),(q=f==null?void 0:f.onError)==null||q.call(f)}})},H=r=>{D(r),j(!0)},X=r=>{d==null||d(r.id),C(r)},I=()=>{C(null)},oe=({title:r,description:K})=>{if(!b)return;const f={};r!==b.title&&(f.title=r),(b.description||"")!==K&&(f.description=K),w(b.id,f,{onSuccess:()=>{C(null)}})};return U?e.jsx(ne,{}):P?e.jsx(he,{onRetry:()=>window.location.reload()}):e.jsxs("div",{className:"flex h-full flex-1 flex-col",children:[e.jsx("div",{className:"flex flex-1 basis-0 flex-col gap-1.5 overflow-y-auto px-0.5",children:G.length===0?e.jsxs("div",{className:"rounded-xl border border-dashed border-border/60 bg-muted/20 px-4 py-8 text-center",children:[e.jsx("div",{className:"mb-3",children:e.jsx(t.ChartColumn,{className:"mx-auto h-12 w-12 text-muted-foreground/50"})}),e.jsx("h3",{className:"mb-1 font-medium text-foreground",children:g?"No dashboards found":"No dashboards yet"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:g?"Try adjusting your search":z?'Click "New" above to add your first dashboard':"No dashboards have been shared with you yet"})]}):G.map(r=>e.jsx(ue,{dashboard:r,isDeleting:V,isDuplicating:A===r.id,onLoadDashboard:Y,onEditDetails:X,onDeleteClick:J,onDuplicateDashboard:n,onShareDashboard:H,formatDate:W,onDashboardItemClick:i},r.id))}),m&&o&&e.jsx(t.ShareDialog,{resource:o,resourceType:t.ResourceType.DASHBOARD,onClose:()=>{j(!1),D(null)}}),e.jsx(t.AlertDialog,{open:N,onOpenChange:r=>{!r&&V||(p(r),r||u(null))},children:e.jsxs(t.AlertDialogContent,{children:[e.jsxs(t.AlertDialogHeader,{children:[e.jsx(t.AlertDialogTitle,{children:"Delete Dashboard"}),e.jsxs(t.AlertDialogDescription,{children:['Are you sure you want to delete "',c==null?void 0:c.title,'"? This action cannot be undone.']})]}),e.jsxs(t.AlertDialogFooter,{children:[e.jsx(t.AlertDialogCancel,{disabled:V,children:"Cancel"}),e.jsxs(t.AlertDialogAction,{onClick:r=>{r.preventDefault(),r.stopPropagation(),Q()},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",disabled:V,children:[V?e.jsx(t.LoaderCircle,{className:"mr-2 h-3.5 w-3.5 animate-spin"}):e.jsx(t.Trash2,{className:"mr-2 h-3.5 w-3.5"}),V?"Deleting...":"Delete"]})]})]})}),b&&e.jsx(t.ResourceEditDialog,{open:!!b,resourceLabel:"Dashboard",initialTitle:b.title||"",initialDescription:b.description||"",onClose:I,onSave:oe,isSaving:B(b.id)})]})}function pe({open:s,onOpenChange:g,onSubmit:x,isCreating:d}){const[i,m]=h.useState(""),[j,o]=h.useState("");h.useEffect(()=>{s||(m(""),o(""))},[s]);const D=()=>{i.trim()&&x({title:i,description:j})},N=p=>{g(p)};return e.jsx(t.Dialog,{open:s,onOpenChange:N,children:e.jsxs(t.DialogContent,{children:[e.jsxs(t.DialogHeader,{children:[e.jsx(t.DialogTitle,{children:"Create New Visual"}),e.jsx(t.DialogDescription,{children:"Add a new visual to your library. You can configure it after creation."})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(t.Label,{htmlFor:"title",children:"Visual Title"}),e.jsx(t.Input$1,{id:"title",placeholder:"Enter visual title...",value:i,onChange:p=>m(p.target.value),disabled:d,onKeyDown:p=>{p.key==="Enter"&&!p.shiftKey&&(p.preventDefault(),D())}})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(t.Label,{htmlFor:"description",children:"Description (optional)"}),e.jsx(t.Input$1,{id:"description",placeholder:"Enter visual description...",value:j,onChange:p=>o(p.target.value),disabled:d})]})]}),e.jsxs(t.DialogFooter,{children:[e.jsx(t.Button,{variant:"outline",onClick:()=>N(!1),disabled:d,children:"Cancel"}),e.jsx(t.Button,{onClick:D,disabled:!i.trim()||d,children:d?e.jsxs(e.Fragment,{children:[e.jsx(t.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating..."]}):"Create Visual"})]})]})})}function xe({isOpen:s,onClose:g,className:x,onDashboardItemClick:d,variant:i="inline"}){var l,B;const m=t.useDashboardStore(w=>w.isDashboardEditing),[j,o]=h.useState(!1),[D,N]=h.useState(""),[p,c]=h.useState(!1),{currentUser:u,userContext:A}=t.useCurrentUserInfo(),R=((l=A==null?void 0:A.permissions)==null?void 0:l.canCreateDashboard)??!1,{onCreateSuccess:b}=t.useDashboardCreation({onDashboardSelect:d}),{selectVisual:C}=t.useManagementActions(),{handleEditLibraryVisual:S}=re.useVisualUtils(),{createResource:E,isCreating:L,refetch:y}=t.useDashboardManagement(),{createResource:v,isCreating:O}=t.useVisualManagement(void 0,w=>{o(!1),w&&(C(w),S(w))}),T=i==="overlay",U=m?"New Visual":"New",P=m?"New Visual":"New Dashboard",a=m?"Search visuals...":"Search dashboards...",_=m?"Collapse visuals panel":"Collapse dashboard panel",F=((u==null?void 0:u.name)??"").trim(),V=((u==null?void 0:u.email)??"").trim(),z=F&&F.toLowerCase()!=="undefined"?F:V||"Current user",G=((B=z.charAt(0))==null?void 0:B.toUpperCase())||"?",W=V&&V.toLowerCase()!=="undefined"?V:"",Y=ae(g,{enabled:s&&T}),J=t.cn("flex h-full flex-col border-r border-border/60 bg-background",T?t.cn("absolute inset-y-0 left-0 z-[51] w-60 overflow-hidden shadow-lg transition-transform duration-300 ease-in-out",s?"translate-x-0":"pointer-events-none -translate-x-full"):"w-full max-w-[17rem] min-w-[11rem] overflow-hidden",x),Q=w=>{},n=w=>{console.log("Editing dashboard:",w)},M=w=>{E(w,{onSuccess:H=>{o(!1),b(H,y)}})};return e.jsx(e.Fragment,{children:(!T||s)&&e.jsxs("div",{ref:Y,className:J,children:[e.jsxs("div",{className:"border-b border-border/60 bg-background",children:[e.jsxs("div",{className:"flex items-center justify-between px-3 py-2",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("h2",{className:"whitespace-nowrap text-sm font-semibold",children:m?"Visuals":"Dashboards"})}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(t.Button,{size:"sm",variant:"ghost",onClick:()=>c(!p),className:"h-8 w-8 rounded-md p-0 text-muted-foreground hover:bg-muted/50 hover:text-foreground","aria-label":p?"Hide search":"Show search",children:e.jsx(t.Search,{className:"h-3.5 w-3.5"})}),(m||R)&&e.jsxs(t.Button,{size:"sm",variant:"secondary",className:"h-8 gap-1.5 whitespace-nowrap rounded-md border border-border/60 bg-muted/30 px-2 text-xs font-medium hover:bg-muted/55",onClick:()=>o(!0),"aria-label":P,children:[e.jsx(t.Plus,{className:"h-3.5 w-3.5"}),U]}),e.jsx(t.Button,{size:"sm",variant:"outline",className:"h-8 w-8 rounded-md border-border/60 bg-background p-0.5 text-muted-foreground hover:bg-muted/35 hover:text-foreground",onClick:g,"aria-label":_,children:e.jsx(t.PanelLeft,{className:"h-3.5 w-3.5"})})]})]}),p&&e.jsx("div",{className:"border-t border-border/50 bg-muted/20 px-3 pb-3 pt-2",children:e.jsx(t.Input$1,{placeholder:a,value:D,onChange:w=>N(w.target.value),className:"h-9 border-border/60 bg-background text-sm focus-visible:border-ring/40 focus-visible:ring-0 focus-visible:ring-offset-0",autoFocus:!0})})]}),e.jsx("div",{className:"flex flex-1 flex-col overflow-auto px-2.5 py-2.5",children:m?e.jsx(ce,{searchQuery:D}):e.jsx(me,{searchQuery:D,onLoadDashboard:Q,onEditDashboard:n,onDashboardItemClick:d})}),u&&e.jsx(t.TooltipProvider,{children:e.jsx("div",{className:"border-t border-border/60 bg-muted/20 px-3 py-2.5",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(t.Tooltip,{children:[e.jsx(t.TooltipTrigger,{asChild:!0,children:e.jsx("div",{className:"flex h-7 w-7 cursor-default items-center justify-center rounded-full bg-primary/10",children:e.jsx("span",{className:"text-xs font-medium text-primary",children:G})})}),e.jsx(t.TooltipContent,{side:"top",className:"max-w-xs",children:e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"font-medium",children:z}),W&&e.jsx("div",{className:"text-xs text-muted-foreground",children:W}),u.role&&e.jsxs("div",{className:"text-xs text-muted-foreground",children:["Role: ",t.toTitleCase(u.role.replace(/_/g," "))]})]})})]}),e.jsx("span",{className:"truncate text-xs font-medium text-muted-foreground",children:z})]})})}),m?e.jsx(pe,{open:j,onOpenChange:o,onSubmit:v,isCreating:O}):e.jsx(t.CreateDashboardDialog,{open:j,onOpenChange:o,onSubmit:M,isCreating:L})]})})}exports.ResourceManagementPanel=xe;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const a=require("./index
|
|
1
|
+
"use strict";const a=require("./index-BKtY-D8Y.js"),g=require("react");function H(e){const n=e.toUpperCase().indexOf("WHERE"),t=e.toUpperCase().indexOf("GROUP BY"),r=e.toUpperCase().indexOf("LIMIT"),s=e.toUpperCase().indexOf("ORDER BY");let c=e.length;if(s!==-1&&(c=s),r!==-1&&r<c&&(c=r),n!==-1){const d=e.substring(0,n),o=e.substring(n);return`${d} {{ filters | where }} AND ${o.substring(6)}`}else if(t!==-1){const d=e.substring(0,t),o=e.substring(t);return`${d} {{ filters | where }} ${o}`}else{const d=e.substring(0,c),o=e.substring(c);return console.log("beforeClause",d),console.log("afterClause",o),o?`${d} {{ filters | where }} ${o}`:`${d.replace(/;$/,"")} {{ filters | where }}`}}function k(e){const[n,t]=g.useState(null),[r,s]=g.useState(null),c=a.useEnsureReactGlobals();return g.useEffect(()=>{if(!e||e.trim()===""){t(null),s(null);return}if(!c)return;(async()=>{try{if(!e.startsWith("http://")&&!e.startsWith("https://"))throw new Error(`Invalid URL format: ${e}`);try{new URL(e)}catch{throw new Error(`Invalid URL: ${e}`)}const l=`${e.endsWith("/")?e:`${e}/`}index.js`;try{if(!(await fetch(l,{method:"HEAD"})).ok)throw new Error(`Module not found at ${l}`)}catch{}const h=await import(l);if(typeof h.useChartStore!="function")throw new Error("useChartStore is not a function");t(()=>h.useChartStore),s(null)}catch(o){const l=o instanceof Error?o.message:"Unknown error";console.error("Failed to load remote chart store:",l),s(l),t(null)}})()},[e,c]),n}function Q(e,n){if(e.length===0)return"";const t=e.find(r=>{var s,c;return((s=r.customCardPreferences)==null?void 0:s.visualType)==="multiple"||!!((c=r.customCardPreferences)!=null&&c.dataInputCardIds)});if(t)return t.id;if(n){const r=e.find(s=>s.id===n);if(r){const s=r.tabTitle;if(s=="All__Header")return e[0].id;if(s&&s.endsWith("__Header")){const d=s.split("__")[0],o=e.find(l=>l.tabTitle===d);return o?o.id:e[0].id}return n}}return e[0].id}const z=e=>{if(!e||!("detailTableBackup"in e))return e;const{detailTableBackup:n,...t}=e;return t};async function W(e,n,t,r){if(!n||!t)throw new Error("Missing auth token or visual ID");const s=["resource-by-id","visual",t],c=r.getQueryData(s);if(c)return console.log("Using cached visual data for:",t),{data:c,fromCache:!0};console.log("Fetching visual data from network for:",t);const d=a.ue.loading("Loading visual...",{position:"top-center"});try{const o=await fetch(`${e}/management/v1/visuals/${t}`,{headers:{Authorization:`Bearer ${n}`}});if(!o.ok)throw new Error("Failed to load visual");const l=await o.json();return r.setQueryData(s,l),a.ue.dismiss(d),{data:l,fromCache:!1}}catch(o){throw a.ue.dismiss(d),o}}function L(e){if(typeof e=="string")return JSON.parse(e);if(typeof e=="object")return e;throw new Error("Invalid frame object format")}function G(e,n){var c,d;const t=(e==null?void 0:e.frameObject)??((c=e==null?void 0:e.visual)==null?void 0:c.frameObject);if(!t)return!1;const r=L(t);if(!(r!=null&&r.cards)||r.cards.length===0)return!1;const s=(d=r.cards)==null?void 0:d.find(o=>o.id===r.activeCardId);return s?(a.setupEditorWithCard({...n,frame:r,card:s,visualId:(e==null?void 0:e.id)||r.visualId}),!0):!1}function Y(){var C;const{setCardSql:e}=a.useEditorActions(),n=a.useEditorStore(i=>i.frame),t=a.useEditorStore(i=>i.card),r=a.useEditorStore(i=>i.isDevMode),s=k(((C=t.customCardPreferences)==null?void 0:C.url)||""),c=a.useEditorStore(i=>i.selectedSchemaName),d=a.useEditorStore(i=>i.selectedDatamodelId),o=a.useEditorStore(i=>i.selectedDatabaseName),l=a.useEditorStore(i=>i.selectedTableName),h=a.useEditorStore(i=>i.selectedConnectionId),m=a.useEditorStore(i=>i.isShowingVisual),p=t.sql;return{getUpdatedFrame:g.useCallback(()=>{var I;let i=p;p&&!p.includes("{{")&&(i=H(p),e(i));const E=(I=s==null?void 0:s.getState())==null?void 0:I.settings,v={...t,dataSource:t.dataSource||{mode:"directSource"},lastSelectedSchema:c,lastSelectedDatamodelId:d,lastSelectedDatabase:o,lastSelectedTable:l,connectionId:h,sql:r?i:void 0,python:r?t.python:void 0,config:r?void 0:z(t.config),customCfg:m?t.customCfg:null,preferences:t.preferences,...E&&{customCardPreferences:{...t.customCardPreferences,settings:E}}},w=n.cards.map(S=>S.id===t.id?v:S);return{...n,cards:w,activeCardId:Q(w,n.activeCardId)}},[t,n,r,m,c,d,o,l,h,e,s,p])}}function J(){const{authToken:e,tokenProps:n}=a.useSemaphorContext(),t=a.useQueryClient(),r=a.useSelectedVisual(),{selectVisual:s}=a.useManagementActions(),{setFrame:c,setCard:d,setIsDevMode:o,initializeModeDrafts:l,setActiveTabCardId:h,updateDataSource:m,setQueryResultColumns:p,setSelectedConnectionId:D,setSelectedDatabaseName:C,setSelectedSchemaName:i,setSelectedTableName:E,setSelectedDatamodelId:v,setFilterValues:w,setApplyFilters:I}=a.useEditorActions(),{setIsDashboardEditing:S,setIsVisualEditing:V,setSelectedFrameId:$,clearSelectedFrameId:A,addFrame:R,setIsDashboardPanelOpen:N}=a.useDashboardActions(),y=a.useDashboardStore(u=>u.selectedSheetId),O=a.useDashboardStore(u=>u.selectedFrameId),T=a.useDashboardStore(u=>u.dashboard),x=a.useDashboardStore(u=>u.filterValues),F=a.useVisualById((r==null?void 0:r.id)||"",{enabled:!!(r!=null&&r.id)&&!!(e!=null&&e.accessToken)}),j=g.useCallback(async u=>{try{s(u),A();const{data:b,fromCache:f}=await W(n.apiServiceUrl,(e==null?void 0:e.accessToken)||"",u.id,t);if(!G(b,{setFrame:c,setCard:d,setIsDevMode:o,initializeModeDrafts:l,setActiveTabCardId:h,updateDataSource:m,setQueryResultColumns:p,setSelectedConnectionId:D,setSelectedDatabaseName:C,setSelectedSchemaName:i,setSelectedTableName:E,setSelectedDatamodelId:v,setFilterValues:w,setApplyFilters:I,setIsDashboardEditing:S,setIsVisualEditing:V,dashboard:T,selectedSheetId:y,selectedFrameId:O,filterValues:x}))throw new Error("Failed to setup editor with visual data");return{success:!0,fromCache:f}}catch(b){return console.error("Error editing visual:",b),{success:!1,error:"Failed to load visual for editing"}}},[e==null?void 0:e.accessToken,n.apiServiceUrl,t,s,c,d,S,V,o,l,h,m,p,D,C,i,E,v,w,I,A,T,y,O,x]),_=g.useCallback(async u=>{var b;try{if(s(u),!y)return{success:!1,error:"No sheet selected. Please select a sheet first."};const{data:f,fromCache:B}=await W(n.apiServiceUrl,(e==null?void 0:e.accessToken)||"",u.id,t),M=(f==null?void 0:f.frameObject)??((b=f==null?void 0:f.visual)==null?void 0:b.frameObject);if(!M)return{success:!1,error:"Visual has no frame data"};const U=L(M);if(!(U!=null&&U.cards)||U.cards.length===0)return{success:!1,error:"Visual frame is malformed"};const P={...a.cloneLinkedFrameWithSourceMapping(U),visualId:u.id};return R(y,P,"end"),S(!0),$(P.id),N(!1),{success:!0,fromCache:B}}catch(f){return console.error("Error adding visual:",f),{success:!1,error:"Failed to add visual to dashboard"}}},[e==null?void 0:e.accessToken,n.apiServiceUrl,t,s,y,R,S,$,N]);return{visual:F.data,isLoading:F.isLoading,isError:F.isError,error:F.error,handleEditLibraryVisual:j,handleAddLibraryVisual:_,getUpdatedFrame:Y().getUpdatedFrame,refetch:F.refetch}}exports.useRemoteChartStore=k;exports.useVisualUtils=J;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { G as z, b as J, H as K, J as Y, K as X, M as H, N as Z, u as v, O as q, Q as ee, x as V, T as te, U as f } from "./index-SLQXKi01.js";
|
|
2
2
|
import { useState as j, useEffect as re, useCallback as D } from "react";
|
|
3
3
|
function se(e) {
|
|
4
4
|
const a = e.toUpperCase().indexOf("WHERE"), t = e.toUpperCase().indexOf("GROUP BY"), r = e.toUpperCase().indexOf("LIMIT"), s = e.toUpperCase().indexOf("ORDER BY");
|
|
@@ -17,7 +17,7 @@ function se(e) {
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
function oe(e) {
|
|
20
|
-
const [a, t] = j(null), [r, s] = j(null), n =
|
|
20
|
+
const [a, t] = j(null), [r, s] = j(null), n = z();
|
|
21
21
|
return re(() => {
|
|
22
22
|
if (!e || e.trim() === "") {
|
|
23
23
|
t(null), s(null);
|
|
@@ -116,7 +116,7 @@ async function k(e, a, t, r) {
|
|
|
116
116
|
throw V.dismiss(i), o;
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
|
-
function
|
|
119
|
+
function Q(e) {
|
|
120
120
|
if (typeof e == "string")
|
|
121
121
|
return JSON.parse(e);
|
|
122
122
|
if (typeof e == "object")
|
|
@@ -128,7 +128,7 @@ function ce(e, a) {
|
|
|
128
128
|
const t = (e == null ? void 0 : e.frameObject) ?? ((n = e == null ? void 0 : e.visual) == null ? void 0 : n.frameObject);
|
|
129
129
|
if (!t)
|
|
130
130
|
return !1;
|
|
131
|
-
const r =
|
|
131
|
+
const r = Q(t);
|
|
132
132
|
if (!(r != null && r.cards) || r.cards.length === 0)
|
|
133
133
|
return !1;
|
|
134
134
|
const s = (i = r.cards) == null ? void 0 : i.find(
|
|
@@ -143,7 +143,7 @@ function ce(e, a) {
|
|
|
143
143
|
}
|
|
144
144
|
function ie() {
|
|
145
145
|
var S;
|
|
146
|
-
const { setCardSql: e } =
|
|
146
|
+
const { setCardSql: e } = H(), a = f((c) => c.frame), t = f((c) => c.card), r = f((c) => c.isDevMode), s = oe(
|
|
147
147
|
((S = t.customCardPreferences) == null ? void 0 : S.url) || ""
|
|
148
148
|
), n = f(
|
|
149
149
|
(c) => c.selectedSchemaName
|
|
@@ -204,7 +204,7 @@ function ie() {
|
|
|
204
204
|
]) };
|
|
205
205
|
}
|
|
206
206
|
function ue() {
|
|
207
|
-
const { authToken: e, tokenProps: a } =
|
|
207
|
+
const { authToken: e, tokenProps: a } = J(), t = K(), r = Y(), { selectVisual: s } = X(), {
|
|
208
208
|
setFrame: n,
|
|
209
209
|
setCard: i,
|
|
210
210
|
setIsDevMode: o,
|
|
@@ -219,19 +219,19 @@ function ue() {
|
|
|
219
219
|
setSelectedDatamodelId: U,
|
|
220
220
|
setFilterValues: w,
|
|
221
221
|
setApplyFilters: I
|
|
222
|
-
} =
|
|
222
|
+
} = H(), {
|
|
223
223
|
setIsDashboardEditing: b,
|
|
224
|
-
setIsVisualEditing:
|
|
225
|
-
setSelectedFrameId:
|
|
226
|
-
clearSelectedFrameId:
|
|
227
|
-
addFrame:
|
|
228
|
-
setIsDashboardPanelOpen:
|
|
229
|
-
} =
|
|
224
|
+
setIsVisualEditing: N,
|
|
225
|
+
setSelectedFrameId: O,
|
|
226
|
+
clearSelectedFrameId: T,
|
|
227
|
+
addFrame: x,
|
|
228
|
+
setIsDashboardPanelOpen: A
|
|
229
|
+
} = Z(), y = v((l) => l.selectedSheetId), M = v((l) => l.selectedFrameId), B = v((l) => l.dashboard), P = v((l) => l.filterValues), E = q((r == null ? void 0 : r.id) || "", {
|
|
230
230
|
enabled: !!(r != null && r.id) && !!(e != null && e.accessToken)
|
|
231
|
-
}),
|
|
231
|
+
}), _ = D(
|
|
232
232
|
async (l) => {
|
|
233
233
|
try {
|
|
234
|
-
s(l),
|
|
234
|
+
s(l), T();
|
|
235
235
|
const { data: g, fromCache: u } = await k(
|
|
236
236
|
a.apiServiceUrl,
|
|
237
237
|
(e == null ? void 0 : e.accessToken) || "",
|
|
@@ -254,11 +254,11 @@ function ue() {
|
|
|
254
254
|
setFilterValues: w,
|
|
255
255
|
setApplyFilters: I,
|
|
256
256
|
setIsDashboardEditing: b,
|
|
257
|
-
setIsVisualEditing:
|
|
257
|
+
setIsVisualEditing: N,
|
|
258
258
|
dashboard: B,
|
|
259
259
|
selectedSheetId: y,
|
|
260
|
-
selectedFrameId:
|
|
261
|
-
filterValues:
|
|
260
|
+
selectedFrameId: M,
|
|
261
|
+
filterValues: P
|
|
262
262
|
}))
|
|
263
263
|
throw new Error("Failed to setup editor with visual data");
|
|
264
264
|
return { success: !0, fromCache: u };
|
|
@@ -274,7 +274,7 @@ function ue() {
|
|
|
274
274
|
n,
|
|
275
275
|
i,
|
|
276
276
|
b,
|
|
277
|
-
|
|
277
|
+
N,
|
|
278
278
|
o,
|
|
279
279
|
d,
|
|
280
280
|
m,
|
|
@@ -287,13 +287,13 @@ function ue() {
|
|
|
287
287
|
U,
|
|
288
288
|
w,
|
|
289
289
|
I,
|
|
290
|
-
|
|
290
|
+
T,
|
|
291
291
|
B,
|
|
292
292
|
y,
|
|
293
|
-
|
|
294
|
-
|
|
293
|
+
M,
|
|
294
|
+
P
|
|
295
295
|
]
|
|
296
|
-
),
|
|
296
|
+
), G = D(
|
|
297
297
|
async (l) => {
|
|
298
298
|
var g;
|
|
299
299
|
try {
|
|
@@ -302,15 +302,15 @@ function ue() {
|
|
|
302
302
|
success: !1,
|
|
303
303
|
error: "No sheet selected. Please select a sheet first."
|
|
304
304
|
};
|
|
305
|
-
const { data: u, fromCache:
|
|
305
|
+
const { data: u, fromCache: R } = await k(
|
|
306
306
|
a.apiServiceUrl,
|
|
307
307
|
(e == null ? void 0 : e.accessToken) || "",
|
|
308
308
|
l.id,
|
|
309
309
|
t
|
|
310
|
-
),
|
|
311
|
-
if (!
|
|
310
|
+
), W = (u == null ? void 0 : u.frameObject) ?? ((g = u == null ? void 0 : u.visual) == null ? void 0 : g.frameObject);
|
|
311
|
+
if (!W)
|
|
312
312
|
return { success: !1, error: "Visual has no frame data" };
|
|
313
|
-
const F =
|
|
313
|
+
const F = Q(W);
|
|
314
314
|
if (!(F != null && F.cards) || F.cards.length === 0)
|
|
315
315
|
return { success: !1, error: "Visual frame is malformed" };
|
|
316
316
|
const L = {
|
|
@@ -318,7 +318,7 @@ function ue() {
|
|
|
318
318
|
visualId: l.id
|
|
319
319
|
// Link this frame to the library visual
|
|
320
320
|
};
|
|
321
|
-
return
|
|
321
|
+
return x(y, L, "end"), b(!0), O(L.id), A(!1), { success: !0, fromCache: R };
|
|
322
322
|
} catch (u) {
|
|
323
323
|
return console.error("Error adding visual:", u), { success: !1, error: "Failed to add visual to dashboard" };
|
|
324
324
|
}
|
|
@@ -329,10 +329,10 @@ function ue() {
|
|
|
329
329
|
t,
|
|
330
330
|
s,
|
|
331
331
|
y,
|
|
332
|
-
|
|
332
|
+
x,
|
|
333
333
|
b,
|
|
334
|
-
|
|
335
|
-
|
|
334
|
+
O,
|
|
335
|
+
A
|
|
336
336
|
]
|
|
337
337
|
);
|
|
338
338
|
return {
|
|
@@ -340,8 +340,8 @@ function ue() {
|
|
|
340
340
|
isLoading: E.isLoading,
|
|
341
341
|
isError: E.isError,
|
|
342
342
|
error: E.error,
|
|
343
|
-
handleEditLibraryVisual:
|
|
344
|
-
handleAddLibraryVisual:
|
|
343
|
+
handleEditLibraryVisual: _,
|
|
344
|
+
handleAddLibraryVisual: G,
|
|
345
345
|
getUpdatedFrame: ie().getUpdatedFrame,
|
|
346
346
|
refetch: E.refetch
|
|
347
347
|
};
|
package/dist/dashboard/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/index
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/index-BKtY-D8Y.js"),r=require("../types/index.cjs");exports.Dashboard=e.Dashboard;exports.EMPTY_SELECTION=r.EMPTY_SELECTION;
|
package/dist/dashboard/index.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/index--t-xJkFo.js"),D=require("./types/index.cjs"),E=require("./chunks/dashboard-summary-settings-dialog-B-EIaEfz.js"),t=require("react/jsx-runtime"),C=require("react"),v=require("./chunks/resource-management-panel-C--Zp8ix.js"),P=require("./chunks/use-debounced-dirty-check-XHSwAefL.js");require("react-dom");const p=require("./chunks/notification-bell-BUK6qo6E.js"),S=require("./chunks/normalize-dashboard-for-dirty-check-B7NQDI1H.js");function _(r){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const n in r)if(n!=="default"){const i=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(a,n,i.get?i:{enumerable:!0,get:()=>r[n]})}}return a.default=r,Object.freeze(a)}const A=_(C);function M(r){const{displayPreferences:a,...n}=r,i={...n,id:r.dashboardId};return t.jsx(e.ErrorBoundary,{FallbackComponent:e.Fallback,children:t.jsxs(e.SemaphorContextProvider,{dashboardProps:i,children:[t.jsx(e.SemaphorReadyIndicator,{componentType:"visual",componentId:r.cardId}),t.jsx(e.UXProvider,{children:t.jsx(e.DisplayPreferencesProvider,{displayPreferences:a,children:t.jsx(e.Container,{type:"visual",...i,children:t.jsx(I,{cardId:r.cardId})})})})]})})}function I({cardId:r}){const a=e.useDashboardStore(o=>{var u;return(u=o.dashboard)==null?void 0:u.sheets}),{card:n,frame:i}=C.useMemo(()=>{const o=a==null?void 0:a.flatMap(s=>s.frames),u=o==null?void 0:o.flatMap(s=>s==null?void 0:s.cards),d=u==null?void 0:u.find(s=>(s==null?void 0:s.id)===r),l=o==null?void 0:o.find(s=>{var m;return(m=s==null?void 0:s.cards)==null?void 0:m.find(h=>(h==null?void 0:h.id)===r)});return{card:d,frame:l}},[a,r]);return!n||!i?t.jsx(e.FallbackVisual,{error:new Error("Card not found"),resetErrorBoundary:()=>{},customerFacingMessage:`Card not found with ID: ${r}`}):t.jsx("main",{className:"flex h-full grow flex-col",children:t.jsx(e.ErrorBoundary,{FallbackComponent:({error:o,resetErrorBoundary:u})=>t.jsx(e.FallbackVisual,{error:o,resetErrorBoundary:u,customerFacingMessage:"Error creating visual. Please try again."}),children:t.jsx(e.DashboardCard,{card:n,frame:i})})})}function F({name:r,items:a,value:n,onChange:i,isLoading:o,isError:u,refetch:d,className:l,icon:s,showNone:m=!1}){const h=A.useRef(null),[f,y]=A.useState(!1),[b,N]=A.useState("100%"),g=m?[...a||[],{id:"none",name:"None"}]:a;A.useLayoutEffect(()=>{h.current&&N(h.current.offsetWidth)},[]);function T(){var c;return o?"Loading...":u?"Error":n?(c=a==null?void 0:a.find(x=>x.id===n))==null?void 0:c.name:`Select ${r}`}function j(c,x){i(x),y(!1)}return t.jsxs(e.Popover,{open:f,onOpenChange:y,children:[t.jsx(e.PopoverTrigger,{asChild:!0,children:t.jsxs(e.Button,{ref:h,variant:"outline",role:"combobox","aria-expanded":f,className:e.cn("flex h-9 w-full justify-between",l),children:[t.jsxs("div",{className:"flex items-center gap-2",children:[s&&t.jsx("div",{className:"mr-2",children:s}),t.jsx("span",{className:"max-w-[150px] overflow-hidden truncate text-ellipsis whitespace-nowrap",children:T()})]}),t.jsx(e.ChevronDown,{className:"size-4 opacity-50"})]})}),t.jsx(e.PopoverContent,{className:"w-full p-0",style:{minWidth:b},children:t.jsxs(e.Command,{children:[t.jsxs("div",{className:"flex h-9 items-center justify-between border-b pr-1",children:[t.jsx(e.CommandInput,{className:"h-9",placeholder:"Search..."}),t.jsx(e.IconButton,{className:"h-7",onClick:d,children:t.jsx(e.RefreshCw,{className:e.cn("size-3.5 opacity-50",o&&"animate-spin")})})]}),t.jsxs(e.CommandList,{children:[t.jsxs(e.CommandEmpty,{children:["No ",r==null?void 0:r.toLowerCase()," found."]}),t.jsx(e.CommandGroup,{children:g==null?void 0:g.map(c=>t.jsx(e.CommandItem,{className:"overflow-x-auto",value:c.name,onSelect:x=>j(x,c.id),children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(e.Check,{className:e.cn("size-4",n===c.id?"opacity-100":"opacity-0")}),t.jsx("div",{title:c.name,children:c.name})]})},c.id))})]})]})})]})}function R({triggerButtonClassName:r,variant:a="ghost"}){const[n,i]=C.useState(!1),o=e.useDashboardStore(d=>{var l;return(l=d.dashboard)==null?void 0:l.id}),u=e.useDashboardStore(d=>{var l;return(l=d.dashboard)==null?void 0:l.title});return o?t.jsxs(t.Fragment,{children:[t.jsx(e.IconButton,{tooltip:"Schedule Dashboard",className:e.cn("h-7 p-2",r),buttonProps:{variant:a},onClick:()=>i(!0),children:t.jsx(e.Clock,{className:"size-4"})}),t.jsx(e.EmailScheduleDialog,{open:n,onOpenChange:i,dashboardId:o,dashboardName:u})]}):null}function w(r,a){C.useEffect(()=>(r&&a&&(window.__SEMAPHOR_PRINT_STATE__={...a}),()=>{r&&window.__SEMAPHOR_PRINT_STATE__&&delete window.__SEMAPHOR_PRINT_STATE__}),[r,a])}function k(){var u,d;const{quotasQuery:r,usageQuery:a}=e.useAlertQuotas(),n=((u=r.data)==null?void 0:u.quotas)||[],i=((d=a.data)==null?void 0:d.usage)||[],o=new Map(i.map(l=>[l.tenantId||"org",l]));return t.jsxs("div",{className:"space-y-4 p-4",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h2",{className:"text-xl font-semibold",children:"Alert Quotas"}),t.jsx(e.Button,{variant:"outline",size:"sm",onClick:()=>{r.refetch(),a.refetch()},children:"Refresh"})]}),r.isLoading||a.isLoading?t.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading quota usage..."}):null,t.jsx("div",{className:"overflow-hidden rounded-lg border",children:t.jsxs("table",{className:"w-full text-sm",children:[t.jsx("thead",{className:"bg-muted/40",children:t.jsxs("tr",{children:[t.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Tenant"}),t.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Active Alerts"}),t.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Max Active"}),t.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Min Cadence"}),t.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Max Context Sources"})]})}),t.jsx("tbody",{children:n.map(l=>{const s=l.tenantId||"org",m=o.get(s);return t.jsxs("tr",{className:"border-t",children:[t.jsx("td",{className:"px-3 py-2",children:s}),t.jsx("td",{className:"px-3 py-2",children:(m==null?void 0:m.activeAlerts)??0}),t.jsx("td",{className:"px-3 py-2",children:l.policy.maxActiveAlerts}),t.jsxs("td",{className:"px-3 py-2",children:[l.policy.minCadenceMinutes," min"]}),t.jsx("td",{className:"px-3 py-2",children:l.policy.maxContextSources})]},s)})})]})})]})}exports.AlertCreationDialog=e.AlertCreationDialog;exports.AlertManagementPage=e.AlertManagementPage;exports.AlertsApiError=e.AlertsApiError;exports.CALCULATED_FIELD_ENTITY_MARKER=e.CALCULATED_FIELD_ENTITY_MARKER;exports.CardAlertIndicator=e.CardAlertIndicator;exports.CardSummary=e.CardSummary;exports.DATE_FORMAT_VALUES=e.DATE_FORMAT_VALUES;exports.Dashboard=e.Dashboard;exports.DashboardExportDialog=e.DashboardExportDialog;exports.DashboardWC=e.DashboardWC;exports.EmailScheduleDialog=e.EmailScheduleDialog;exports.ExportError=e.ExportError;exports.PivotMarkerEnum=e.PivotMarkerEnum;exports.ResourceType=e.ResourceType;exports.SemaphorContextProvider=e.SemaphorContextProvider;exports.SemaphorDataProvider=e.SemaphorQueryClient;exports.SemaphorQueryClient=e.SemaphorQueryClient;exports.ShareDialog=e.ShareDialog;exports.SummaryCard=e.SummaryCard;exports.Surfboard=e.DashboardPlus;exports.backtestAlert=e.backtestAlert;exports.cancelExport=e.cancelExport;exports.cloneDeep=e.cloneDeep;exports.createAlert=e.createAlert;exports.createEmptyKpiConfig=e.createEmptyKpiConfig;exports.createExport=e.createExport;exports.createSqlGenConfig=e.createSqlGenConfig;exports.deleteAlert=e.deleteAlert;exports.downloadPdf=e.downloadPdf;exports.emitDashboardLoad=e.emitDashboardLoad;exports.emitDashboardUnload=e.emitDashboardUnload;exports.fmt=e.fmt;exports.formatFileSize=e.formatFileSize;exports.getAlert=e.getAlert;exports.getAlertContextSources=e.getAlertContextSources;exports.getAlertHistory=e.getAlertHistory;exports.getAlertQuotaUsage=e.getAlertQuotaUsage;exports.getAlertRunDeliveries=e.getAlertRunDeliveries;exports.getAlertRunSteps=e.getAlertRunSteps;exports.getAlertRuns=e.getAlertRuns;exports.getAlertState=e.getAlertState;exports.getColumnDataType=e.getColumnDataType;exports.getDownloadUrl=e.getDownloadUrl;exports.getExportStatus=e.getExportStatus;exports.getExports=e.getExports;exports.getFilterValueType=e.getFilterValueType;exports.getFormattedTableNameForQuery=e.getFormattedTableNameForQuery;exports.getQualifiedTableName=e.getQualifiedTableName;exports.getSql=e.getSql;exports.interpretAlertContext=e.interpretAlertContext;exports.invalidateToken=e.invalidateToken;exports.isBooleanDataType=e.isBooleanDataType;exports.isCalculatedDimension=e.isCalculatedDimension;exports.isCalculatedField=e.isCalculatedField;exports.isCalculatedMetric=e.isCalculatedMetric;exports.isColumnInSqlGen=e.isColumnInSqlGen;exports.isDateDataType=e.isDateDataType;exports.isExportComplete=e.isExportComplete;exports.isExportInProgress=e.isExportInProgress;exports.isNumberDataType=e.isNumberDataType;exports.isTextDataType=e.isTextDataType;exports.listAlertQuotas=e.listAlertQuotas;exports.listAlerts=e.listAlerts;exports.previewAlertDeliverable=e.previewAlertDeliverable;exports.resolveDataType=e.resolveDataType;exports.resolveDatamodelName=e.resolveDatamodelName;exports.triggerAlertNow=e.triggerAlertNow;exports.updateAlert=e.updateAlert;exports.updateAlertContextSources=e.updateAlertContextSources;exports.updateAlertQuota=e.updateAlertQuota;exports.useActiveExports=e.useActiveExports;exports.useAddNewFrame=e.useAddNewFrame;exports.useAlertActions=e.useAlertActions;exports.useAlertBacktest=e.useAlertBacktest;exports.useAlertContextBuilder=e.useAlertContextBuilder;exports.useAlertDeliveries=e.useAlertDeliveries;exports.useAlertDetail=e.useAlertDetail;exports.useAlertDraft=e.useAlertDraft;exports.useAlertFilters=e.useAlertFilters;exports.useAlertHistory=e.useAlertHistory;exports.useAlertQuotas=e.useAlertQuotas;exports.useAlertRuns=e.useAlertRuns;exports.useAlertState=e.useAlertState;exports.useAlertStore=e.useAlertStore;exports.useAlerts=e.useAlerts;exports.useAlertsBootstrap=e.useAlertsBootstrap;exports.useAlertsById=e.useAlertsById;exports.useAlertsForCard=e.useAlertsForCard;exports.useCard=e.useCard;exports.useCardAlertMap=e.useCardAlertMap;exports.useCardSummary=e.useCardSummary;exports.useCurrentActiveCard=e.useCurrentActiveCard;exports.useCurrentCardConfig=e.useCurrentCardConfig;exports.useCurrentSheetActiveCards=e.useCurrentSheetActiveCards;exports.useDashboardActions=e.useDashboardActions;exports.useDashboardById=e.useDashboardById;exports.useDashboardQuery=e.useDashboardQuery;exports.useDashboardStore=e.useDashboardStore;exports.useDashboardSummary=e.useDashboardSummary;exports.useDataColumns=e.useDataColumns;exports.useDateFilterHook=e.useDateFilterHook;exports.useEditorActions=e.useEditorActions;exports.useEditorAside=e.useEditorAside;exports.useEditorStore=e.useEditorStore;exports.useExportActions=e.useExportActions;exports.useExportStore=e.useExportStore;exports.useInProgressExportsCount=e.useInProgressExportsCount;exports.useManagementStore=e.useManagementStore;exports.useResourceManagement=e.useResourceManagement;exports.useSelectedAlertId=e.useSelectedAlertId;exports.useTextFilterHook=e.useTextFilterHook;exports.DEFAULT_CALENDAR_CONTEXT=D.DEFAULT_CALENDAR_CONTEXT;exports.DEFAULT_SEMANTIC_DOMAIN_ACCESS=D.DEFAULT_SEMANTIC_DOMAIN_ACCESS;exports.EMPTY_SELECTION=D.EMPTY_SELECTION;exports.CalendarPreferencesDialog=E.CalendarPreferencesDialog;exports.DashboardSummarySettingsDialog=E.DashboardSummarySettingsDialog;exports.ResourceManagementPanel=v.ResourceManagementPanel;exports.useDebouncedDirtyCheck=P.useDebouncedDirtyCheck;exports.AdvancedModeToggle=p.AdvancedModeToggle;exports.ExportNotificationItem=p.ExportNotificationItem;exports.ExportNotificationList=p.ExportNotificationList;exports.NotificationBell=p.NotificationBell;exports.UnsavedChangesAlert=p.UnsavedChangesAlert;exports.VisualEditingControls=p.VisualEditingControls;exports.useExportPolling=p.useExportPolling;exports.useExportRecovery=p.useExportRecovery;exports.usePristineSnapshotInitializer=p.usePristineSnapshotInitializer;exports.normalizeDashboardForDirtyCheck=S.normalizeDashboardForDirtyCheck;exports.serializeDashboardForDirtyCheck=S.serializeDashboardForDirtyCheck;exports.Combobox=F;exports.ScheduleDashboard=R;exports.TenantQuotaPage=k;exports.Visual=M;exports.useExposePrintState=w;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/index-BKtY-D8Y.js"),D=require("./types/index.cjs"),E=require("./chunks/dashboard-summary-settings-dialog-BBOnX1vh.js"),t=require("react/jsx-runtime"),C=require("react"),v=require("./chunks/resource-management-panel-TqjX5FH0.js"),P=require("./chunks/use-debounced-dirty-check-XHSwAefL.js");require("react-dom");const p=require("./chunks/notification-bell-BlKABlIE.js"),S=require("./chunks/normalize-dashboard-for-dirty-check-B7NQDI1H.js");function _(r){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const n in r)if(n!=="default"){const i=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(a,n,i.get?i:{enumerable:!0,get:()=>r[n]})}}return a.default=r,Object.freeze(a)}const A=_(C);function M(r){const{displayPreferences:a,...n}=r,i={...n,id:r.dashboardId};return t.jsx(e.ErrorBoundary,{FallbackComponent:e.Fallback,children:t.jsxs(e.SemaphorContextProvider,{dashboardProps:i,children:[t.jsx(e.SemaphorReadyIndicator,{componentType:"visual",componentId:r.cardId}),t.jsx(e.UXProvider,{children:t.jsx(e.DisplayPreferencesProvider,{displayPreferences:a,children:t.jsx(e.Container,{type:"visual",...i,children:t.jsx(I,{cardId:r.cardId})})})})]})})}function I({cardId:r}){const a=e.useDashboardStore(o=>{var u;return(u=o.dashboard)==null?void 0:u.sheets}),{card:n,frame:i}=C.useMemo(()=>{const o=a==null?void 0:a.flatMap(s=>s.frames),u=o==null?void 0:o.flatMap(s=>s==null?void 0:s.cards),d=u==null?void 0:u.find(s=>(s==null?void 0:s.id)===r),l=o==null?void 0:o.find(s=>{var m;return(m=s==null?void 0:s.cards)==null?void 0:m.find(h=>(h==null?void 0:h.id)===r)});return{card:d,frame:l}},[a,r]);return!n||!i?t.jsx(e.FallbackVisual,{error:new Error("Card not found"),resetErrorBoundary:()=>{},customerFacingMessage:`Card not found with ID: ${r}`}):t.jsx("main",{className:"flex h-full grow flex-col",children:t.jsx(e.ErrorBoundary,{FallbackComponent:({error:o,resetErrorBoundary:u})=>t.jsx(e.FallbackVisual,{error:o,resetErrorBoundary:u,customerFacingMessage:"Error creating visual. Please try again."}),children:t.jsx(e.DashboardCard,{card:n,frame:i})})})}function F({name:r,items:a,value:n,onChange:i,isLoading:o,isError:u,refetch:d,className:l,icon:s,showNone:m=!1}){const h=A.useRef(null),[f,y]=A.useState(!1),[b,N]=A.useState("100%"),g=m?[...a||[],{id:"none",name:"None"}]:a;A.useLayoutEffect(()=>{h.current&&N(h.current.offsetWidth)},[]);function T(){var c;return o?"Loading...":u?"Error":n?(c=a==null?void 0:a.find(x=>x.id===n))==null?void 0:c.name:`Select ${r}`}function j(c,x){i(x),y(!1)}return t.jsxs(e.Popover,{open:f,onOpenChange:y,children:[t.jsx(e.PopoverTrigger,{asChild:!0,children:t.jsxs(e.Button,{ref:h,variant:"outline",role:"combobox","aria-expanded":f,className:e.cn("flex h-9 w-full justify-between",l),children:[t.jsxs("div",{className:"flex items-center gap-2",children:[s&&t.jsx("div",{className:"mr-2",children:s}),t.jsx("span",{className:"max-w-[150px] overflow-hidden truncate text-ellipsis whitespace-nowrap",children:T()})]}),t.jsx(e.ChevronDown,{className:"size-4 opacity-50"})]})}),t.jsx(e.PopoverContent,{className:"w-full p-0",style:{minWidth:b},children:t.jsxs(e.Command,{children:[t.jsxs("div",{className:"flex h-9 items-center justify-between border-b pr-1",children:[t.jsx(e.CommandInput,{className:"h-9",placeholder:"Search..."}),t.jsx(e.IconButton,{className:"h-7",onClick:d,children:t.jsx(e.RefreshCw,{className:e.cn("size-3.5 opacity-50",o&&"animate-spin")})})]}),t.jsxs(e.CommandList,{children:[t.jsxs(e.CommandEmpty,{children:["No ",r==null?void 0:r.toLowerCase()," found."]}),t.jsx(e.CommandGroup,{children:g==null?void 0:g.map(c=>t.jsx(e.CommandItem,{className:"overflow-x-auto",value:c.name,onSelect:x=>j(x,c.id),children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(e.Check,{className:e.cn("size-4",n===c.id?"opacity-100":"opacity-0")}),t.jsx("div",{title:c.name,children:c.name})]})},c.id))})]})]})})]})}function R({triggerButtonClassName:r,variant:a="ghost"}){const[n,i]=C.useState(!1),o=e.useDashboardStore(d=>{var l;return(l=d.dashboard)==null?void 0:l.id}),u=e.useDashboardStore(d=>{var l;return(l=d.dashboard)==null?void 0:l.title});return o?t.jsxs(t.Fragment,{children:[t.jsx(e.IconButton,{tooltip:"Schedule Dashboard",className:e.cn("h-7 p-2",r),buttonProps:{variant:a},onClick:()=>i(!0),children:t.jsx(e.Clock,{className:"size-4"})}),t.jsx(e.EmailScheduleDialog,{open:n,onOpenChange:i,dashboardId:o,dashboardName:u})]}):null}function w(r,a){C.useEffect(()=>(r&&a&&(window.__SEMAPHOR_PRINT_STATE__={...a}),()=>{r&&window.__SEMAPHOR_PRINT_STATE__&&delete window.__SEMAPHOR_PRINT_STATE__}),[r,a])}function k(){var u,d;const{quotasQuery:r,usageQuery:a}=e.useAlertQuotas(),n=((u=r.data)==null?void 0:u.quotas)||[],i=((d=a.data)==null?void 0:d.usage)||[],o=new Map(i.map(l=>[l.tenantId||"org",l]));return t.jsxs("div",{className:"space-y-4 p-4",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h2",{className:"text-xl font-semibold",children:"Alert Quotas"}),t.jsx(e.Button,{variant:"outline",size:"sm",onClick:()=>{r.refetch(),a.refetch()},children:"Refresh"})]}),r.isLoading||a.isLoading?t.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading quota usage..."}):null,t.jsx("div",{className:"overflow-hidden rounded-lg border",children:t.jsxs("table",{className:"w-full text-sm",children:[t.jsx("thead",{className:"bg-muted/40",children:t.jsxs("tr",{children:[t.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Tenant"}),t.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Active Alerts"}),t.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Max Active"}),t.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Min Cadence"}),t.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Max Context Sources"})]})}),t.jsx("tbody",{children:n.map(l=>{const s=l.tenantId||"org",m=o.get(s);return t.jsxs("tr",{className:"border-t",children:[t.jsx("td",{className:"px-3 py-2",children:s}),t.jsx("td",{className:"px-3 py-2",children:(m==null?void 0:m.activeAlerts)??0}),t.jsx("td",{className:"px-3 py-2",children:l.policy.maxActiveAlerts}),t.jsxs("td",{className:"px-3 py-2",children:[l.policy.minCadenceMinutes," min"]}),t.jsx("td",{className:"px-3 py-2",children:l.policy.maxContextSources})]},s)})})]})})]})}exports.AlertCreationDialog=e.AlertCreationDialog;exports.AlertManagementPage=e.AlertManagementPage;exports.AlertsApiError=e.AlertsApiError;exports.CALCULATED_FIELD_ENTITY_MARKER=e.CALCULATED_FIELD_ENTITY_MARKER;exports.CardAlertIndicator=e.CardAlertIndicator;exports.CardSummary=e.CardSummary;exports.DATE_FORMAT_VALUES=e.DATE_FORMAT_VALUES;exports.Dashboard=e.Dashboard;exports.DashboardExportDialog=e.DashboardExportDialog;exports.DashboardWC=e.DashboardWC;exports.EmailScheduleDialog=e.EmailScheduleDialog;exports.ExportError=e.ExportError;exports.PivotMarkerEnum=e.PivotMarkerEnum;exports.ResourceType=e.ResourceType;exports.SemaphorContextProvider=e.SemaphorContextProvider;exports.SemaphorDataProvider=e.SemaphorQueryClient;exports.SemaphorQueryClient=e.SemaphorQueryClient;exports.ShareDialog=e.ShareDialog;exports.SummaryCard=e.SummaryCard;exports.Surfboard=e.DashboardPlus;exports.backtestAlert=e.backtestAlert;exports.cancelExport=e.cancelExport;exports.cloneDeep=e.cloneDeep;exports.createAlert=e.createAlert;exports.createEmptyKpiConfig=e.createEmptyKpiConfig;exports.createExport=e.createExport;exports.createSqlGenConfig=e.createSqlGenConfig;exports.deleteAlert=e.deleteAlert;exports.downloadPdf=e.downloadPdf;exports.emitDashboardLoad=e.emitDashboardLoad;exports.emitDashboardUnload=e.emitDashboardUnload;exports.fmt=e.fmt;exports.formatFileSize=e.formatFileSize;exports.getAlert=e.getAlert;exports.getAlertContextSources=e.getAlertContextSources;exports.getAlertHistory=e.getAlertHistory;exports.getAlertQuotaUsage=e.getAlertQuotaUsage;exports.getAlertRunDeliveries=e.getAlertRunDeliveries;exports.getAlertRunSteps=e.getAlertRunSteps;exports.getAlertRuns=e.getAlertRuns;exports.getAlertState=e.getAlertState;exports.getColumnDataType=e.getColumnDataType;exports.getDownloadUrl=e.getDownloadUrl;exports.getExportStatus=e.getExportStatus;exports.getExports=e.getExports;exports.getFilterValueType=e.getFilterValueType;exports.getFormattedTableNameForQuery=e.getFormattedTableNameForQuery;exports.getQualifiedTableName=e.getQualifiedTableName;exports.getSql=e.getSql;exports.interpretAlertContext=e.interpretAlertContext;exports.invalidateToken=e.invalidateToken;exports.isBooleanDataType=e.isBooleanDataType;exports.isCalculatedDimension=e.isCalculatedDimension;exports.isCalculatedField=e.isCalculatedField;exports.isCalculatedMetric=e.isCalculatedMetric;exports.isColumnInSqlGen=e.isColumnInSqlGen;exports.isDateDataType=e.isDateDataType;exports.isExportComplete=e.isExportComplete;exports.isExportInProgress=e.isExportInProgress;exports.isNumberDataType=e.isNumberDataType;exports.isTextDataType=e.isTextDataType;exports.listAlertQuotas=e.listAlertQuotas;exports.listAlerts=e.listAlerts;exports.previewAlertDeliverable=e.previewAlertDeliverable;exports.resolveDataType=e.resolveDataType;exports.resolveDatamodelName=e.resolveDatamodelName;exports.triggerAlertNow=e.triggerAlertNow;exports.updateAlert=e.updateAlert;exports.updateAlertContextSources=e.updateAlertContextSources;exports.updateAlertQuota=e.updateAlertQuota;exports.useActiveExports=e.useActiveExports;exports.useAddNewFrame=e.useAddNewFrame;exports.useAlertActions=e.useAlertActions;exports.useAlertBacktest=e.useAlertBacktest;exports.useAlertContextBuilder=e.useAlertContextBuilder;exports.useAlertDeliveries=e.useAlertDeliveries;exports.useAlertDetail=e.useAlertDetail;exports.useAlertDraft=e.useAlertDraft;exports.useAlertFilters=e.useAlertFilters;exports.useAlertHistory=e.useAlertHistory;exports.useAlertQuotas=e.useAlertQuotas;exports.useAlertRuns=e.useAlertRuns;exports.useAlertState=e.useAlertState;exports.useAlertStore=e.useAlertStore;exports.useAlerts=e.useAlerts;exports.useAlertsBootstrap=e.useAlertsBootstrap;exports.useAlertsById=e.useAlertsById;exports.useAlertsForCard=e.useAlertsForCard;exports.useCard=e.useCard;exports.useCardAlertMap=e.useCardAlertMap;exports.useCardSummary=e.useCardSummary;exports.useCurrentActiveCard=e.useCurrentActiveCard;exports.useCurrentCardConfig=e.useCurrentCardConfig;exports.useCurrentSheetActiveCards=e.useCurrentSheetActiveCards;exports.useDashboardActions=e.useDashboardActions;exports.useDashboardById=e.useDashboardById;exports.useDashboardQuery=e.useDashboardQuery;exports.useDashboardStore=e.useDashboardStore;exports.useDashboardSummary=e.useDashboardSummary;exports.useDataColumns=e.useDataColumns;exports.useDateFilterHook=e.useDateFilterHook;exports.useEditorActions=e.useEditorActions;exports.useEditorAside=e.useEditorAside;exports.useEditorStore=e.useEditorStore;exports.useExportActions=e.useExportActions;exports.useExportStore=e.useExportStore;exports.useInProgressExportsCount=e.useInProgressExportsCount;exports.useManagementStore=e.useManagementStore;exports.useResourceManagement=e.useResourceManagement;exports.useSelectedAlertId=e.useSelectedAlertId;exports.useTextFilterHook=e.useTextFilterHook;exports.DEFAULT_CALENDAR_CONTEXT=D.DEFAULT_CALENDAR_CONTEXT;exports.DEFAULT_SEMANTIC_DOMAIN_ACCESS=D.DEFAULT_SEMANTIC_DOMAIN_ACCESS;exports.EMPTY_SELECTION=D.EMPTY_SELECTION;exports.CalendarPreferencesDialog=E.CalendarPreferencesDialog;exports.DashboardSummarySettingsDialog=E.DashboardSummarySettingsDialog;exports.ResourceManagementPanel=v.ResourceManagementPanel;exports.useDebouncedDirtyCheck=P.useDebouncedDirtyCheck;exports.AdvancedModeToggle=p.AdvancedModeToggle;exports.ExportNotificationItem=p.ExportNotificationItem;exports.ExportNotificationList=p.ExportNotificationList;exports.NotificationBell=p.NotificationBell;exports.UnsavedChangesAlert=p.UnsavedChangesAlert;exports.VisualEditingControls=p.VisualEditingControls;exports.useExportPolling=p.useExportPolling;exports.useExportRecovery=p.useExportRecovery;exports.usePristineSnapshotInitializer=p.usePristineSnapshotInitializer;exports.normalizeDashboardForDirtyCheck=S.normalizeDashboardForDirtyCheck;exports.serializeDashboardForDirtyCheck=S.serializeDashboardForDirtyCheck;exports.Combobox=F;exports.ScheduleDashboard=R;exports.TenantQuotaPage=k;exports.Visual=M;exports.useExposePrintState=w;
|
package/dist/index.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { V as D, W as _, Y as I, Z as M, _ as w, $ as F, a0 as R, u as C, a1 as y, a2 as k, P as L, k as B, B as E, c as f, a3 as O, l as Q, m as U, n as z, a4 as N, a5 as q, o as V, p as H, q as j, r as W, s as G, a6 as K, a7 as Y, a8 as $ } from "./chunks/index-SLQXKi01.js";
|
|
2
|
+
import { aS as pe, aR as he, bA as be, aU as fe, aT as Ae, ar as Ce, aV as xe, D as ge, ap as ye, aj as De, bG as Ee, aZ as Ne, ab as Se, ae as ve, ae as Te, af as Pe, aq as _e, a as Ie, bs as Me, bF as we, am as Fe, bj as Re, bg as ke, bB as Le, b4 as Be, bl as Oe, ao as Qe, ak as Ue, al as ze, a_ as qe, bJ as Ve, bi as He, bu as je, bp as We, by as Ge, bq as Ke, br as Ye, bo as $e, bn as Xe, b6 as Je, bE as Ze, bD as ea, bC as aa, b5 as sa, b9 as ta, ba as ra, b3 as oa, bt as na, an as la, b2 as ia, aX as da, aY as ca, aW as ua, b7 as ma, b1 as pa, bI as ha, bH as ba, b0 as fa, a$ as Aa, bx as Ca, bh as xa, bw as ga, bb as ya, b8 as Da, bm as Ea, bk as Na, bv as Sa, bz as va, ay as Ta, av as Pa, aK as _a, aI as Ia, aH as Ma, aG as wa, aC as Fa, aQ as Ra, aP as ka, aF as La, aE as Ba, aD as Oa, aJ as Qa, aA as Ua, aB as za, aL as qa, aN as Va, ai as Ha, aM as ja, at as Wa, bd as Ga, bf as Ka, be as Ya, N as $a, ah as Xa, aa as Ja, as as Za, au as es, ac as as, M as ss, bc as ts, U as rs, ax as os, aw as ns, az as ls, a9 as is, ag as ds, aO as cs, ad as us } from "./chunks/index-SLQXKi01.js";
|
|
3
3
|
import { DEFAULT_CALENDAR_CONTEXT as ps, DEFAULT_SEMANTIC_DOMAIN_ACCESS as hs, EMPTY_SELECTION as bs } from "./types/index.js";
|
|
4
|
-
import { C as As, D as Cs } from "./chunks/dashboard-summary-settings-dialog-
|
|
5
|
-
import { jsx as e, jsxs as n, Fragment as
|
|
4
|
+
import { C as As, D as Cs } from "./chunks/dashboard-summary-settings-dialog-Dd-wAZsI.js";
|
|
5
|
+
import { jsx as e, jsxs as n, Fragment as X } from "react/jsx-runtime";
|
|
6
6
|
import * as b from "react";
|
|
7
7
|
import { useMemo as J, useState as Z, useEffect as ee } from "react";
|
|
8
|
-
import { ResourceManagementPanel as gs } from "./chunks/resource-management-panel-
|
|
8
|
+
import { ResourceManagementPanel as gs } from "./chunks/resource-management-panel-CJXZMjqO.js";
|
|
9
9
|
import { u as Ds } from "./chunks/use-debounced-dirty-check-BwAbnX_5.js";
|
|
10
10
|
import "react-dom";
|
|
11
|
-
import { A as Ns, a as Ss, E as vs, N as Ts, U as Ps, V as _s, u as
|
|
12
|
-
import { n as
|
|
11
|
+
import { A as Ns, a as Ss, E as vs, N as Ts, U as Ps, V as _s, u as Is, b as Ms, c as ws } from "./chunks/notification-bell-D83sUTTI.js";
|
|
12
|
+
import { n as Rs, s as ks } from "./chunks/normalize-dashboard-for-dirty-check-Bn27S0PN.js";
|
|
13
13
|
function ne(a) {
|
|
14
14
|
const { displayPreferences: s, ...i } = a, d = {
|
|
15
15
|
...i,
|
|
16
16
|
id: a.dashboardId
|
|
17
17
|
// override the id to the dashboard id so that the dashboard is not loaded
|
|
18
18
|
};
|
|
19
|
-
return /* @__PURE__ */ e(D, { FallbackComponent: _, children: /* @__PURE__ */ n(
|
|
20
|
-
/* @__PURE__ */ e(
|
|
21
|
-
/* @__PURE__ */ e(
|
|
19
|
+
return /* @__PURE__ */ e(D, { FallbackComponent: _, children: /* @__PURE__ */ n(I, { dashboardProps: d, children: [
|
|
20
|
+
/* @__PURE__ */ e(M, { componentType: "visual", componentId: a.cardId }),
|
|
21
|
+
/* @__PURE__ */ e(w, { children: /* @__PURE__ */ e(F, { displayPreferences: s, children: /* @__PURE__ */ e(R, { type: "visual", ...d, children: /* @__PURE__ */ e(ae, { cardId: a.cardId }) }) }) })
|
|
22
22
|
] }) });
|
|
23
23
|
}
|
|
24
24
|
function ae({ cardId: a }) {
|
|
@@ -106,9 +106,9 @@ function le({
|
|
|
106
106
|
{
|
|
107
107
|
className: "w-full p-0",
|
|
108
108
|
style: { minWidth: S },
|
|
109
|
-
children: /* @__PURE__ */ n(
|
|
109
|
+
children: /* @__PURE__ */ n(U, { children: [
|
|
110
110
|
/* @__PURE__ */ n("div", { className: "flex h-9 items-center justify-between border-b pr-1", children: [
|
|
111
|
-
/* @__PURE__ */ e(
|
|
111
|
+
/* @__PURE__ */ e(z, { className: "h-9", placeholder: "Search..." }),
|
|
112
112
|
/* @__PURE__ */ e(N, { className: "h-7", onClick: c, children: /* @__PURE__ */ e(
|
|
113
113
|
q,
|
|
114
114
|
{
|
|
@@ -119,8 +119,8 @@ function le({
|
|
|
119
119
|
}
|
|
120
120
|
) })
|
|
121
121
|
] }),
|
|
122
|
-
/* @__PURE__ */ n(
|
|
123
|
-
/* @__PURE__ */ n(
|
|
122
|
+
/* @__PURE__ */ n(V, { children: [
|
|
123
|
+
/* @__PURE__ */ n(H, { children: [
|
|
124
124
|
"No ",
|
|
125
125
|
a == null ? void 0 : a.toLowerCase(),
|
|
126
126
|
" found."
|
|
@@ -163,7 +163,7 @@ function ie({
|
|
|
163
163
|
var o;
|
|
164
164
|
return (o = c.dashboard) == null ? void 0 : o.title;
|
|
165
165
|
});
|
|
166
|
-
return r ? /* @__PURE__ */ n(
|
|
166
|
+
return r ? /* @__PURE__ */ n(X, { children: [
|
|
167
167
|
/* @__PURE__ */ e(
|
|
168
168
|
N,
|
|
169
169
|
{
|
|
@@ -194,7 +194,7 @@ function de(a, s) {
|
|
|
194
194
|
}
|
|
195
195
|
function ce() {
|
|
196
196
|
var l, c;
|
|
197
|
-
const { quotasQuery: a, usageQuery: s } =
|
|
197
|
+
const { quotasQuery: a, usageQuery: s } = $(), i = ((l = a.data) == null ? void 0 : l.quotas) || [], d = ((c = s.data) == null ? void 0 : c.usage) || [], r = new Map(d.map((o) => [o.tenantId || "org", o]));
|
|
198
198
|
return /* @__PURE__ */ n("div", { className: "space-y-4 p-4", children: [
|
|
199
199
|
/* @__PURE__ */ n("div", { className: "flex items-center justify-between", children: [
|
|
200
200
|
/* @__PURE__ */ e("h2", { className: "text-xl font-semibold", children: "Alert Quotas" }),
|
|
@@ -262,37 +262,37 @@ export {
|
|
|
262
262
|
gs as ResourceManagementPanel,
|
|
263
263
|
Se as ResourceType,
|
|
264
264
|
ie as ScheduleDashboard,
|
|
265
|
-
|
|
265
|
+
I as SemaphorContextProvider,
|
|
266
266
|
ve as SemaphorDataProvider,
|
|
267
267
|
Te as SemaphorQueryClient,
|
|
268
268
|
Pe as ShareDialog,
|
|
269
269
|
_e as SummaryCard,
|
|
270
|
-
|
|
270
|
+
Ie as Surfboard,
|
|
271
271
|
ce as TenantQuotaPage,
|
|
272
272
|
Ps as UnsavedChangesAlert,
|
|
273
273
|
ne as Visual,
|
|
274
274
|
_s as VisualEditingControls,
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
275
|
+
Me as backtestAlert,
|
|
276
|
+
we as cancelExport,
|
|
277
|
+
Fe as cloneDeep,
|
|
278
|
+
Re as createAlert,
|
|
279
279
|
ke as createEmptyKpiConfig,
|
|
280
280
|
Le as createExport,
|
|
281
281
|
Be as createSqlGenConfig,
|
|
282
282
|
Oe as deleteAlert,
|
|
283
283
|
Qe as downloadPdf,
|
|
284
|
-
|
|
285
|
-
|
|
284
|
+
Ue as emitDashboardLoad,
|
|
285
|
+
ze as emitDashboardUnload,
|
|
286
286
|
qe as fmt,
|
|
287
|
-
|
|
288
|
-
|
|
287
|
+
Ve as formatFileSize,
|
|
288
|
+
He as getAlert,
|
|
289
289
|
je as getAlertContextSources,
|
|
290
290
|
We as getAlertHistory,
|
|
291
291
|
Ge as getAlertQuotaUsage,
|
|
292
292
|
Ke as getAlertRunDeliveries,
|
|
293
293
|
Ye as getAlertRunSteps,
|
|
294
|
-
|
|
295
|
-
|
|
294
|
+
$e as getAlertRuns,
|
|
295
|
+
Xe as getAlertState,
|
|
296
296
|
Je as getColumnDataType,
|
|
297
297
|
Ze as getDownloadUrl,
|
|
298
298
|
ea as getExportStatus,
|
|
@@ -315,7 +315,7 @@ export {
|
|
|
315
315
|
Aa as isTextDataType,
|
|
316
316
|
Ca as listAlertQuotas,
|
|
317
317
|
xa as listAlerts,
|
|
318
|
-
|
|
318
|
+
Rs as normalizeDashboardForDirtyCheck,
|
|
319
319
|
ga as previewAlertDeliverable,
|
|
320
320
|
ya as resolveDataType,
|
|
321
321
|
Da as resolveDatamodelName,
|
|
@@ -327,29 +327,29 @@ export {
|
|
|
327
327
|
Ta as useActiveExports,
|
|
328
328
|
Pa as useAddNewFrame,
|
|
329
329
|
_a as useAlertActions,
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
330
|
+
Ia as useAlertBacktest,
|
|
331
|
+
Ma as useAlertContextBuilder,
|
|
332
|
+
wa as useAlertDeliveries,
|
|
333
|
+
Fa as useAlertDetail,
|
|
334
|
+
Ra as useAlertDraft,
|
|
335
335
|
ka as useAlertFilters,
|
|
336
336
|
La as useAlertHistory,
|
|
337
|
-
|
|
337
|
+
$ as useAlertQuotas,
|
|
338
338
|
Ba as useAlertRuns,
|
|
339
339
|
Oa as useAlertState,
|
|
340
340
|
Qa as useAlertStore,
|
|
341
|
-
|
|
342
|
-
|
|
341
|
+
Ua as useAlerts,
|
|
342
|
+
za as useAlertsBootstrap,
|
|
343
343
|
qa as useAlertsById,
|
|
344
|
-
|
|
345
|
-
|
|
344
|
+
Va as useAlertsForCard,
|
|
345
|
+
Ha as useCard,
|
|
346
346
|
ja as useCardAlertMap,
|
|
347
347
|
Wa as useCardSummary,
|
|
348
348
|
Ga as useCurrentActiveCard,
|
|
349
349
|
Ka as useCurrentCardConfig,
|
|
350
350
|
Ya as useCurrentSheetActiveCards,
|
|
351
|
-
|
|
352
|
-
|
|
351
|
+
$a as useDashboardActions,
|
|
352
|
+
Xa as useDashboardById,
|
|
353
353
|
Ja as useDashboardQuery,
|
|
354
354
|
C as useDashboardStore,
|
|
355
355
|
Za as useDashboardSummary,
|
|
@@ -360,13 +360,13 @@ export {
|
|
|
360
360
|
ts as useEditorAside,
|
|
361
361
|
rs as useEditorStore,
|
|
362
362
|
os as useExportActions,
|
|
363
|
-
|
|
364
|
-
|
|
363
|
+
Is as useExportPolling,
|
|
364
|
+
Ms as useExportRecovery,
|
|
365
365
|
ns as useExportStore,
|
|
366
366
|
de as useExposePrintState,
|
|
367
367
|
ls as useInProgressExportsCount,
|
|
368
368
|
is as useManagementStore,
|
|
369
|
-
|
|
369
|
+
ws as usePristineSnapshotInitializer,
|
|
370
370
|
ds as useResourceManagement,
|
|
371
371
|
cs as useSelectedAlertId,
|
|
372
372
|
us as useTextFilterHook
|