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

web-interface.assets.325e2d4b-9138.0712dacfc5a329cc54ea.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-9138"],{pLLmkYy5:(e,t,n)=>{n.d(t,{Z:()=>u});var s=n("Z7aTuO5B"),i=n("J6y4/h8P"),l=n("F9olzlTR"),r=n("EeAwn/0x"),a=n("0zTRKSqx"),o=n("XR6lEGGZ");const c=(0,i.default)(l.Si).withConfig({displayName:"PageNavigation__Container",componentId:"sc-1if5i40-0"})(["margin-bottom:10px;"]),p=(0,i.default)(l.zx).withConfig({displayName:"PageNavigation__StyledButton",componentId:"sc-1if5i40-1"})((e=>{let{theme:t}=e;return(0,i.css)(["font-family:",";font-size:",";&&&&{color:",";:hover,:focus{text-decoration:none;}:hover{","}&.active{color:",";"," :hover,:focus{","}}}"],t.fonts.family.navigation,t.fonts.size.navigation,t.colors.variant.darker.default,(0,o.RF)(t),t.colors.global.textDefault,(0,o.A7)(t),(0,o.A7)(t))}));p.displayName="Button";const u=e=>{let{items:t}=e;return s.createElement(c,null,t.map((e=>{let{path:t,title:n,permissions:i,exactPathMatch:l}=e;return t?s.createElement(a.AE,{permissions:null!=i?i:[],key:t},s.createElement(r.J,{to:t,relativeActive:!l},s.createElement(p,{bsStyle:"link"},s.createElement(o.ZP,null,n)))):null})))}},HaF9mmRp:(e,t,n)=>{n.d(t,{Z:()=>o});var s=n("ii0bleBb"),i=n.n(s),l=n("Z7aTuO5B"),r=n("6n4dw8v3");const a=e=>{let{pipeline:t,connections:n,streams:s,streamsFormatter:i,noConnectionsMessage:a}=e;const o=n.filter((e=>e.pipeline_ids&&e.pipeline_ids.includes(t.id))).filter((e=>s.some((t=>t.id===e.stream_id)))).map((e=>s.find((t=>t.id===e.stream_id)))).sort(((e,t)=>(0,r.S)(e.title,t.title)));return l.createElement("span",null,0===o.length?a:i(o))};a.propTypes={pipeline:i().object.isRequired,connections:i().array.isRequired,streams:i().array.isRequired,streamsFormatter:i().func.isRequired,noConnectionsMessage:i().node},a.defaultProps={noConnectionsMessage:"Pipeline not connected to any streams"};const o=a},MOgDWHS8:(e,t,n)=>{n.d(t,{Z:()=>o});var s=n("Z7aTuO5B"),i=n("pLLmkYy5"),l=n("DeVaSktS"),r=n("F9olzlTR");const a=[{title:"Manage pipelines",path:l.ZP.SYSTEM.PIPELINES.OVERVIEW,exactPathMatch:!0},{title:"Manage rules",path:l.ZP.SYSTEM.PIPELINES.RULES},{title:"Simulator",path:l.ZP.SYSTEM.PIPELINES.SIMULATOR}],o=()=>s.createElement(r.X2,null,s.createElement(i.Z,{items:a}))},"z+v0JWIW":(e,t,n)=>{n.r(t),n.d(t,{default:()=>ie});var s=n("ii0bleBb"),i=n.n(s),l=n("Z7aTuO5B"),r=n("D4SbLiE/"),a=n.n(r),o=n("JnTtTRmZ"),c=n.n(o),p=n("F9olzlTR"),u=n("0zTRKSqx"),d=n("J6y4/h8P"),m=n("Y1Txt3Ie"),g=n("b/6pmtOr"),h=n("0I+u03RB"),f=n("EUJYvlA3"),E=n("j7/yTk5n"),C=n("EeAwn/0x"),P=n("YyiN4DLW"),y=n("ApyIyvbD"),S=n("DeVaSktS");const R=e=>{let{pipeline:t,stage:n,create:s,save:i}=e;const r=(0,E.Z)(),a=(0,l.useRef)(),o=(0,l.useMemo)((()=>s?Math.max(...t.stages.map((e=>e.stage)))+1:n.stage),[s,t.stages,n.stage]),[c,d]=(0,l.useState)({...n,stage:o}),{rules:m}=(0,g.o)(h.G),R=e=>{let{target:t}=e;d((e=>({...e,[t.name]:(0,P.n6)(t)})))},Z=()=>{a.current&&a.current.close()},b=(0,l.useMemo)((()=>c.stage!==o&&t.stages.some((e=>{let{stage:t}=e;return t===c.stage}))),[c.stage,o,t.stages]),v=e=>{let{title:t}=e;return{value:t,label:t}},T=(0,l.useCallback)((()=>{const e=c.rules;return m?m.filter((t=>((e,t)=>!t.includes(e.title))(t,e))).map(v):[]}),[c.rules,m]),w=l.createElement("span",null,"Select the rules evaluated on this stage, or create one in the"," ",l.createElement(C.r,{to:S.ZP.SYSTEM.PIPELINES.RULES},"Pipeline Rules page"),".");return l.createElement("span",null,l.createElement(p.zx,{disabled:!(0,f.rq)(r.permissions,"pipeline:edit"),onClick:()=>{a.current&&a.current.open()},bsStyle:s?"success":"info"},s?"Add new stage":"Edit"),l.createElement(p.K$,{ref:a,title:`${s?"Add new":"Edit"} stage ${c.stage}`,onSubmitForm:()=>{b||i(c,Z)},submitButtonText:s?"Add stage":"Update stage"},l.createElement("fieldset",null,l.createElement(p.II,{type:"number",id:"stage",name:"stage",label:"Stage",autoFocus:!0,min:y.Z.JAVA_INTEGER_MIN_VALUE+1,max:y.Z.JAVA_INTEGER_MAX_VALUE,onChange:R,bsStyle:b?"error":null,help:b?"Stage is already in use, please use another number or edit the existing stage.":"Stage priority. The lower the number, the earlier it will execute.",value:c.stage}),l.createElement(p.cw,null,l.createElement(p.J$,null,"Continue processing on next stage when")),l.createElement(p.II,{type:"radio",id:"match_all",name:"match",value:"ALL",label:"All rules on this stage match the message",onChange:R,checked:"ALL"===c.match}),l.createElement(p.II,{type:"radio",id:"match_any",name:"match",value:"EITHER",label:"At least one of the rules on this stage matches the message",onChange:R,checked:"EITHER"===c.match}),l.createElement(p.II,{type:"radio",id:"match_pass",name:"match",value:"PASS",label:"None or more rules on this stage match",onChange:R,checked:"PASS"===c.match}),l.createElement(p.II,{id:"stage-rules-select",label:"Stage rules",help:w},l.createElement(u.eR,{options:T(),isLoading:!m,onChange:e=>{d((t=>({...t,rules:e})))},selectedOptions:c.rules})))))};R.propTypes={pipeline:i().object.isRequired,stage:i().object,create:i().bool,save:i().func.isRequired},R.defaultProps={create:!1,stage:{stage:0,match:"EITHER",rules:[]}};const Z=R,b=d.default.td.withConfig({displayName:"StageRules__TitleTd",componentId:"sc-14noj8x-0"})(["width:400px;"]),v=e=>{let{pipeline:t,stage:n,rules:s}=e;return l.createElement(u.wQ,{id:"processing-timeline",className:"table-hover",headers:["Title","Description","Throughput","Errors"],headerCellFormatter:e=>l.createElement("th",null,e),rows:s,dataRowFormatter:(e,s)=>{let i,r=e;return r?i=l.createElement(C.r,{to:S.ZP.SYSTEM.PIPELINES.RULE(r.id)},r.title):(r={id:`invalid-${s}`,description:`Rule ${n.rules[s]} has been renamed or removed. This rule will be skipped.`},i=l.createElement("span",null,l.createElement(u.JO,{name:"exclamation-triangle",className:"text-danger"})," ",n.rules[s])),l.createElement("tr",{key:r.id},l.createElement(b,null,i),l.createElement("td",null,r.description),l.createElement("td",null,l.createElement(m.CL,{name:`org.graylog.plugins.pipelineprocessor.ast.Rule.${r.id}.${t.id}.${n.stage}.executed`},l.createElement(m.qb,{zeroOnMissing:!0,suffix:"msg/s"}))),l.createElement("td",null,l.createElement(m.CL,{name:`org.graylog.plugins.pipelineprocessor.ast.Rule.${r.id}.${t.id}.${n.stage}.failed`},l.createElement(m.qb,{showTotal:!0,zeroOnMissing:!0,suffix:"errors/s"}))))},noDataText:"This stage has no rules yet. Click on edit to add some.",filterLabel:"",filterKeys:[]})};v.propTypes={pipeline:i().object.isRequired,stage:i().object.isRequired,rules:i().array},v.defaultProps={rules:[]};const T=v,w=e=>{let{stage:t,pipeline:n,isLastStage:s,onUpdate:i,onDelete:r}=e;const a=(0,E.Z)(),{rules:o}=(0,g.o)(h.G),c="Contains "+(1===t.rules.length?"1 rule":`${t.rules.length} rules`),d=l.createElement(m.CL,{name:`org.graylog.plugins.pipelineprocessor.ast.Pipeline.${n.id}.stage.${t.stage}.executed`},l.createElement(m.qb,{showTotal:!1,prefix:"Throughput: ",suffix:"msg/s"})),C=[l.createElement(p.zx,{disabled:!(0,f.rq)(a.permissions,"pipeline:edit"),key:`delete-stage-${t}`,bsStyle:"primary",onClick:r},"Delete"),l.createElement(Z,{key:`edit-stage-${t}`,pipeline:n,stage:t,save:i})];let P;if(s)P="There are no further stages in this pipeline. Once rules in this stage are applied, the pipeline will have finished processing.";else{let e;switch(t.match){case"ALL":e="all rules";break;case"EITHER":e="at least one rule";break;case"PASS":e="none or more rules";break;default:e="UNKNOWN"}P=l.createElement("span",null,"Messages satisfying ",l.createElement("strong",null,e)," ","in this stage, will continue to the next stage.")}const y=l.createElement("span",null,P,l.createElement("br",null),d),S=o?l.createElement(T,{pipeline:n,stage:t,rules:t.rules.map((e=>o.filter((t=>t.title===e))[0]))}):l.createElement(u.$j,null);return l.createElement(u.S6,{title:`Stage ${t.stage}`,titleSuffix:c,actions:C,description:y,contentRow:l.createElement(p.JX,{md:12},S)})};w.propTypes={stage:i().object.isRequired,pipeline:i().object.isRequired,isLastStage:i().bool.isRequired,onUpdate:i().func.isRequired,onDelete:i().func.isRequired};const _=w;var D=n("nHcjWeCO");const I=e=>{let{pipeline:t,create:n,modal:s,save:i,onCancel:r}=e;const a=(0,E.Z)(),o=(0,l.useRef)(),[c,d]=(0,l.useState)((0,D.cloneDeep)(t)),m=()=>{o.current&&o.current.open()},g=e=>{let{target:t}=e;d((e=>({...e,[t.name]:(0,P.n6)(t)})))},h=()=>{o.current&&o.current.close(),n&&d((0,D.cloneDeep)(t))},C=e=>{e&&e.preventDefault(),i(c,h)},y=l.createElement("fieldset",null,l.createElement(p.II,{type:"text",id:"title",name:"title",label:"Title",autoFocus:!0,required:!0,onChange:g,help:"Pipeline name.",value:c.title}),l.createElement(p.II,{type:"text",id:"description",name:"description",label:"Description",onChange:g,help:"Pipeline description.",value:c.description}));return s?l.createElement("span",null,l.createElement(p.zx,{disabled:!(0,f.rq)(a.permissions,"pipeline:edit"),onClick:m,bsStyle:"success"},n?"Add new pipeline":"Edit pipeline details"),l.createElement(p.K$,{ref:o,title:`${n?"Add new":"Edit"} pipeline ${c.title}`,onSubmitForm:C,submitButtonText:n?"Add pipeline":"Update pipeline"},y)):l.createElement("form",{onSubmit:C},y,l.createElement(p.X2,null,l.createElement(p.JX,{md:12},l.createElement(u.Ow,{submitButtonText:n?"Create pipeline":"Update pipeline",onCancel:r}))))};I.propTypes={pipeline:i().object,create:i().bool,modal:i().bool,save:i().func.isRequired,onCancel:i().func},I.defaultProps={modal:!0,create:!1,pipeline:{id:void 0,title:"",description:"",stages:[{stage:0,rules:[]}]},onCancel:()=>{}};const x=I,q=d.default.dl.withConfig({displayName:"PipelineDetails__PipelineDl",componentId:"sc-1hfmywu-0"})(["&{margin-bottom:0;margin-top:10px;}& > dt{text-align:left;width:160px;}& > dt::after{content:':';}& > dd{margin-left:120px;}"]),L=e=>{let{pipeline:t,create:n,onChange:s,onCancel:i}=e;return n?l.createElement(x,{create:!0,save:s,onCancel:i,modal:!1}):l.createElement("div",null,l.createElement(p.X2,null,l.createElement(p.JX,{md:12},l.createElement("div",{className:"pull-right"},l.createElement(x,{pipeline:t,save:s})),l.createElement("h2",null,"Details"),l.createElement(q,{className:"dl-horizontal"},l.createElement("dt",null,"Title"),l.createElement("dd",null,t.title),l.createElement("dt",null,"Description"),l.createElement("dd",null,t.description),l.createElement("dt",null,"Created"),l.createElement("dd",null,l.createElement(u.ij,{dateTime:t.created_at})),l.createElement("dt",null,"Last modified"),l.createElement("dd",null,l.createElement(u.ij,{dateTime:t.modified_at})),l.createElement("dt",null,"Current throughput"),l.createElement("dd",null,l.createElement(m.CL,{name:`org.graylog.plugins.pipelineprocessor.ast.Pipeline.${t.id}.executed`},l.createElement(m.qb,{suffix:"msg/s"})))))),l.createElement("hr",null))};L.propTypes={pipeline:i().object,create:i().bool,onChange:i().func.isRequired,onCancel:i().func},L.defaultProps={pipeline:void 0,create:!1,onCancel:()=>{}};const N=L;var k=n("6n4dw8v3");const M=e=>e.map((e=>({value:e.id,label:e.title}))).sort(((e,t)=>(0,k.S)(e.label,t.label))),A=e=>{let{pipeline:t,connections:n,streams:s,save:i}=e;const r=(0,E.Z)(),a=(0,l.useRef)(),o=(0,l.useMemo)((()=>n.filter((e=>e.pipeline_ids&&e.pipeline_ids.includes(t.id))).filter((e=>s.some((t=>t.id===e.stream_id)))).map((e=>s.find((t=>t.id===e.stream_id))))),[t,n,s]),[c,d]=(0,l.useState)(M(o)),m=(0,l.useMemo)((()=>s.filter((e=>!c.some((t=>t.value.toLowerCase()===e.id.toLowerCase()))))),[s,c]),g=()=>{a.current&&a.current.close()},h=l.createElement("span",null,"Select the streams you want to connect to this pipeline, or create one in the"," ",l.createElement(C.r,{to:S.ZP.STREAMS},"Streams page"),".");return l.createElement("span",null,l.createElement(p.zx,{disabled:!(0,f.rq)(r.permissions,"pipeline_connection:edit"),onClick:()=>{a.current&&a.current.open()},bsStyle:"info"},l.createElement("span",null,"Edit connections")),l.createElement(p.K$,{ref:a,title:l.createElement("span",null,"Edit connections for ",l.createElement("em",null,t.title)),onSubmitForm:()=>{const e=c.map((e=>e.value)),n={pipeline:t.id,streams:e};i(n,g)},submitButtonText:"Update connections"},l.createElement("fieldset",null,l.createElement(p.cw,{id:"streamsConnections"},l.createElement(p.J$,null,"Streams"),l.createElement(u.eR,{options:M(m),onChange:e=>{d(e.sort(((e,t)=>(0,k.S)(e.label,t.label))))},selectedOptionsType:"object",selectedOptions:c}),l.createElement(p.Qb,null,h)))))};A.propTypes={pipeline:i().object.isRequired,connections:i().array.isRequired,streams:i().array.isRequired,save:i().func.isRequired};const O=A;var F=n("HaF9mmRp");const U=(0,d.default)(p.bZ).withConfig({displayName:"Pipeline__ConnectionWarning",componentId:"sc-ctlssi-0"})(["margin-bottom:13px;"]),J=(0,d.default)(p.X2).withConfig({displayName:"Pipeline__StyledRow",componentId:"sc-ctlssi-1"})(["margin-top:10px;"]),j=d.default.p.withConfig({displayName:"Pipeline__StyledP",componentId:"sc-ctlssi-2"})(["margin-top:5px;"]),X=e=>{let{pipeline:t,connections:n,streams:s,onConnectionsChange:i,onStagesChange:r,onPipelineChange:a}=e;const o=(0,l.useCallback)((e=>(n,s)=>{const i=t.stages.filter((t=>t.stage!==e.stage));i.push(n),r(i,s)}),[t,r]),c=(0,l.useCallback)((e=>()=>{if(window.confirm(`You are about to delete stage ${e.stage}, are you sure you want to proceed?`)){const n=t.stages.filter((t=>t.stage!==e.stage));r(n)}}),[t,r]),d=(0,l.useMemo)((()=>{const e=t.stages.reduce(((e,t)=>Math.max(e,t.stage)),-1/0);return t.stages.sort(((e,t)=>e.stage-t.stage)).map((n=>l.createElement(_,{key:`stage-${n.stage}`,pipeline:t,stage:n,isLastStage:n.stage===e,onUpdate:o(n),onDelete:c(n)})))}),[t,o,c]),m=(0,l.useMemo)((()=>t.stages.map((e=>e.stage)).join("-")),[t.stages]);return l.createElement("div",null,0===n.length?l.createElement(U,{bsStyle:"danger"},"This pipeline is currently not connected to any streams. You have to connect a pipeline to at least one stream to make it process incoming messages. Note that this is not required if you intend to use this pipeline only for search result transformation using decorators."):null,l.createElement(N,{pipeline:t,onChange:a}),l.createElement(J,{className:"row-sm"},l.createElement(p.JX,{md:12},l.createElement("div",{className:"pull-right"},l.createElement(O,{pipeline:t,connections:n,streams:s,save:i})),l.createElement("h2",null,"Pipeline connections"),l.createElement(j,null,l.createElement(F.Z,{pipeline:t,connections:n,streams:s,streamsFormatter:e=>{const t=e.map((e=>`"${e.title}"`)),n=t.length>1?[t.slice(0,-1).join(", "),t.slice(-1)].join(" and "):t[0];return l.createElement("span",null,"This pipeline is processing messages from the"," ",l.createElement(u.qX,{singular:"stream",plural:"streams",value:t.length})," ",n,".")},noConnectionsMessage:"Select streams that will be processed by this pipeline."})),l.createElement("hr",null))),l.createElement(J,{className:"row-sm"},l.createElement(p.JX,{md:12},l.createElement("div",{className:"pull-right"},l.createElement(Z,{key:m,pipeline:t,create:!0,save:(e,n)=>{const s=t.stages.slice();s.push(e),r(s,n)}})),l.createElement("h2",null,"Pipeline Stages"),l.createElement(j,null,"Stages are groups of conditions and actions which need to run in order, and provide the necessary"," ","control flow to decide whether or not to run the rest of a pipeline."))),l.createElement(u.XO,{bsNoItemsStyle:"info",noItemsText:"There are no rules on this stage.",items:d}))};X.propTypes={pipeline:i().object.isRequired,connections:i().array.isRequired,streams:i().array.isRequired,onConnectionsChange:i().func.isRequired,onStagesChange:i().func.isRequired,onPipelineChange:i().func.isRequired};const G=X;var B=n("BSHS2nUH");const Y=e=>{let{onChange:t}=e;const n=e=>{B.Z.push(S.ZP.SYSTEM.PIPELINES.PIPELINE(e.id))};return l.createElement(p.X2,null,l.createElement(p.JX,{md:6},l.createElement("p",null,"Give a name and description to the new pipeline. You can add stages to it when you save the changes."),l.createElement(N,{create:!0,onChange:e=>{t(e,n)},onCancel:()=>{B.Z.goBack()}})))};Y.propTypes={onChange:i().func.isRequired};const z=Y,W={generatePipeline(e){let t=`pipeline "${e.title}"\n`;return e.stages.forEach((e=>{var n;t+=`stage ${e.stage} match ${(null===(n=e.match)||void 0===n?void 0:n.toLowerCase())||"either"}\n`,e.rules.forEach((e=>{t+=`rule "${e}"\n`}))})),t+="end",t}};var H=n("+g3JwX3k"),V=n("CfS4XPvw"),K=n("xxwliabF"),Q=n("CTSsa1wm"),ee=n("uaoWrOBD"),te=n("4Js8dUPg"),ne=n("MOgDWHS8");const se=a()({displayName:"PipelineDetailsPage",propTypes:{params:i().object.isRequired},mixins:[c().connectFilter(ee.X,"pipeline",(function(e){return e.pipelines?e.pipelines.filter((e=>e.id===this.props.params.pipelineId))[0]:void 0})),c().connectFilter(Q.V,"connections",(function(e){if(e.connections)return e.connections.filter((e=>e.pipeline_ids&&e.pipeline_ids.includes(this.props.params.pipelineId)))}))],componentDidMount(){const{params:e}=this.props;this._isNewPipeline(e.pipelineId)||ee.o.get(e.pipelineId),h.G.list(),Q.q.list(),K.sH.listStreams().then((e=>{const t=e.filter((e=>e.is_editable));this.setState({streams:t})}))},UNSAFE_componentWillReceiveProps(e){this._isNewPipeline(e.params.pipelineId)||ee.o.get(e.params.pipelineId)},_onConnectionsChange(e,t){Q.q.connectToPipeline(e),t()},_onStagesChange(e,t){const{pipeline:n}=this.state,s=H.Z.clone(n);s.stages=e,s.source=W.generatePipeline(s),ee.o.update(s),"function"==typeof t&&t()},_savePipeline(e,t){const n=H.Z.clone(e);let s;n.source=W.generatePipeline(e),s=n.id?ee.o.update(n):ee.o.save(n),s.then((e=>t(e)))},_isNewPipeline:e=>"new"===e,_isLoading(){const{params:e}=this.props,{connections:t,streams:n,pipeline:s}=this.state;return!(this._isNewPipeline(e.pipelineId)||s&&t&&n)},render(){if(this._isLoading())return l.createElement(u.$j,null);const{params:e}=this.props,{connections:t,streams:n,pipeline:s,rules:i}=this.state;let r,a;r=this._isNewPipeline(e.pipelineId)?"New pipeline":l.createElement("span",null,"Pipeline ",l.createElement("em",null,s.title)),a=this._isNewPipeline(e.pipelineId)?l.createElement(z,{onChange:this._savePipeline}):l.createElement(G,{pipeline:s,connections:t,streams:n,rules:i,onConnectionsChange:this._onConnectionsChange,onStagesChange:this._onStagesChange,onPipelineChange:this._savePipeline});const o=this._isNewPipeline(e.pipelineId)?"New pipeline":`Pipeline ${s.title}`;return l.createElement(u.$4,{title:o},l.createElement("div",null,l.createElement(ne.Z,null),l.createElement(u.mr,{title:r,documentationLink:{title:"Pipelines documentation",path:te.Z.PAGES.PIPELINES}},l.createElement("span",null,"Pipelines let you transform and process messages coming from streams. Pipelines consist of stages where rules are evaluated and applied. Messages can go through one or more stages.",l.createElement("br",null),"After each stage is completed, you can decide if messages matching all or one of the rules continue to the next stage.")),l.createElement(p.X2,{className:"content"},l.createElement(p.JX,{md:12},a))))}}),ie=(0,V.Z)(se)},CTSsa1wm:(e,t,n)=>{n.d(t,{V:()=>u,q:()=>p});var s=n("JnTtTRmZ"),i=n.n(s),l=n("4af3+9mh"),r=n("rkoyttmq"),a=n("0wQfx7YJ"),o=n("OqsMdpSm"),c=n("xc00RsLr");const p=(0,c.ei)("core.PipelineConnections",(()=>i().createActions({list:{asyncResult:!0},connectToStream:{asyncResult:!0},connectToPipeline:{asyncResult:!0}}))),u=(0,c.dS)("core.PipelineConnections",(()=>i().createStore({listenables:[p],connections:void 0,getInitialState(){return{connections:this.connections}},list(){const e=(0,a.DC)(r.Z.ConnectionsController.list().url);(0,o.ZP)("GET",e).then((e=>{this.connections=e,this.trigger({connections:e})}),(e=>{l.Z.error(`Fetching pipeline connections failed with status: ${e.message}`,"Could not retrieve pipeline connections")}))},connectToStream(e){const t=(0,a.DC)(r.Z.ConnectionsController.to_stream().url),n={stream_id:e.stream,pipeline_ids:e.pipelines};(0,o.ZP)("POST",t,n).then((e=>{this.connections.filter((t=>t.stream_id===e.stream_id))[0]?this.connections=this.connections.map((t=>t.stream_id===e.stream_id?e:t)):this.connections.push(e),this.trigger({connections:this.connections}),l.Z.success("Pipeline connections updated successfully")}),this._failUpdateCallback)},connectToPipeline(e){const t=(0,a.DC)(r.Z.ConnectionsController.to_pipeline().url),n={pipeline_id:e.pipeline,stream_ids:e.streams};(0,o.ZP)("POST",t,n).then((e=>{e.forEach((e=>{this.connections.filter((t=>t.stream_id===e.stream_id))[0]?this.connections=this.connections.map((t=>t.stream_id===e.stream_id?e:t)):this.connections.push(e)})),this.trigger({connections:this.connections}),l.Z.success("Pipeline connections updated successfully")}),this._failUpdateCallback)},_failUpdateCallback(e){l.Z.error(`Updating pipeline connections failed with status: ${e.message}`,"Could not update pipeline connections")}})))},uaoWrOBD:(e,t,n)=>{n.d(t,{X:()=>h,o:()=>m});var s=n("JnTtTRmZ"),i=n.n(s),l=n("VPaD/Np4"),r=n.n(l),a=n("4af3+9mh"),o=n("0wQfx7YJ"),c=n("rkoyttmq"),p=n("OqsMdpSm"),u=n("4sldgQy6"),d=n("xc00RsLr");const m=(0,d.ei)("core.Pipelines",(()=>i().createActions({delete:{asyncResult:!0},list:{asyncResult:!0},listPaginated:{asyncResult:!0},get:{asyncResult:!0},save:{asyncResult:!0},update:{asyncResult:!0},parse:{asyncResult:!0}}))),g=e=>{a.Z.error(`Fetching pipelines failed with status: ${e.message}`,"Could not retrieve processing pipelines")},h=(0,d.dS)("core.Pipelines",(()=>i().createStore({listenables:[m],pipelines:void 0,getInitialState(){return{pipelines:this.pipelines}},_updatePipelinesState(e){if(this.pipelines){this.pipelines.some((t=>t.id===e.id))?this.pipelines=this.pipelines.map((t=>t.id===e.id?e:t)):this.pipelines.push(e)}else this.pipelines=[e];this.trigger({pipelines:this.pipelines})},list(){const e=(0,o.DC)(c.Z.PipelinesController.list().url);return(0,p.ZP)("GET",e).then((e=>{this.pipelines=e,this.trigger({pipelines:e})}),g)},listPaginated(e){let{page:t,perPage:n,query:s}=e;const i=(0,u.Z)(c.Z.PipelinesController.paginatedList().url,t,n,s),l=(0,p.ZP)("GET",(0,o.DC)(i)).then((e=>({list:r().List(e.pipelines),pagination:{page:e.page,perPage:e.per_page,query:e.query,count:e.count,total:e.total}})),g);return m.listPaginated.promise(l),l},get(e){const t=(0,o.DC)(c.Z.PipelinesController.get(e).url);(0,p.ZP)("GET",t).then(this._updatePipelinesState,(t=>{a.Z.error(`Fetching pipeline failed with status: ${t.message}`,`Could not retrieve processing pipeline "${e}"`)}))},save(e){const t=(0,o.DC)(c.Z.PipelinesController.create().url),n={title:e.title,description:e.description,source:e.source},s=(0,p.ZP)("POST",t,n);s.then((e=>{this._updatePipelinesState(e),a.Z.success(`Pipeline "${n.title}" created successfully`)}),(e=>{a.Z.error(`Saving pipeline failed with status: ${e.message}`,"Could not save processing pipeline")})),m.save.promise(s)},update(e){const t=(0,o.DC)(c.Z.PipelinesController.update(e.id).url),n={id:e.id,title:e.title,description:e.description,source:e.source},s=(0,p.ZP)("PUT",t,n);s.then((e=>{this._updatePipelinesState(e),a.Z.success(`Pipeline "${n.title}" updated successfully`)}),(e=>{a.Z.error(`Updating pipeline failed with status: ${e.message}`,"Could not update processing pipeline")})),m.update.promise(s)},delete(e){const t=(0,o.DC)(c.Z.PipelinesController.delete(e).url),n=(0,p.ZP)("DELETE",t).then((()=>{const t=this.pipelines||[];this.pipelines=t.filter((t=>t.id!==e)),this.trigger({pipelines:this.pipelines}),a.Z.success(`Pipeline "${e}" deleted successfully`)}),(t=>{a.Z.error(`Deleting pipeline failed with status: ${t.message}`,`Could not delete processing pipeline "${e}"`)}));return m.delete.promise(n),n},parse(e,t){const n=(0,o.DC)(c.Z.PipelinesController.parse().url),s={title:e.title,description:e.description,source:e.source};return(0,p.ZP)("POST",n,s).then((()=>{t([])}),(e=>{400===e.status&&t(e.additional.body)}))}})))},"0I+u03RB":(e,t,n)=>{n.d(t,{G:()=>m,W:()=>d});var s=n("JnTtTRmZ"),i=n.n(s),l=n("6n4dw8v3"),r=n("4af3+9mh"),a=n("0wQfx7YJ"),o=n("4sldgQy6"),c=n("rkoyttmq"),p=n("OqsMdpSm"),u=n("xc00RsLr");const d=(0,u.ei)("core.Rules",(()=>i().createActions({delete:{asyncResult:!0},list:{asyncResult:!0},get:{asyncResult:!0},save:{asyncResult:!0},update:{asyncResult:!0},parse:{asyncResult:!0},multiple:{asyncResult:!0},loadFunctions:{asyncResult:!0},loadMetricsConfig:{asyncResult:!0},updateMetricsConfig:{asyncResult:!0},listPaginated:{asyncResult:!0}}))),m=(0,u.dS)("core.Rules",(()=>i().createStore({listenables:[d],rules:void 0,rulesContext:void 0,functionDescriptors:void 0,metricsConfig:void 0,getInitialState(){return{rules:this.rules,rulesContext:this.rulesContext,functionDescriptors:this.functionDescriptors,metricsConfig:this.metricsConfig}},_updateRulesState(e){if(this.rules){this.rules.some((t=>t.id===e.id))?this.rules=this.rules.map((t=>t.id===e.id?e:t)):this.rules.push(e)}else this.rules=[e];this.trigger({rules:this.rules,functionDescriptors:this.functionDescriptors})},_updateFunctionDescriptors(e){e&&(this.functionDescriptors=e.sort(((e,t)=>(0,l.S)(e.name,t.name)))),this.trigger({rules:this.rules,functionDescriptors:this.functionDescriptors})},list(){const e=(0,a.DC)(c.Z.RulesController.list().url);return(0,p.ZP)("GET",e).then((e=>{this.rules=e,this.trigger({rules:e,functionDescriptors:this.functionDescriptors})}),(e=>{r.Z.error(`Fetching rules failed with status: ${e.message}`,"Could not retrieve processing rules")}))},listPaginated(e){let{page:t,perPage:n,query:s}=e;const i=(0,o.Z)(c.Z.RulesController.paginatedList().url,t,n,s),l=(0,p.ZP)("GET",(0,a.DC)(i)).then((e=>({list:e.rules,context:e.context,pagination:{count:e.count,total:e.total,page:e.page,perPage:e.per_page,query:e.query}})),(e=>{e.additional&&404===e.additional.status||r.Z.error(`Loading rules list failed with status: ${e}`,"Could not load rules.")}));return d.listPaginated.promise(l),l},get(e){const t=(0,a.DC)(c.Z.RulesController.get(e).url),n=(0,p.ZP)("GET",t);return n.then(this._updateRulesState,(t=>{r.Z.error(`Fetching rule "${e}" failed with status: ${t.message}`,`Could not retrieve processing rule "${e}"`)})),d.get.promise(n),n},save(e){const t=(0,a.DC)(c.Z.RulesController.create().url),n={title:e.title,description:e.description,source:e.source},s=(0,p.ZP)("POST",t,n);return s.then((e=>(this._updateRulesState(e),r.Z.success(`Rule "${e.title}" created successfully`),e)),(t=>{r.Z.error(`Saving rule "${e.title}" failed with status: ${t.message}`,`Could not save processing rule "${e.title}"`)})),d.save.promise(s),s},update(e){const t=(0,a.DC)(c.Z.RulesController.update(e.id).url),n={id:e.id,title:e.title,description:e.description,source:e.source},s=(0,p.ZP)("PUT",t,n);return s.then((e=>(this._updateRulesState(e),r.Z.success(`Rule "${e.title}" updated successfully`),e)),(t=>{r.Z.error(`Updating rule "${e.title}" failed with status: ${t.message}`,`Could not update processing rule "${e.title}"`)})),d.update.promise(s),s},delete(e){const t=(0,a.DC)(c.Z.RulesController.delete(e.id).url),n=(0,p.ZP)("DELETE",t).then((()=>{this.rules=this.rules.filter((t=>t.id!==e.id)),this.trigger({rules:this.rules,functionDescriptors:this.functionDescriptors}),r.Z.success(`Rule "${e.title}" was deleted successfully`)}),(t=>{r.Z.error(`Deleting rule "${e.title}" failed with status: ${t.message}`,`Could not delete processing rule "${e.title}"`)}));return d.delete.promise(n),n},parse(e,t){const n=(0,a.DC)(c.Z.RulesController.parse().url),s={title:e.title,description:e.description,source:e.source};return(0,p.ZP)("POST",n,s).then((e=>(t([]),e)),(e=>{400===e.status&&t(e.additional.body)}))},multiple(e,t){const n=(0,a.DC)(c.Z.RulesController.multiple().url),s=(0,p.ZP)("POST",n,{rules:e});return s.then(t),s},loadFunctions(){if(this.functionDescriptors)return;const e=(0,a.DC)(c.Z.RulesController.functions().url);return(0,p.ZP)("GET",e).then(this._updateFunctionDescriptors)},loadMetricsConfig(){const e=(0,a.DC)(c.Z.RulesController.metricsConfig().url),t=(0,p.ZP)("GET",e);t.then((e=>{this.metricsConfig=e,this.trigger({rules:this.rules,functionDescriptors:this.functionDescriptors,metricsConfig:this.metricsConfig})}),(e=>{r.Z.error(`Couldn't load rule metrics config: ${e.message}`,"Couldn't load rule metrics config")})),d.loadMetricsConfig.promise(t)},updateMetricsConfig(e){const t=(0,a.DC)(c.Z.RulesController.metricsConfig().url),n=(0,p.ZP)("PUT",t,e);n.then((e=>{this.metricsConfig=e,this.trigger({rules:this.rules,functionDescriptors:this.functionDescriptors,metricsConfig:this.metricsConfig}),r.Z.success("Successfully updated rule metrics config")}),(e=>{r.Z.error(`Couldn't update rule metrics config: ${e.message}`,"Couldn't update rule metrics config")})),d.updateMetricsConfig.promise(n)}})))}}]);
//# sourceMappingURL=325e2d4b-9138.0712dacfc5a329cc54ea.js.map




© 2015 - 2024 Weber Informatics LLC | Privacy Policy