@mongodb-js/compass-shell 3.7.0 → 3.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/508.index.js +12 -0
- package/dist/{945.browser.js → 716.browser.js} +2 -2
- package/dist/766.browser.js +38 -192
- package/dist/766.index.js +1765 -0
- package/dist/browser.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +20 -20
- package/dist/281.index.js +0 -1919
- package/dist/996.index.js +0 -12
- /package/dist/{281.index.js.LICENSE.txt → 766.index.js.LICENSE.txt} +0 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
(global.webpackChunkCompassShellPlugin=global.webpackChunkCompassShellPlugin||[]).push([[508],{49945:(e,t,o)=>{"use strict";o.r(t),o.d(t,{CompassShell:()=>B,default:()=>L});var i=o(99497),n=o.n(i),r=o(13980),s=o.n(r),l=o(86993),a=o(39662),c=o(30709);const h=[{key:"Ctrl+`",description:"Toggle shell."},{key:"Ctrl+A",description:"Moves the cursor to the beginning of the line."},{key:"Ctrl+B",description:"Moves the cursor Backward one character."},{key:"Ctrl+C",description:"Stop currently running command."},{key:"Ctrl+D",description:"Deletes the next character."},{key:"Ctrl+E",description:"Moves the cursor to the end of the line."},{key:"Ctrl+F",description:"Moves the cursor Forward one character."},{key:"Ctrl+H",description:"Erases one character, similar to hitting backspace."},{key:"meta+L",description:"Clears the screen, similar to the clear command."},{key:"Ctrl+T",description:"Swap the last two characters before the cursor."},{key:"Ctrl+U",description:"Changes the line to Uppercase."},{key:"ArrowUp",description:"Cycle backwards through command history."},{key:"ArrowDown",description:"Cycle forwards through command history."}];function d(){return n().createElement(c.Table,{data:h,columns:[n().createElement(c.TableHeader,{key:"name",label:"Key"}),n().createElement(c.TableHeader,{key:"value",label:"Description"})]},(({datum:e})=>n().createElement(c.Row,{key:e.key},n().createElement(c.Cell,null,n().createElement(c.Body,{weight:"medium"},n().createElement(c.KeyboardShortcut,{hotkey:e.key}))),n().createElement(c.Cell,null,n().createElement(c.Description,null,e.description)))))}const p=`v${o(74841).i8}`,u=(0,c.css)({marginTop:c.spacing[2],maxHeight:"50vh",overflow:"auto"}),m=(0,c.css)({marginTop:c.spacing[4]});function g({hideInfoModal:e,show:t}){const o=(0,i.useCallback)((()=>{e()}),[e]);return n().createElement(c.InfoModal,{open:t,title:`mongosh ${p}`,trackingId:"shell_info_modal","data-testid":"shell-info-modal",onClose:o},n().createElement(c.Banner,null,"For more information please visit the ",n().createElement(c.Link,{id:"mongosh-info-link",href:"https://docs.mongodb.com/compass/beta/embedded-shell/",target:"_blank"},"MongoDB Shell Documentation"),"."),n().createElement(c.Subtitle,{className:m},"Keyboard Shortcuts"),n().createElement("div",{className:u},n().createElement(d,null)))}g.propTypes={hideInfoModal:s().func.isRequired,show:s().bool.isRequired};const y=g,f=(0,c.css)({height:c.spacing[5],display:"flex",color:c.palette.gray.light1}),b=(0,c.css)({borderTop:`1px solid ${c.palette.gray.dark2}`}),k=(0,c.css)({flexGrow:1,display:"flex",alignItems:"center"}),S=c.palette.gray.light1,E=c.palette.gray.base,w=c.palette.gray.light2,C=c.keyframes`
|
|
2
|
+
0% { color: ${S}; }
|
|
3
|
+
10% { color: ${E}; }
|
|
4
|
+
20% { color: ${w}; }
|
|
5
|
+
30% { color: ${E}; }
|
|
6
|
+
40% { color: ${w}; }
|
|
7
|
+
50% { color: ${E}; }
|
|
8
|
+
60% { color: ${w}; }
|
|
9
|
+
70% { color: ${E}; }
|
|
10
|
+
80% { color: ${w}; }
|
|
11
|
+
100% { color: ${S}; }
|
|
12
|
+
`,v=(0,c.css)({background:"none",border:"none",cursor:"pointer",color:S,padding:`0px ${c.spacing[2]}px`,height:"100%",display:"flex",verticalAlign:"middle",flexDirection:"row",alignItems:"center",margin:"auto 0",fontWeight:"bold",fontSize:1.5*c.spacing[2],lineHeight:`${c.spacing[5]}px`,transition:"all 200ms",userSelect:"none",textTransform:"uppercase",animation:`${C} 2s linear`,"&:hover":{color:c.palette.gray.light3}}),O=(0,c.css)({display:"flex",paddingTop:c.spacing[1]/2,paddingRight:c.spacing[2]}),x=(0,c.css)({marginRight:c.spacing[2]}),I=(0,c.css)({color:c.palette.green.light2,marginLeft:c.spacing[2]}),M=(0,c.css)({borderTopColor:c.palette.green.light2}),H=({darkMode:e,isExpanded:t,isOperationInProgress:o,onShellToggleClicked:i,showInfoModal:r})=>((0,c.useHotkeys)("ctrl + `",i),n().createElement("div",{className:(0,c.cx)(f,e&&b)},n().createElement("div",{className:k},n().createElement("button",{type:"button","data-testid":"shell-expand-button",className:v,"aria-label":t?"Close Shell":"Open Shell",onClick:i,"aria-pressed":t},">_MONGOSH",!t&&o&&n().createElement("span",{className:I},n().createElement(c.SpinLoader,{size:"12px",className:M})," Command in progress…"))),n().createElement("div",{className:O},t&&n().createElement(c.IconButton,{"data-testid":"shell-info-button",className:x,variant:"dark","aria-label":"Shell Info","aria-haspopup":"dialog",onClick:r},n().createElement(c.Icon,{glyph:"InfoWithCircle",size:"small"})),n().createElement(c.IconButton,{variant:"dark","aria-label":t?"Close Shell":"Open Shell",onClick:i,"aria-pressed":t},n().createElement(c.Icon,{glyph:t?"ChevronDown":"ChevronUp",size:"small"})))));H.propTypes={darkMode:s().bool,isExpanded:s().bool.isRequired,isOperationInProgress:s().bool.isRequired,onShellToggleClicked:s().func.isRequired,showInfoModal:s().func.isRequired};const R=(0,c.withDarkMode)(H),{Shell:T}=o(72519),D=(0,c.css)({backgroundColor:c.palette.gray.dark4,display:"flex",flexBasis:"auto",position:"relative",flexDirection:"column",width:"100vw"},(0,c.getScrollbarStyles)(!0)),$=(0,c.css)({flexGrow:1,display:"none",overflow:"auto",borderTop:`1px solid ${c.palette.gray.dark2}`}),P=(0,c.css)({display:"flex"}),N=100;function U(){return Math.max(240,window.innerHeight-100)}class B extends i.Component{static propTypes={emitShellPluginOpened:s().func,runtime:s().object,shellOutput:s().array,historyStorage:s().object,enableShell:s().bool};static defaultProps={emitShellPluginOpened:()=>{},runtime:null};constructor(e){super(e),this.shellRef=n().createRef(),this.shellOutput=this.props.shellOutput||[],this.state={height:32,prevHeight:240,initialHistory:this.props.historyStorage?null:[],isOperationInProgress:!1,showInfoModal:!1}}componentDidMount(){this.loadHistory(),window.addEventListener("beforeunload",this.terminateRuntime)}componentDidUpdate(e,t){const{height:o}=this.state;t.height<N&&o>N&&this.props.emitShellPluginOpened()}componentWillUnmount(){window.removeEventListener("beforeunload",this.terminateRuntime)}onShellOutputChanged=e=>{this.shellOutput=e};onOperationStarted=()=>{this.setState({isOperationInProgress:!0})};onOperationEnd=()=>{this.setState({isOperationInProgress:!1})};terminateRuntime=()=>{this.props.runtime&&this.props.runtime.terminate()};saveHistory=async e=>{if(this.props.historyStorage)try{await this.props.historyStorage.save(e)}catch(e){console.error(e)}};loadHistory=async()=>{if(this.props.historyStorage)try{const e=await this.props.historyStorage.load();this.setState({initialHistory:e})}catch(e){console.error(e),this.setState({initialHistory:[]})}};updateHeight(e){this.setState(e>N?{height:e,prevHeight:e}:{height:e})}hideInfoModal(){this.setState({showInfoModal:!1})}focusEditor(){this.shellRef.current&&"Range"!==window.getSelection()?.type&&this.shellRef.current.focusEditor()}render(){const{height:e,prevHeight:t,isOperationInProgress:o,showInfoModal:r}=this.state;if(!this.props.enableShell||!this.props.runtime||!this.state.initialHistory)return n().createElement("div",null);const s=e>N,l=s?function(e){const t=U();return Math.min(t,Math.max(N,e))}(e):32;return n().createElement(i.Fragment,null,n().createElement(y,{show:r,hideInfoModal:this.hideInfoModal.bind(this)}),n().createElement("div",{"data-testid":"shell-section",className:D,style:{height:l},id:"content",onClick:this.focusEditor.bind(this)},n().createElement(c.ResizeHandle,{direction:c.ResizeDirection.TOP,onChange:e=>this.updateHeight(e),value:e,minValue:32,maxValue:U(),title:"MongoDB Shell"}),n().createElement(R,{isExpanded:s,onShellToggleClicked:()=>s?this.updateHeight(32):this.updateHeight(t),isOperationInProgress:o,showInfoModal:()=>this.setState({showInfoModal:!0})}),n().createElement("div",{"data-testid":"shell-content",className:(0,c.cx)($,s&&P)},n().createElement(T,{ref:this.shellRef,runtime:this.props.runtime,initialHistory:this.state.initialHistory,initialOutput:this.shellOutput,onHistoryChanged:this.saveHistory,onOutputChanged:this.onShellOutputChanged,onOperationStarted:this.onOperationStarted,onOperationEnd:this.onOperationEnd}))))}}const L=(0,l.$j)((e=>({emitShellPluginOpened:()=>{e.appRegistry&&e.appRegistry.globalAppRegistry&&e.appRegistry.globalAppRegistry.emit("compass:compass-shell:opened")},runtime:e.runtime?e.runtime.runtime:null})))((0,a.withPreferences)(B,["enableShell"],n()))},54039:e=>{function t(e){return Promise.resolve().then((()=>{var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}))}t.keys=()=>[],t.resolve=t,t.id=54039,e.exports=t},98953:e=>{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=98953,e.exports=t},70648:()=>{}}]);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
(self.webpackChunkCompassShellPlugin=self.webpackChunkCompassShellPlugin||[]).push([[716],{49945:(e,t,o)=>{"use strict";o.r(t),o.d(t,{CompassShell:()=>q,default:()=>z});var i=o(99497),n=o.n(i),s=o(13980),r=o.n(s),l=o(86993),a=o(39662),c=o(30709);const h=[{key:"Ctrl+`",description:"Toggle shell."},{key:"Ctrl+A",description:"Moves the cursor to the beginning of the line."},{key:"Ctrl+B",description:"Moves the cursor Backward one character."},{key:"Ctrl+C",description:"Stop currently running command."},{key:"Ctrl+D",description:"Deletes the next character."},{key:"Ctrl+E",description:"Moves the cursor to the end of the line."},{key:"Ctrl+F",description:"Moves the cursor Forward one character."},{key:"Ctrl+H",description:"Erases one character, similar to hitting backspace."},{key:"meta+L",description:"Clears the screen, similar to the clear command."},{key:"Ctrl+T",description:"Swap the last two characters before the cursor."},{key:"Ctrl+U",description:"Changes the line to Uppercase."},{key:"ArrowUp",description:"Cycle backwards through command history."},{key:"ArrowDown",description:"Cycle forwards through command history."}];function p(){return n().createElement(c.Table,{data:h,columns:[n().createElement(c.TableHeader,{key:"name",label:"Key"}),n().createElement(c.TableHeader,{key:"value",label:"Description"})]},(e=>{let{datum:t}=e;return n().createElement(c.Row,{key:t.key},n().createElement(c.Cell,null,n().createElement(c.Body,{weight:"medium"},n().createElement(c.KeyboardShortcut,{hotkey:t.key}))),n().createElement(c.Cell,null,n().createElement(c.Description,null,t.description)))}))}const d=`v${o(74841).i8}`,u=(0,c.css)({marginTop:c.spacing[2],maxHeight:"50vh",overflow:"auto"}),m=(0,c.css)({marginTop:c.spacing[4]});function g(e){let{hideInfoModal:t,show:o}=e;const s=(0,i.useCallback)((()=>{t()}),[t]);return n().createElement(c.InfoModal,{open:o,title:`mongosh ${d}`,trackingId:"shell_info_modal","data-testid":"shell-info-modal",onClose:s},n().createElement(c.Banner,null,"For more information please visit the ",n().createElement(c.Link,{id:"mongosh-info-link",href:"https://docs.mongodb.com/compass/beta/embedded-shell/",target:"_blank"},"MongoDB Shell Documentation"),"."),n().createElement(c.Subtitle,{className:m},"Keyboard Shortcuts"),n().createElement("div",{className:u},n().createElement(p,null)))}g.propTypes={hideInfoModal:r().func.isRequired,show:r().bool.isRequired};const y=g,f=(0,c.css)({height:c.spacing[5],display:"flex",color:c.palette.gray.light1}),b=(0,c.css)({borderTop:`1px solid ${c.palette.gray.dark2}`}),S=(0,c.css)({flexGrow:1,display:"flex",alignItems:"center"}),k=c.palette.gray.light1,E=c.palette.gray.base,C=c.palette.gray.light2,w=c.keyframes`
|
|
2
2
|
0% { color: ${k}; }
|
|
3
3
|
10% { color: ${E}; }
|
|
4
4
|
20% { color: ${C}; }
|
|
@@ -9,4 +9,4 @@
|
|
|
9
9
|
70% { color: ${E}; }
|
|
10
10
|
80% { color: ${C}; }
|
|
11
11
|
100% { color: ${k}; }
|
|
12
|
-
`,v=(0,c.css)({background:"none",border:"none",cursor:"pointer",color:k,padding:`0px ${c.spacing[2]}px`,height:"100%",display:"flex",verticalAlign:"middle",flexDirection:"row",alignItems:"center",margin:"auto 0",fontWeight:"bold",fontSize:1.5*c.spacing[2],lineHeight:`${c.spacing[5]}px`,transition:"all 200ms",userSelect:"none",textTransform:"uppercase",animation:`${w} 2s linear`,"&:hover":{color:c.palette.gray.light3}}),O=(0,c.css)({display:"flex",paddingTop:c.spacing[1]/2,paddingRight:c.spacing[2]}),x=(0,c.css)({marginRight:c.spacing[2]}),I=(0,c.css)({color:c.palette.green.light2,marginLeft:c.spacing[2]}),H=(0,c.css)({borderTopColor:c.palette.green.light2}),M=e=>{let{darkMode:t,isExpanded:o,isOperationInProgress:i,onShellToggleClicked:s,showInfoModal:r}=e;return(0,c.useHotkeys)("ctrl + `",s),n().createElement("div",{className:(0,c.cx)(f,t&&b)},n().createElement("div",{className:S},n().createElement("button",{type:"button","data-testid":"shell-expand-button",className:v,"aria-label":o?"Close Shell":"Open Shell",onClick:s,"aria-pressed":o},">_MONGOSH",!o&&i&&n().createElement("span",{className:I},n().createElement(c.SpinLoader,{size:"12px",className:H})," Command in progress…"))),n().createElement("div",{className:O},o&&n().createElement(c.IconButton,{"data-testid":"shell-info-button",className:x,variant:"dark","aria-label":"Shell Info","aria-haspopup":"dialog",onClick:r},n().createElement(c.Icon,{glyph:"InfoWithCircle",size:"small"})),n().createElement(c.IconButton,{variant:"dark","aria-label":o?"Close Shell":"Open Shell",onClick:s,"aria-pressed":o},n().createElement(c.Icon,{glyph:o?"ChevronDown":"ChevronUp",size:"small"}))))};M.propTypes={darkMode:r().bool,isExpanded:r().bool.isRequired,isOperationInProgress:r().bool.isRequired,onShellToggleClicked:r().func.isRequired,showInfoModal:r().func.isRequired};const R=(0,c.withDarkMode)(M),{Shell:T}=o(72519),$=(0,c.css)({backgroundColor:c.palette.gray.dark4,display:"flex",flexBasis:"auto",position:"relative",flexDirection:"column",width:"100vw"},(0,c.getScrollbarStyles)(!0)),P=(0,c.css)({flexGrow:1,display:"none",overflow:"auto",borderTop:`1px solid ${c.palette.gray.dark2}`}),D=(0,c.css)({display:"flex"}),N=100;function B(){return Math.max(240,window.innerHeight-100)}class q extends i.Component{static propTypes={emitShellPluginOpened:r().func,runtime:r().object,shellOutput:r().array,historyStorage:r().object,enableShell:r().bool};static defaultProps={emitShellPluginOpened:()=>{},runtime:null};constructor(e){super(e),this.shellRef=n().createRef(),this.shellOutput=this.props.shellOutput||[],this.state={height:32,prevHeight:240,initialHistory:this.props.historyStorage?null:[],isOperationInProgress:!1,showInfoModal:!1}}componentDidMount(){this.loadHistory(),window.addEventListener("beforeunload",this.terminateRuntime)}componentDidUpdate(e,t){const{height:o}=this.state;t.height<N&&o>N&&this.props.emitShellPluginOpened()}componentWillUnmount(){window.removeEventListener("beforeunload",this.terminateRuntime)}onShellOutputChanged=e=>{this.shellOutput=e};onOperationStarted=()=>{this.setState({isOperationInProgress:!0})};onOperationEnd=()=>{this.setState({isOperationInProgress:!1})};terminateRuntime=()=>{this.props.runtime&&this.props.runtime.terminate()};saveHistory=async e=>{if(this.props.historyStorage)try{await this.props.historyStorage.save(e)}catch(e){console.error(e)}};loadHistory=async()=>{if(this.props.historyStorage)try{const e=await this.props.historyStorage.load();this.setState({initialHistory:e})}catch(e){console.error(e),this.setState({initialHistory:[]})}};updateHeight(e){this.setState(e>N?{height:e,prevHeight:e}:{height:e})}hideInfoModal(){this.setState({showInfoModal:!1})}focusEditor(){this.shellRef.current&&"Range"!==window.getSelection()?.type&&this.shellRef.current.focusEditor()}render(){const{height:e,prevHeight:t,isOperationInProgress:o,showInfoModal:s}=this.state;if(!this.props.enableShell||!this.props.runtime||!this.state.initialHistory)return n().createElement("div",null);const r=e>N,l=r?function(e){const t=B();return Math.min(t,Math.max(N,e))}(e):32;return n().createElement(i.Fragment,null,n().createElement(y,{show:s,hideInfoModal:this.hideInfoModal.bind(this)}),n().createElement("div",{"data-testid":"shell-section",className:$,style:{height:l},id:"content",onClick:this.focusEditor.bind(this)},n().createElement(c.ResizeHandle,{direction:c.ResizeDirection.TOP,onChange:e=>this.updateHeight(e),value:e,minValue:32,maxValue:B(),title:"MongoDB Shell"}),n().createElement(R,{isExpanded:r,onShellToggleClicked:()=>r?this.updateHeight(32):this.updateHeight(t),isOperationInProgress:o,showInfoModal:()=>this.setState({showInfoModal:!0})}),n().createElement("div",{"data-testid":"shell-content",className:(0,c.cx)(P,r&&D)},n().createElement(T,{ref:this.shellRef,runtime:this.props.runtime,initialHistory:this.state.initialHistory,initialOutput:this.shellOutput,onHistoryChanged:this.saveHistory,onOutputChanged:this.onShellOutputChanged,onOperationStarted:this.onOperationStarted,onOperationEnd:this.onOperationEnd}))))}}const z=(0,l.$j)((e=>({emitShellPluginOpened:()=>{e.appRegistry&&e.appRegistry.globalAppRegistry&&e.appRegistry.globalAppRegistry.emit("compass:compass-shell:opened")},runtime:e.runtime?e.runtime.runtime:null})))((0,a.withPreferences)(q,["enableShell"],n()))}}]);
|
|
12
|
+
`,v=(0,c.css)({background:"none",border:"none",cursor:"pointer",color:k,padding:`0px ${c.spacing[2]}px`,height:"100%",display:"flex",verticalAlign:"middle",flexDirection:"row",alignItems:"center",margin:"auto 0",fontWeight:"bold",fontSize:1.5*c.spacing[2],lineHeight:`${c.spacing[5]}px`,transition:"all 200ms",userSelect:"none",textTransform:"uppercase",animation:`${w} 2s linear`,"&:hover":{color:c.palette.gray.light3}}),O=(0,c.css)({display:"flex",paddingTop:c.spacing[1]/2,paddingRight:c.spacing[2]}),x=(0,c.css)({marginRight:c.spacing[2]}),I=(0,c.css)({color:c.palette.green.light2,marginLeft:c.spacing[2]}),H=(0,c.css)({borderTopColor:c.palette.green.light2}),M=e=>{let{darkMode:t,isExpanded:o,isOperationInProgress:i,onShellToggleClicked:s,showInfoModal:r}=e;return(0,c.useHotkeys)("ctrl + `",s),n().createElement("div",{className:(0,c.cx)(f,t&&b)},n().createElement("div",{className:S},n().createElement("button",{type:"button","data-testid":"shell-expand-button",className:v,"aria-label":o?"Close Shell":"Open Shell",onClick:s,"aria-pressed":o},">_MONGOSH",!o&&i&&n().createElement("span",{className:I},n().createElement(c.SpinLoader,{size:"12px",className:H})," Command in progress…"))),n().createElement("div",{className:O},o&&n().createElement(c.IconButton,{"data-testid":"shell-info-button",className:x,variant:"dark","aria-label":"Shell Info","aria-haspopup":"dialog",onClick:r},n().createElement(c.Icon,{glyph:"InfoWithCircle",size:"small"})),n().createElement(c.IconButton,{variant:"dark","aria-label":o?"Close Shell":"Open Shell",onClick:s,"aria-pressed":o},n().createElement(c.Icon,{glyph:o?"ChevronDown":"ChevronUp",size:"small"}))))};M.propTypes={darkMode:r().bool,isExpanded:r().bool.isRequired,isOperationInProgress:r().bool.isRequired,onShellToggleClicked:r().func.isRequired,showInfoModal:r().func.isRequired};const R=(0,c.withDarkMode)(M),{Shell:T}=o(72519),$=(0,c.css)({backgroundColor:c.palette.gray.dark4,display:"flex",flexBasis:"auto",position:"relative",flexDirection:"column",width:"100vw"},(0,c.getScrollbarStyles)(!0)),P=(0,c.css)({flexGrow:1,display:"none",overflow:"auto",borderTop:`1px solid ${c.palette.gray.dark2}`}),D=(0,c.css)({display:"flex"}),N=100;function B(){return Math.max(240,window.innerHeight-100)}class q extends i.Component{static propTypes={emitShellPluginOpened:r().func,runtime:r().object,shellOutput:r().array,historyStorage:r().object,enableShell:r().bool};static defaultProps={emitShellPluginOpened:()=>{},runtime:null};constructor(e){super(e),this.shellRef=n().createRef(),this.shellOutput=this.props.shellOutput||[],this.state={height:32,prevHeight:240,initialHistory:this.props.historyStorage?null:[],isOperationInProgress:!1,showInfoModal:!1}}componentDidMount(){this.loadHistory(),window.addEventListener("beforeunload",this.terminateRuntime)}componentDidUpdate(e,t){const{height:o}=this.state;t.height<N&&o>N&&this.props.emitShellPluginOpened()}componentWillUnmount(){window.removeEventListener("beforeunload",this.terminateRuntime)}onShellOutputChanged=e=>{this.shellOutput=e};onOperationStarted=()=>{this.setState({isOperationInProgress:!0})};onOperationEnd=()=>{this.setState({isOperationInProgress:!1})};terminateRuntime=()=>{this.props.runtime&&this.props.runtime.terminate()};saveHistory=async e=>{if(this.props.historyStorage)try{await this.props.historyStorage.save(e)}catch(e){console.error(e)}};loadHistory=async()=>{if(this.props.historyStorage)try{const e=await this.props.historyStorage.load();this.setState({initialHistory:e})}catch(e){console.error(e),this.setState({initialHistory:[]})}};updateHeight(e){this.setState(e>N?{height:e,prevHeight:e}:{height:e})}hideInfoModal(){this.setState({showInfoModal:!1})}focusEditor(){this.shellRef.current&&"Range"!==window.getSelection()?.type&&this.shellRef.current.focusEditor()}render(){const{height:e,prevHeight:t,isOperationInProgress:o,showInfoModal:s}=this.state;if(!this.props.enableShell||!this.props.runtime||!this.state.initialHistory)return n().createElement("div",null);const r=e>N,l=r?function(e){const t=B();return Math.min(t,Math.max(N,e))}(e):32;return n().createElement(i.Fragment,null,n().createElement(y,{show:s,hideInfoModal:this.hideInfoModal.bind(this)}),n().createElement("div",{"data-testid":"shell-section",className:$,style:{height:l},id:"content",onClick:this.focusEditor.bind(this)},n().createElement(c.ResizeHandle,{direction:c.ResizeDirection.TOP,onChange:e=>this.updateHeight(e),value:e,minValue:32,maxValue:B(),title:"MongoDB Shell"}),n().createElement(R,{isExpanded:r,onShellToggleClicked:()=>r?this.updateHeight(32):this.updateHeight(t),isOperationInProgress:o,showInfoModal:()=>this.setState({showInfoModal:!0})}),n().createElement("div",{"data-testid":"shell-content",className:(0,c.cx)(P,r&&D)},n().createElement(T,{ref:this.shellRef,runtime:this.props.runtime,initialHistory:this.state.initialHistory,initialOutput:this.shellOutput,onHistoryChanged:this.saveHistory,onOutputChanged:this.onShellOutputChanged,onOperationStarted:this.onOperationStarted,onOperationEnd:this.onOperationEnd}))))}}const z=(0,l.$j)((e=>({emitShellPluginOpened:()=>{e.appRegistry&&e.appRegistry.globalAppRegistry&&e.appRegistry.globalAppRegistry.emit("compass:compass-shell:opened")},runtime:e.runtime?e.runtime.runtime:null})))((0,a.withPreferences)(q,["enableShell"],n()))},70648:()=>{}}]);
|