@deephaven/code-studio 0.27.1-beta.2 → 0.27.1-beta.3
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.
|
@@ -43,5 +43,5 @@ This note can be edited using **markdown** for styling.`;function U2(t){qs(t);co
|
|
|
43
43
|
`)),e}renderFormatRule(t,e){const n=`input-${t}-columnName`,s=`input-${t}-columnType`,i=`input-${t}-format`,o=this.getCachedColumnTypeOptions(),r=c=>this.handleFormatRuleChange(t,"columnName",c.target.value),l=()=>this.handleFormatRuleChange(t,"isNewRule",!1),a=c=>this.handleFormatRuleChange(t,"columnType",c.target.value),d=this.getRuleError(e);return T("fieldset",{className:"container-fluid format-rule-container",children:[T("div",{className:"form-row",children:[T("div",{className:"form-group col-7 mb-2",children:[h("label",{htmlFor:n,children:"Column Name"}),h("input",{id:n,className:z("form-control",{"is-invalid":d.hasColumnNameError}),"data-lpignore":!0,type:"text",value:e.columnName,onChange:r,onBlur:l})]}),T("div",{className:"form-group col mb-2",children:[h(W,{kind:"ghost",className:"btn-delete-format-rule float-right",tabIndex:-1,onClick:()=>this.handleFormatRuleDelete(t),icon:hn,tooltip:"Delete","aria-label":"Delete Format Rule"}),h("label",{htmlFor:s,children:"Column Type"}),h("select",{id:s,className:"custom-select",value:e.columnType,onChange:a,children:o})]})]}),h("div",{className:"form-row",children:T("div",{className:"form-group col-12 d-flex mb-2",children:[h("label",{className:"flex-shrink-0 col-form-label mr-3",htmlFor:i,children:"Formatting Rule"}),this.renderFormatRuleInput(t,e.columnType,i,e.format,d.hasFormatError)]})}),h("div",{className:"form-row",children:h("div",{className:"form-group col-12 d-flex mb-2",children:d.message&&h("p",{className:"text-danger",children:d.message})})})]},t)}renderFormatRuleInput(t,e,n,s,i){switch(_.getNormalizedType(e)){case _.dataType.DATETIME:return this.renderDateTimeFormatRuleInput(t,n,s,i);case _.dataType.DECIMAL:return this.renderDecimalFormatRuleInput(t,n,s,i);case _.dataType.INT:return this.renderIntegerFormatRuleInput(t,n,s,i);default:throw new Error(`Unrecognized column type: ${e}`)}}renderDateTimeFormatRuleInput(t,e,n,s){var a;const{showTimeZone:i,showTSeparator:o,timeZone:r}=this.state,l=(a=n.formatString)!=null?a:"";return T("select",{className:z("custom-select",{"is-invalid":s}),value:l,id:e,onChange:d=>{const c=st.makeFormat("",d.target.value,st.TYPE_GLOBAL);this.handleFormatRuleChange(t,"format",c)},children:[h("option",{value:"",disabled:!0,children:"Select format"},"default"),this.getCachedDateTimeFormatOptions(r,i,o)]})}renderIntegerFormatRuleInput(t,e,n,s){var o;const i=(o=n.formatString)!=null?o:"";return h("input",{className:z("form-control","flex-grow-1",{"is-invalid":s}),"data-lpignore":!0,id:e,placeholder:Qe.DEFAULT_FORMAT_STRING,type:"text",value:i,onChange:r=>{const l=Qe.makeFormat("",r.target.value,Qe.TYPE_GLOBAL,void 0);this.handleFormatRuleChange(t,"format",l)}})}renderDecimalFormatRuleInput(t,e,n,s){var o;const i=(o=n.formatString)!=null?o:"";return h("input",{className:z("form-control","flex-grow-1",{"is-invalid":s}),"data-lpignore":!0,id:e,placeholder:_e.DEFAULT_FORMAT_STRING,type:"text",value:i,onChange:r=>{const l=_e.makeFormat("",r.target.value,_e.TYPE_GLOBAL,void 0);this.handleFormatRuleChange(t,"format",l)}})}render(){const{formatRulesChanged:t,formatSettings:e}=this.state,n=e.map((i,o)=>h(mt,{classNames:"fade",timeout:ze.transitionMs,onEnter:this.handleFormatRuleEntered,children:this.renderFormatRule(o,i)},i.id)),s=h(W,{kind:"ghost",className:"mb-3",onClick:this.handleFormatRuleCreate,ref:this.addFormatRuleButtonRef,icon:Gs,children:"Add New Rule"});return T("div",{className:"app-settings-formatting-section",ref:this.containerRef,children:[h("div",{children:"Default formatting for matched column names"}),h("div",{className:"app-settings-menu-description mb-3",children:"Applies a formatting rule to all columns that match a specified name and type."}),h(bf,{appear:t,enter:t,exit:t,children:n}),s]})}};let Dc=_g;Dc.defaultProps={scrollTo:()=>{},defaults:{defaultDateTimeFormat:st.DEFAULT_DATETIME_FORMAT_STRING,defaultDecimalFormatOptions:{defaultFormatString:_e.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:Qe.DEFAULT_FORMAT_STRING},showTimeZone:!1,showTSeparator:!0,timeZone:st.DEFAULT_TIME_ZONE_ID}};Dc.inputDebounceTime=250;const Ty=t=>({formatter:Pm(t),defaultDateTimeFormat:Om(t),defaultDecimalFormatOptions:Lm(t),defaultIntegerFormatOptions:Am(t),showTimeZone:Hm(t),showTSeparator:Vm(t),truncateNumbersWithPound:Um(t),timeZone:or(t),settings:Rt(t)}),Ey=It(Ty,{saveSettings:Yl})(Dc),ms=class extends w.exports.Component{constructor(t){super(t),this.handleClose=this.handleClose.bind(this),this.handleScrollTo=this.handleScrollTo.bind(this),this.handleSectionToggle=this.handleSectionToggle.bind(this),this.handleExportSupportLogs=this.handleExportSupportLogs.bind(this),this.menuContentRef=X.createRef(),this.state={expandedSectionKey:ms.FORMATTING_SECTION_KEY}}static focusFirstInputInContainer(t){const e=t==null?void 0:t.querySelector("input, select, textarea");e&&e.focus()}componentDidMount(){ms.focusFirstInputInContainer(this.menuContentRef.current)}isSectionExpanded(t){const{expandedSectionKey:e}=this.state;return e===t}handleScrollTo(t,e){var n;(n=this.menuContentRef.current)==null||n.scrollTo(t,e)}handleSectionToggle(t){this.setState(e=>({expandedSectionKey:e.expandedSectionKey===t?void 0:t}))}handleClose(){const{onDone:t}=this.props;t()}handleExportSupportLogs(){const{serverConfigValues:t}=this.props;Sy(void 0,Object.fromEntries(t))}render(){const t="0.27.0",e="https://github.com/deephaven/web-client-ui/",n="https://deephaven.io/core/docs/",{serverConfigValues:s}=this.props,i=s.get("barrage.version"),o=s.get("java.version"),r=s.get("deephaven.version"),l=(a,d)=>T(Te,{children:[h("div",{children:a}),h("div",{children:d})]});return T("div",{className:"app-settings-menu",children:[T("header",{className:"app-settings-menu-header",children:[h("div",{className:"flex-spacer"}),h(W,{kind:"ghost",className:"btn-close-settings-menu",onClick:this.handleClose,icon:h(ee,{icon:oo,transform:"grow-4"}),tooltip:"Close"})]}),T("div",{className:"app-settings-menu-content",ref:this.menuContentRef,children:[h("h5",{children:"Settings"}),h("hr",{className:"my-0"}),h(Yo,{sectionKey:ms.FORMATTING_SECTION_KEY,isExpanded:this.isSectionExpanded(ms.FORMATTING_SECTION_KEY),title:T(Te,{children:[h(ee,{icon:jC,transform:"grow-4",className:"mr-2"}),"Default Formatting & Time zone"]}),onToggle:this.handleSectionToggle,children:h(ly,{})}),h(Yo,{sectionKey:ms.COLUMN_SPECIFIC_SECTION_KEY,isExpanded:this.isSectionExpanded(ms.COLUMN_SPECIFIC_SECTION_KEY),title:T(Te,{children:[h(ee,{icon:OC,transform:"grow-4",className:"mr-2"}),"Column Specific Formatting Rules"]}),onToggle:this.handleSectionToggle,children:h(Ey,{scrollTo:this.handleScrollTo})}),h(Yo,{sectionKey:ms.SHORTCUT_SECTION_KEY,isExpanded:this.isSectionExpanded(ms.SHORTCUT_SECTION_KEY),title:T(Te,{children:[h(ee,{icon:zC,transform:"grow-2"})," ","Keyboard Shortcuts"]}),onToggle:this.handleSectionToggle,children:h(py,{})}),T("div",{className:"app-settings-footer",children:[T("div",{className:"app-settings-footer-section",children:[T("div",{className:"app-settings-footer-item",children:[h("div",{className:"font-weight-bold",children:"Support"}),T("div",{children:["GitHub:\xA0",h("a",{href:e,className:"custom-link",target:"_blank",rel:"noopener noreferrer",children:e})]}),h(W,{kind:"tertiary",className:"mt-2 py-2",onClick:this.handleExportSupportLogs,children:"Export Logs"})]}),T("div",{className:"app-settings-footer-item",children:[h("div",{className:"font-weight-bold",children:"Documentation"}),h("a",{target:"_blank",rel:"noreferrer noopener",href:n,className:"custom-link",children:n})]}),T("div",{className:"app-settings-footer-item",children:[h("div",{className:"font-weight-bold",children:"Version"}),T("span",{className:"d-inline-block text-muted",children:[r," ",h(ee,{icon:xC}),T(Ye,{interactive:!0,children:[T("div",{className:"detailed-server-config",children:[l("Engine Version",r),l("Web UI Version",t),l("Java Version",o),l("Barrage Version",i)]}),h(Pl,{tooltip:"Copy version numbers",copy:`Engine Version: ${r}
|
|
44
44
|
Web UI Version: ${t}
|
|
45
45
|
Java Version: ${o}
|
|
46
|
-
Barrage Version: ${i}`,children:"Copy Versions"})]})]})]}),h("div",{className:"app-settings-footer-item",children:h(ay,{})})]}),h("div",{className:"app-settings-footer-section",children:h("div",{className:"logo",children:h("a",{target:"_blank",rel:"noreferrer noopener",href:"https://deephaven.io",className:"d-inline-block custom-link p-1",children:h("img",{src:yg,alt:"Deephaven Data Labs",width:"230px"})})})})]})]})]})}};let bo=ms;bo.defaultProps={onDone:()=>{}};bo.FORMATTING_SECTION_KEY="SettingsMenu.formatting";bo.COLUMN_SPECIFIC_SECTION_KEY="SettingsMenu.columnFormatting";bo.APPLICATION_SECTION_KEY="ApplicationMenu.settings";bo.SHORTCUT_SECTION_KEY="SettingsMenu.shortcuts";const pu=10;function Gi(t){const{forwardedProps:{menuItem:{action:e,title:n,disabled:s},iconElement:i,displayShortcut:o,isMouseSelected:r,isKeyboardSelected:l,closeMenu:a}}=t,d=w.exports.useRef(),c=w.exports.useRef(),u=w.exports.useRef(null),[m,p]=w.exports.useState(!1),g=w.exports.useCallback(C=>{d.current!=null&&c.current!=null&&u.current&&(Math.abs(d.current-C.clientX)>=pu||Math.abs(c.current-C.clientY)>=pu)&&(p(!0),window.removeEventListener("mousemove",g),a(),e(C),u.current=null)},[e,a]);function f(C){d.current=C.clientX,c.current=C.clientY,u.current=C.target,window.addEventListener("mousemove",g)}function b(C){u.current===C.target&&(p(!0),a(),e(),window.removeEventListener("mousemove",g)),u.current=null}return w.exports.useEffect(function(){return function(){return window.removeEventListener("mousemove",g)}},[g]),T("button",{type:"button",className:z("btn-context-menu",{disabled:s},{active:r&&!s},{"keyboard-active":l&&!s}),onMouseDown:f,onMouseUp:b,disabled:m,children:[h("span",{className:z("icon"),children:i}),h("span",{className:"title",children:n}),h("span",{className:"shortcut",children:o})]})}function Mc(t){const{handleControlSelect:e,handleToolSelect:n,onClearFilter:s}=t,i=w.exports.useMemo(()=>[{title:"Input Filter",icon:db,menuElement:h(Gi,{}),action:o=>{e(wn.INPUT_FILTER,o)},order:10},{title:"Dropdown Filter",icon:Hu,menuElement:h(Gi,{}),action:o=>{e(wn.DROPDOWN_FILTER,o)},order:15},{title:"Markdown Widget",icon:HC,menuElement:h(Gi,{}),action:o=>{e(wn.MARKDOWN,o)},order:20},{title:"Filter Sets",icon:za,menuElement:h(Gi,{}),action:o=>{e(wn.FILTER_SET_MANAGER,o)},order:25},{disabled:!0,menuElement:h("div",{className:"context-menu-group-header",children:"Tools"}),order:30},{title:"Linker",icon:Ed,action:()=>{n(Yt.LINKER)},order:40,shortcut:bs.LINKER},{disabled:!0,menuElement:h("div",{className:"context-menu-group-header",children:"Actions"}),order:50},{title:"Clear All Filters",icon:ob,action:()=>{s()},order:60,shortcut:an.TABLE.CLEAR_ALL_FILTERS}],[e,n,s]);return h(Fn,{popperClassName:"controls-menu-popper",actions:i})}Mc.propTypes={handleControlSelect:D.exports.func,handleToolSelect:D.exports.func,onClearFilter:D.exports.func};Mc.defaultProps={handleControlSelect:()=>{},handleToolSelect:()=>{},onClearFilter:()=>{}};Gi.propTypes={forwardedProps:D.exports.shape({iconElement:D.exports.node,displayShortcut:D.exports.string,isMouseSelected:D.exports.bool.isRequired,isKeyboardSelected:D.exports.bool.isRequired,closeMenu:D.exports.func.isRequired,menuItem:D.exports.shape({action:D.exports.func,title:D.exports.string,disabled:D.exports.bool}).isRequired})};Gi.defaultProps={forwardedProps:null};const yy=Ks(Eg,null),Iy={layoutStorage:yy},Ry=t=>t.layoutStorage,Dy=t=>t.serverConfigValues;Object.entries(Iy).map(([t,e])=>ho.register(t,e));const gu=10;function My(t){const{onExportLayout:e,onImportLayout:n,onResetLayout:s,onSelect:i,widgets:o=[]}=t,[r,l]=w.exports.useState(!1),[a,d]=w.exports.useState(""),c=w.exports.useRef(null),u=w.exports.useRef(),m=w.exports.useCallback((y,E)=>{y!=null&&i(y,E)},[i]),p=w.exports.useCallback(y=>{d(y.target.value)},[]),g=w.exports.useCallback(y=>{u.current!=null&&(Math.abs(u.current.x-y.clientX)>=gu||Math.abs(u.current.y-y.clientY)>=gu)&&(l(!0),window.removeEventListener("mousemove",g),m(u.current.widget,y),u.current=void 0)},[u,m]),f=w.exports.useCallback((y,E)=>{u.current={x:y.clientX,y:y.clientY,widget:E},window.addEventListener("mousemove",g)},[g]),b=w.exports.useCallback((y,E)=>{var I;window.removeEventListener("mousemove",g),((I=u.current)==null?void 0:I.widget)===E&&(l(!0),m(E)),u.current=void 0},[g,u,m]),C=w.exports.useMemo(()=>o.filter(y=>{var E;return a?(E=y.name)==null?void 0:E.toLowerCase().includes(a.toLowerCase()):!0}),[a,o]).sort((y,E)=>{var I,R,N;return(N=(R=y.name)==null?void 0:R.localeCompare((I=E.name)!=null?I:""))!=null?N:0}),S=w.exports.useMemo(()=>C.map(y=>{var E,I;return h("li",{children:T(W,{kind:"ghost","data-testid":`panel-list-item-${(E=y.name)!=null?E:""}-button`,onMouseDown:R=>{f(R,y)},onMouseUp:R=>{b(R,y)},onKeyDown:R=>{(R.key==="Enter"||R.key===" ")&&m(y)},disabled:r,onClick:()=>{},children:[h(lm,{type:y.type})," ",(I=y.name)!=null?I:""]})},y.name)}),[C,r,f,b,m]),v=w.exports.useMemo(()=>S.length===0?h("span",{children:"No bound variables found."}):null,[S]);return T("div",{className:"widget-list-container d-flex flex-column",children:[h("div",{className:"widget-list-header",children:h(ws,{value:a,placeholder:"Find Table, Plot or Widget",onChange:p,ref:c})}),T("ul",{className:"widget-list flex-grow-1",children:[v&&h("li",{className:"widget-list-message",children:v}),!v&&S]}),h("div",{children:h("hr",{})}),T("div",{className:"widget-list-footer",children:[T(W,{kind:"ghost",onClick:e,children:[T("div",{className:"fa-md fa-layers",children:[h(ee,{mask:Wa,icon:$c,transform:"right-5 down-5"}),h(ee,{icon:$c,transform:"right-8 down-6"})]}),"Export Layout"]}),T(W,{kind:"ghost",onClick:n,children:[T("div",{className:"fa-md fa-layers",children:[h(ee,{mask:Wa,icon:$a,transform:"right-5 down-5"}),h(ee,{icon:$a,transform:"right-8 down-6"})]}),"Import Layout"]}),h(W,{kind:"ghost",icon:hi,onClick:s,tooltip:"Reset Layout"})]})]})}const Ny=async(t,e,n)=>{let s,i,o,r;if(sl(e)?(s=e.settings,i=e.table,o=void 0,r=e.tableSettings):(s={},i="",o=e.figure,r={}),n!==void 0&&(n.tableSettings!=null&&(r=n.tableSettings),n.table!=null&&(i=n.table),n.figure!=null&&(o=n.figure),n.settings!=null&&(s={...s,...n.settings})),o!==void 0){const d={title:o,name:o,type:M.VariableType.FIGURE},c=await t.getObject(d);return eo.makeModel(s,c)}const l={title:o,name:i,type:M.VariableType.TABLE},a=await t.getObject(l);return ie.applyTableSettings(a,r,or(jl.getState())),eo.makeModelFromSettings(s,a)},Fy=async(t,e,n=M.VariableType.TABLE)=>{const{table:s}=e,i={title:s,name:s,type:n},o=await t.getObject(i);return dc.makeModel(o)};function xy({onAutoFillClick:t=()=>{}}){return T("div",{className:"empty-dashboard-container",children:[T("div",{className:"hint-container",children:[h(ee,{icon:Mu})," ",h("br",{}),"Use the panel list to add objects from a query."]}),T("div",{className:"empty-dashboard",children:[h("div",{className:"add-panels-hint",children:"Drag Panels Here"}),h(W,{kind:"tertiary",onClick:t,children:"Auto fill objects"})]})]})}function _y(t){return t.version===2}function ky(t){return Array.isArray(t)}const Zr=Z.module("UserLayoutUtils"),Oy={layoutConfig:[{type:"column",content:[{type:"row",height:40,content:[{type:"stack",content:[{type:"react-component",component:Wi.COMPONENT,title:Wi.TITLE,isClosable:!1},{type:"react-component",component:Ml.COMPONENT,title:Ml.TITLE,isClosable:!1}]},{type:"stack",width:25,content:[{type:"react-component",component:Il.COMPONENT,title:Il.TITLE,isClosable:!1},{type:"react-component",component:Rl.COMPONENT,title:Rl.TITLE,isClosable:!1}]}]},{type:"row",content:[{type:"stack",title:"Notebooks",content:[]}]}]}],links:[],filterSets:[],version:2},Ly={layoutConfig:[],links:[],filterSets:[],version:2};function kg(t){if(_y(t))return t;if(ky(t))return{layoutConfig:t,links:[],filterSets:[],version:2};throw new Error(`Unexpected layout import format: ${t}`)}async function Ay(t,e=!0){try{const n=await t.getLayouts();if(n.length>0)try{const s=await t.getLayout(n[0]);return kg(s)}catch(s){Zr.error("Unable to load layout",n[0],":",s),Zr.warn("No valid layouts found, falling back to default layout")}}catch(n){Zr.error("Unable to fetch layout list",n),Zr.warn("Falling back to default layout")}return e?Oy:Ly}function Py(t){const{filterSets:e,layoutConfig:n,links:s}=t;return{filterSets:e,layoutConfig:n,links:s,version:2}}const al={exportLayout:Py,getDefaultLayout:Ay,normalizeLayout:kg},Qr=Z.module("DownloadServiceWorkerUtils"),Og=class{static registerOnLoaded(){new URL("/ide/",window.location.href).origin===window.location.origin&&("serviceWorker"in navigator?window.addEventListener("load",()=>{const e=new URL("/ide/download/serviceWorker.js",window.location.href);navigator.serviceWorker.register(e).then(n=>{n.update(),Qr.info("Registering service worker on ",e,n)}).catch(n=>{Qr.error("Failed to register service worker",n)})}):Qr.info("Service worker is not supported."))}static async getServiceWorker(){if("serviceWorker"in navigator){const e=(await navigator.serviceWorker.getRegistrations()).find(n=>n.scope.endsWith(Og.DOWNLOAD_PATH));if(e&&e.active)return Qr.info("Download service worker is active."),e.active;throw new Error("Can not find download service worker.")}throw new Error("Download service worker is not available.")}static unregisterSW(){}};let Nl=Og;Nl.DOWNLOAD_PATH="/download/";const Lg={react:X},Hy=Sf(Lg),Vy=wf({requires:Hy}),Uy=vf.createRequires(Lg),By=Tf({requires:Uy}),$y=Z.module("PluginUtils");class pd{static loadComponentPlugin(e){if("".split(",").includes(e)){const o=X.lazy(()=>Df(()=>import(`./internal/${e}`),[])),r=X.forwardRef((l,a)=>h(w.exports.Suspense,{fallback:h("div",{children:"Loading Plugin..."}),children:h(o,{ref:a,...l})}));return r.pluginName=e,r.displayName="Local Plugin",r}const n=new URL("/ide/plugins/",`${window.location}`),s=new URL(`${e}.js`,n),i=X.forwardRef((o,r)=>h(Vy,{url:s,render:({err:l,Component:a})=>{if(l!=null&&l!==""){const d=`Error loading plugin ${e} from ${s} due to ${l}`;return $y.error(d),h("div",{className:"error-message",children:`${d}`})}return h(a,{ref:r,...o})}}));return i.pluginName=e,i.displayName="Plugin",i}static async loadModulePlugin(e){return await By(e)}static async loadJson(e){return new Promise((n,s)=>{const i=new XMLHttpRequest;i.addEventListener("load",()=>{try{const o=JSON.parse(i.responseText);n(o)}catch(o){s(o)}}),i.addEventListener("error",o=>{s(o)}),i.open("GET",e),i.send()})}}const Pt=Z.module("AppMainContainer");class Xo extends w.exports.Component{constructor(e){super(e),this.getDashboardPlugins=Se(n=>[...n.entries()].filter(([,s])=>s.DashboardPlugin!=null).map(([s,{DashboardPlugin:i}])=>h(i,{},s))),this.handleSettingsMenuHide=this.handleSettingsMenuHide.bind(this),this.handleSettingsMenuShow=this.handleSettingsMenuShow.bind(this),this.handleError=this.handleError.bind(this),this.handleControlSelect=this.handleControlSelect.bind(this),this.handleToolSelect=this.handleToolSelect.bind(this),this.handleClearFilter=this.handleClearFilter.bind(this),this.handleDataChange=this.handleDataChange.bind(this),this.handleAutoFillClick=this.handleAutoFillClick.bind(this),this.handleGoldenLayoutChange=this.handleGoldenLayoutChange.bind(this),this.handleLayoutConfigChange=this.handleLayoutConfigChange.bind(this),this.handleExportLayoutClick=this.handleExportLayoutClick.bind(this),this.handleImportLayoutClick=this.handleImportLayoutClick.bind(this),this.handleImportLayoutFiles=this.handleImportLayoutFiles.bind(this),this.handleLoadTablePlugin=this.handleLoadTablePlugin.bind(this),this.handleResetLayoutClick=this.handleResetLayoutClick.bind(this),this.handleWidgetMenuClick=this.handleWidgetMenuClick.bind(this),this.handleWidgetsMenuClose=this.handleWidgetsMenuClose.bind(this),this.handleWidgetSelect=this.handleWidgetSelect.bind(this),this.handlePaste=this.handlePaste.bind(this),this.hydrateChart=this.hydrateChart.bind(this),this.hydrateGrid=this.hydrateGrid.bind(this),this.hydratePandas=this.hydratePandas.bind(this),this.hydrateDefault=this.hydrateDefault.bind(this),this.openNotebookFromURL=this.openNotebookFromURL.bind(this),this.importElement=X.createRef(),this.state={contextActions:[{action:()=>{this.handleToolSelect(Yt.LINKER)},shortcut:bs.LINKER,isGlobal:!0},{action:()=>{this.sendClearFilter()},shortcut:an.TABLE.CLEAR_ALL_FILTERS,isGlobal:!0},{action:()=>{Pt.debug("Consume unhandled save shortcut")},shortcut:bs.SAVE,isGlobal:!0}],isPanelsMenuShown:!1,isSettingsMenuShown:!1,widgets:[]}}static handleWindowBeforeUnload(e){e.preventDefault(),e.returnValue=""}static hydrateConsole(e,n){return td.hydrate({...e,unzip:s=>Tu.loadAsync(s).then(i=>Object.values(i.files))},n)}componentDidMount(){this.initWidgets(),window.addEventListener("beforeunload",Xo.handleWindowBeforeUnload)}componentDidUpdate(e){const{dashboardData:n}=this.props;e.dashboardData!==n&&this.handleDataChange(n)}componentWillUnmount(){this.deinitWidgets(),window.removeEventListener("beforeunload",Xo.handleWindowBeforeUnload)}initWidgets(){const{connection:e}=this.props;if(e.subscribeToFieldUpdates==null){Pt.warn("subscribeToFieldUpdates not supported, not initializing widgets");return}this.widgetListenerRemover=e.subscribeToFieldUpdates(n=>{Pt.debug("Got updates",n),this.setState(({widgets:s})=>{const{updated:i,created:o,removed:r}=n,l=[...i,...r],a=s.filter(c=>!l.some(u=>u.name===c.name));return[...i,...o].forEach(c=>{c.name!=null&&c.name!==""&&a.push(c)}),{widgets:a}})})}deinitWidgets(){var e;(e=this.widgetListenerRemover)==null||e.call(this)}openNotebookFromURL(){const{match:e}=this.props,{notebookPath:n}=e.params;if(n){const{session:s,sessionConfig:i}=this.props;if(s==null||i==null){Pt.error("No session available to open notebook URL",n);return}const o={id:`/${n}`,itemName:`/${n}`},r=i.type,l={value:null,language:r};this.emitLayoutEvent(Le.SELECT_NOTEBOOK,s,r,l,o,!0)}}sendClearFilter(){this.emitLayoutEvent(Pe.CLEAR_ALL_FILTERS)}emitLayoutEvent(e,...n){var s;(s=this.goldenLayout)==null||s.eventHub.emit(e,...n)}handleError(e){ye.isCanceled(e)||Pt.error(e)}handleSettingsMenuHide(){this.setState({isSettingsMenuShown:!1})}handleSettingsMenuShow(){this.setState({isSettingsMenuShown:!0})}handleControlSelect(e,n=null){switch(Pt.debug("handleControlSelect",e),e){case wn.DROPDOWN_FILTER:this.emitLayoutEvent(Pe.OPEN_DROPDOWN,{title:"DropdownFilter",type:e,createNewStack:!0,dragEvent:n});break;case wn.INPUT_FILTER:this.emitLayoutEvent(Pe.OPEN_INPUT,{title:"InputFilter",type:e,createNewStack:!0,dragEvent:n});break;case wn.MARKDOWN:this.emitLayoutEvent(sg.OPEN,{title:"Markdown",type:e,dragEvent:n});break;case wn.FILTER_SET_MANAGER:this.emitLayoutEvent(Pe.OPEN_FILTER_SET_MANAGER,{title:"FilterSets",type:e,dragEvent:n});break;default:throw new Error(`Unrecognized control type ${e}`)}}handleToolSelect(e){Pt.debug("handleToolSelect",e);const{activeTool:n,setActiveTool:s}=this.props;s(n===e?Yt.DEFAULT:e)}handleClearFilter(){this.sendClearFilter()}handleDataChange(e){const{updateWorkspaceData:n}=this.props,{closed:s,filterSets:i,links:o}=e;n({closed:s,filterSets:i,links:o})}handleGoldenLayoutChange(e){this.goldenLayout=e}handleLayoutConfigChange(e){const{updateWorkspaceData:n}=this.props;n({layoutConfig:e})}handleWidgetMenuClick(){this.setState(({isPanelsMenuShown:e})=>({isPanelsMenuShown:!e}))}handleWidgetSelect(e,n){this.setState({isPanelsMenuShown:!1}),Pt.debug("handleWidgetSelect",e,n),this.openWidget(e,n)}handleWidgetsMenuClose(){this.setState({isPanelsMenuShown:!1})}handleAutoFillClick(){const{widgets:e}=this.state;Pt.debug("handleAutoFillClick",e);const n=e.sort((s,i)=>s.title!=null&&i.title!=null?s.title.localeCompare(i.title):0);for(let s=0;s<n.length;s+=1)this.openWidget(n[s])}handleExportLayoutClick(){Pt.info("handleExportLayoutClick"),this.setState({isPanelsMenuShown:!1});try{const{workspace:e}=this.props,{data:n}=e,s=al.exportLayout(n);Pt.info("handleExportLayoutClick exportedConfig",s);const i=new Blob([JSON.stringify(s)],{type:"application/json"}),o=M.i18n.DateTimeFormat.format("yyyy-MM-dd-HHmmss",new Date),r=document.createElement("a");r.href=URL.createObjectURL(i),r.download=`deephaven-app-layout-${o}.json`,r.click()}catch(e){Pt.error("Unable to export layout",e)}}handleImportLayoutClick(){Pt.info("handleImportLayoutClick"),this.setState({isPanelsMenuShown:!1}),this.importElement.current!=null&&(this.importElement.current.value="",this.importElement.current.click())}handleResetLayoutClick(){Pt.info("handleResetLayoutClick"),this.setState({isPanelsMenuShown:!1}),this.resetLayout()}handleImportLayoutFiles(e){var n;e.stopPropagation(),e.preventDefault(),e.target.files!=null&&this.importLayoutFile((n=e.target.files)==null?void 0:n[0])}async importLayoutFile(e){try{const{updateDashboardData:n,updateWorkspaceData:s}=this.props,i=await e.text(),o=JSON.parse(i),{filterSets:r,layoutConfig:l,links:a}=al.normalizeLayout(o);s({layoutConfig:l}),n(Mn,{filterSets:r,links:a})}catch(n){Pt.error("Unable to import layout",n)}}async resetLayout(){const{layoutStorage:e,session:n}=this.props,{filterSets:s,layoutConfig:i,links:o}=await al.getDefaultLayout(e,n!==void 0),{updateDashboardData:r,updateWorkspaceData:l}=this.props;l({layoutConfig:i}),r(Mn,{filterSets:s,links:o})}handlePaste(e){let n=e.currentTarget.parentElement;for(;n!=null;){if(n.classList.contains("monaco-editor"))return;n=n.parentElement}const{clipboardData:s}=e,i=s.getData("Text"),o=/“|”/g;o.test(i)&&(e.preventDefault(),e.stopPropagation(),document.execCommand("insertText",!1,i.replace(o,'"')))}handleLoadTablePlugin(e){const{plugins:n}=this.props,s=n.get(e);return s!=null&&s.TablePlugin!=null?s.TablePlugin:pd.loadComponentPlugin(e)}hydrateDefault(e,n){const{connection:s}=this.props,{metadata:i}=e;if((i==null?void 0:i.type)!=null&&((i==null?void 0:i.id)!=null||(i==null?void 0:i.name)!=null)){const o=i.id!=null?{type:i.type,id:i.id}:{type:i.type,name:i.name,title:i.name};return{fetch:()=>s.getObject(o),localDashboardId:n,...e}}return td.hydrate(e,n)}hydrateGrid(e,n){var s;return this.hydrateTable(e,n,(s=e.metadata.type)!=null?s:M.VariableType.TABLE)}hydratePandas(e,n){return this.hydrateTable(e,n,M.VariableType.PANDAS)}hydrateTable(e,n,s=M.VariableType.TABLE){const{connection:i}=this.props;return{...e,getDownloadWorker:Nl.getServiceWorker,loadPlugin:this.handleLoadTablePlugin,localDashboardId:n,makeModel:()=>Fy(i,e.metadata,s)}}hydrateChart(e,n){const{connection:s}=this.props;return{...e,localDashboardId:n,makeModel:()=>{const{metadata:i,panelState:o}=e;return Ny(s,i,o)}}}openWidget(e,n){const{connection:s}=this.props;this.emitLayoutEvent(De.OPEN,{dragEvent:n,fetch:()=>s.getObject(e),widget:e})}render(){const{activeTool:e,plugins:n,user:s,workspace:i,serverConfigValues:o}=this.props,{data:r}=i,{layoutConfig:l}=r,{permissions:a}=s,{canUsePanels:d}=a,{contextActions:c,isPanelsMenuShown:u,isSettingsMenuShown:m,widgets:p}=this.state,g=this.getDashboardPlugins(n);return T("div",{className:z("app-main-tabs","w-100","h-100","d-flex","flex-column",e?`active-tool-${e.toLowerCase()}`:""),onPaste:this.handlePaste,tabIndex:-1,children:[h("nav",{className:"nav-container",children:T("div",{className:"app-main-top-nav-menus",children:[h("img",{src:yg,alt:"Deephaven Data Labs",width:"115px",className:"ml-1"}),T("div",{children:[T(W,{kind:"ghost",className:"btn-panels-menu",icon:gb,onClick:()=>{},children:["Controls",h(Mc,{handleControlSelect:this.handleControlSelect,handleToolSelect:this.handleToolSelect,onClearFilter:this.handleClearFilter})]}),d&&T(W,{kind:"ghost",className:"btn-panels-menu btn-show-panels","data-testid":"app-main-panels-button",onClick:this.handleWidgetMenuClick,icon:hb,children:["Panels",h(kn,{isShown:u,className:"panels-menu-popper",onExited:this.handleWidgetsMenuClose,closeOnBlur:!0,interactive:!0,children:h(My,{widgets:p,onExportLayout:this.handleExportLayoutClick,onImportLayout:this.handleImportLayoutClick,onResetLayout:this.handleResetLayoutClick,onSelect:this.handleWidgetSelect})})]}),h(W,{kind:"ghost",className:z("btn-settings-menu",{"text-warning":s.operateAs!==s.name}),onClick:this.handleSettingsMenuShow,icon:h(ee,{icon:sr,transform:"grow-3 right-1 down-1"}),tooltip:"User Settings"})]})]})}),T(Ev,{emptyDashboard:h(xy,{onAutoFillClick:this.handleAutoFillClick}),id:Mn,layoutConfig:l,onGoldenLayoutChange:this.handleGoldenLayoutChange,onLayoutConfigChange:this.handleLayoutConfigChange,onLayoutInitialized:this.openNotebookFromURL,hydrate:this.hydrateDefault,children:[h(k2,{hydrate:this.hydrateGrid,getDownloadWorker:Nl.getServiceWorker,loadPlugin:this.handleLoadTablePlugin}),h(D2,{hydrate:this.hydrateChart}),h(M2,{}),h(F2,{hydrateConsole:Xo.hydrateConsole,notebooksUrl:new URL("/notebooks/",`${window.location}`).href}),h(x2,{}),h(B2,{hydrate:this.hydratePandas}),h(U2,{}),h(V2,{}),g]}),h(mt,{in:m,timeout:ze.transitionMidMs,classNames:"slide-left",mountOnEnter:!0,unmountOnExit:!0,children:h(bo,{serverConfigValues:o,onDone:this.handleSettingsMenuHide})}),h(ae,{actions:c}),h("input",{ref:this.importElement,type:"file",accept:".json",style:{display:"none"},onChange:this.handleImportLayoutFiles})]})}}const zy=t=>{var e,n;return{activeTool:ql(t),dashboardData:Zt(t,Mn),layoutStorage:Ry(t),plugins:D0(t),connection:P1(t,Mn),session:(e=wi(t,Mn))==null?void 0:e.session,sessionConfig:(n=wi(t,Mn))==null?void 0:n.config,user:xm(t),workspace:Kl(t),serverConfigValues:Dy(t)}},Wy=It(zy,{setActiveTool:Xl,updateDashboardData:ts,updateWorkspaceData:jm})(Ef(Xo));function Gy(){return T("div",{className:"app",children:[h(Wy,{}),h(Wu,{})]})}const Ky=Z.module("LocalWorkspaceStorage"),zo=class{static async makeDefaultWorkspaceData(t,e){const{filterSets:n,links:s,layoutConfig:i}=await al.getDefaultLayout(t,e==null?void 0:e.isConsoleAvailable);return{settings:{defaultDateTimeFormat:st.DEFAULT_DATETIME_FORMAT_STRING,formatter:[],timeZone:st.DEFAULT_TIME_ZONE_ID,showTimeZone:!1,showTSeparator:!0,disableMoveConfirmation:!1,defaultDecimalFormatOptions:{defaultFormatString:_e.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:Qe.DEFAULT_FORMAT_STRING},truncateNumbersWithPound:!1,defaultNotebookSettings:{isMinimapEnabled:!1}},layoutConfig:i,closed:[{}],links:s,filterSets:n}}static async makeDefaultWorkspace(t,e){return{data:await zo.makeDefaultWorkspaceData(t,e)}}constructor(t){this.layoutStorage=t}async load(t){var e;try{return JSON.parse((e=localStorage.getItem(zo.STORAGE_KEY))!=null?e:"")}catch{return Ky.info("Unable to load workspace data, initializing to default data"),zo.makeDefaultWorkspace(this.layoutStorage,t)}}async save(t){return localStorage.setItem(zo.STORAGE_KEY,JSON.stringify(t)),t}};let Ag=zo;Ag.STORAGE_KEY="deephaven.WorkspaceStorage";class qy extends Error{constructor(){super(...arguments),this.isNoConsolesError=!0}}function Yy(t){return t.isNoConsolesError}const zs=Z.module("SessionUtils");var Pg=(t=>(t.ANONYMOUS="anonymous",t.PARENT="parent",t))(Pg||{});function Xy(){return new URL("/jsapi",`${window.location}`)}function Hg(){const t=Xy();return`${t.protocol}//${t.host}`}function jy(){switch(new URLSearchParams(window.location.search).get("authProvider")){case"parent":return"parent";default:return"anonymous"}}function Zy(){const t=Hg();return zs.info(`Starting connection to '${t}'...`),new M.IdeConnection(t)}async function Qy(t){zs.info("Getting console types...");const e=await t.getConsoleTypes();if(zs.info("Available types:",e),e.length===0)throw new qy("No console types available");const n=e[0];zs.info("Starting session with type",n);const s=await t.startSession(n),i={type:n,id:We.generate()};return zs.info("Console session established",i),{session:s,config:i,connection:t}}function Jy(){const t=Hg();return zs.info("createCoreClient",t),new M.CoreClient(t)}async function eI(){if(window.opener==null)throw new Error("window.opener is null, unable to send auth request.");return new Promise(t=>{const e=n=>{const{data:s}=n;if(zs.debug("Received message",s),(s==null?void 0:s.message)!=="loginOptions"){zs.debug("Ignore received message",s);return}window.removeEventListener("message",e),t(s.payload)};window.addEventListener("message",e),window.opener.postMessage("requestLoginOptionsFromParent","*")})}async function tI(t){switch(t){case"parent":return eI();case"anonymous":return{type:M.CoreClient.LOGIN_TYPE_ANONYMOUS};default:throw new Error(`Unknown auth type: ${t}`)}}class nI{constructor(e,n=""){this.storageService=e,this.root=n}async getLayouts(){return(await this.storageService.listItems(this.root,"*.json")).map(n=>n.basename)}async getLayout(e){const s=await(await this.storageService.loadFile(`${this.root}/${e}`)).text();return JSON.parse(s)}}const Lo=Z.module("GrpcFileStorageTable"),gd=class{constructor(t,e="",n=e){this.currentSize=0,this.listeners=[],this.childTables=new Map,this.storageService=t,this.baseRoot=e,this.root=n,n===e&&(this.doRefresh=Ze(this.doRefresh.bind(this),gd.REFRESH_DEBOUNCE))}removeBaseRoot(t){return pe.removeRoot(this.baseRoot,t)}getViewportData(){var t;return this.viewportUpdatePromise||this.refreshInternal(),(t=this.viewportUpdatePromise)!=null?t:Promise.resolve({items:[],offset:0})}getSnapshot(t){throw new Error("Method not implemented.")}get size(){return this.currentSize}setExpanded(t,e){const n=t.split("/");let s=n.shift();if((s===void 0||s==="")&&(s=n.shift()),s===void 0||s==="")throw new Error(`Invalid path: ${t}`);const i=n.join("/");if(e){if(!this.childTables.has(s)){const o=new gd(this.storageService,this.baseRoot,`${this.root}/${s}`);this.childTables.set(s,o)}if(i){const o=this.childTables.get(s);o==null||o.setExpanded(i,e)}}else if(this.childTables.has(s))if(i){const o=this.childTables.get(s);o==null||o.setExpanded(i,e)}else this.childTables.delete(s);this.currentViewport&&this.refreshInternal()}collapseAll(){this.childTables.clear(),this.currentViewport&&this.refreshInternal()}setSearch(t){throw new Error("Method not implemented.")}setViewport(t){this.currentViewport=t,this.refreshInternal()}setFilters(){throw new Error("Method not implemented.")}setSorts(){throw new Error("Method not implemented.")}setReversed(){throw new Error("Method not implemented.")}close(){this.listeners=[]}onUpdate(t){return this.listeners=[...this.listeners,t],()=>{this.listeners=this.listeners.filter(e=>e!==t)}}doRefresh(t){Lo.debug2("doRefresh",this.root),t(this.fetchData())}refresh(){var n;Lo.debug2("refresh",this.root),(n=this.viewportUpdatePromise)==null||n.cancel();const t=new Promise(s=>{this.doRefresh(s)}),e=ye.makeCancelable(t.then(s=>{if(this.viewportUpdatePromise!==e)throw new Qi;return this.currentViewportData=s,this.sendUpdate(),s}));e.catch(s=>{ye.isCanceled(s)||Lo.error("Error updating viewport",s)}),this.viewportUpdatePromise=e}refreshInternal(){try{this.refresh()}catch(t){ye.isCanceled(t)||Lo.error("Unable to refresh data",t)}}async fetchData(){const{currentViewport:t}=this;if(!t)throw new Error("No viewport set");let n=(await this.storageService.listItems(this.root)).map(s=>({type:s.type,filename:this.removeBaseRoot(s.filename),basename:s.basename,id:this.removeBaseRoot(s.filename),isExpanded:s.type==="directory"?this.childTables.has(s.basename):void 0})).sort((s,i)=>s.type!==i.type?s.type==="directory"?-1:1:s.basename.localeCompare(i.basename));for(let s=0;s<n.length;s+=1){const i=n[s],{basename:o,filename:r}=i;if(r===this.removeBaseRoot(`${this.root}/${o}`)&&i.type==="directory"){const l=this.childTables.get(o);if(l!=null){l.setViewport({top:0,bottom:t.bottom-s});const a=await l.getViewportData();n.splice(s+1,0,...a.items)}}}return this.currentSize=n.length,Lo.debug2(this.root,"items",n,t),n=n.slice(t.top,t.bottom),{items:n,offset:t.top}}sendUpdate(){var n;const{listeners:t}=this,e=(n=this.currentViewportData)!=null?n:{items:[],offset:0};for(let s=0;s<t.length;s+=1)t[s](e)}};let Vg=gd;Vg.REFRESH_DEBOUNCE=50;const sI=Z.module("GrpcFileStorage"),Ug=class{constructor(t,e=""){this.tables=[],this.refreshTables=Qn(()=>{this.tables.forEach(n=>n.refresh())},Ug.REFRESH_THROTTLE),this.storageService=t,this.root=e}removeRoot(t){return pe.removeRoot(this.root,t)}addRoot(t){return pe.addRoot(this.root,t)}async createDirectory(t){return await this.storageService.createDirectory(this.addRoot(t)),this.refreshTables(),{type:"directory",id:t,filename:t,basename:pe.getBaseName(t)}}async getTable(){const t=new Vg(this.storageService,this.root);return this.tables.push(t),t}async saveFile(t){const e=dh.storage.FileContents.text(t.content);return await this.storageService.saveFile(this.addRoot(t.filename),e,!0),this.refreshTables(),t}async loadFile(t){const n=await(await this.storageService.loadFile(this.addRoot(t))).text();return{filename:t,basename:pe.getBaseName(t),content:n}}async deleteFile(t){await this.storageService.deleteItem(this.addRoot(t)),this.refreshTables()}async moveFile(t,e){await this.storageService.moveItem(this.addRoot(t),this.addRoot(e)),this.refreshTables()}async info(t){const e=await this.storageService.listItems(this.addRoot(pe.getPath(t)),pe.getBaseName(t));if(e.length===0)throw new Sc;if(e.length>1)throw sI.error("More than one matching file found, should never happen.",e),new Error("More than one matching file found");const n=e[0];return{filename:this.removeRoot(n.filename),basename:n.basename,id:this.removeRoot(n.filename),type:n.type}}};let Bg=Ug;Bg.REFRESH_THROTTLE=150;const Ws=Z.module("AppInit");async function iI(){Ws.debug("Loading plugins...");try{const t=await pd.loadJson("/js-plugins/manifest.json");Ws.debug("Plugin manifest loaded:",t);const e=[];for(let i=0;i<t.plugins.length;i+=1){const{name:o,main:r}=t.plugins[i],l=`/js-plugins/${o}/${r}`;e.push(pd.loadModulePlugin(l))}const n=await Promise.all(e),s=new Map;for(let i=0;i<n.length;i+=1){const{name:o}=t.plugins[i];s.set(o,n[i])}return Ws.info("Plugins loaded:",s),s}catch(t){return Ws.error("Unable to load plugins:",t),new Map}}async function oI(t){let e;try{e=await Qy(t)}catch(n){if(!Yy(n))throw n}return e}function Nc(t){const{workspace:e,setActiveTool:n,setCommandHistoryStorage:s,setDashboardData:i,setFileStorage:o,setLayoutStorage:r,setDashboardConnection:l,setDashboardSessionWrapper:a,setPlugins:d,setUser:c,setWorkspace:u,setWorkspaceStorage:m,setServerConfigValues:p}=t,[g,f]=w.exports.useState(),[b,C]=w.exports.useState(!0),S=w.exports.useCallback(async()=>{var R,N;try{Ws.info("Initializing Web UI","0.27.0",navigator.userAgent);const F=Jy(),P=jy();Ws.info(`Login using auth type ${P}...`),await F.login(await tI(P));const H=await iI(),x=await(P===Pg.ANONYMOUS&&F.getAsIdeConnection==null?Zy():F.getAsIdeConnection());x.addEventListener(M.IdeConnection.HACK_CONNECTION_FAILURE,He=>{var Ve;const{detail:lt}=He;Ws.error("Connection failure",`${JSON.stringify(lt)}`),f(`Unable to connect: ${(Ve=lt.details)!=null?Ve:"Unknown Error"}`)});const A=await oI(x),k="user",G=F.getStorageService(),V=new nI(G,"/layouts"),O=new Bg(G,"/notebooks"),$=new Ag(V),Y=new J2,Q=await $.load({isConsoleAvailable:A!==void 0}),{data:U}=Q,{settings:q}=U;q.defaultDecimalFormatOptions===void 0&&(q.defaultDecimalFormatOptions={defaultFormatString:_e.DEFAULT_FORMAT_STRING}),q.defaultIntegerFormatOptions===void 0&&(q.defaultIntegerFormatOptions={defaultFormatString:Qe.DEFAULT_FORMAT_STRING}),q.truncateNumbersWithPound===void 0&&(q.truncateNumbersWithPound=!1);const{shortcutOverrides:j={}}=q,ce=Kt.isMacPlatform?(R=j.mac)!=null?R:{}:(N=j.windows)!=null?N:{};Object.entries(ce).forEach(([He,lt])=>{var Ve;(Ve=Ae.get(He))==null||Ve.setKeyState(lt)});const ne={filterSets:U.filterSets,links:U.links},he=await F.getServerConfigValues(),Ce=new Map(he),Re={name:k,operateAs:k,groups:[],permissions:{isSuperUser:!1,isQueryViewOnly:!1,isNonInteractive:!1,canUsePanels:!0,canCreateDashboard:!0,canCreateCodeStudio:!0,canCreateQueryMonitor:!0,canCopy:Ce.get("internal.webClient.appInit.canCopy")!=="false",canDownloadCsv:Ce.get("internal.webClient.appInit.canDownloadCsv")!=="false"}};n(Yt.DEFAULT),p(Ce),s(Y),i(Mn,ne),o(O),r(V),l(Mn,x),A!==void 0&&a(Mn,A),d(H),c(Re),m($),u(Q)}catch(F){Ws.error(F),f(F)}},[n,s,i,o,r,l,a,d,c,u,m,p]),v=w.exports.useCallback(()=>{document.fonts!=null?document.fonts.ready.then(()=>{C(!1)}):C(!1)},[]);w.exports.useEffect(function(){S(),v()},[S,v]);const y=e==null&&g==null||b,E=!y&&g==null,I=g!=null?`${g}`:null;return T(Te,{children:[E&&h(Gy,{}),h(Vl,{isLoading:y,isLoaded:E,errorMessage:I}),T("div",{id:"preload-fonts",style:{visibility:"hidden",position:"absolute",top:-1e4},children:[h("p",{className:"fira-sans-regular",children:"preload"}),h("p",{className:"fira-sans-semibold",children:"preload"}),h("p",{className:"fira-mono",children:"preload"})]})]})}Nc.propTypes={workspace:D.exports.shape({}),workspaceStorage:D.exports.shape({close:D.exports.func}),setActiveTool:D.exports.func.isRequired,setCommandHistoryStorage:D.exports.func.isRequired,setDashboardData:D.exports.func.isRequired,setFileStorage:D.exports.func.isRequired,setLayoutStorage:D.exports.func.isRequired,setDashboardConnection:D.exports.func.isRequired,setDashboardSessionWrapper:D.exports.func.isRequired,setPlugins:D.exports.func.isRequired,setUser:D.exports.func.isRequired,setWorkspace:D.exports.func.isRequired,setWorkspaceStorage:D.exports.func.isRequired};Nc.defaultProps={workspace:null,workspaceStorage:null};const rI=t=>({workspace:Kl(t),workspaceStorage:y0(t)}),fu=It(rI,{setActiveTool:Xl,setCommandHistoryStorage:F0,setDashboardData:wp,setFileStorage:x0,setLayoutStorage:ey,setDashboardConnection:H1,setDashboardSessionWrapper:V1,setPlugins:k0,setUser:M0,setWorkspace:Xm,setWorkspaceStorage:N0,setServerConfigValues:O0})(Nc);function lI(){return h(yf,{basename:"/ide/",children:T(If,{children:[h(Hc,{exact:!0,path:"/",component:fu}),h(Hc,{path:"/notebook/:notebookPath+",component:fu}),h(Rf,{from:"*",to:"/"})]})})}Boolean(window.location.hostname==="localhost"||window.location.hostname==="[::1]"||window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/));function aI(){"serviceWorker"in navigator&&navigator.serviceWorker.getRegistrations().then(t=>{t.forEach(e=>{e.scope.endsWith("/download/")||e.unregister()})})}gy();bi.render(h(Su,{store:jl,children:h(lI,{})}),document.getElementById("root"));aI();Nl.registerOnLoaded();rt.init({getWorker:()=>new Mf});window["__react-beautiful-dnd-disable-dev-warnings"]=!0;
|
|
47
|
-
//# sourceMappingURL=index.
|
|
46
|
+
Barrage Version: ${i}`,children:"Copy Versions"})]})]})]}),h("div",{className:"app-settings-footer-item",children:h(ay,{})})]}),h("div",{className:"app-settings-footer-section",children:h("div",{className:"logo",children:h("a",{target:"_blank",rel:"noreferrer noopener",href:"https://deephaven.io",className:"d-inline-block custom-link p-1",children:h("img",{src:yg,alt:"Deephaven Data Labs",width:"230px"})})})})]})]})]})}};let bo=ms;bo.defaultProps={onDone:()=>{}};bo.FORMATTING_SECTION_KEY="SettingsMenu.formatting";bo.COLUMN_SPECIFIC_SECTION_KEY="SettingsMenu.columnFormatting";bo.APPLICATION_SECTION_KEY="ApplicationMenu.settings";bo.SHORTCUT_SECTION_KEY="SettingsMenu.shortcuts";const pu=10;function Gi(t){const{forwardedProps:{menuItem:{action:e,title:n,disabled:s},iconElement:i,displayShortcut:o,isMouseSelected:r,isKeyboardSelected:l,closeMenu:a}}=t,d=w.exports.useRef(),c=w.exports.useRef(),u=w.exports.useRef(null),[m,p]=w.exports.useState(!1),g=w.exports.useCallback(C=>{d.current!=null&&c.current!=null&&u.current&&(Math.abs(d.current-C.clientX)>=pu||Math.abs(c.current-C.clientY)>=pu)&&(p(!0),window.removeEventListener("mousemove",g),a(),e(C),u.current=null)},[e,a]);function f(C){d.current=C.clientX,c.current=C.clientY,u.current=C.target,window.addEventListener("mousemove",g)}function b(C){u.current===C.target&&(p(!0),a(),e(),window.removeEventListener("mousemove",g)),u.current=null}return w.exports.useEffect(function(){return function(){return window.removeEventListener("mousemove",g)}},[g]),T("button",{type:"button",className:z("btn-context-menu",{disabled:s},{active:r&&!s},{"keyboard-active":l&&!s}),onMouseDown:f,onMouseUp:b,disabled:m,children:[h("span",{className:z("icon"),children:i}),h("span",{className:"title",children:n}),h("span",{className:"shortcut",children:o})]})}function Mc(t){const{handleControlSelect:e,handleToolSelect:n,onClearFilter:s}=t,i=w.exports.useMemo(()=>[{title:"Input Filter",icon:db,menuElement:h(Gi,{}),action:o=>{e(wn.INPUT_FILTER,o)},order:10},{title:"Dropdown Filter",icon:Hu,menuElement:h(Gi,{}),action:o=>{e(wn.DROPDOWN_FILTER,o)},order:15},{title:"Markdown Widget",icon:HC,menuElement:h(Gi,{}),action:o=>{e(wn.MARKDOWN,o)},order:20},{title:"Filter Sets",icon:za,menuElement:h(Gi,{}),action:o=>{e(wn.FILTER_SET_MANAGER,o)},order:25},{disabled:!0,menuElement:h("div",{className:"context-menu-group-header",children:"Tools"}),order:30},{title:"Linker",icon:Ed,action:()=>{n(Yt.LINKER)},order:40,shortcut:bs.LINKER},{disabled:!0,menuElement:h("div",{className:"context-menu-group-header",children:"Actions"}),order:50},{title:"Clear All Filters",icon:ob,action:()=>{s()},order:60,shortcut:an.TABLE.CLEAR_ALL_FILTERS}],[e,n,s]);return h(Fn,{popperClassName:"controls-menu-popper",actions:i})}Mc.propTypes={handleControlSelect:D.exports.func,handleToolSelect:D.exports.func,onClearFilter:D.exports.func};Mc.defaultProps={handleControlSelect:()=>{},handleToolSelect:()=>{},onClearFilter:()=>{}};Gi.propTypes={forwardedProps:D.exports.shape({iconElement:D.exports.node,displayShortcut:D.exports.string,isMouseSelected:D.exports.bool.isRequired,isKeyboardSelected:D.exports.bool.isRequired,closeMenu:D.exports.func.isRequired,menuItem:D.exports.shape({action:D.exports.func,title:D.exports.string,disabled:D.exports.bool}).isRequired})};Gi.defaultProps={forwardedProps:null};const yy=Ks(Eg,null),Iy={layoutStorage:yy},Ry=t=>t.layoutStorage,Dy=t=>t.serverConfigValues;Object.entries(Iy).map(([t,e])=>ho.register(t,e));const gu=10;function My(t){const{onExportLayout:e,onImportLayout:n,onResetLayout:s,onSelect:i,widgets:o=[]}=t,[r,l]=w.exports.useState(!1),[a,d]=w.exports.useState(""),c=w.exports.useRef(null),u=w.exports.useRef(),m=w.exports.useCallback((y,E)=>{y!=null&&i(y,E)},[i]),p=w.exports.useCallback(y=>{d(y.target.value)},[]),g=w.exports.useCallback(y=>{u.current!=null&&(Math.abs(u.current.x-y.clientX)>=gu||Math.abs(u.current.y-y.clientY)>=gu)&&(l(!0),window.removeEventListener("mousemove",g),m(u.current.widget,y),u.current=void 0)},[u,m]),f=w.exports.useCallback((y,E)=>{u.current={x:y.clientX,y:y.clientY,widget:E},window.addEventListener("mousemove",g)},[g]),b=w.exports.useCallback((y,E)=>{var I;window.removeEventListener("mousemove",g),((I=u.current)==null?void 0:I.widget)===E&&(l(!0),m(E)),u.current=void 0},[g,u,m]),C=w.exports.useMemo(()=>o.filter(y=>{var E;return a?(E=y.name)==null?void 0:E.toLowerCase().includes(a.toLowerCase()):!0}),[a,o]).sort((y,E)=>{var I,R,N;return(N=(R=y.name)==null?void 0:R.localeCompare((I=E.name)!=null?I:""))!=null?N:0}),S=w.exports.useMemo(()=>C.map(y=>{var E,I;return h("li",{children:T(W,{kind:"ghost","data-testid":`panel-list-item-${(E=y.name)!=null?E:""}-button`,onMouseDown:R=>{f(R,y)},onMouseUp:R=>{b(R,y)},onKeyDown:R=>{(R.key==="Enter"||R.key===" ")&&m(y)},disabled:r,onClick:()=>{},children:[h(lm,{type:y.type})," ",(I=y.name)!=null?I:""]})},y.name)}),[C,r,f,b,m]),v=w.exports.useMemo(()=>S.length===0?h("span",{children:"No bound variables found."}):null,[S]);return T("div",{className:"widget-list-container d-flex flex-column",children:[h("div",{className:"widget-list-header",children:h(ws,{value:a,placeholder:"Find Table, Plot or Widget",onChange:p,ref:c})}),T("ul",{className:"widget-list flex-grow-1",children:[v&&h("li",{className:"widget-list-message",children:v}),!v&&S]}),h("div",{children:h("hr",{})}),T("div",{className:"widget-list-footer",children:[T(W,{kind:"ghost",onClick:e,children:[T("div",{className:"fa-md fa-layers",children:[h(ee,{mask:Wa,icon:$c,transform:"right-5 down-5"}),h(ee,{icon:$c,transform:"right-8 down-6"})]}),"Export Layout"]}),T(W,{kind:"ghost",onClick:n,children:[T("div",{className:"fa-md fa-layers",children:[h(ee,{mask:Wa,icon:$a,transform:"right-5 down-5"}),h(ee,{icon:$a,transform:"right-8 down-6"})]}),"Import Layout"]}),h(W,{kind:"ghost",icon:hi,onClick:s,tooltip:"Reset Layout"})]})]})}const Ny=async(t,e,n)=>{let s,i,o,r;if(sl(e)?(s=e.settings,i=e.table,o=void 0,r=e.tableSettings):(s={},i="",o=e.figure,r={}),n!==void 0&&(n.tableSettings!=null&&(r=n.tableSettings),n.table!=null&&(i=n.table),n.figure!=null&&(o=n.figure),n.settings!=null&&(s={...s,...n.settings})),o!==void 0){const d={title:o,name:o,type:M.VariableType.FIGURE},c=await t.getObject(d);return eo.makeModel(s,c)}const l={title:o,name:i,type:M.VariableType.TABLE},a=await t.getObject(l);return ie.applyTableSettings(a,r,or(jl.getState())),eo.makeModelFromSettings(s,a)},Fy=async(t,e,n=M.VariableType.TABLE)=>{const{table:s}=e,i={title:s,name:s,type:n},o=await t.getObject(i);return dc.makeModel(o)};function xy({onAutoFillClick:t=()=>{}}){return T("div",{className:"empty-dashboard-container",children:[T("div",{className:"hint-container",children:[h(ee,{icon:Mu})," ",h("br",{}),"Use the panel list to add objects from a query."]}),T("div",{className:"empty-dashboard",children:[h("div",{className:"add-panels-hint",children:"Drag Panels Here"}),h(W,{kind:"tertiary",onClick:t,children:"Auto fill objects"})]})]})}function _y(t){return t.version===2}function ky(t){return Array.isArray(t)}const Zr=Z.module("UserLayoutUtils"),Oy={layoutConfig:[{type:"column",content:[{type:"row",height:40,content:[{type:"stack",content:[{type:"react-component",component:Wi.COMPONENT,title:Wi.TITLE,isClosable:!1},{type:"react-component",component:Ml.COMPONENT,title:Ml.TITLE,isClosable:!1}]},{type:"stack",width:25,content:[{type:"react-component",component:Il.COMPONENT,title:Il.TITLE,isClosable:!1},{type:"react-component",component:Rl.COMPONENT,title:Rl.TITLE,isClosable:!1}]}]},{type:"row",content:[{type:"stack",title:"Notebooks",content:[]}]}]}],links:[],filterSets:[],version:2},Ly={layoutConfig:[],links:[],filterSets:[],version:2};function kg(t){if(_y(t))return t;if(ky(t))return{layoutConfig:t,links:[],filterSets:[],version:2};throw new Error(`Unexpected layout import format: ${t}`)}async function Ay(t,e=!0){try{const n=await t.getLayouts();if(n.length>0)try{const s=await t.getLayout(n[0]);return kg(s)}catch(s){Zr.error("Unable to load layout",n[0],":",s),Zr.warn("No valid layouts found, falling back to default layout")}}catch(n){Zr.error("Unable to fetch layout list",n),Zr.warn("Falling back to default layout")}return e?Oy:Ly}function Py(t){const{filterSets:e,layoutConfig:n,links:s}=t;return{filterSets:e,layoutConfig:n,links:s,version:2}}const al={exportLayout:Py,getDefaultLayout:Ay,normalizeLayout:kg},Qr=Z.module("DownloadServiceWorkerUtils"),Og=class{static registerOnLoaded(){new URL("/ide/",window.location.href).origin===window.location.origin&&("serviceWorker"in navigator?window.addEventListener("load",()=>{const e=new URL("/ide/download/serviceWorker.js",window.location.href);navigator.serviceWorker.register(e).then(n=>{n.update(),Qr.info("Registering service worker on ",e,n)}).catch(n=>{Qr.error("Failed to register service worker",n)})}):Qr.info("Service worker is not supported."))}static async getServiceWorker(){if("serviceWorker"in navigator){const e=(await navigator.serviceWorker.getRegistrations()).find(n=>n.scope.endsWith(Og.DOWNLOAD_PATH));if(e&&e.active)return Qr.info("Download service worker is active."),e.active;throw new Error("Can not find download service worker.")}throw new Error("Download service worker is not available.")}static unregisterSW(){}};let Nl=Og;Nl.DOWNLOAD_PATH="/download/";const Lg={react:X},Hy=Sf(Lg),Vy=wf({requires:Hy}),Uy=vf.createRequires(Lg),By=Tf({requires:Uy}),$y=Z.module("PluginUtils");class pd{static loadComponentPlugin(e){if("".split(",").includes(e)){const o=X.lazy(()=>Df(()=>import(`./internal/${e}`),[])),r=X.forwardRef((l,a)=>h(w.exports.Suspense,{fallback:h("div",{children:"Loading Plugin..."}),children:h(o,{ref:a,...l})}));return r.pluginName=e,r.displayName="Local Plugin",r}const n=new URL("/ide/plugins/",`${window.location}`),s=new URL(`${e}.js`,n),i=X.forwardRef((o,r)=>h(Vy,{url:s,render:({err:l,Component:a})=>{if(l!=null&&l!==""){const d=`Error loading plugin ${e} from ${s} due to ${l}`;return $y.error(d),h("div",{className:"error-message",children:`${d}`})}return h(a,{ref:r,...o})}}));return i.pluginName=e,i.displayName="Plugin",i}static async loadModulePlugin(e){return await By(e)}static async loadJson(e){return new Promise((n,s)=>{const i=new XMLHttpRequest;i.addEventListener("load",()=>{try{const o=JSON.parse(i.responseText);n(o)}catch(o){s(o)}}),i.addEventListener("error",o=>{s(o)}),i.open("GET",e),i.send()})}}const Pt=Z.module("AppMainContainer");class Xo extends w.exports.Component{constructor(e){super(e),this.getDashboardPlugins=Se(n=>[...n.entries()].filter(([,s])=>s.DashboardPlugin!=null).map(([s,{DashboardPlugin:i}])=>h(i,{},s))),this.handleSettingsMenuHide=this.handleSettingsMenuHide.bind(this),this.handleSettingsMenuShow=this.handleSettingsMenuShow.bind(this),this.handleError=this.handleError.bind(this),this.handleControlSelect=this.handleControlSelect.bind(this),this.handleToolSelect=this.handleToolSelect.bind(this),this.handleClearFilter=this.handleClearFilter.bind(this),this.handleDataChange=this.handleDataChange.bind(this),this.handleAutoFillClick=this.handleAutoFillClick.bind(this),this.handleGoldenLayoutChange=this.handleGoldenLayoutChange.bind(this),this.handleLayoutConfigChange=this.handleLayoutConfigChange.bind(this),this.handleExportLayoutClick=this.handleExportLayoutClick.bind(this),this.handleImportLayoutClick=this.handleImportLayoutClick.bind(this),this.handleImportLayoutFiles=this.handleImportLayoutFiles.bind(this),this.handleLoadTablePlugin=this.handleLoadTablePlugin.bind(this),this.handleResetLayoutClick=this.handleResetLayoutClick.bind(this),this.handleWidgetMenuClick=this.handleWidgetMenuClick.bind(this),this.handleWidgetsMenuClose=this.handleWidgetsMenuClose.bind(this),this.handleWidgetSelect=this.handleWidgetSelect.bind(this),this.handlePaste=this.handlePaste.bind(this),this.hydrateChart=this.hydrateChart.bind(this),this.hydrateGrid=this.hydrateGrid.bind(this),this.hydratePandas=this.hydratePandas.bind(this),this.hydrateDefault=this.hydrateDefault.bind(this),this.openNotebookFromURL=this.openNotebookFromURL.bind(this),this.importElement=X.createRef(),this.state={contextActions:[{action:()=>{this.handleToolSelect(Yt.LINKER)},shortcut:bs.LINKER,isGlobal:!0},{action:()=>{this.sendClearFilter()},shortcut:an.TABLE.CLEAR_ALL_FILTERS,isGlobal:!0},{action:()=>{Pt.debug("Consume unhandled save shortcut")},shortcut:bs.SAVE,isGlobal:!0}],isPanelsMenuShown:!1,isSettingsMenuShown:!1,widgets:[]}}static handleWindowBeforeUnload(e){e.preventDefault(),e.returnValue=""}static hydrateConsole(e,n){return td.hydrate({...e,unzip:s=>Tu.loadAsync(s).then(i=>Object.values(i.files))},n)}componentDidMount(){this.initWidgets(),window.addEventListener("beforeunload",Xo.handleWindowBeforeUnload)}componentDidUpdate(e){const{dashboardData:n}=this.props;e.dashboardData!==n&&this.handleDataChange(n)}componentWillUnmount(){this.deinitWidgets(),window.removeEventListener("beforeunload",Xo.handleWindowBeforeUnload)}initWidgets(){const{connection:e}=this.props;if(e.subscribeToFieldUpdates==null){Pt.warn("subscribeToFieldUpdates not supported, not initializing widgets");return}this.widgetListenerRemover=e.subscribeToFieldUpdates(n=>{Pt.debug("Got updates",n),this.setState(({widgets:s})=>{const{updated:i,created:o,removed:r}=n,l=[...i,...r],a=s.filter(c=>!l.some(u=>u.name===c.name));return[...i,...o].forEach(c=>{c.name!=null&&c.name!==""&&a.push(c)}),{widgets:a}})})}deinitWidgets(){var e;(e=this.widgetListenerRemover)==null||e.call(this)}openNotebookFromURL(){const{match:e}=this.props,{notebookPath:n}=e.params;if(n){const{session:s,sessionConfig:i}=this.props;if(s==null||i==null){Pt.error("No session available to open notebook URL",n);return}const o={id:`/${n}`,itemName:`/${n}`},r=i.type,l={value:null,language:r};this.emitLayoutEvent(Le.SELECT_NOTEBOOK,s,r,l,o,!0)}}sendClearFilter(){this.emitLayoutEvent(Pe.CLEAR_ALL_FILTERS)}emitLayoutEvent(e,...n){var s;(s=this.goldenLayout)==null||s.eventHub.emit(e,...n)}handleError(e){ye.isCanceled(e)||Pt.error(e)}handleSettingsMenuHide(){this.setState({isSettingsMenuShown:!1})}handleSettingsMenuShow(){this.setState({isSettingsMenuShown:!0})}handleControlSelect(e,n=null){switch(Pt.debug("handleControlSelect",e),e){case wn.DROPDOWN_FILTER:this.emitLayoutEvent(Pe.OPEN_DROPDOWN,{title:"DropdownFilter",type:e,createNewStack:!0,dragEvent:n});break;case wn.INPUT_FILTER:this.emitLayoutEvent(Pe.OPEN_INPUT,{title:"InputFilter",type:e,createNewStack:!0,dragEvent:n});break;case wn.MARKDOWN:this.emitLayoutEvent(sg.OPEN,{title:"Markdown",type:e,dragEvent:n});break;case wn.FILTER_SET_MANAGER:this.emitLayoutEvent(Pe.OPEN_FILTER_SET_MANAGER,{title:"FilterSets",type:e,dragEvent:n});break;default:throw new Error(`Unrecognized control type ${e}`)}}handleToolSelect(e){Pt.debug("handleToolSelect",e);const{activeTool:n,setActiveTool:s}=this.props;s(n===e?Yt.DEFAULT:e)}handleClearFilter(){this.sendClearFilter()}handleDataChange(e){const{updateWorkspaceData:n}=this.props,{closed:s,filterSets:i,links:o}=e;n({closed:s,filterSets:i,links:o})}handleGoldenLayoutChange(e){this.goldenLayout=e}handleLayoutConfigChange(e){const{updateWorkspaceData:n}=this.props;n({layoutConfig:e})}handleWidgetMenuClick(){this.setState(({isPanelsMenuShown:e})=>({isPanelsMenuShown:!e}))}handleWidgetSelect(e,n){this.setState({isPanelsMenuShown:!1}),Pt.debug("handleWidgetSelect",e,n),this.openWidget(e,n)}handleWidgetsMenuClose(){this.setState({isPanelsMenuShown:!1})}handleAutoFillClick(){const{widgets:e}=this.state;Pt.debug("handleAutoFillClick",e);const n=e.sort((s,i)=>s.title!=null&&i.title!=null?s.title.localeCompare(i.title):0);for(let s=0;s<n.length;s+=1)this.openWidget(n[s])}handleExportLayoutClick(){Pt.info("handleExportLayoutClick"),this.setState({isPanelsMenuShown:!1});try{const{workspace:e}=this.props,{data:n}=e,s=al.exportLayout(n);Pt.info("handleExportLayoutClick exportedConfig",s);const i=new Blob([JSON.stringify(s)],{type:"application/json"}),o=M.i18n.DateTimeFormat.format("yyyy-MM-dd-HHmmss",new Date),r=document.createElement("a");r.href=URL.createObjectURL(i),r.download=`deephaven-app-layout-${o}.json`,r.click()}catch(e){Pt.error("Unable to export layout",e)}}handleImportLayoutClick(){Pt.info("handleImportLayoutClick"),this.setState({isPanelsMenuShown:!1}),this.importElement.current!=null&&(this.importElement.current.value="",this.importElement.current.click())}handleResetLayoutClick(){Pt.info("handleResetLayoutClick"),this.setState({isPanelsMenuShown:!1}),this.resetLayout()}handleImportLayoutFiles(e){var n;e.stopPropagation(),e.preventDefault(),e.target.files!=null&&this.importLayoutFile((n=e.target.files)==null?void 0:n[0])}async importLayoutFile(e){try{const{updateDashboardData:n,updateWorkspaceData:s}=this.props,i=await e.text(),o=JSON.parse(i),{filterSets:r,layoutConfig:l,links:a}=al.normalizeLayout(o);s({layoutConfig:l}),n(Mn,{filterSets:r,links:a})}catch(n){Pt.error("Unable to import layout",n)}}async resetLayout(){const{layoutStorage:e,session:n}=this.props,{filterSets:s,layoutConfig:i,links:o}=await al.getDefaultLayout(e,n!==void 0),{updateDashboardData:r,updateWorkspaceData:l}=this.props;l({layoutConfig:i}),r(Mn,{filterSets:s,links:o})}handlePaste(e){if(e.target instanceof HTMLElement&&e.target.closest(".monaco-editor"))return;const{clipboardData:n}=e,s=n.getData("Text"),i=/“|”/g;i.test(s)&&(e.preventDefault(),e.stopPropagation(),document.execCommand("insertText",!1,s.replace(i,'"')))}handleLoadTablePlugin(e){const{plugins:n}=this.props,s=n.get(e);return s!=null&&s.TablePlugin!=null?s.TablePlugin:pd.loadComponentPlugin(e)}hydrateDefault(e,n){const{connection:s}=this.props,{metadata:i}=e;if((i==null?void 0:i.type)!=null&&((i==null?void 0:i.id)!=null||(i==null?void 0:i.name)!=null)){const o=i.id!=null?{type:i.type,id:i.id}:{type:i.type,name:i.name,title:i.name};return{fetch:()=>s.getObject(o),localDashboardId:n,...e}}return td.hydrate(e,n)}hydrateGrid(e,n){var s;return this.hydrateTable(e,n,(s=e.metadata.type)!=null?s:M.VariableType.TABLE)}hydratePandas(e,n){return this.hydrateTable(e,n,M.VariableType.PANDAS)}hydrateTable(e,n,s=M.VariableType.TABLE){const{connection:i}=this.props;return{...e,getDownloadWorker:Nl.getServiceWorker,loadPlugin:this.handleLoadTablePlugin,localDashboardId:n,makeModel:()=>Fy(i,e.metadata,s)}}hydrateChart(e,n){const{connection:s}=this.props;return{...e,localDashboardId:n,makeModel:()=>{const{metadata:i,panelState:o}=e;return Ny(s,i,o)}}}openWidget(e,n){const{connection:s}=this.props;this.emitLayoutEvent(De.OPEN,{dragEvent:n,fetch:()=>s.getObject(e),widget:e})}render(){const{activeTool:e,plugins:n,user:s,workspace:i,serverConfigValues:o}=this.props,{data:r}=i,{layoutConfig:l}=r,{permissions:a}=s,{canUsePanels:d}=a,{contextActions:c,isPanelsMenuShown:u,isSettingsMenuShown:m,widgets:p}=this.state,g=this.getDashboardPlugins(n);return T("div",{className:z("app-main-tabs","w-100","h-100","d-flex","flex-column",e?`active-tool-${e.toLowerCase()}`:""),onPaste:this.handlePaste,tabIndex:-1,children:[h("nav",{className:"nav-container",children:T("div",{className:"app-main-top-nav-menus",children:[h("img",{src:yg,alt:"Deephaven Data Labs",width:"115px",className:"ml-1"}),T("div",{children:[T(W,{kind:"ghost",className:"btn-panels-menu",icon:gb,onClick:()=>{},children:["Controls",h(Mc,{handleControlSelect:this.handleControlSelect,handleToolSelect:this.handleToolSelect,onClearFilter:this.handleClearFilter})]}),d&&T(W,{kind:"ghost",className:"btn-panels-menu btn-show-panels","data-testid":"app-main-panels-button",onClick:this.handleWidgetMenuClick,icon:hb,children:["Panels",h(kn,{isShown:u,className:"panels-menu-popper",onExited:this.handleWidgetsMenuClose,closeOnBlur:!0,interactive:!0,children:h(My,{widgets:p,onExportLayout:this.handleExportLayoutClick,onImportLayout:this.handleImportLayoutClick,onResetLayout:this.handleResetLayoutClick,onSelect:this.handleWidgetSelect})})]}),h(W,{kind:"ghost",className:z("btn-settings-menu",{"text-warning":s.operateAs!==s.name}),onClick:this.handleSettingsMenuShow,icon:h(ee,{icon:sr,transform:"grow-3 right-1 down-1"}),tooltip:"User Settings"})]})]})}),T(Ev,{emptyDashboard:h(xy,{onAutoFillClick:this.handleAutoFillClick}),id:Mn,layoutConfig:l,onGoldenLayoutChange:this.handleGoldenLayoutChange,onLayoutConfigChange:this.handleLayoutConfigChange,onLayoutInitialized:this.openNotebookFromURL,hydrate:this.hydrateDefault,children:[h(k2,{hydrate:this.hydrateGrid,getDownloadWorker:Nl.getServiceWorker,loadPlugin:this.handleLoadTablePlugin}),h(D2,{hydrate:this.hydrateChart}),h(M2,{}),h(F2,{hydrateConsole:Xo.hydrateConsole,notebooksUrl:new URL("/notebooks/",`${window.location}`).href}),h(x2,{}),h(B2,{hydrate:this.hydratePandas}),h(U2,{}),h(V2,{}),g]}),h(mt,{in:m,timeout:ze.transitionMidMs,classNames:"slide-left",mountOnEnter:!0,unmountOnExit:!0,children:h(bo,{serverConfigValues:o,onDone:this.handleSettingsMenuHide})}),h(ae,{actions:c}),h("input",{ref:this.importElement,type:"file",accept:".json",style:{display:"none"},onChange:this.handleImportLayoutFiles})]})}}const zy=t=>{var e,n;return{activeTool:ql(t),dashboardData:Zt(t,Mn),layoutStorage:Ry(t),plugins:D0(t),connection:P1(t,Mn),session:(e=wi(t,Mn))==null?void 0:e.session,sessionConfig:(n=wi(t,Mn))==null?void 0:n.config,user:xm(t),workspace:Kl(t),serverConfigValues:Dy(t)}},Wy=It(zy,{setActiveTool:Xl,updateDashboardData:ts,updateWorkspaceData:jm})(Ef(Xo));function Gy(){return T("div",{className:"app",children:[h(Wy,{}),h(Wu,{})]})}const Ky=Z.module("LocalWorkspaceStorage"),zo=class{static async makeDefaultWorkspaceData(t,e){const{filterSets:n,links:s,layoutConfig:i}=await al.getDefaultLayout(t,e==null?void 0:e.isConsoleAvailable);return{settings:{defaultDateTimeFormat:st.DEFAULT_DATETIME_FORMAT_STRING,formatter:[],timeZone:st.DEFAULT_TIME_ZONE_ID,showTimeZone:!1,showTSeparator:!0,disableMoveConfirmation:!1,defaultDecimalFormatOptions:{defaultFormatString:_e.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:Qe.DEFAULT_FORMAT_STRING},truncateNumbersWithPound:!1,defaultNotebookSettings:{isMinimapEnabled:!1}},layoutConfig:i,closed:[{}],links:s,filterSets:n}}static async makeDefaultWorkspace(t,e){return{data:await zo.makeDefaultWorkspaceData(t,e)}}constructor(t){this.layoutStorage=t}async load(t){var e;try{return JSON.parse((e=localStorage.getItem(zo.STORAGE_KEY))!=null?e:"")}catch{return Ky.info("Unable to load workspace data, initializing to default data"),zo.makeDefaultWorkspace(this.layoutStorage,t)}}async save(t){return localStorage.setItem(zo.STORAGE_KEY,JSON.stringify(t)),t}};let Ag=zo;Ag.STORAGE_KEY="deephaven.WorkspaceStorage";class qy extends Error{constructor(){super(...arguments),this.isNoConsolesError=!0}}function Yy(t){return t.isNoConsolesError}const zs=Z.module("SessionUtils");var Pg=(t=>(t.ANONYMOUS="anonymous",t.PARENT="parent",t))(Pg||{});function Xy(){return new URL("/jsapi",`${window.location}`)}function Hg(){const t=Xy();return`${t.protocol}//${t.host}`}function jy(){switch(new URLSearchParams(window.location.search).get("authProvider")){case"parent":return"parent";default:return"anonymous"}}function Zy(){const t=Hg();return zs.info(`Starting connection to '${t}'...`),new M.IdeConnection(t)}async function Qy(t){zs.info("Getting console types...");const e=await t.getConsoleTypes();if(zs.info("Available types:",e),e.length===0)throw new qy("No console types available");const n=e[0];zs.info("Starting session with type",n);const s=await t.startSession(n),i={type:n,id:We.generate()};return zs.info("Console session established",i),{session:s,config:i,connection:t}}function Jy(){const t=Hg();return zs.info("createCoreClient",t),new M.CoreClient(t)}async function eI(){if(window.opener==null)throw new Error("window.opener is null, unable to send auth request.");return new Promise(t=>{const e=n=>{const{data:s}=n;if(zs.debug("Received message",s),(s==null?void 0:s.message)!=="loginOptions"){zs.debug("Ignore received message",s);return}window.removeEventListener("message",e),t(s.payload)};window.addEventListener("message",e),window.opener.postMessage("requestLoginOptionsFromParent","*")})}async function tI(t){switch(t){case"parent":return eI();case"anonymous":return{type:M.CoreClient.LOGIN_TYPE_ANONYMOUS};default:throw new Error(`Unknown auth type: ${t}`)}}class nI{constructor(e,n=""){this.storageService=e,this.root=n}async getLayouts(){return(await this.storageService.listItems(this.root,"*.json")).map(n=>n.basename)}async getLayout(e){const s=await(await this.storageService.loadFile(`${this.root}/${e}`)).text();return JSON.parse(s)}}const Lo=Z.module("GrpcFileStorageTable"),gd=class{constructor(t,e="",n=e){this.currentSize=0,this.listeners=[],this.childTables=new Map,this.storageService=t,this.baseRoot=e,this.root=n,n===e&&(this.doRefresh=Ze(this.doRefresh.bind(this),gd.REFRESH_DEBOUNCE))}removeBaseRoot(t){return pe.removeRoot(this.baseRoot,t)}getViewportData(){var t;return this.viewportUpdatePromise||this.refreshInternal(),(t=this.viewportUpdatePromise)!=null?t:Promise.resolve({items:[],offset:0})}getSnapshot(t){throw new Error("Method not implemented.")}get size(){return this.currentSize}setExpanded(t,e){const n=t.split("/");let s=n.shift();if((s===void 0||s==="")&&(s=n.shift()),s===void 0||s==="")throw new Error(`Invalid path: ${t}`);const i=n.join("/");if(e){if(!this.childTables.has(s)){const o=new gd(this.storageService,this.baseRoot,`${this.root}/${s}`);this.childTables.set(s,o)}if(i){const o=this.childTables.get(s);o==null||o.setExpanded(i,e)}}else if(this.childTables.has(s))if(i){const o=this.childTables.get(s);o==null||o.setExpanded(i,e)}else this.childTables.delete(s);this.currentViewport&&this.refreshInternal()}collapseAll(){this.childTables.clear(),this.currentViewport&&this.refreshInternal()}setSearch(t){throw new Error("Method not implemented.")}setViewport(t){this.currentViewport=t,this.refreshInternal()}setFilters(){throw new Error("Method not implemented.")}setSorts(){throw new Error("Method not implemented.")}setReversed(){throw new Error("Method not implemented.")}close(){this.listeners=[]}onUpdate(t){return this.listeners=[...this.listeners,t],()=>{this.listeners=this.listeners.filter(e=>e!==t)}}doRefresh(t){Lo.debug2("doRefresh",this.root),t(this.fetchData())}refresh(){var n;Lo.debug2("refresh",this.root),(n=this.viewportUpdatePromise)==null||n.cancel();const t=new Promise(s=>{this.doRefresh(s)}),e=ye.makeCancelable(t.then(s=>{if(this.viewportUpdatePromise!==e)throw new Qi;return this.currentViewportData=s,this.sendUpdate(),s}));e.catch(s=>{ye.isCanceled(s)||Lo.error("Error updating viewport",s)}),this.viewportUpdatePromise=e}refreshInternal(){try{this.refresh()}catch(t){ye.isCanceled(t)||Lo.error("Unable to refresh data",t)}}async fetchData(){const{currentViewport:t}=this;if(!t)throw new Error("No viewport set");let n=(await this.storageService.listItems(this.root)).map(s=>({type:s.type,filename:this.removeBaseRoot(s.filename),basename:s.basename,id:this.removeBaseRoot(s.filename),isExpanded:s.type==="directory"?this.childTables.has(s.basename):void 0})).sort((s,i)=>s.type!==i.type?s.type==="directory"?-1:1:s.basename.localeCompare(i.basename));for(let s=0;s<n.length;s+=1){const i=n[s],{basename:o,filename:r}=i;if(r===this.removeBaseRoot(`${this.root}/${o}`)&&i.type==="directory"){const l=this.childTables.get(o);if(l!=null){l.setViewport({top:0,bottom:t.bottom-s});const a=await l.getViewportData();n.splice(s+1,0,...a.items)}}}return this.currentSize=n.length,Lo.debug2(this.root,"items",n,t),n=n.slice(t.top,t.bottom),{items:n,offset:t.top}}sendUpdate(){var n;const{listeners:t}=this,e=(n=this.currentViewportData)!=null?n:{items:[],offset:0};for(let s=0;s<t.length;s+=1)t[s](e)}};let Vg=gd;Vg.REFRESH_DEBOUNCE=50;const sI=Z.module("GrpcFileStorage"),Ug=class{constructor(t,e=""){this.tables=[],this.refreshTables=Qn(()=>{this.tables.forEach(n=>n.refresh())},Ug.REFRESH_THROTTLE),this.storageService=t,this.root=e}removeRoot(t){return pe.removeRoot(this.root,t)}addRoot(t){return pe.addRoot(this.root,t)}async createDirectory(t){return await this.storageService.createDirectory(this.addRoot(t)),this.refreshTables(),{type:"directory",id:t,filename:t,basename:pe.getBaseName(t)}}async getTable(){const t=new Vg(this.storageService,this.root);return this.tables.push(t),t}async saveFile(t){const e=dh.storage.FileContents.text(t.content);return await this.storageService.saveFile(this.addRoot(t.filename),e,!0),this.refreshTables(),t}async loadFile(t){const n=await(await this.storageService.loadFile(this.addRoot(t))).text();return{filename:t,basename:pe.getBaseName(t),content:n}}async deleteFile(t){await this.storageService.deleteItem(this.addRoot(t)),this.refreshTables()}async moveFile(t,e){await this.storageService.moveItem(this.addRoot(t),this.addRoot(e)),this.refreshTables()}async info(t){const e=await this.storageService.listItems(this.addRoot(pe.getPath(t)),pe.getBaseName(t));if(e.length===0)throw new Sc;if(e.length>1)throw sI.error("More than one matching file found, should never happen.",e),new Error("More than one matching file found");const n=e[0];return{filename:this.removeRoot(n.filename),basename:n.basename,id:this.removeRoot(n.filename),type:n.type}}};let Bg=Ug;Bg.REFRESH_THROTTLE=150;const Ws=Z.module("AppInit");async function iI(){Ws.debug("Loading plugins...");try{const t=await pd.loadJson("/js-plugins/manifest.json");Ws.debug("Plugin manifest loaded:",t);const e=[];for(let i=0;i<t.plugins.length;i+=1){const{name:o,main:r}=t.plugins[i],l=`/js-plugins/${o}/${r}`;e.push(pd.loadModulePlugin(l))}const n=await Promise.all(e),s=new Map;for(let i=0;i<n.length;i+=1){const{name:o}=t.plugins[i];s.set(o,n[i])}return Ws.info("Plugins loaded:",s),s}catch(t){return Ws.error("Unable to load plugins:",t),new Map}}async function oI(t){let e;try{e=await Qy(t)}catch(n){if(!Yy(n))throw n}return e}function Nc(t){const{workspace:e,setActiveTool:n,setCommandHistoryStorage:s,setDashboardData:i,setFileStorage:o,setLayoutStorage:r,setDashboardConnection:l,setDashboardSessionWrapper:a,setPlugins:d,setUser:c,setWorkspace:u,setWorkspaceStorage:m,setServerConfigValues:p}=t,[g,f]=w.exports.useState(),[b,C]=w.exports.useState(!0),S=w.exports.useCallback(async()=>{var R,N;try{Ws.info("Initializing Web UI","0.27.0",navigator.userAgent);const F=Jy(),P=jy();Ws.info(`Login using auth type ${P}...`),await F.login(await tI(P));const H=await iI(),x=await(P===Pg.ANONYMOUS&&F.getAsIdeConnection==null?Zy():F.getAsIdeConnection());x.addEventListener(M.IdeConnection.HACK_CONNECTION_FAILURE,He=>{var Ve;const{detail:lt}=He;Ws.error("Connection failure",`${JSON.stringify(lt)}`),f(`Unable to connect: ${(Ve=lt.details)!=null?Ve:"Unknown Error"}`)});const A=await oI(x),k="user",G=F.getStorageService(),V=new nI(G,"/layouts"),O=new Bg(G,"/notebooks"),$=new Ag(V),Y=new J2,Q=await $.load({isConsoleAvailable:A!==void 0}),{data:U}=Q,{settings:q}=U;q.defaultDecimalFormatOptions===void 0&&(q.defaultDecimalFormatOptions={defaultFormatString:_e.DEFAULT_FORMAT_STRING}),q.defaultIntegerFormatOptions===void 0&&(q.defaultIntegerFormatOptions={defaultFormatString:Qe.DEFAULT_FORMAT_STRING}),q.truncateNumbersWithPound===void 0&&(q.truncateNumbersWithPound=!1);const{shortcutOverrides:j={}}=q,ce=Kt.isMacPlatform?(R=j.mac)!=null?R:{}:(N=j.windows)!=null?N:{};Object.entries(ce).forEach(([He,lt])=>{var Ve;(Ve=Ae.get(He))==null||Ve.setKeyState(lt)});const ne={filterSets:U.filterSets,links:U.links},he=await F.getServerConfigValues(),Ce=new Map(he),Re={name:k,operateAs:k,groups:[],permissions:{isSuperUser:!1,isQueryViewOnly:!1,isNonInteractive:!1,canUsePanels:!0,canCreateDashboard:!0,canCreateCodeStudio:!0,canCreateQueryMonitor:!0,canCopy:Ce.get("internal.webClient.appInit.canCopy")!=="false",canDownloadCsv:Ce.get("internal.webClient.appInit.canDownloadCsv")!=="false"}};n(Yt.DEFAULT),p(Ce),s(Y),i(Mn,ne),o(O),r(V),l(Mn,x),A!==void 0&&a(Mn,A),d(H),c(Re),m($),u(Q)}catch(F){Ws.error(F),f(F)}},[n,s,i,o,r,l,a,d,c,u,m,p]),v=w.exports.useCallback(()=>{document.fonts!=null?document.fonts.ready.then(()=>{C(!1)}):C(!1)},[]);w.exports.useEffect(function(){S(),v()},[S,v]);const y=e==null&&g==null||b,E=!y&&g==null,I=g!=null?`${g}`:null;return T(Te,{children:[E&&h(Gy,{}),h(Vl,{isLoading:y,isLoaded:E,errorMessage:I}),T("div",{id:"preload-fonts",style:{visibility:"hidden",position:"absolute",top:-1e4},children:[h("p",{className:"fira-sans-regular",children:"preload"}),h("p",{className:"fira-sans-semibold",children:"preload"}),h("p",{className:"fira-mono",children:"preload"})]})]})}Nc.propTypes={workspace:D.exports.shape({}),workspaceStorage:D.exports.shape({close:D.exports.func}),setActiveTool:D.exports.func.isRequired,setCommandHistoryStorage:D.exports.func.isRequired,setDashboardData:D.exports.func.isRequired,setFileStorage:D.exports.func.isRequired,setLayoutStorage:D.exports.func.isRequired,setDashboardConnection:D.exports.func.isRequired,setDashboardSessionWrapper:D.exports.func.isRequired,setPlugins:D.exports.func.isRequired,setUser:D.exports.func.isRequired,setWorkspace:D.exports.func.isRequired,setWorkspaceStorage:D.exports.func.isRequired};Nc.defaultProps={workspace:null,workspaceStorage:null};const rI=t=>({workspace:Kl(t),workspaceStorage:y0(t)}),fu=It(rI,{setActiveTool:Xl,setCommandHistoryStorage:F0,setDashboardData:wp,setFileStorage:x0,setLayoutStorage:ey,setDashboardConnection:H1,setDashboardSessionWrapper:V1,setPlugins:k0,setUser:M0,setWorkspace:Xm,setWorkspaceStorage:N0,setServerConfigValues:O0})(Nc);function lI(){return h(yf,{basename:"/ide/",children:T(If,{children:[h(Hc,{exact:!0,path:"/",component:fu}),h(Hc,{path:"/notebook/:notebookPath+",component:fu}),h(Rf,{from:"*",to:"/"})]})})}Boolean(window.location.hostname==="localhost"||window.location.hostname==="[::1]"||window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/));function aI(){"serviceWorker"in navigator&&navigator.serviceWorker.getRegistrations().then(t=>{t.forEach(e=>{e.scope.endsWith("/download/")||e.unregister()})})}gy();bi.render(h(Su,{store:jl,children:h(lI,{})}),document.getElementById("root"));aI();Nl.registerOnLoaded();rt.init({getWorker:()=>new Mf});window["__react-beautiful-dnd-disable-dev-warnings"]=!0;
|
|
47
|
+
//# sourceMappingURL=index.a4955cea.js.map
|