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