All Downloads are FREE. Search and download functionalities are using the official Maven repository.

web-interface.assets.325e2d4b-2533.0de4abcf3cc2cdb98480.js Maven / Gradle / Ivy

There is a newer version: 6.0.1
Show newest version
"use strict";(self.webpackChunkgraylog_web_interface=self.webpackChunkgraylog_web_interface||[]).push([["325e2d4b-2533"],{"9l53l/qm":(t,e,n)=>{n.d(e,{Z:()=>g});var i=n("Z7aTuO5B"),s=n("ii0bleBb"),a=n("J6y4/h8P"),l=n("VPaD/Np4"),r=n("F9olzlTR"),o=n("8pZttqbT");const p=a.default.div.withConfig({displayName:"InputDropdown__LoaderContainer",componentId:"sc-8jvk3u-0"})(["display:flex;flex-wrap:wrap;.form-group{margin:0 15px 0 0;}"]),c=(0,a.default)(r.II).withConfig({displayName:"InputDropdown__StyledInputDropdown",componentId:"sc-8jvk3u-1"})(["min-width:400px;"]),u="placeholder",d=t=>{let{id:e,title:n,type:s}=t;return i.createElement("option",{key:e,value:e},n," (",s,")")},m=(t,e)=>t.title.localeCompare(e.title),h=t=>{let{input:{type:e,title:n}}=t;return i.createElement(c,{id:`${e}-select`,type:"select",disabled:!0},i.createElement("option",null,`${n} (${e})`))},f=t=>{let{disabled:e,inputs:n,onLoadMessage:s,preselectedInputId:a,title:l}=t;const[f,g]=(0,i.useState)(a||u),b=(0,i.useCallback)((t=>g(t.target.value)),[]),_=(0,i.useCallback)((()=>s(f)),[s,f]),E=(0,i.useMemo)((()=>null==n?void 0:n.get(a)),[n,a]);if(E)return i.createElement(p,null,i.createElement(h,{input:E}),i.createElement(r.zx,{bsStyle:"info",disabled:f===u,onClick:_},l));if(n){const t=n.sort(m).map(d);return i.createElement(p,null,i.createElement(c,{id:"placeholder-select",type:"select","aria-label":"server input select",value:f,onChange:b,placeholder:u},i.createElement("option",{value:u},"Select an Input"),t.toArray()),i.createElement(r.zx,{bsStyle:"info",disabled:e||f===u,onClick:_},l))}return i.createElement(o.Z,null)};f.propTypes={inputs:s.object,title:s.string.isRequired,preselectedInputId:s.string,onLoadMessage:s.func,disabled:s.bool},f.defaultProps={inputs:l.Map(),onLoadMessage:()=>{},preselectedInputId:void 0,disabled:!1};const g=f},"Rlqle+a0":(t,e,n)=>{n.d(e,{M5:()=>v,s_:()=>q,Et:()=>G,$B:()=>H,JQ:()=>K,t5:()=>Z,vk:()=>nt,yV:()=>at});var i=n("Z7aTuO5B"),s=n("D4SbLiE/"),a=n.n(s),l=n("JnTtTRmZ"),r=n.n(l),o=n("J6y4/h8P"),p=n("AztyBNMT"),c=n("F9olzlTR"),u=n("0zTRKSqx"),d=n("JNjM1tjZ"),m=n("up7V834Q");const h=(0,o.default)(c.X2).withConfig({displayName:"CreateInputControl__NewInputRow",componentId:"sc-9jx23w-0"})(["margin-bottom:8px;"]),f=a()({displayName:"CreateInputControl",mixins:[r().connect(m.W)],getInitialState:()=>({selectedInput:void 0,selectedInputDefinition:void 0}),_formatSelectOptions(){let t=[];const{inputTypes:e}=this.state;if(e){t=Object.keys(e).map((t=>({value:t,label:e[t]}))),t.sort(((t,e)=>t.label.toLowerCase().localeCompare(e.label.toLowerCase())))}else t.push({value:"none",label:"No inputs available",disabled:!0});return t},_onInputSelect(t){""===t&&this.setState(this.getInitialState()),this.setState({selectedInput:t}),m._.get.triggerPromise(t).then((t=>this.setState({selectedInputDefinition:t})))},_openModal(t){t.preventDefault();const{selectedInput:e}=this.state,n=p.PluginStore.exports("inputConfiguration").find((t=>t.type===e));if(n){const t=()=>this.setState({customInputsComponent:void 0}),e=n.component;this.setState({customInputsComponent:i.createElement(e,{onClose:t})})}this.configurationForm.open()},_createInput(t){d.x.create(t).then((()=>{this.setState(this.getInitialState())}))},render(){let t;const{selectedInputDefinition:e,selectedInput:n,inputTypes:s,customInputsComponent:a}=this.state;if(e&&!a){const a=s[n];t=i.createElement(v,{ref:t=>{this.configurationForm=t},key:"configuration-form-input",configFields:e.requested_configuration,title:i.createElement("span",null,"Launch new ",i.createElement("em",null,a)," input"),submitButtonText:"Launch Input",helpBlock:"Select a name of your new input that describes it.",typeName:n,submitAction:this._createInput})}return i.createElement(h,{className:"content"},i.createElement(c.JX,{md:12},i.createElement("form",{className:"form-inline",onSubmit:this._openModal},i.createElement("div",{className:"form-group",style:{width:300}},i.createElement(u.Ph,{placeholder:"Select input",options:this._formatSelectOptions(),matchProp:"label",onChange:this._onInputSelect,value:n}))," ",i.createElement(c.zx,{bsStyle:"success",type:"submit",disabled:!n},"Launch new input"),i.createElement(u.bd,{href:"https://marketplace.graylog.org/",bsStyle:"info",style:{marginLeft:10}},"Find more inputs")),t||a))}});n("9l53l/qm");var g=n("ii0bleBb"),b=n.n(g),_=n("kqAR+wt5"),E=n.n(_),y=n("Vpcj0rDf");function I(){return I=Object.assign?Object.assign.bind():function(t){for(var e=1;e{const n={};n[t]=e,this.setState(n)})),S(this,"_onSubmit",(t=>{const e=E().extend(t,{global:this.state.global,node:this.state.node});this.props.submitAction(e)})),S(this,"open",(()=>{this.configurationForm.open()})),S(this,"getValues",(()=>{const{values:t}=this.props;return t||(this.configurationForm?this.configurationForm.getValue().configuration:{})})),S(this,"getTitleValue",(()=>{const{titleValue:t}=this.props;return t||(this.configurationForm?this.configurationForm.getValue().titleValue:"")})),this.state={global:void 0!==this.props.globalValue&&this.props.globalValue,node:void 0!==this.props.nodeValue?this.props.nodeValue:void 0}}render(){const t=this.getValues(),e=this.getTitleValue();return i.createElement(y.fI,I({},this.props,{ref:t=>{this.configurationForm=t},values:t,titleValue:e,submitAction:this._onSubmit}),i.createElement(nt,{onChange:this._handleChange,global:this.state.global,node:this.state.node}))}}S(N,"propTypes",{globalValue:b().bool,nodeValue:b().string,titleValue:b().string,submitAction:b().func.isRequired,values:b().object,submitButtonText:b().string.isRequired}),S(N,"defaultProps",{globalValue:void 0,nodeValue:void 0,titleValue:void 0,values:void 0});const v=N;var x=n("EeAwn/0x"),C=n("EUJYvlA3"),w=n("DeVaSktS");const T=a()({displayName:"InputListItem",propTypes:{input:b().object.isRequired,currentNode:b().object.isRequired,permissions:b().array.isRequired},mixins:[C.ZP,r().connect(m.W)],_deleteInput(){window.confirm(`Do you really want to delete input '${this.props.input.title}'?`)&&d.x.delete(this.props.input)},_openStaticFieldForm(){this.staticFieldForm.open()},_editInput(){this.configurationForm.open()},_updateInput(t){d.x.update(this.props.input.id,t)},render(){if(!this.state.inputTypes)return i.createElement(u.$j,null);const{input:t}=this.props,e=this.state.inputDescriptions[t.type],n=i.createElement("span",null,this.props.input.name," ",i.createElement(q,{input:this.props.input})),s=[];if(this.isPermitted(this.props.permissions,["searches:relative"])&&s.push(i.createElement(x.J,{key:`received-messages-${this.props.input.id}`,to:w.ZP.search(`gl2_source_input:${this.props.input.id}`,{relative:0})},i.createElement(c.zx,null,"Show received messages"))),this.isPermitted(this.props.permissions,[`inputs:edit:${this.props.input.id}`])){let t;t=this.props.input.global?w.ZP.global_input_extractors(this.props.input.id):w.ZP.local_input_extractors(this.props.currentNode.node_id,this.props.input.id),s.push(i.createElement(x.J,{key:`manage-extractors-${this.props.input.id}`,to:t},i.createElement(c.zx,null,"Manage extractors"))),s.push(i.createElement(G,{key:`input-state-control-${this.props.input.id}`,input:this.props.input}))}let a,l;this.props.input.global||(a=i.createElement(x.J,{to:w.ZP.filtered_metrics(this.props.input.node,this.props.input.id)},i.createElement(c.sN,{key:`show-metrics-${this.props.input.id}`},"Show metrics"))),s.push(i.createElement(c.PS,{key:`more-actions-${this.props.input.id}`,title:"More actions",id:`more-actions-dropdown-${this.props.input.id}`,pullRight:!0},i.createElement(u.AE,{permissions:`inputs:edit:${this.props.input.id}`},i.createElement(c.sN,{key:`edit-input-${this.props.input.id}`,onSelect:this._editInput,disabled:void 0===e},"Edit input")),a,i.createElement(u.AE,{permissions:`inputs:edit:${this.props.input.id}`},i.createElement(c.sN,{key:`add-static-field-${this.props.input.id}`,onSelect:this._openStaticFieldForm},"Add static field")),i.createElement(u.AE,{permissions:"inputs:terminate"},i.createElement(c.sN,{key:`divider-${this.props.input.id}`,divider:!0})),i.createElement(u.AE,{permissions:"inputs:terminate"},i.createElement(c.sN,{key:`delete-input-${this.props.input.id}`,onSelect:this._deleteInput},"Delete input")))),!this.props.input.global&&this.props.input.node&&(l=i.createElement("span",null,"On node"," ",i.createElement(u.Zv,{nodeId:this.props.input.node})));const r=e?i.createElement(v,{ref:t=>{this.configurationForm=t},key:`edit-form-input-${t.id}`,globalValue:t.global,nodeValue:t.node,configFields:e.requested_configuration,title:`Editing Input ${t.title}`,titleValue:t.title,typeName:t.type,includeTitleField:!0,submitAction:this._updateInput,submitButtonText:"Update input",values:t.attributes}):null,o=i.createElement("div",null,i.createElement(c.JX,{md:8},i.createElement(y.$O,{className:"configuration-well",id:t.id,configuration:t.attributes,typeDefinition:e||{}}),i.createElement(at,{ref:t=>{this.staticFieldForm=t},input:this.props.input}),i.createElement(H,{input:this.props.input})),i.createElement(c.JX,{md:4},i.createElement(K,{input:t})),r);return i.createElement(u.S6,{key:`entry-list-${this.props.input.id}`,title:this.props.input.title,titleSuffix:n,description:l,createdFromContentPack:!!this.props.input.content_pack,actions:s,contentRow:o})}});var k=n("HEvxCVG3"),F=n("8/qN0F2n"),R=n("0wQfx7YJ"),D=n("OqsMdpSm"),O=n("xc00RsLr");const V=(0,O.ei)("core.SingleNode",(()=>r().createActions({get:{asyncResult:!0}}))),j=(0,O.dS)("core.SingleNode",(()=>r().createStore({listenables:[V],sourceUrl:"/system/cluster/node",node:void 0,init(){this._propagateState()},getInitialState(){return this._getNodeInfo()},_getNodeInfo(){return{node:this.node}},_propagateState(){this.trigger(this._getNodeInfo())},get(t){const e=(0,D.ZP)("GET",R.DC(t?R.em(this.sourceUrl,t):this.sourceUrl)).then((t=>{this.node=t,this._propagateState()}));V.get.promise(e)}}))),A=(0,o.default)(c.X2).withConfig({displayName:"InputsList__InputListRow",componentId:"sc-fpyxac-0"})(["h2{margin-bottom:5px;}.alert{margin-top:10px;}.static-fields{margin-top:10px;margin-left:3px;ul{margin:0;padding:0;.remove-static-field{margin-left:5px;}}}"]),Z=a()({displayName:"InputsList",propTypes:{permissions:b().array.isRequired,node:b().object},mixins:[r().connect(j),r().listenTo(d.Q,"_splitInputs")],getDefaultProps:()=>({node:void 0}),getInitialState:()=>({globalInputs:void 0,localInputs:void 0,filteredGlobalInputs:void 0,filteredLocalInputs:void 0,filter:void 0}),componentDidMount(){m._.list(),d.x.list(),V.get()},_splitInputs(t){const{inputs:e}=t,n=e.filter((t=>!0===t.global)).sort(((t,e)=>(0,k.Q)(t.title,e.title)));let i=e.filter((t=>!1===t.global)).sort(((t,e)=>(0,k.Q)(t.title,e.title)));this.props.node&&(i=i.filter((t=>t.node===this.props.node.node_id))),this.setState({globalInputs:n,localInputs:i}),this._onFilterInputs(this.state.filter)},_isLoading(){return!(this.state.localInputs&&this.state.globalInputs&&this.state.node&&this.state.filteredLocalInputs&&this.state.filteredGlobalInputs)},_formatInput(t){return i.createElement(T,{key:t.id,input:t,currentNode:this.state.node,permissions:this.props.permissions})},_nodeAffix(){return this.props.node?" on this node":""},_onFilterInputs(t,e){const{globalInputs:n,localInputs:i}=this.state,s=RegExp(t,"i");if(!n||!i)return void(e&&e());if(!t||t.length<=0)return this.setState({filteredGlobalInputs:n,filteredLocalInputs:i,filter:void 0}),void(e&&e());const a=t=>s.test(t.title),l=this.state.globalInputs.filter(a),r=this.state.localInputs.filter(a);this.setState({filteredGlobalInputs:l,filteredLocalInputs:r,filter:t}),e&&e()},_onFilterReset(){const{globalInputs:t,localInputs:e}=this.state;this.setState({filteredGlobalInputs:t,filteredLocalInputs:e,filter:void 0})},render(){return this._isLoading()?i.createElement(u.$j,null):i.createElement("div",null,!this.props.node&&i.createElement(u.AE,{permissions:"inputs:create"},i.createElement(f,null)),i.createElement(A,{id:"filter-input",className:"content"},i.createElement(c.JX,{md:12},i.createElement(u.UI,{onSearch:this._onFilterInputs,topMargin:0,onReset:this._onFilterReset,searchButtonLabel:"Filter",placeholder:"Filter by title"}),i.createElement("br",null),i.createElement("h2",null,"Global inputs  ",i.createElement("small",null,this.state.globalInputs.length," configured",this._nodeAffix())),i.createElement(F.Z,{bsNoItemsStyle:"info",noItemsText:this.state.globalInputs.length<=0?"There are no global inputs.":"No global inputs match the filter",items:this.state.filteredGlobalInputs.map((t=>this._formatInput(t)))}),i.createElement("br",null),i.createElement("br",null),i.createElement("h2",null,"Local inputs  ",i.createElement("small",null,this.state.localInputs.length," configured",this._nodeAffix())),i.createElement(F.Z,{bsNoItemsStyle:"info",noItemsText:this.state.localInputs.length<=0?"There are no local inputs.":"No local inputs match the filter",items:this.state.filteredLocalInputs.map((t=>this._formatInput(t)))}))))}});const L=class{constructor(){this.mapping={CREATED:0,INITIALIZED:1,INVALID_CONFIGURATION:2,STARTING:3,RUNNING:4,FAILED:2,STOPPING:1,STOPPED:0,TERMINATED:0}}compare(t,e){return this.mapping[t.toUpperCase()]-this.mapping[e.toUpperCase()]}};var P=n("CTjt89g5"),M=n("b3xCUZUh");const q=a()({displayName:"InputStateBadge",propTypes:{input:b().object.isRequired},mixins:[r().connect(P.c),r().connect(M.S)],comparator:new L,_labelClassForState(t){const{input:e}=this.props,{nodes:n}=this.state,i=t.reduce(((t,e)=>t+e.count),0);if(e.global&&i!==Object.keys(n).length)return"warning";const{state:s}=t[0];switch(s){case"RUNNING":return"success";case"FAILED":case"STOPPED":return"danger";case"STARTING":return"info";default:return"warning"}},_textForState(t){const{input:e}=this.props;return e.global?t.map((t=>`${t.count} ${t.state}`)).join(", "):t[0].state},_isLoading(){const{inputStates:t,nodes:e}=this.state;return!(t&&e)},render(){if(this._isLoading())return i.createElement(u.$j,null);const{input:t}=this.props,{inputStates:e}=this.state,n=t.id,s={};e[n]&&Object.keys(e[n]).forEach((t=>{const{state:i}=e[n][t];s[i]||(s[i]=[]),s[i].push(t)}));const a=Object.keys(s).sort(this.comparator.compare.bind(this.comparator)).map((t=>({state:t,count:s[t].length})));if(a.length>0){const e=a.map((t=>s[t.state].map((e=>i.createElement("small",null,i.createElement(u.Zv,{nodeId:e}),": ",t.state,i.createElement("br",null)))))),n=i.createElement(c.J2,{id:"inputstate-badge-details",title:`Input States for ${t.title}`},e);return i.createElement(u.Ox,{trigger:"click",placement:"bottom",overlay:n,rootClose:!0},i.createElement(c.__,{bsStyle:this._labelClassForState(a),title:"Click to show details",bsSize:"xsmall",style:{cursor:"pointer"}},this._textForState(a)))}const l=t.global||void 0===t.node?"0 RUNNING":"NOT RUNNING";return i.createElement(c.__,{bsStyle:"warning",bsSize:"xsmall"},l)}});const G=a()({displayName:"InputStateControl",propTypes:{input:b().object.isRequired},mixins:[r().connectFilter(P.c,"inputState",(function(t){return t.inputStates?t.inputStates[this.props.input.id]:void 0}))],getInitialState:()=>({loading:!1}),_isInputRunning(){if(!this.state.inputState)return!1;const t=Object.keys(this.state.inputState);return 0!==t.length&&t.some((t=>"RUNNING"===this.state.inputState[t].state))},_startInput(){this.setState({loading:!0}),P.c.start(this.props.input).finally((()=>this.setState({loading:!1})))},_stopInput(){this.setState({loading:!0}),P.c.stop(this.props.input).finally((()=>this.setState({loading:!1})))},render(){return this._isInputRunning()?i.createElement(c.zx,{bsStyle:"primary",onClick:this._stopInput,disabled:this.state.loading},this.state.loading?"Stopping...":"Stop input"):i.createElement(c.zx,{bsStyle:"success",onClick:this._startInput,disabled:this.state.loading},this.state.loading?"Starting...":"Start input")}});var B=n("9pdI12pI"),J=n.n(B),U=n("ApyIyvbD"),z=n("+we59NjM");const Q=o.default.span.withConfig({displayName:"InputThroughput__InputIO",componentId:"sc-9c6m2q-0"})((t=>{let{theme:e}=t;return(0,o.css)([".total{color:",";}.value{font-family:",";}.persec{margin-left:3px;}.channel-direction{position:relative;left:-1px;}.channel-direction-down{position:relative;top:1px;}.channel-direction-up{position:relative;top:-1px;}"],e.colors.gray[70],e.fonts.family.monospace)})),K=a()({displayName:"InputThroughput",propTypes:{input:b().object.isRequired},mixins:[r().connect(z.q)],getInitialState:()=>({showDetails:!1}),UNSAFE_componentWillMount(){this._metricNames().forEach((t=>z.K.addGlobal(t)))},componentWillUnmount(){this._metricNames().forEach((t=>z.K.removeGlobal(t)))},_metricNames(){return[this._prefix("incomingMessages"),this._prefix("emptyMessages"),this._prefix("open_connections"),this._prefix("total_connections"),this._prefix("written_bytes_1sec"),this._prefix("written_bytes_total"),this._prefix("read_bytes_1sec"),this._prefix("read_bytes_total")]},_prefix(t){const{input:e}=this.props;return`${e.type}.${e.id}.${t}`},_getValueFromMetric(t){if(null!=t)switch(t.type){case"meter":return t.metric.rate.mean;case"gauge":return t.metric.value;case"counter":return t.metric.count;default:return}},_calculateMetrics(t){const e={};return this._metricNames().forEach((n=>{e[n]=Object.keys(t).reduce(((e,i)=>{if(!t[i][n])return e;const s=this._getValueFromMetric(t[i][n]);return void 0!==s?isNaN(e)?s:e+s:e}),NaN)})),e},_formatCount:t=>J()(t).format("0,0"),_formatNetworkStats:(t,e,n,s)=>i.createElement(Q,null,i.createElement("span",null,"Network IO: "),i.createElement("span",{className:"persec"},i.createElement(u.JO,{name:"caret-down",className:"channel-direction channel-direction-down"}),i.createElement("span",{className:"rx value"},U.Z.formatBytes(n)," "),i.createElement(u.JO,{name:"caret-up",className:"channel-direction channel-direction-up"}),i.createElement("span",{className:"tx value"},U.Z.formatBytes(t))),i.createElement("span",{className:"total"},i.createElement("span",null," (total: "),i.createElement(u.JO,{name:"caret-down",className:"channel-direction channel-direction-down"}),i.createElement("span",{className:"rx value"},U.Z.formatBytes(s)," "),i.createElement(u.JO,{name:"caret-up",className:"channel-direction channel-direction-up"}),i.createElement("span",{className:"tx value"},U.Z.formatBytes(e)),i.createElement("span",null," )")),i.createElement("br",null)),_formatConnections(t,e){return i.createElement("span",null,"Active connections: ",i.createElement("span",{className:"active"},this._formatCount(t)," "),"(",i.createElement("span",{className:"total"},this._formatCount(e))," total)",i.createElement("br",null))},_formatAllNodeDetails(t){return i.createElement("span",null,i.createElement("hr",{key:"separator"}),Object.keys(t).map((e=>this._formatNodeDetails(e,t[e]))))},_formatNodeDetails(t,e){const{input:n}=this.props,s=this._getValueFromMetric(e[this._prefix("open_connections")]),a=this._getValueFromMetric(e[this._prefix("total_connections")]),l=this._getValueFromMetric(e[this._prefix("emptyMessages")]),r=this._getValueFromMetric(e[this._prefix("written_bytes_1sec")]),o=this._getValueFromMetric(e[this._prefix("written_bytes_total")]),p=this._getValueFromMetric(e[this._prefix("read_bytes_1sec")]),c=this._getValueFromMetric(e[this._prefix("read_bytes_total")]);return i.createElement("span",{key:n.id+t},i.createElement(u.Zv,{nodeId:t}),i.createElement("br",null),!isNaN(r)&&this._formatNetworkStats(r,o,p,c),!isNaN(s)&&this._formatConnections(s,a),!isNaN(l)&&i.createElement("span",null,"Empty messages discarded: ",this._formatCount(l),i.createElement("br",null)),isNaN(r)&&isNaN(s)&&i.createElement("span",null,"No metrics available for this node"),i.createElement("br",null))},_toggleShowDetails(t){t.preventDefault();const{showDetails:e}=this.state;this.setState({showDetails:!e})},render(){const{metrics:t,showDetails:e}=this.state,{input:n}=this.props;if(!t)return i.createElement(u.$j,null);const s=this._calculateMetrics(t),a=s[this._prefix("incomingMessages")],l=s[this._prefix("emptyMessages")],r=s[this._prefix("open_connections")],o=s[this._prefix("total_connections")],p=s[this._prefix("written_bytes_1sec")],c=s[this._prefix("written_bytes_total")],d=s[this._prefix("read_bytes_1sec")],m=s[this._prefix("read_bytes_total")];return i.createElement("div",{className:"graylog-input-metrics"},i.createElement("h3",null,"Throughput / Metrics"),i.createElement("span",null,isNaN(a)&&isNaN(p)&&isNaN(r)&&i.createElement("i",null,"No metrics available for this input"),!isNaN(a)&&i.createElement("span",null,"1 minute average rate: ",this._formatCount(a)," msg/s",i.createElement("br",null)),!isNaN(p)&&this._formatNetworkStats(p,c,d,m),!isNaN(r)&&this._formatConnections(r,o),!isNaN(l)&&i.createElement("span",null,"Empty messages discarded: ",this._formatCount(l),i.createElement("br",null)),!isNaN(p)&&n.global&&i.createElement("a",{href:"",onClick:this._toggleShowDetails},e?"Hide":"Show"," details"),!isNaN(p)&&e&&this._formatAllNodeDetails(t)))}});var X=n("+RYU3/K1");function W(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}class Y extends i.Component{constructor(){super(...arguments),W(this,"_deleteStaticField",(t=>()=>{window.confirm(`Are you sure you want to remove static field '${t}' from '${this.props.input.title}'?`)&&X.Q.destroy(this.props.input,t)})),W(this,"_deleteButton",(t=>i.createElement(c.zx,{bsStyle:"link",bsSize:"xsmall",style:{verticalAlign:"baseline"},onClick:this._deleteStaticField(t)},i.createElement(u.JO,{name:"remove"})))),W(this,"_formatStaticFields",(t=>{const e=[];return Object.keys(t).forEach((n=>{e.push(i.createElement("li",{key:`${n}-field`},i.createElement("strong",null,n,":")," ",t[n]," ",this._deleteButton(n)))})),e}))}render(){return 0===Object.keys(this.props.input.static_fields).length?i.createElement("div",null):i.createElement("div",{className:"static-fields"},i.createElement("h3",{style:{marginBottom:5}},"Static fields"),i.createElement("ul",null,this._formatStaticFields(this.props.input.static_fields)))}}W(Y,"propTypes",{input:b().object.isRequired});const H=Y;var tt=n("b/6pmtOr");const et=t=>{let{global:e=!1,node:n,onChange:s}=t;const{nodes:a}=(0,tt.o)(M.S),[l,r]=(0,i.useState)(e),[o,p]=(0,i.useState)(n);(0,i.useEffect)((()=>{if(!n&&a){const t=Object.keys(a);1===t.length&&(s("node",t[0]),p(t[0]))}}),[a]);const d=(0,i.useCallback)((t=>{const e=t.target.checked;r(e),e?(p("placeholder"),s("node",void 0)):s("node",o),s("global",e)}),[s,o,p,r]),m=(0,i.useCallback)((t=>{p(t.target.value),s("node",t.target.value)}),[p,s]);if(!a)return i.createElement(u.$j,null);const h=Object.keys(a).map((t=>i.createElement("option",{key:t,value:t},a[t].short_node_id," / ",a[t].hostname))),f=l?null:i.createElement(c.II,{id:"node-select",type:"select",label:"Node",placeholder:"placeholder",value:n,help:"On which node should this input start",onChange:m,required:!0},i.createElement("option",{key:"placeholder",value:""},"Select Node"),h);return i.createElement("span",null,i.createElement(c.II,{id:"global-checkbox",type:"checkbox",label:"Global",help:"Should this input start on all nodes",checked:l,onChange:d}),f)};et.propTypes={global:b().bool,onChange:b().func.isRequired,node:b().string},et.defaultProps={global:!1,node:void 0};const nt=et;function it(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}class st extends i.Component{constructor(){super(...arguments),it(this,"open",(()=>{this.modal.open()})),it(this,"_addStaticField",(()=>{const t=this.fieldName.getValue(),e=this.fieldValue.getValue();X.Q.create(this.props.input,t,e).then((()=>this.modal.close()))}))}render(){return i.createElement(c.K$,{ref:t=>{this.modal=t},title:"Add static field",submitButtonText:"Add field",onSubmitForm:this._addStaticField},i.createElement("p",null,"Define a static field that is added to every message that comes in via this input. The field is not overwritten If the message already has that key. Key must only contain alphanumeric characters or underscores and not be a reserved field."),i.createElement(c.II,{ref:t=>{this.fieldName=t},type:"text",id:"field-name",label:"Field name",required:!0,pattern:"[A-Za-z0-9_]*",title:"Should consist only of alphanumeric characters and underscores.",autoFocus:!0}),i.createElement(c.II,{ref:t=>{this.fieldValue=t},type:"text",id:"field-value",label:"Field value",required:!0}))}}it(st,"propTypes",{input:b().object.isRequired});const at=st},CTjt89g5:(t,e,n)=>{n.d(e,{c:()=>p});var i=n("JnTtTRmZ"),s=n.n(i),a=n("4af3+9mh"),l=n("0wQfx7YJ"),r=n("rkoyttmq"),o=n("OqsMdpSm");const p=(0,n("xc00RsLr").dS)("core.InputStates",(()=>s().createStore({listenables:[],init(){this.list()},getInitialState(){return{inputStates:this.inputStates}},list(){const t=l.DC(r.Z.ClusterInputStatesController.list().url);return(0,o.ZP)("GET",t).then((t=>{const e={};return Object.keys(t).forEach((n=>{t[n]&&t[n].forEach((t=>{e[t.id]||(e[t.id]={}),e[t.id][n]=t}))})),this.inputStates=e,this.trigger({inputStates:this.inputStates}),e}))},_checkInputStateChangeResponse(t,e,n){const i=Object.keys(e).filter((e=>!!t.global||e===t.node)),s=i.filter((t=>null===e[t]));0===s.length?a.Z.success(`Request to ${n.toLowerCase()} input '${t.title}' was sent successfully.`,`Input '${t.title}' will be ${"START"===n?"started":"stopped"} shortly`):s.length===i.length?a.Z.error(`Request to ${n.toLowerCase()} input '${t.title}' failed. Check your Graylog logs for more information.`,`Input '${t.title}' could not be ${"START"===n?"started":"stopped"}`):a.Z.warning(`Request to ${n.toLowerCase()} input '${t.title}' failed in some nodes. Check your Graylog logs for more information.`,`Input '${t.title}' could not be ${"START"===n?"started":"stopped"} in all nodes`)},start(t){const e=l.DC(r.Z.ClusterInputStatesController.start(t.id).url);return(0,o.ZP)("PUT",e).then((e=>(this._checkInputStateChangeResponse(t,e,"START"),this.list(),e)),(e=>{a.Z.error(`Error starting input '${t.title}': ${e}`,`Input '${t.title}' could not be started`)}))},stop(t){const e=l.DC(r.Z.ClusterInputStatesController.stop(t.id).url);return(0,o.ZP)("DELETE",e).then((e=>(this._checkInputStateChangeResponse(t,e,"STOP"),this.list(),e)),(e=>{a.Z.error(`Error stopping input '${t.title}': ${e}`,`Input '${t.title}' could not be stopped`)}))}})))},up7V834Q:(t,e,n)=>{n.d(e,{W:()=>c,_:()=>p});var i=n("JnTtTRmZ"),s=n.n(i),a=n("0wQfx7YJ"),l=n("OqsMdpSm"),r=n("4af3+9mh"),o=n("xc00RsLr");const p=(0,o.ei)("core.InputTypes",(()=>s().createActions({list:{asyncResult:!0},get:{asyncResult:!0}}))),c=(0,o.dS)("core.InputTypes",(()=>s().createStore({listenables:[p],sourceUrl:"/system/inputs/types",inputTypes:void 0,inputDescriptions:void 0,init(){this.list()},getInitialState(){return{inputTypes:this.inputTypes,inputDescriptions:this.inputDescriptions}},list(){const t=(0,l.ZP)("GET",(0,a.DC)(this.sourceUrl)),e=(0,l.ZP)("GET",(0,a.DC)(`${this.sourceUrl}/all`)),n=Promise.all([t,e]);n.then((t=>{let[e,n]=t;this.inputTypes=e.types,this.inputDescriptions=n,this.trigger(this.getInitialState())}),(t=>{r.Z.error(`Fetching Input Types failed with status: ${t}`,"Could not retrieve Inputs")})),p.list.promise(n)},get(t){const e=(0,l.ZP)("GET",(0,a.DC)(`${this.sourceUrl}/${t}`));e.catch((e=>{r.Z.error(`Fetching input ${t} failed with status: ${e}`,"Could not retrieve input")})),p.get.promise(e)}})))},HEvxCVG3:(t,e,n)=>{n.d(e,{Q:()=>r,d:()=>l});var i=n("9oVghaOd"),s=n.n(i),a=n("6n4dw8v3");function l(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"asc";const i=s()(t),a=s()(e);return"asc"===n?i.isBefore(a)?-1:a.isBefore(i)?1:0:a.isBefore(i)?-1:i.isBefore(a)?1:0}function r(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"asc";return"asc"===n?(0,a.S)(t.toLowerCase(),e.toLowerCase()):(0,a.S)(e.toLowerCase(),t.toLowerCase())}}}]);
//# sourceMappingURL=325e2d4b-2533.0de4abcf3cc2cdb98480.js.map




© 2015 - 2024 Weber Informatics LLC | Privacy Policy