web-interface.assets.1255d548-3521.d1b3693e3651623483d5.js Maven / Gradle / Ivy
(()=>{(self.webpackChunkgraylog_web_interface=self.webpackChunkgraylog_web_interface||[]).push([["1255d548-3521"],{DWNbF6Hg:(h,g,e)=>{"use strict";e.r(g),e.d(g,{default:()=>U});var t=e("Z7aTuO5B"),c=e("bXwLS4nb"),p=e.n(c),E=e("ii0bleBb"),o=e.n(E),R=e("dTvPVhvw"),z=e("M41Hih61"),u=e("J6y4/h8P"),T=e("MdYBRjRJ"),A=e("U1Iufsob"),k=e("eFxcQyPT"),D=e("ys/4WHo5"),l=e("uZqmR+ju");let y="";class Z extends ace.require("ace/mode/text_highlight_rules").TextHighlightRules{constructor(){super();const n="let|when|then|rule|end",s="and|or|not|during",r=this.createKeywordMapper({"variable.language":"stage","support.type":"$message","support.function":y,keyword:n,"constant.language":s},"identifier");this.$rules={start:[{token:"comment",regex:"\\/\\/.*$"},{token:"comment",regex:"\\/\\*",next:"comment"},{token:"string",regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'},{token:"string",regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"},{token:"constant.numeric",regex:/0(?:[xX][0-9a-fA-F][0-9a-fA-F_]*|[bB][01][01_]*)[LlSsDdFfYy]?\b/},{token:"constant.numeric",regex:/[+-]?\d[\d_]*(?:(?:\.[\d_]*)?(?:[eE][+-]?[\d_]+)?)?[LlSsDdFfYy]?\b/},{token:"constant.language.boolean",regex:"(?:true|false)\\b"},{token:"language.support.class",regex:"&&"},{token:r,regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{token:"text",regex:"\\s+"}],comment:[{token:"comment",regex:"\\*\\/",next:"start"},{defaultToken:"comment"}]}}}class M extends ace.require("ace/mode/text").Mode{constructor(n){super(n),y=n,this.HighlightRules=Z}}var O=e("SLtHYqXc"),m=e("93yMNhQL"),Q=e("v2kDoRGM"),Y=e("XNk36CWX"),I=e("hVvV2+Ph"),K=e("QOLcmcSG"),J=e("h5z8Xmwg"),q=e("3ad14trG"),_=e("m4MXsOkU"),ee=e("aw86CeQX"),te=e("kzlSyjDK");const v=u.default.div(({$resizable:i,theme:n})=>(0,u.css)`
.react-resizable-handle {
z-index: 100; /* Ensure resize handle is over text editor */
display: ${i?"block":"none"};
}
${n.components.aceEditor}
`),$=(0,u.default)(l.Tooltip)`
width: 250px;
`,B=u.default.div(({theme:i})=>(0,u.css)`
background: ${i.colors.global.contentBackground};
border: 1px solid ${i.colors.gray[80]};
border-bottom: 0;
border-radius: 5px 5px 0 0;
.btn-link {
color: ${i.colors.variant.dark.info};
&:hover {
color: ${i.colors.variant.darkest.info};
background-color: ${i.colors.variant.lightest.info};
}
&.disabled,
&[disabled] {
color: ${i.colors.variant.light.default};
&:hover {
color: ${i.colors.variant.light.default};
}
}
}
& + ${v} {
/* Do not add border radius if code editor comes after toolbar */
.ace_editor {
border-radius: 0 0 5px 5px;
}
}
`),P=["json","lua","markdown","text","yaml","pipeline"];class f extends t.Component{constructor(n){super(n),this.handleResize=(s,{size:r})=>{const{height:a,width:d}=r;this.setState({height:a,width:d},this.reloadEditor)},this.reloadEditor=()=>{const{resizable:s}=this.props;s&&this.reactAce.editor.resize()},this.isCopyDisabled=()=>this.props.readOnly||this.state.selectedText==="",this.isPasteDisabled=()=>this.props.readOnly,this.isRedoDisabled=()=>this.props.readOnly||!this.reactAce||!this.reactAce.editor.getSession().getUndoManager().hasRedo(),this.isUndoDisabled=()=>this.props.readOnly||!this.reactAce||!this.reactAce.editor.getSession().getUndoManager().hasUndo(),this.handleRedo=()=>{this.reactAce.editor.redo(),this.focusEditor()},this.handleUndo=()=>{this.reactAce.editor.undo(),this.focusEditor()},this.handleSelectionChange=s=>{const{toolbar:r,readOnly:a}=this.props;if(!this.reactAce||!r||a)return;const d=this.reactAce.editor.getSession().getTextRange(s.getRange());this.setState({selectedText:d})},this.focusEditor=()=>{this.reactAce.editor.focus()},this.state={height:n.height,width:n.width,selectedText:""},this.overlayContainerRef=t.createRef()}componentDidMount(){const{mode:n}=this.props;if(n==="pipeline"){const s=(0,T.DC)(A.Z.RulesController.functions().url);(0,k.ZP)("GET",s).then(r=>{if(!Array.isArray(r))return"";const a=r.map(b=>b.name).join("|"),d=new M(a);return this.reactAce.editor.getSession().setMode(d),a})}}componentDidUpdate(n){const{height:s,width:r}=this.props;(s!==n.height||r!==n.width)&&this.reloadEditor()}render(){const{height:n,width:s,selectedText:r}=this.state,{resizable:a,toolbar:d,annotations:b,focus:L,fontSize:F,mode:w,id:W,innerRef:x,onLoad:X,onChange:j,onBlur:H,readOnly:V,value:G}=this.props,C=p()(s)?s:"100%",N=t.createElement($,{id:"paste-button-tooltip",className:"in"},"Press Ctrl+V (\u2318V in macOS) or select Edit\u2009\u2192\u2009Paste to paste from clipboard.");return t.createElement("div",{className:"source-code-editor"},d&&t.createElement(B,{style:{width:C}},t.createElement(l.ButtonToolbar,null,t.createElement(l.ButtonGroup,{ref:this.overlayContainerRef},t.createElement(O.Z,{title:t.createElement(m.Z,{name:"copy",fixedWidth:!0}),bsStyle:"link",bsSize:"sm",onSuccess:this.focusEditor,text:r,buttonTitle:"Copy (Ctrl+C / \u2318C)",disabled:this.isCopyDisabled()}),t.createElement(D.Z,{placement:"top",trigger:"click",overlay:N,rootClose:!0,container:this.overlayContainerRef.current},t.createElement(l.Button,{bsStyle:"link",bsSize:"sm",title:"Paste (Ctrl+V / \u2318V)",disabled:this.isPasteDisabled()},t.createElement(m.Z,{name:"clipboard",fixedWidth:!0})))),t.createElement(l.ButtonGroup,null,t.createElement(l.Button,{bsStyle:"link",bsSize:"sm",onClick:this.handleUndo,title:"Undo (Ctrl+Z / \u2318Z)",disabled:this.isUndoDisabled()},t.createElement(m.Z,{name:"undo",fixedWidth:!0})),t.createElement(l.Button,{bsStyle:"link",bsSize:"sm",onClick:this.handleRedo,title:"Redo (Ctrl+Shift+Z / \u2318\u21E7Z)",disabled:this.isRedoDisabled()},t.createElement(m.Z,{name:"redo",fixedWidth:!0}))))),t.createElement(R.Resizable,{height:n,width:s,minConstraints:[200,200],onResize:this.handleResize},t.createElement(v,{style:{height:n,width:C},$resizable:a},t.createElement(z.ZP,{ref:S=>{this.reactAce=S,x&&(x.current=S)},annotations:b,setOptions:{newLineMode:"unix"},focus:L,fontSize:F,mode:w,theme:"graylog",name:W,height:"100%",onLoad:X,onChange:j,onBlur:H,onSelectionChange:this.handleSelectionChange,readOnly:V,value:G,width:"100%"}))))}}f.propTypes={annotations:o().array,focus:o().bool,fontSize:o().number,height:o().number,id:o().string.isRequired,innerRef:o().oneOfType([o().func,o().shape({current:o().any})]),mode:o().oneOf(P),onLoad:o().func,onChange:o().func,onBlur:o().func,readOnly:o().bool,resizable:o().bool,toolbar:o().bool,value:o().string,width:o().number},f.defaultProps={annotations:[],focus:!1,fontSize:13,height:200,innerRef:void 0,mode:"text",onChange:()=>{},onBlur:()=>{},onLoad:()=>{},readOnly:!1,resizable:!0,toolbar:!0,value:void 0,width:1/0};const U=f},kzlSyjDK:(h,g,e)=>{h=e.nmd(h),ace.define("ace/theme/graylog",["require","exports","module","ace/lib/dom"],(t,c)=>{c.cssText="",c.cssClass="ace-graylog",t("../lib/dom").importCssString(c.cssText,c.cssClass)}),function(){ace.require(["ace/theme/graylog"],t=>{h&&(h.exports=t)})}()}}]);})();
//# sourceMappingURL=1255d548-3521.d1b3693e3651623483d5.js.map
© 2015 - 2024 Weber Informatics LLC | Privacy Policy