@deephaven/code-studio 0.29.1-relative-base-url.0 → 0.29.1-relative-base-url.1
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 K2(t){Xs(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:$("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(z,{kind:"ghost",className:"btn-delete-format-rule float-right",tabIndex:-1,onClick:()=>this.handleFormatRuleDelete(t),icon:un,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:$("custom-select",{"is-invalid":s}),value:l,id:e,onChange:d=>{const c=ot.makeFormat("",d.target.value,ot.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:$("form-control","flex-grow-1",{"is-invalid":s}),"data-lpignore":!0,id:e,placeholder:et.DEFAULT_FORMAT_STRING,type:"text",value:i,onChange:r=>{const l=et.makeFormat("",r.target.value,et.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:$("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(gt,{classNames:"fade",timeout:ze.transitionMs,onEnter:this.handleFormatRuleEntered,children:this.renderFormatRule(o,i)},i.id)),s=h(z,{kind:"ghost",className:"mb-3",onClick:this.handleFormatRuleCreate,ref:this.addFormatRuleButtonRef,icon:qs,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(Ef,{appear:t,enter:t,exit:t,children:n}),s]})}};let Fc=Pg;Fc.defaultProps={scrollTo:()=>{},defaults:{defaultDateTimeFormat:ot.DEFAULT_DATETIME_FORMAT_STRING,defaultDecimalFormatOptions:{defaultFormatString:_e.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:et.DEFAULT_FORMAT_STRING},showTimeZone:!1,showTSeparator:!0,timeZone:ot.DEFAULT_TIME_ZONE_ID}};Fc.inputDebounceTime=250;const My=t=>({formatter:$m(t),defaultDateTimeFormat:Um(t),defaultDecimalFormatOptions:Vm(t),defaultIntegerFormatOptions:Bm(t),showTimeZone:zm(t),showTSeparator:Wm(t),truncateNumbersWithPound:Gm(t),timeZone:dr(t),settings:Nt(t)}),Ny=Mt(My,{saveSettings:jl})(Fc),gs=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=Q.createRef(),this.state={expandedSectionKey:gs.FORMATTING_SECTION_KEY}}static focusFirstInputInContainer(t){const e=t==null?void 0:t.querySelector("input, select, textarea");e&&e.focus()}componentDidMount(){gs.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;Iy(void 0,Object.fromEntries(t))}render(){const t="0.29.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(z,{kind:"ghost",className:"btn-close-settings-menu",onClick:this.handleClose,icon:h(te,{icon:ao,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(Qo,{sectionKey:gs.FORMATTING_SECTION_KEY,isExpanded:this.isSectionExpanded(gs.FORMATTING_SECTION_KEY),title:T(Te,{children:[h(te,{icon:tb,transform:"grow-4",className:"mr-2"}),"Default Formatting & Time zone"]}),onToggle:this.handleSectionToggle,children:h(my,{})}),h(Qo,{sectionKey:gs.COLUMN_SPECIFIC_SECTION_KEY,isExpanded:this.isSectionExpanded(gs.COLUMN_SPECIFIC_SECTION_KEY),title:T(Te,{children:[h(te,{icon:UC,transform:"grow-4",className:"mr-2"}),"Column Specific Formatting Rules"]}),onToggle:this.handleSectionToggle,children:h(Ny,{scrollTo:this.handleScrollTo})}),h(Qo,{sectionKey:gs.SHORTCUT_SECTION_KEY,isExpanded:this.isSectionExpanded(gs.SHORTCUT_SECTION_KEY),title:T(Te,{children:[h(te,{icon:YC,transform:"grow-2"})," ","Keyboard Shortcuts"]}),onToggle:this.handleSectionToggle,children:h(wy,{})}),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(z,{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(te,{icon:LC}),T(qe,{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(Ul,{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(py,{})})]}),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:Ng,alt:"Deephaven Data Labs",width:"230px"})})})})]})]})]})}};let vo=gs;vo.defaultProps={onDone:()=>{}};vo.FORMATTING_SECTION_KEY="SettingsMenu.formatting";vo.COLUMN_SPECIFIC_SECTION_KEY="SettingsMenu.columnFormatting";vo.APPLICATION_SECTION_KEY="ApplicationMenu.settings";vo.SHORTCUT_SECTION_KEY="SettingsMenu.shortcuts";const Su=10;function Yi(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)>=Su||Math.abs(c.current-C.clientY)>=Su)&&(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:$("btn-context-menu",{disabled:s},{active:r&&!s},{"keyboard-active":l&&!s}),onMouseDown:f,onMouseUp:b,disabled:m,children:[h("span",{className:$("icon"),children:i}),h("span",{className:"title",children:n}),h("span",{className:"shortcut",children:o})]})}function xc(t){const{handleControlSelect:e,handleToolSelect:n,onClearFilter:s}=t,i=w.exports.useMemo(()=>[{title:"Input Filter",icon:pb,menuElement:h(Yi,{}),action:o=>{e(Tn.INPUT_FILTER,o)},order:10},{title:"Dropdown Filter",icon:zu,menuElement:h(Yi,{}),action:o=>{e(Tn.DROPDOWN_FILTER,o)},order:15},{title:"Markdown Widget",icon:zC,menuElement:h(Yi,{}),action:o=>{e(Tn.MARKDOWN,o)},order:20},{title:"Filter Sets",icon:Ka,menuElement:h(Yi,{}),action:o=>{e(Tn.FILTER_SET_MANAGER,o)},order:25},{disabled:!0,menuElement:h("div",{className:"context-menu-group-header",children:"Tools"}),order:30},{title:"Linker",icon:Rd,action:()=>{n(Xt.LINKER)},order:40,shortcut:vs.LINKER},{disabled:!0,menuElement:h("div",{className:"context-menu-group-header",children:"Actions"}),order:50},{title:"Clear All Filters",icon:cb,action:()=>{s()},order:60,shortcut:dn.TABLE.CLEAR_ALL_FILTERS}],[e,n,s]);return h(_n,{popperClassName:"controls-menu-popper",actions:i})}xc.propTypes={handleControlSelect:D.exports.func,handleToolSelect:D.exports.func,onClearFilter:D.exports.func};xc.defaultProps={handleControlSelect:()=>{},handleToolSelect:()=>{},onClearFilter:()=>{}};Yi.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})};Yi.defaultProps={forwardedProps:null};const Fy=Ys(Mg,null),xy={layoutStorage:Fy},_y=t=>t.layoutStorage,ky=t=>t.serverConfigValues;Object.entries(xy).map(([t,e])=>po.register(t,e));const wu=10;function Oy(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)>=wu||Math.abs(u.current.y-y.clientY)>=wu)&&(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(z,{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(um,{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(Es,{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(z,{kind:"ghost",onClick:e,children:[T("div",{className:"fa-md fa-layers",children:[h(te,{mask:qa,icon:Kc,transform:"right-5 down-5"}),h(te,{icon:Kc,transform:"right-8 down-6"})]}),"Export Layout"]}),T(z,{kind:"ghost",onClick:n,children:[T("div",{className:"fa-md fa-layers",children:[h(te,{mask:qa,icon:Ga,transform:"right-5 down-5"}),h(te,{icon:Ga,transform:"right-8 down-6"})]}),"Import Layout"]}),h(z,{kind:"ghost",icon:mi,onClick:s,tooltip:"Reset Layout"})]})]})}const Ay=async(t,e,n)=>{let s,i,o,r;if(rl(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 so.makeModel(s,c)}const l={title:o,name:i,type:M.VariableType.TABLE},a=await t.getObject(l);return ie.applyTableSettings(a,r,dr(Ql.getState())),so.makeModelFromSettings(s,a)},Ly=async(t,e,n=M.VariableType.TABLE)=>{const{table:s}=e,i={title:s,name:s,type:n},o=await t.getObject(i);return uc.makeModel(o)};function Py({onAutoFillClick:t=()=>{}}){return T("div",{className:"empty-dashboard-container",children:[T("div",{className:"hint-container",children:[h(te,{icon:ku})," ",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(z,{kind:"tertiary",onClick:t,children:"Auto fill objects"})]})]})}function Hy(t){return t.version===2}function Uy(t){return Array.isArray(t)}const el=J.module("UserLayoutUtils"),Vy={layoutConfig:[{type:"column",content:[{type:"row",height:40,content:[{type:"stack",content:[{type:"react-component",component:qi.COMPONENT,title:qi.TITLE,isClosable:!1},{type:"react-component",component:Fl.COMPONENT,title:Fl.TITLE,isClosable:!1}]},{type:"stack",width:25,content:[{type:"react-component",component:Dl.COMPONENT,title:Dl.TITLE,isClosable:!1},{type:"react-component",component:Ml.COMPONENT,title:Ml.TITLE,isClosable:!1}]}]},{type:"row",content:[{type:"stack",title:"Notebooks",content:[]}]}]}],links:[],filterSets:[],version:2},By={layoutConfig:[],links:[],filterSets:[],version:2};function Hg(t){if(Hy(t))return t;if(Uy(t))return{layoutConfig:t,links:[],filterSets:[],version:2};throw new Error(`Unexpected layout import format: ${t}`)}async function $y(t,e=!0){try{const n=await t.getLayouts();if(n.length>0)try{const s=await t.getLayout(n[0]);return Hg(s)}catch(s){el.error("Unable to load layout",n[0],":",s),el.warn("No valid layouts found, falling back to default layout")}}catch(n){el.error("Unable to fetch layout list",n),el.warn("Falling back to default layout")}return e?Vy:By}function zy(t){const{filterSets:e,layoutConfig:n,links:s}=t;return{filterSets:e,layoutConfig:n,links:s,version:2}}const hl={exportLayout:zy,getDefaultLayout:$y,normalizeLayout:Hg},tl=J.module("DownloadServiceWorkerUtils"),Ug=class{static registerOnLoaded(){new URL("./",window.location.href).origin===window.location.origin&&("serviceWorker"in navigator?window.addEventListener("load",()=>{const e=new URL("./download/serviceWorker.js",window.location.href);navigator.serviceWorker.register(e).then(n=>{n.update(),tl.info("Registering service worker on ",e,n)}).catch(n=>{tl.error("Failed to register service worker",n)})}):tl.info("Service worker is not supported."))}static async getServiceWorker(){if("serviceWorker"in navigator){const e=(await navigator.serviceWorker.getRegistrations()).find(n=>n.scope.endsWith(Ug.DOWNLOAD_PATH));if(e&&e.active)return tl.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 xl=Ug;xl.DOWNLOAD_PATH="/download/";const Vg={react:Q},Wy=yf(Vg),Gy=If({requires:Wy}),Ky=Rf.createRequires(Vg),qy=Df({requires:Ky}),Yy=J.module("PluginUtils");class Cd{static loadComponentPlugin(e){if("".split(",").includes(e)){const o=Q.lazy(()=>_f(()=>import(`./internal/${e}`),[],import.meta.url)),r=Q.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("./plugins/",`${window.location}`),s=new URL(`${e}.js`,n),i=Q.forwardRef((o,r)=>h(Gy,{url:s,render:({err:l,Component:a})=>{if(l!=null&&l!==""){const d=`Error loading plugin ${e} from ${s} due to ${l}`;return Yy.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 qy(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 Ut=J.module("AppMainContainer");class Jo 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=Q.createRef(),this.state={contextActions:[{action:()=>{this.handleToolSelect(Xt.LINKER)},shortcut:vs.LINKER,isGlobal:!0},{action:()=>{this.sendClearFilter()},shortcut:dn.TABLE.CLEAR_ALL_FILTERS,isGlobal:!0},{action:()=>{Ut.debug("Consume unhandled save shortcut")},shortcut:vs.SAVE,isGlobal:!0}],isPanelsMenuShown:!1,isSettingsMenuShown:!1,widgets:[]}}static handleWindowBeforeUnload(e){e.preventDefault(),e.returnValue=""}static hydrateConsole(e,n){return id.hydrate({...e,unzip:s=>Du.loadAsync(s).then(i=>Object.values(i.files))},n)}componentDidMount(){this.initWidgets(),window.addEventListener("beforeunload",Jo.handleWindowBeforeUnload)}componentDidUpdate(e){const{dashboardData:n}=this.props;e.dashboardData!==n&&this.handleDataChange(n)}componentWillUnmount(){this.deinitWidgets(),window.removeEventListener("beforeunload",Jo.handleWindowBeforeUnload)}initWidgets(){const{connection:e}=this.props;if(e.subscribeToFieldUpdates==null){Ut.warn("subscribeToFieldUpdates not supported, not initializing widgets");return}this.widgetListenerRemover=e.subscribeToFieldUpdates(n=>{Ut.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){Ut.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(Ae.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)||Ut.error(e)}handleSettingsMenuHide(){this.setState({isSettingsMenuShown:!1})}handleSettingsMenuShow(){this.setState({isSettingsMenuShown:!0})}handleControlSelect(e,n=null){switch(Ut.debug("handleControlSelect",e),e){case Tn.DROPDOWN_FILTER:this.emitLayoutEvent(Pe.OPEN_DROPDOWN,{title:"DropdownFilter",type:e,createNewStack:!0,dragEvent:n});break;case Tn.INPUT_FILTER:this.emitLayoutEvent(Pe.OPEN_INPUT,{title:"InputFilter",type:e,createNewStack:!0,dragEvent:n});break;case Tn.MARKDOWN:this.emitLayoutEvent(ag.OPEN,{title:"Markdown",type:e,dragEvent:n});break;case Tn.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){Ut.debug("handleToolSelect",e);const{activeTool:n,setActiveTool:s}=this.props;s(n===e?Xt.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}),Ut.debug("handleWidgetSelect",e,n),this.openWidget(e,n)}handleWidgetsMenuClose(){this.setState({isPanelsMenuShown:!1})}handleAutoFillClick(){const{widgets:e}=this.state;Ut.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(){Ut.info("handleExportLayoutClick"),this.setState({isPanelsMenuShown:!1});try{const{workspace:e}=this.props,{data:n}=e,s=hl.exportLayout(n);Ut.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){Ut.error("Unable to export layout",e)}}handleImportLayoutClick(){Ut.info("handleImportLayoutClick"),this.setState({isPanelsMenuShown:!1}),this.importElement.current!=null&&(this.importElement.current.value="",this.importElement.current.click())}handleResetLayoutClick(){Ut.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}=hl.normalizeLayout(o);s({layoutConfig:l}),n(Fn,{filterSets:r,links:a})}catch(n){Ut.error("Unable to import layout",n)}}async resetLayout(){const{layoutStorage:e,session:n}=this.props,{filterSets:s,layoutConfig:i,links:o}=await hl.getDefaultLayout(e,n!==void 0),{updateDashboardData:r,updateWorkspaceData:l}=this.props;l({layoutConfig:i}),r(Fn,{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:Cd.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 id.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:xl.getServiceWorker,loadPlugin:this.handleLoadTablePlugin,localDashboardId:n,makeModel:()=>Ly(i,e.metadata,s)}}hydrateChart(e,n){const{connection:s}=this.props;return{...e,localDashboardId:n,makeModel:()=>{const{metadata:i,panelState:o}=e;return Ay(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:$("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:Ng,alt:"Deephaven Data Labs",width:"115px",className:"ml-1"}),T("div",{children:[T(z,{kind:"ghost",className:"btn-panels-menu",icon:wb,onClick:()=>{},children:["Controls",h(xc,{handleControlSelect:this.handleControlSelect,handleToolSelect:this.handleToolSelect,onClearFilter:this.handleClearFilter})]}),d&&T(z,{kind:"ghost",className:"btn-panels-menu btn-show-panels","data-testid":"app-main-panels-button",onClick:this.handleWidgetMenuClick,icon:fb,children:["Panels",h(An,{isShown:u,className:"panels-menu-popper",onExited:this.handleWidgetsMenuClose,closeOnBlur:!0,interactive:!0,children:h(Oy,{widgets:p,onExportLayout:this.handleExportLayoutClick,onImportLayout:this.handleImportLayoutClick,onResetLayout:this.handleResetLayoutClick,onSelect:this.handleWidgetSelect})})]}),h(z,{kind:"ghost",className:$("btn-settings-menu",{"text-warning":s.operateAs!==s.name}),onClick:this.handleSettingsMenuShow,icon:h(te,{icon:lr,transform:"grow-3 right-1 down-1"}),tooltip:"User Settings"})]})]})}),T(Mv,{emptyDashboard:h(Py,{onAutoFillClick:this.handleAutoFillClick}),id:Fn,layoutConfig:l,onGoldenLayoutChange:this.handleGoldenLayoutChange,onLayoutConfigChange:this.handleLayoutConfigChange,onLayoutInitialized:this.openNotebookFromURL,hydrate:this.hydrateDefault,children:[h(U2,{hydrate:this.hydrateGrid,getDownloadWorker:xl.getServiceWorker,loadPlugin:this.handleLoadTablePlugin}),h(k2,{hydrate:this.hydrateChart}),h(O2,{}),h(L2,{hydrateConsole:Jo.hydrateConsole,notebooksUrl:new URL("../notebooks/",`${window.location}`).href}),h(P2,{}),h(q2,{hydrate:this.hydratePandas}),h(K2,{}),h(G2,{}),g]}),h(gt,{in:m,timeout:ze.transitionMidMs,classNames:"slide-left",mountOnEnter:!0,unmountOnExit:!0,children:h(vo,{serverConfigValues:o,onDone:this.handleSettingsMenuHide})}),h(de,{actions:c}),h("input",{ref:this.importElement,type:"file",accept:".json",style:{display:"none"},onChange:this.handleImportLayoutFiles})]})}}const Xy=t=>{var e,n;return{activeTool:Xl(t),dashboardData:Qt(t,Fn),layoutStorage:_y(t),plugins:_0(t),connection:z1(t,Fn),session:(e=Ei(t,Fn))==null?void 0:e.session,sessionConfig:(n=Ei(t,Fn))==null?void 0:n.config,user:Lm(t),workspace:Yl(t),serverConfigValues:ky(t)}},jy=Mt(Xy,{setActiveTool:Zl,updateDashboardData:ns,updateWorkspaceData:tp})(Mf(Jo));function Zy(){return T("div",{className:"app",children:[h(jy,{}),h(Xu,{})]})}const Qy=J.module("LocalWorkspaceStorage"),qo=class{static async makeDefaultWorkspaceData(t,e){const{filterSets:n,links:s,layoutConfig:i}=await hl.getDefaultLayout(t,e==null?void 0:e.isConsoleAvailable);return{settings:{defaultDateTimeFormat:ot.DEFAULT_DATETIME_FORMAT_STRING,formatter:[],timeZone:ot.DEFAULT_TIME_ZONE_ID,showTimeZone:!1,showTSeparator:!0,disableMoveConfirmation:!1,defaultDecimalFormatOptions:{defaultFormatString:_e.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:et.DEFAULT_FORMAT_STRING},truncateNumbersWithPound:!1,defaultNotebookSettings:{isMinimapEnabled:!1}},layoutConfig:i,closed:[{}],links:s,filterSets:n}}static async makeDefaultWorkspace(t,e){return{data:await qo.makeDefaultWorkspaceData(t,e)}}constructor(t){this.layoutStorage=t}async load(t){var e;try{return JSON.parse((e=localStorage.getItem(qo.STORAGE_KEY))!=null?e:"")}catch{return Qy.info("Unable to load workspace data, initializing to default data"),qo.makeDefaultWorkspace(this.layoutStorage,t)}}async save(t){return localStorage.setItem(qo.STORAGE_KEY,JSON.stringify(t)),t}};let Bg=qo;Bg.STORAGE_KEY="deephaven.WorkspaceStorage";class Jy extends Error{constructor(){super(...arguments),this.isNoConsolesError=!0}}function eI(t){return t.isNoConsolesError}const Gs=J.module("SessionUtils");var $g=(t=>(t.ANONYMOUS="anonymous",t.PARENT="parent",t))($g||{});function tI(){return new URL("/jsapi",`${window.location}`)}function zg(){const t=tI();return`${t.protocol}//${t.host}`}function nI(){switch(new URLSearchParams(window.location.search).get("authProvider")){case"parent":return"parent";default:return"anonymous"}}function sI(){const t=zg();return Gs.info(`Starting connection to '${t}'...`),new M.IdeConnection(t)}async function iI(t){Gs.info("Getting console types...");const e=await t.getConsoleTypes();if(Gs.info("Available types:",e),e.length===0)throw new Jy("No console types available");const n=e[0];Gs.info("Starting session with type",n);const s=await t.startSession(n),i={type:n,id:Ge.generate()};return Gs.info("Console session established",i),{session:s,config:i,connection:t}}function oI(){const t=zg();return Gs.info("createCoreClient",t),new M.CoreClient(t)}async function rI(){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(Gs.debug("Received message",s),(s==null?void 0:s.message)!=="loginOptions"){Gs.debug("Ignore received message",s);return}window.removeEventListener("message",e),t(s.payload)};window.addEventListener("message",e),window.opener.postMessage("requestLoginOptionsFromParent","*")})}async function lI(t){switch(t){case"parent":return rI();case"anonymous":return{type:M.CoreClient.LOGIN_TYPE_ANONYMOUS};default:throw new Error(`Unknown auth type: ${t}`)}}class aI{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 Uo=J.module("GrpcFileStorageTable"),bd=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=Je(this.doRefresh.bind(this),bd.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 bd(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){Uo.debug2("doRefresh",this.root),t(this.fetchData())}refresh(){var n;Uo.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 to;return this.currentViewportData=s,this.sendUpdate(),s}));e.catch(s=>{ye.isCanceled(s)||Uo.error("Error updating viewport",s)}),this.viewportUpdatePromise=e}refreshInternal(){try{this.refresh()}catch(t){ye.isCanceled(t)||Uo.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,Uo.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 Wg=bd;Wg.REFRESH_DEBOUNCE=50;const dI=J.module("GrpcFileStorage"),Gg=class{constructor(t,e=""){this.tables=[],this.refreshTables=Jn(()=>{this.tables.forEach(n=>n.refresh())},Gg.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 Wg(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 Tc;if(e.length>1)throw dI.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 Kg=Gg;Kg.REFRESH_THROTTLE=150;const Ks=J.module("AppInit");async function cI(){Ks.debug("Loading plugins...");try{const t=await Cd.loadJson("../js-plugins/manifest.json");Ks.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(Cd.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 Ks.info("Plugins loaded:",s),s}catch(t){return Ks.error("Unable to load plugins:",t),new Map}}async function hI(t){let e;try{e=await iI(t)}catch(n){if(!eI(n))throw n}return e}function _c(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{Ks.info("Initializing Web UI","0.29.0",navigator.userAgent);const F=oI(),H=nI();Ks.info(`Login using auth type ${H}...`),await F.login(await lI(H));const U=await cI(),x=await(H===$g.ANONYMOUS&&F.getAsIdeConnection==null?sI():F.getAsIdeConnection());x.addEventListener(M.IdeConnection.HACK_CONNECTION_FAILURE,He=>{var Ct;const{detail:dt}=He;Ks.error("Connection failure",`${JSON.stringify(dt)}`),f(`Unable to connect: ${(Ct=dt.details)!=null?Ct:"Unknown Error"}`)});const A=await hI(x),k="user",W=F.getStorageService(),X=new aI(W,"../layouts"),V=new Kg(W,"../notebooks"),L=new Bg(X),K=new oy,Y=await L.load({isConsoleAvailable:A!==void 0}),{data:P}=Y,{settings:G}=P;G.defaultDecimalFormatOptions===void 0&&(G.defaultDecimalFormatOptions={defaultFormatString:_e.DEFAULT_FORMAT_STRING}),G.defaultIntegerFormatOptions===void 0&&(G.defaultIntegerFormatOptions={defaultFormatString:et.DEFAULT_FORMAT_STRING}),G.truncateNumbersWithPound===void 0&&(G.truncateNumbersWithPound=!1);const{shortcutOverrides:Z={}}=G,ae=qt.isMacPlatform?(R=Z.mac)!=null?R:{}:(N=Z.windows)!=null?N:{};Object.entries(ae).forEach(([He,dt])=>{var Ct;(Ct=Le.get(He))==null||Ct.setKeyState(dt)});const j={filterSets:P.filterSets,links:P.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(Xt.DEFAULT),p(Ce),s(K),i(Fn,j),o(V),r(X),l(Fn,x),A!==void 0&&a(Fn,A),d(U),c(Re),m(L),u(Y)}catch(F){Ks.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(Zy,{}),h(Bl,{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"})]})]})}_c.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};_c.defaultProps={workspace:null,workspaceStorage:null};const uI=t=>({workspace:Yl(t),workspaceStorage:N0(t)}),vu=Mt(uI,{setActiveTool:Zl,setCommandHistoryStorage:A0,setDashboardData:Ip,setFileStorage:L0,setLayoutStorage:ry,setDashboardConnection:W1,setDashboardSessionWrapper:G1,setPlugins:H0,setUser:k0,setWorkspace:ep,setWorkspaceStorage:O0,setServerConfigValues:U0})(_c);function mI(){return h(Nf,{basename:"./",children:T(Ff,{children:[h($c,{exact:!0,path:"/",component:vu}),h($c,{path:"/notebook/:notebookPath+",component:vu}),h(xf,{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 pI(){"serviceWorker"in navigator&&navigator.serviceWorker.getRegistrations().then(t=>{t.forEach(e=>{e.scope.endsWith("/download/")||e.unregister()})})}vy();wi.render(h(yu,{store:Ql,children:h(mI,{})}),document.getElementById("root"));pI();xl.registerOnLoaded();at.init({getWorker:()=>new kf});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(py,{})})]}),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:Ng,alt:"Deephaven Data Labs",width:"230px"})})})})]})]})]})}};let vo=gs;vo.defaultProps={onDone:()=>{}};vo.FORMATTING_SECTION_KEY="SettingsMenu.formatting";vo.COLUMN_SPECIFIC_SECTION_KEY="SettingsMenu.columnFormatting";vo.APPLICATION_SECTION_KEY="ApplicationMenu.settings";vo.SHORTCUT_SECTION_KEY="SettingsMenu.shortcuts";const Su=10;function Yi(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)>=Su||Math.abs(c.current-C.clientY)>=Su)&&(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:$("btn-context-menu",{disabled:s},{active:r&&!s},{"keyboard-active":l&&!s}),onMouseDown:f,onMouseUp:b,disabled:m,children:[h("span",{className:$("icon"),children:i}),h("span",{className:"title",children:n}),h("span",{className:"shortcut",children:o})]})}function xc(t){const{handleControlSelect:e,handleToolSelect:n,onClearFilter:s}=t,i=w.exports.useMemo(()=>[{title:"Input Filter",icon:pb,menuElement:h(Yi,{}),action:o=>{e(Tn.INPUT_FILTER,o)},order:10},{title:"Dropdown Filter",icon:zu,menuElement:h(Yi,{}),action:o=>{e(Tn.DROPDOWN_FILTER,o)},order:15},{title:"Markdown Widget",icon:zC,menuElement:h(Yi,{}),action:o=>{e(Tn.MARKDOWN,o)},order:20},{title:"Filter Sets",icon:Ka,menuElement:h(Yi,{}),action:o=>{e(Tn.FILTER_SET_MANAGER,o)},order:25},{disabled:!0,menuElement:h("div",{className:"context-menu-group-header",children:"Tools"}),order:30},{title:"Linker",icon:Rd,action:()=>{n(Xt.LINKER)},order:40,shortcut:vs.LINKER},{disabled:!0,menuElement:h("div",{className:"context-menu-group-header",children:"Actions"}),order:50},{title:"Clear All Filters",icon:cb,action:()=>{s()},order:60,shortcut:dn.TABLE.CLEAR_ALL_FILTERS}],[e,n,s]);return h(_n,{popperClassName:"controls-menu-popper",actions:i})}xc.propTypes={handleControlSelect:D.exports.func,handleToolSelect:D.exports.func,onClearFilter:D.exports.func};xc.defaultProps={handleControlSelect:()=>{},handleToolSelect:()=>{},onClearFilter:()=>{}};Yi.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})};Yi.defaultProps={forwardedProps:null};const Fy=Ys(Mg,null),xy={layoutStorage:Fy},_y=t=>t.layoutStorage,ky=t=>t.serverConfigValues;Object.entries(xy).map(([t,e])=>po.register(t,e));const wu=10;function Oy(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)>=wu||Math.abs(u.current.y-y.clientY)>=wu)&&(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(z,{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(um,{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(Es,{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(z,{kind:"ghost",onClick:e,children:[T("div",{className:"fa-md fa-layers",children:[h(te,{mask:qa,icon:Kc,transform:"right-5 down-5"}),h(te,{icon:Kc,transform:"right-8 down-6"})]}),"Export Layout"]}),T(z,{kind:"ghost",onClick:n,children:[T("div",{className:"fa-md fa-layers",children:[h(te,{mask:qa,icon:Ga,transform:"right-5 down-5"}),h(te,{icon:Ga,transform:"right-8 down-6"})]}),"Import Layout"]}),h(z,{kind:"ghost",icon:mi,onClick:s,tooltip:"Reset Layout"})]})]})}const Ay=async(t,e,n)=>{let s,i,o,r;if(rl(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 so.makeModel(s,c)}const l={title:o,name:i,type:M.VariableType.TABLE},a=await t.getObject(l);return ie.applyTableSettings(a,r,dr(Ql.getState())),so.makeModelFromSettings(s,a)},Ly=async(t,e,n=M.VariableType.TABLE)=>{const{table:s}=e,i={title:s,name:s,type:n},o=await t.getObject(i);return uc.makeModel(o)};function Py({onAutoFillClick:t=()=>{}}){return T("div",{className:"empty-dashboard-container",children:[T("div",{className:"hint-container",children:[h(te,{icon:ku})," ",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(z,{kind:"tertiary",onClick:t,children:"Auto fill objects"})]})]})}function Hy(t){return t.version===2}function Uy(t){return Array.isArray(t)}const el=J.module("UserLayoutUtils"),Vy={layoutConfig:[{type:"column",content:[{type:"row",height:40,content:[{type:"stack",content:[{type:"react-component",component:qi.COMPONENT,title:qi.TITLE,isClosable:!1},{type:"react-component",component:Fl.COMPONENT,title:Fl.TITLE,isClosable:!1}]},{type:"stack",width:25,content:[{type:"react-component",component:Dl.COMPONENT,title:Dl.TITLE,isClosable:!1},{type:"react-component",component:Ml.COMPONENT,title:Ml.TITLE,isClosable:!1}]}]},{type:"row",content:[{type:"stack",title:"Notebooks",content:[]}]}]}],links:[],filterSets:[],version:2},By={layoutConfig:[],links:[],filterSets:[],version:2};function Hg(t){if(Hy(t))return t;if(Uy(t))return{layoutConfig:t,links:[],filterSets:[],version:2};throw new Error(`Unexpected layout import format: ${t}`)}async function $y(t,e=!0){try{const n=await t.getLayouts();if(n.length>0)try{const s=await t.getLayout(n[0]);return Hg(s)}catch(s){el.error("Unable to load layout",n[0],":",s),el.warn("No valid layouts found, falling back to default layout")}}catch(n){el.error("Unable to fetch layout list",n),el.warn("Falling back to default layout")}return e?Vy:By}function zy(t){const{filterSets:e,layoutConfig:n,links:s}=t;return{filterSets:e,layoutConfig:n,links:s,version:2}}const hl={exportLayout:zy,getDefaultLayout:$y,normalizeLayout:Hg},tl=J.module("DownloadServiceWorkerUtils"),Ug=class{static registerOnLoaded(){new URL("./",window.location.href).origin===window.location.origin&&("serviceWorker"in navigator?window.addEventListener("load",()=>{const e=new URL("./download/serviceWorker.js",window.location.href);navigator.serviceWorker.register(e).then(n=>{n.update(),tl.info("Registering service worker on ",e,n)}).catch(n=>{tl.error("Failed to register service worker",n)})}):tl.info("Service worker is not supported."))}static async getServiceWorker(){if("serviceWorker"in navigator){const e=(await navigator.serviceWorker.getRegistrations()).find(n=>n.scope.endsWith(Ug.DOWNLOAD_PATH));if(e&&e.active)return tl.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 xl=Ug;xl.DOWNLOAD_PATH="/download/";const Vg={react:Q},Wy=yf(Vg),Gy=If({requires:Wy}),Ky=Rf.createRequires(Vg),qy=Df({requires:Ky}),Yy=J.module("PluginUtils");class Cd{static loadComponentPlugin(e){if("".split(",").includes(e)){const o=Q.lazy(()=>_f(()=>import(`./internal/${e}`),[],import.meta.url)),r=Q.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("./plugins/",`${window.location}`),s=new URL(`${e}.js`,n),i=Q.forwardRef((o,r)=>h(Gy,{url:s,render:({err:l,Component:a})=>{if(l!=null&&l!==""){const d=`Error loading plugin ${e} from ${s} due to ${l}`;return Yy.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 qy(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 Ut=J.module("AppMainContainer");class Jo 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=Q.createRef(),this.state={contextActions:[{action:()=>{this.handleToolSelect(Xt.LINKER)},shortcut:vs.LINKER,isGlobal:!0},{action:()=>{this.sendClearFilter()},shortcut:dn.TABLE.CLEAR_ALL_FILTERS,isGlobal:!0},{action:()=>{Ut.debug("Consume unhandled save shortcut")},shortcut:vs.SAVE,isGlobal:!0}],isPanelsMenuShown:!1,isSettingsMenuShown:!1,widgets:[]}}static handleWindowBeforeUnload(e){e.preventDefault(),e.returnValue=""}static hydrateConsole(e,n){return id.hydrate({...e,unzip:s=>Du.loadAsync(s).then(i=>Object.values(i.files))},n)}componentDidMount(){this.initWidgets(),window.addEventListener("beforeunload",Jo.handleWindowBeforeUnload)}componentDidUpdate(e){const{dashboardData:n}=this.props;e.dashboardData!==n&&this.handleDataChange(n)}componentWillUnmount(){this.deinitWidgets(),window.removeEventListener("beforeunload",Jo.handleWindowBeforeUnload)}initWidgets(){const{connection:e}=this.props;if(e.subscribeToFieldUpdates==null){Ut.warn("subscribeToFieldUpdates not supported, not initializing widgets");return}this.widgetListenerRemover=e.subscribeToFieldUpdates(n=>{Ut.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){Ut.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(Ae.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)||Ut.error(e)}handleSettingsMenuHide(){this.setState({isSettingsMenuShown:!1})}handleSettingsMenuShow(){this.setState({isSettingsMenuShown:!0})}handleControlSelect(e,n=null){switch(Ut.debug("handleControlSelect",e),e){case Tn.DROPDOWN_FILTER:this.emitLayoutEvent(Pe.OPEN_DROPDOWN,{title:"DropdownFilter",type:e,createNewStack:!0,dragEvent:n});break;case Tn.INPUT_FILTER:this.emitLayoutEvent(Pe.OPEN_INPUT,{title:"InputFilter",type:e,createNewStack:!0,dragEvent:n});break;case Tn.MARKDOWN:this.emitLayoutEvent(ag.OPEN,{title:"Markdown",type:e,dragEvent:n});break;case Tn.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){Ut.debug("handleToolSelect",e);const{activeTool:n,setActiveTool:s}=this.props;s(n===e?Xt.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}),Ut.debug("handleWidgetSelect",e,n),this.openWidget(e,n)}handleWidgetsMenuClose(){this.setState({isPanelsMenuShown:!1})}handleAutoFillClick(){const{widgets:e}=this.state;Ut.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(){Ut.info("handleExportLayoutClick"),this.setState({isPanelsMenuShown:!1});try{const{workspace:e}=this.props,{data:n}=e,s=hl.exportLayout(n);Ut.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){Ut.error("Unable to export layout",e)}}handleImportLayoutClick(){Ut.info("handleImportLayoutClick"),this.setState({isPanelsMenuShown:!1}),this.importElement.current!=null&&(this.importElement.current.value="",this.importElement.current.click())}handleResetLayoutClick(){Ut.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}=hl.normalizeLayout(o);s({layoutConfig:l}),n(Fn,{filterSets:r,links:a})}catch(n){Ut.error("Unable to import layout",n)}}async resetLayout(){const{layoutStorage:e,session:n}=this.props,{filterSets:s,layoutConfig:i,links:o}=await hl.getDefaultLayout(e,n!==void 0),{updateDashboardData:r,updateWorkspaceData:l}=this.props;l({layoutConfig:i}),r(Fn,{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:Cd.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 id.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:xl.getServiceWorker,loadPlugin:this.handleLoadTablePlugin,localDashboardId:n,makeModel:()=>Ly(i,e.metadata,s)}}hydrateChart(e,n){const{connection:s}=this.props;return{...e,localDashboardId:n,makeModel:()=>{const{metadata:i,panelState:o}=e;return Ay(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:$("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:Ng,alt:"Deephaven Data Labs",width:"115px",className:"ml-1"}),T("div",{children:[T(z,{kind:"ghost",className:"btn-panels-menu",icon:wb,onClick:()=>{},children:["Controls",h(xc,{handleControlSelect:this.handleControlSelect,handleToolSelect:this.handleToolSelect,onClearFilter:this.handleClearFilter})]}),d&&T(z,{kind:"ghost",className:"btn-panels-menu btn-show-panels","data-testid":"app-main-panels-button",onClick:this.handleWidgetMenuClick,icon:fb,children:["Panels",h(An,{isShown:u,className:"panels-menu-popper",onExited:this.handleWidgetsMenuClose,closeOnBlur:!0,interactive:!0,children:h(Oy,{widgets:p,onExportLayout:this.handleExportLayoutClick,onImportLayout:this.handleImportLayoutClick,onResetLayout:this.handleResetLayoutClick,onSelect:this.handleWidgetSelect})})]}),h(z,{kind:"ghost",className:$("btn-settings-menu",{"text-warning":s.operateAs!==s.name}),onClick:this.handleSettingsMenuShow,icon:h(te,{icon:lr,transform:"grow-3 right-1 down-1"}),tooltip:"User Settings"})]})]})}),T(Mv,{emptyDashboard:h(Py,{onAutoFillClick:this.handleAutoFillClick}),id:Fn,layoutConfig:l,onGoldenLayoutChange:this.handleGoldenLayoutChange,onLayoutConfigChange:this.handleLayoutConfigChange,onLayoutInitialized:this.openNotebookFromURL,hydrate:this.hydrateDefault,children:[h(U2,{hydrate:this.hydrateGrid,getDownloadWorker:xl.getServiceWorker,loadPlugin:this.handleLoadTablePlugin}),h(k2,{hydrate:this.hydrateChart}),h(O2,{}),h(L2,{hydrateConsole:Jo.hydrateConsole,notebooksUrl:new URL("../notebooks/",`${window.location}`).href}),h(P2,{}),h(q2,{hydrate:this.hydratePandas}),h(K2,{}),h(G2,{}),g]}),h(gt,{in:m,timeout:ze.transitionMidMs,classNames:"slide-left",mountOnEnter:!0,unmountOnExit:!0,children:h(vo,{serverConfigValues:o,onDone:this.handleSettingsMenuHide})}),h(de,{actions:c}),h("input",{ref:this.importElement,type:"file",accept:".json",style:{display:"none"},onChange:this.handleImportLayoutFiles})]})}}const Xy=t=>{var e,n;return{activeTool:Xl(t),dashboardData:Qt(t,Fn),layoutStorage:_y(t),plugins:_0(t),connection:z1(t,Fn),session:(e=Ei(t,Fn))==null?void 0:e.session,sessionConfig:(n=Ei(t,Fn))==null?void 0:n.config,user:Lm(t),workspace:Yl(t),serverConfigValues:ky(t)}},jy=Mt(Xy,{setActiveTool:Zl,updateDashboardData:ns,updateWorkspaceData:tp})(Mf(Jo));function Zy(){return T("div",{className:"app",children:[h(jy,{}),h(Xu,{})]})}const Qy=J.module("LocalWorkspaceStorage"),qo=class{static async makeDefaultWorkspaceData(t,e){const{filterSets:n,links:s,layoutConfig:i}=await hl.getDefaultLayout(t,e==null?void 0:e.isConsoleAvailable);return{settings:{defaultDateTimeFormat:ot.DEFAULT_DATETIME_FORMAT_STRING,formatter:[],timeZone:ot.DEFAULT_TIME_ZONE_ID,showTimeZone:!1,showTSeparator:!0,disableMoveConfirmation:!1,defaultDecimalFormatOptions:{defaultFormatString:_e.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:et.DEFAULT_FORMAT_STRING},truncateNumbersWithPound:!1,defaultNotebookSettings:{isMinimapEnabled:!1}},layoutConfig:i,closed:[{}],links:s,filterSets:n}}static async makeDefaultWorkspace(t,e){return{data:await qo.makeDefaultWorkspaceData(t,e)}}constructor(t){this.layoutStorage=t}async load(t){var e;try{return JSON.parse((e=localStorage.getItem(qo.STORAGE_KEY))!=null?e:"")}catch{return Qy.info("Unable to load workspace data, initializing to default data"),qo.makeDefaultWorkspace(this.layoutStorage,t)}}async save(t){return localStorage.setItem(qo.STORAGE_KEY,JSON.stringify(t)),t}};let Bg=qo;Bg.STORAGE_KEY="deephaven.WorkspaceStorage";class Jy extends Error{constructor(){super(...arguments),this.isNoConsolesError=!0}}function eI(t){return t.isNoConsolesError}const Gs=J.module("SessionUtils");var $g=(t=>(t.ANONYMOUS="anonymous",t.PARENT="parent",t))($g||{});function tI(){return new URL("../jsapi",`${window.location}`)}function zg(){const t=tI();return`${t.protocol}//${t.host}`}function nI(){switch(new URLSearchParams(window.location.search).get("authProvider")){case"parent":return"parent";default:return"anonymous"}}function sI(){const t=zg();return Gs.info(`Starting connection to '${t}'...`),new M.IdeConnection(t)}async function iI(t){Gs.info("Getting console types...");const e=await t.getConsoleTypes();if(Gs.info("Available types:",e),e.length===0)throw new Jy("No console types available");const n=e[0];Gs.info("Starting session with type",n);const s=await t.startSession(n),i={type:n,id:Ge.generate()};return Gs.info("Console session established",i),{session:s,config:i,connection:t}}function oI(){const t=zg();return Gs.info("createCoreClient",t),new M.CoreClient(t)}async function rI(){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(Gs.debug("Received message",s),(s==null?void 0:s.message)!=="loginOptions"){Gs.debug("Ignore received message",s);return}window.removeEventListener("message",e),t(s.payload)};window.addEventListener("message",e),window.opener.postMessage("requestLoginOptionsFromParent","*")})}async function lI(t){switch(t){case"parent":return rI();case"anonymous":return{type:M.CoreClient.LOGIN_TYPE_ANONYMOUS};default:throw new Error(`Unknown auth type: ${t}`)}}class aI{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 Uo=J.module("GrpcFileStorageTable"),bd=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=Je(this.doRefresh.bind(this),bd.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 bd(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){Uo.debug2("doRefresh",this.root),t(this.fetchData())}refresh(){var n;Uo.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 to;return this.currentViewportData=s,this.sendUpdate(),s}));e.catch(s=>{ye.isCanceled(s)||Uo.error("Error updating viewport",s)}),this.viewportUpdatePromise=e}refreshInternal(){try{this.refresh()}catch(t){ye.isCanceled(t)||Uo.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,Uo.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 Wg=bd;Wg.REFRESH_DEBOUNCE=50;const dI=J.module("GrpcFileStorage"),Gg=class{constructor(t,e=""){this.tables=[],this.refreshTables=Jn(()=>{this.tables.forEach(n=>n.refresh())},Gg.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 Wg(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 Tc;if(e.length>1)throw dI.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 Kg=Gg;Kg.REFRESH_THROTTLE=150;const Ks=J.module("AppInit");async function cI(){Ks.debug("Loading plugins...");try{const t=await Cd.loadJson("../js-plugins/manifest.json");Ks.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(Cd.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 Ks.info("Plugins loaded:",s),s}catch(t){return Ks.error("Unable to load plugins:",t),new Map}}async function hI(t){let e;try{e=await iI(t)}catch(n){if(!eI(n))throw n}return e}function _c(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{Ks.info("Initializing Web UI","0.29.0",navigator.userAgent);const F=oI(),H=nI();Ks.info(`Login using auth type ${H}...`),await F.login(await lI(H));const U=await cI(),x=await(H===$g.ANONYMOUS&&F.getAsIdeConnection==null?sI():F.getAsIdeConnection());x.addEventListener(M.IdeConnection.HACK_CONNECTION_FAILURE,He=>{var Ct;const{detail:dt}=He;Ks.error("Connection failure",`${JSON.stringify(dt)}`),f(`Unable to connect: ${(Ct=dt.details)!=null?Ct:"Unknown Error"}`)});const A=await hI(x),k="user",W=F.getStorageService(),X=new aI(W,"../layouts"),V=new Kg(W,"../notebooks"),L=new Bg(X),K=new oy,Y=await L.load({isConsoleAvailable:A!==void 0}),{data:P}=Y,{settings:G}=P;G.defaultDecimalFormatOptions===void 0&&(G.defaultDecimalFormatOptions={defaultFormatString:_e.DEFAULT_FORMAT_STRING}),G.defaultIntegerFormatOptions===void 0&&(G.defaultIntegerFormatOptions={defaultFormatString:et.DEFAULT_FORMAT_STRING}),G.truncateNumbersWithPound===void 0&&(G.truncateNumbersWithPound=!1);const{shortcutOverrides:Z={}}=G,ae=qt.isMacPlatform?(R=Z.mac)!=null?R:{}:(N=Z.windows)!=null?N:{};Object.entries(ae).forEach(([He,dt])=>{var Ct;(Ct=Le.get(He))==null||Ct.setKeyState(dt)});const j={filterSets:P.filterSets,links:P.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(Xt.DEFAULT),p(Ce),s(K),i(Fn,j),o(V),r(X),l(Fn,x),A!==void 0&&a(Fn,A),d(U),c(Re),m(L),u(Y)}catch(F){Ks.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(Zy,{}),h(Bl,{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"})]})]})}_c.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};_c.defaultProps={workspace:null,workspaceStorage:null};const uI=t=>({workspace:Yl(t),workspaceStorage:N0(t)}),vu=Mt(uI,{setActiveTool:Zl,setCommandHistoryStorage:A0,setDashboardData:Ip,setFileStorage:L0,setLayoutStorage:ry,setDashboardConnection:W1,setDashboardSessionWrapper:G1,setPlugins:H0,setUser:k0,setWorkspace:ep,setWorkspaceStorage:O0,setServerConfigValues:U0})(_c);function mI(){return h(Nf,{basename:"./",children:T(Ff,{children:[h($c,{exact:!0,path:"/",component:vu}),h($c,{path:"/notebook/:notebookPath+",component:vu}),h(xf,{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 pI(){"serviceWorker"in navigator&&navigator.serviceWorker.getRegistrations().then(t=>{t.forEach(e=>{e.scope.endsWith("/download/")||e.unregister()})})}vy();wi.render(h(yu,{store:Ql,children:h(mI,{})}),document.getElementById("root"));pI();xl.registerOnLoaded();at.init({getWorker:()=>new kf});window["__react-beautiful-dnd-disable-dev-warnings"]=!0;
|
|
47
|
+
//# sourceMappingURL=index.80806d3b.js.map
|