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

web-interface.assets.1255d548-2032.eaea4d7ded536fdf945d.js Maven / Gradle / Ivy

There is a newer version: 6.1.4
Show newest version
"use strict";(()=>{(self.webpackChunkgraylog_web_interface=self.webpackChunkgraylog_web_interface||[]).push([["1255d548-2032"],{SfPIQIJE:(W,U,t)=>{t.d(U,{Z:()=>f});var L=t("Z7aTuO5B"),c=t("J6y4/h8P"),e=t("uZqmR+ju"),C=t("ty2gyrHp"),m=t("/GOzvPf6"),D=t("NV1/EHMi");const E=(0,c.default)(e.ButtonToolbar)`
  margin-bottom: 10px;
`,l=(0,c.default)(e.Button)(({theme:g})=>(0,c.css)`
  font-family: ${g.fonts.family.navigation};
  font-size: ${g.fonts.size.navigation};

  &&&& {
    color: ${g.colors.variant.darker.default};
    
    &:hover,
    &:focus {
      text-decoration: none;
    }

    > div {
      &:hover,
      &:focus {
        color: ${g.colors.variant.darker.default};
      }
    }

    &:hover {
      ${(0,D.RF)(g)}
    }

    &.active {
      color: ${g.colors.global.textDefault};

      ${(0,D.A7)(g)}

      &:hover,
      &:focus {
        ${(0,D.A7)(g)}
      }
    }
  }
`);l.displayName="Button";const f=({items:g})=>L.createElement(E,null,g.map(({path:i,title:a,permissions:s,exactPathMatch:r})=>i?L.createElement(m.AE,{permissions:s!=null?s:[],key:i},L.createElement(C.J,{to:i,relativeActive:!r},L.createElement(l,{bsStyle:"link"},L.createElement(D.ZP,null,a)))):null))},"1f+2RmbX":(W,U,t)=>{t.d(U,{Z:()=>D});var L=t("ii0bleBb"),c=t.n(L),e=t("Z7aTuO5B"),C=t("4E3oowBb");const m=({pipeline:E,connections:l,streams:M,streamsFormatter:f,noConnectionsMessage:g})=>{const i=l.filter(a=>a.pipeline_ids&&a.pipeline_ids.includes(E.id)).filter(a=>M.some(s=>s.id===a.stream_id)).map(a=>M.find(s=>s.id===a.stream_id)).sort((a,s)=>(0,C.S)(a.title,s.title));return e.createElement("span",null,i.length===0?g:f(i))};m.propTypes={pipeline:c().object.isRequired,connections:c().array.isRequired,streams:c().array.isRequired,streamsFormatter:c().func.isRequired,noConnectionsMessage:c().node},m.defaultProps={noConnectionsMessage:"Pipeline not connected to any streams"};const D=m},ZspbpBGx:(W,U,t)=>{t.d(U,{Z:()=>E});var L=t("Z7aTuO5B"),c=t("SfPIQIJE"),e=t("d4kzUuQm"),C=t("uZqmR+ju");const m=[{title:"Manage pipelines",path:e.ZP.SYSTEM.PIPELINES.OVERVIEW,exactPathMatch:!0},{title:"Manage rules",path:e.ZP.SYSTEM.PIPELINES.RULES},{title:"Simulator",path:e.ZP.SYSTEM.PIPELINES.SIMULATOR}],E=()=>L.createElement(C.Row,null,L.createElement(c.Z,{items:m}))},Y4ZJYI0O:(W,U,t)=>{t.r(U),t.d(U,{default:()=>Oe});var L=t("ii0bleBb"),c=t.n(L),e=t("Z7aTuO5B"),C=t("D4SbLiE/"),m=t.n(C),D=t("JnTtTRmZ"),E=t.n(D),l=t("uZqmR+ju"),M=t("/GOzvPf6"),f=t("J6y4/h8P"),g=t("nKnTKuph"),i=t("8fnsnG21"),a=t("sRNsEgBM"),s=t("0TVxnHwi"),r=t("q2j1bVbz"),u=t("ty2gyrHp"),p=t("S6FuRS7B"),T=t("zkmy/ViL"),Z=t("d4kzUuQm");const G=({pipeline:n,stage:o,create:d,save:h})=>{const y=(0,r.Z)(),[A,O]=(0,e.useState)(!1),S=(0,e.useMemo)(()=>d?Math.max(...n.stages.map($=>$.stage))+1:o.stage,[d,n.stages,o.stage]),[R,b]=(0,e.useState)({...o,stage:S}),{rules:x}=(0,i.o)(a.G),K=()=>{O(!0)},N=({target:$})=>{b(F=>({...F,[$.name]:(0,p.n6)($)}))},v=$=>{b(F=>({...F,rules:$}))},P=()=>{O(!1)},I=()=>{P()},_=(0,e.useMemo)(()=>R.stage!==S&&n.stages.some(({stage:$})=>$===R.stage),[R.stage,S,n.stages]),B=()=>{_||h(R,I)},w=({title:$})=>({value:$,label:$}),Ze=($,F)=>!F.includes($.title),Ae=(0,e.useCallback)(()=>{const $=R.rules;return x?x.filter(F=>Ze(F,$)).map(w):[]},[R.rules,x]),Le=e.createElement("span",null,"Select the rules evaluated on this stage, or create one in the"," ",e.createElement(u.r,{to:Z.ZP.SYSTEM.PIPELINES.RULES},"Pipeline Rules page"),".");return e.createElement("span",null,e.createElement(l.Button,{disabled:!(0,s.rq)(y.permissions,"pipeline:edit"),onClick:K,bsStyle:d?"success":"info"},d?"Add new stage":"Edit"),e.createElement(l.BootstrapModalForm,{show:A,title:`${d?"Add new":"Edit"} stage ${R.stage}`,"data-telemetry-title":`${d?"Add new":"Edit"} stage`,onSubmitForm:B,onCancel:P,submitButtonText:d?"Add stage":"Update stage"},e.createElement("fieldset",null,e.createElement(l.Input,{type:"number",id:"stage",name:"stage",label:"Stage",autoFocus:!0,min:T.Z.JAVA_INTEGER_MIN_VALUE+1,max:T.Z.JAVA_INTEGER_MAX_VALUE,onChange:N,bsStyle:_?"error":null,help:_?"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:R.stage}),e.createElement(l.FormGroup,null,e.createElement(l.ControlLabel,null,"Continue processing on next stage when")),e.createElement(l.Input,{type:"radio",id:"match_all",name:"match",value:"ALL",label:"All rules on this stage match the message",onChange:N,checked:R.match==="ALL"}),e.createElement(l.Input,{type:"radio",id:"match_any",name:"match",value:"EITHER",label:"At least one of the rules on this stage matches the message",onChange:N,checked:R.match==="EITHER"}),e.createElement(l.Input,{type:"radio",id:"match_pass",name:"match",value:"PASS",label:"None or more rules on this stage match",onChange:N,checked:R.match==="PASS"}),e.createElement(l.Input,{id:"stage-rules-select",label:"Stage rules",help:Le},e.createElement(M.eR,{options:Ae(),isLoading:!x,onChange:v,selectedOptions:R.rules})))))};G.propTypes={pipeline:c().object.isRequired,stage:c().object,create:c().bool,save:c().func.isRequired},G.defaultProps={create:!1,stage:{stage:0,match:"EITHER",rules:[]}};const X=G,ce=f.default.td`
  width: 400px;
`,Y=({pipeline:n,stage:o,rules:d})=>{const h=["Title","Description","Throughput","Errors"],y=(A,O)=>{let S=A,R;if(!S)S={id:`invalid-${O}`,description:`Rule ${o.rules[O]} has been renamed or removed. This rule will be skipped.`},R=e.createElement("span",null,e.createElement(M.JO,{name:"exclamation-triangle",className:"text-danger"})," ",o.rules[O]);else{const b=S.rule_builder?"?rule_builder=true":"";R=e.createElement(u.r,{to:`${Z.ZP.SYSTEM.PIPELINES.RULE(S.id)}${b}`},S.title)}return e.createElement("tr",{key:S.id},e.createElement(ce,null,R),e.createElement("td",null,S.description),e.createElement("td",null,e.createElement(g.CL,{name:`org.graylog.plugins.pipelineprocessor.ast.Rule.${S.id}.${n.id}.${o.stage}.executed`},e.createElement(g.qb,{zeroOnMissing:!0,suffix:"msg/s"}))),e.createElement("td",null,e.createElement(g.CL,{name:`org.graylog.plugins.pipelineprocessor.ast.Rule.${S.id}.${n.id}.${o.stage}.failed`},e.createElement(g.qb,{showTotal:!0,zeroOnMissing:!0,suffix:"errors/s"}))))};return e.createElement(M.wQ,{id:"processing-timeline",className:"table-hover",headers:h,headerCellFormatter:A=>e.createElement("th",null,A),rows:d,dataRowFormatter:y,noDataText:"This stage has no rules yet. Click on edit to add some.",filterLabel:"",filterKeys:[]})};Y.propTypes={pipeline:c().object.isRequired,stage:c().object.isRequired,rules:c().array},Y.defaultProps={rules:[]};const ue=Y,z=({stage:n,pipeline:o,isLastStage:d,onUpdate:h,onDelete:y})=>{const A=(0,r.Z)(),{rules:O}=(0,i.o)(a.G),S=`Contains ${n.rules.length===1?"1 rule":`${n.rules.length} rules`}`,R=e.createElement(g.CL,{name:`org.graylog.plugins.pipelineprocessor.ast.Pipeline.${o.id}.stage.${n.stage}.executed`},e.createElement(g.qb,{showTotal:!1,prefix:"Throughput: ",suffix:"msg/s"})),b=[e.createElement(l.Button,{disabled:!(0,s.rq)(A.permissions,"pipeline:edit"),key:`delete-stage-${n}`,bsStyle:"danger",onClick:y},"Delete"),e.createElement(X,{key:`edit-stage-${n}`,pipeline:o,stage:n,save:h})];let x;if(d)x="There are no further stages in this pipeline. Once rules in this stage are applied, the pipeline will have finished processing.";else{let v;switch(n.match){case"ALL":v="all rules";break;case"EITHER":v="at least one rule";break;case"PASS":v="none or more rules";break;default:v="UNKNOWN";break}x=e.createElement("span",null,"Messages satisfying ",e.createElement("strong",null,v)," ","in this stage, will continue to the next stage.")}const K=e.createElement("span",null,x,e.createElement("br",null),R),N=O?e.createElement(ue,{pipeline:o,stage:n,rules:n.rules.map(v=>O.filter(P=>P.title===v)[0])}):e.createElement(M.$j,null);return e.createElement(M.S6,{title:`Stage ${n.stage}`,titleSuffix:S,actions:b,description:K,contentRow:e.createElement(l.Col,{md:12},N)})};z.propTypes={stage:c().object.isRequired,pipeline:c().object.isRequired,isLastStage:c().bool.isRequired,onUpdate:c().func.isRequired,onDelete:c().func.isRequired};const de=z;var pe=t("IW7priiX"),Q=t.n(pe),me=t("gTexEe+8");const J=({pipeline:n,create:o,modal:d,save:h,onCancel:y})=>{const A=(0,r.Z)(),[O,S]=(0,e.useState)(Q()(n)),[R,b]=(0,e.useState)(!1),x=()=>{b(!0)},K=({target:_})=>{S(B=>({...B,[_.name]:(0,p.n6)(_)}))},N=()=>{b(!1)},v=()=>{N(),o&&S(Q()(n))},P=_=>{_&&_.preventDefault(),h(O,v)},I=e.createElement("fieldset",null,e.createElement(l.Input,{type:"text",id:"title",name:"title",label:"Title",autoFocus:!0,required:!0,onChange:K,help:"Pipeline name.",value:O.title}),e.createElement(l.Input,{type:"text",id:"description",name:"description",label:"Description",onChange:K,help:"Pipeline description.",value:O.description}));return d?e.createElement("span",null,e.createElement(l.Button,{disabled:!(0,s.rq)(A.permissions,"pipeline:edit"),onClick:x,bsStyle:"success"},o?"Add new pipeline":"Edit pipeline details"),e.createElement(me.Z,{show:R,title:`${o?"Add new":"Edit"} pipeline ${O.title}`,"data-telemetry-title":`${o?"Add new":"Edit"} pipeline`,onSubmitForm:P,onCancel:N,submitButtonText:o?"Add pipeline":"Update pipeline"},I)):e.createElement("form",{onSubmit:P},I,e.createElement(l.Row,null,e.createElement(l.Col,{md:12},e.createElement(M.Ow,{submitButtonText:o?"Create pipeline":"Update pipeline",onCancel:y}))))};J.propTypes={pipeline:c().object,create:c().bool,modal:c().bool,save:c().func.isRequired,onCancel:c().func},J.defaultProps={modal:!0,create:!1,pipeline:{id:void 0,title:"",description:"",stages:[{stage:0,rules:[]}]},onCancel:()=>{}};const k=J,ge=f.default.dl`
  & {
    margin-bottom: 0;
    margin-top: 10px;
  }

  & > dt {
    text-align: left;
    width: 160px;
  }

  & > dt::after {
    content: ':';
  }

  & > dd {
    margin-left: 120px;
  }
`,H=({pipeline:n,create:o,onChange:d,onCancel:h})=>o?e.createElement(k,{create:!0,save:d,onCancel:h,modal:!1}):e.createElement("div",null,e.createElement(l.Row,null,e.createElement(l.Col,{md:12},e.createElement("div",{className:"pull-right"},e.createElement(k,{pipeline:n,save:d})),e.createElement("h2",null,"Details"),e.createElement(ge,{className:"dl-horizontal"},e.createElement("dt",null,"Title"),e.createElement("dd",null,n.title),e.createElement("dt",null,"Description"),e.createElement("dd",null,n.description),e.createElement("dt",null,"Created"),e.createElement("dd",null,e.createElement(M.ij,{dateTime:n.created_at})),e.createElement("dt",null,"Last modified"),e.createElement("dd",null,e.createElement(M.ij,{dateTime:n.modified_at})),e.createElement("dt",null,"Current throughput"),e.createElement("dd",null,e.createElement(g.CL,{name:`org.graylog.plugins.pipelineprocessor.ast.Pipeline.${n.id}.executed`},e.createElement(g.qb,{suffix:"msg/s"})))))),e.createElement("hr",null));H.propTypes={pipeline:c().object,create:c().bool,onChange:c().func.isRequired,onCancel:c().func},H.defaultProps={pipeline:void 0,create:!1,onCancel:()=>{}};const q=H;var ee=t("4E3oowBb");const te=n=>n.map(o=>({value:o.id,label:o.title})).sort((o,d)=>(0,ee.S)(o.label,d.label)),se=({pipeline:n,connections:o,streams:d,save:h})=>{const y=(0,r.Z)(),[A,O]=(0,e.useState)(!1),S=(0,e.useMemo)(()=>o.filter(_=>_.pipeline_ids&&_.pipeline_ids.includes(n.id)).filter(_=>d.some(B=>B.id===_.stream_id)).map(_=>d.find(B=>B.id===_.stream_id)),[n,o,d]),[R,b]=(0,e.useState)(te(S)),x=(0,e.useMemo)(()=>d.filter(_=>!R.some(B=>B.value.toLowerCase()===_.id.toLowerCase())),[d,R]),K=()=>{O(!0)},N=_=>{b(_.sort((B,w)=>(0,ee.S)(B.label,w.label)))},v=()=>{O(!1)},P=()=>{const _=R.map(w=>w.value),B={pipeline:n.id,streams:_};h(B,v)},I=e.createElement("span",null,"Select the streams you want to connect to this pipeline, or create one in the"," ",e.createElement(u.r,{to:Z.ZP.STREAMS},"Streams page"),".");return e.createElement("span",null,e.createElement(l.Button,{disabled:!(0,s.rq)(y.permissions,"pipeline_connection:edit"),onClick:K,bsStyle:"info"},e.createElement("span",null,"Edit connections")),e.createElement(l.BootstrapModalForm,{show:A,title:e.createElement("span",null,"Edit connections for ",e.createElement("em",null,n.title)),"data-telemetry-title":"Edit connections for pipeline",onSubmitForm:P,onCancel:v,submitButtonText:"Update connections"},e.createElement("fieldset",null,e.createElement(l.FormGroup,{id:"streamsConnections"},e.createElement(l.ControlLabel,null,"Streams"),e.createElement(M.eR,{options:te(x),onChange:N,selectedOptionsType:"object",selectedOptions:R}),e.createElement(l.HelpBlock,null,I)))))};se.propTypes={pipeline:c().object.isRequired,connections:c().array.isRequired,streams:c().array.isRequired,save:c().func.isRequired};const Ee=se;var he=t("1f+2RmbX");const fe=(0,f.default)(l.Alert)`
  margin-bottom: 13px;
`,ne=(0,f.default)(l.Row)`
  margin-top: 10px;
`,ie=f.default.p`
  margin-top: 5px;
`,le=({pipeline:n,connections:o,streams:d,onConnectionsChange:h,onStagesChange:y,onPipelineChange:A})=>{const O=()=>o.length===0?e.createElement(fe,{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,S=(v,P)=>{const I=n.stages.slice();I.push(v),y(I,P)},R=(0,e.useCallback)(v=>(P,I)=>{const _=n.stages.filter(B=>B.stage!==v.stage);_.push(P),y(_,I)},[n,y]),b=(0,e.useCallback)(v=>()=>{if(window.confirm(`You are about to delete stage ${v.stage}, are you sure you want to proceed?`)){const P=n.stages.filter(I=>I.stage!==v.stage);y(P)}},[n,y]),x=v=>{const P=v.map(_=>`"${_.title}"`),I=P.length>1?[P.slice(0,-1).join(", "),P.slice(-1)].join(" and "):P[0];return e.createElement("span",null,"This pipeline is processing messages from the"," ",e.createElement(M.qX,{singular:"stream",plural:"streams",value:P.length})," ",I,".")},K=(0,e.useMemo)(()=>{const v=n.stages.reduce((P,I)=>Math.max(P,I.stage),-1/0);return n.stages.sort((P,I)=>P.stage-I.stage).map(P=>e.createElement(de,{key:`stage-${P.stage}`,pipeline:n,stage:P,isLastStage:P.stage===v,onUpdate:R(P),onDelete:b(P)}))},[n,R,b]),N=(0,e.useMemo)(()=>n.stages.map(v=>v.stage).join("-"),[n.stages]);return e.createElement("div",null,O(),e.createElement(q,{pipeline:n,onChange:A}),e.createElement(ne,{className:"row-sm"},e.createElement(l.Col,{md:12},e.createElement("div",{className:"pull-right"},e.createElement(Ee,{pipeline:n,connections:o,streams:d,save:h})),e.createElement("h2",null,"Pipeline connections"),e.createElement(ie,null,e.createElement(he.Z,{pipeline:n,connections:o,streams:d,streamsFormatter:x,noConnectionsMessage:"Select streams that will be processed by this pipeline."})),e.createElement("hr",null))),e.createElement(ne,{className:"row-sm"},e.createElement(l.Col,{md:12},e.createElement("div",{className:"pull-right"},e.createElement(X,{key:N,pipeline:n,create:!0,save:S})),e.createElement("h2",null,"Pipeline Stages"),e.createElement(ie,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."))),e.createElement(M.XO,{bsNoItemsStyle:"info",noItemsText:"There are no rules on this stage.",items:K}))};le.propTypes={pipeline:c().object.isRequired,connections:c().array.isRequired,streams:c().array.isRequired,onConnectionsChange:c().func.isRequired,onStagesChange:c().func.isRequired,onPipelineChange:c().func.isRequired};const Pe=le;var Ce=t("/7OuCFNo");const oe=({onChange:n})=>{const o=(0,Ce.Z)(),d=A=>{o.push(Z.ZP.SYSTEM.PIPELINES.PIPELINE(A.id))},h=()=>{o.goBack()},y=A=>{n(A,d)};return e.createElement(l.Row,null,e.createElement(l.Col,{md:6},e.createElement("p",null,"Give a name and description to the new pipeline. You can add stages to it when you save the changes."),e.createElement(q,{create:!0,onChange:y,onCancel:h})))};oe.propTypes={onChange:c().func.isRequired};const Re=oe,ae={generatePipeline(n){let o=`pipeline "${n.title}"
`;return n.stages.forEach(d=>{var h;o+=`stage ${d.stage} match ${((h=d.match)==null?void 0:h.toLowerCase())||"either"}
`,d.rules.forEach(y=>{o+=`rule "${y}"
`})}),o+="end",o}};var re=t("QdZ7Yq43"),ve=t("c9JM82dZ"),_e=t("pUKP3+Pg"),V=t("3ndo/hra"),j=t("RU4i+ZYB"),De=t("E+CaPsQD"),Me=t("ZspbpBGx");function Te(n){return n.pipelines?n.pipelines.filter(o=>o.id===this.props.params.pipelineId)[0]:void 0}function Se(n){if(n.connections)return n.connections.filter(o=>o.pipeline_ids&&o.pipeline_ids.includes(this.props.params.pipelineId))}const ye=m()({displayName:"PipelineDetailsPage",propTypes:{params:c().object.isRequired},mixins:[E().connectFilter(j.X,"pipeline",Te),E().connectFilter(V.V,"connections",Se)],componentDidMount(){const{params:n}=this.props;this._isNewPipeline(n.pipelineId)||j.o.get(n.pipelineId),a.G.list(),V.q.list(),_e.sH.listStreams().then(o=>{const d=o.filter(h=>h.is_editable);this.setState({streams:d})})},UNSAFE_componentWillReceiveProps(n){this._isNewPipeline(n.params.pipelineId)||j.o.get(n.params.pipelineId)},_onConnectionsChange(n,o){V.q.connectToPipeline(n),o()},_onStagesChange(n,o){const{pipeline:d}=this.state,h=re.Z.clone(d);h.stages=n,h.source=ae.generatePipeline(h),j.o.update(h),typeof o=="function"&&o()},_savePipeline(n,o){const d=re.Z.clone(n);d.source=ae.generatePipeline(n);let h;d.id?h=j.o.update(d):h=j.o.save(d),h.then(y=>o(y))},_isNewPipeline(n){return n==="new"},_isLoading(){const{params:n}=this.props,{connections:o,streams:d,pipeline:h}=this.state;return!this._isNewPipeline(n.pipelineId)&&(!h||!o||!d)},render(){if(this._isLoading())return e.createElement(M.$j,null);const{params:n}=this.props,{connections:o,streams:d,pipeline:h,rules:y}=this.state;let A;this._isNewPipeline(n.pipelineId)?A="New pipeline":A=e.createElement("span",null,"Pipeline ",e.createElement("em",null,h.title));let O;this._isNewPipeline(n.pipelineId)?O=e.createElement(Re,{onChange:this._savePipeline}):O=e.createElement(Pe,{pipeline:h,connections:o,streams:d,rules:y,onConnectionsChange:this._onConnectionsChange,onStagesChange:this._onStagesChange,onPipelineChange:this._savePipeline});const S=this._isNewPipeline(n.pipelineId)?"New pipeline":`Pipeline ${h.title}`;return e.createElement(M.$4,{title:S},e.createElement("div",null,e.createElement(Me.Z,null),e.createElement(M.mr,{title:A,documentationLink:{title:"Pipelines documentation",path:De.Z.PAGES.PIPELINES}},e.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.",e.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.")),e.createElement(l.Row,{className:"content"},e.createElement(l.Col,{md:12},O))))}}),Oe=(0,ve.Z)(ye)},c9JM82dZ:(W,U,t)=>{t.d(U,{Z:()=>C});var L=t("Z7aTuO5B"),c=t("yAXMqwrl");const C=m=>D=>{const E=(0,c.useParams)();return L.createElement(m,{...D,params:E})}},"3ndo/hra":(W,U,t)=>{t.d(U,{V:()=>M,q:()=>l});var L=t("JnTtTRmZ"),c=t.n(L),e=t("jAGDuYSC"),C=t("U1Iufsob"),m=t("MdYBRjRJ"),D=t("eFxcQyPT"),E=t("IA3Ku5lS");const l=(0,E.ei)("core.PipelineConnections",()=>c().createActions({list:{asyncResult:!0},connectToStream:{asyncResult:!0},connectToPipeline:{asyncResult:!0}})),M=(0,E.dS)("core.PipelineConnections",()=>c().createStore({listenables:[l],connections:void 0,getInitialState(){return{connections:this.connections}},list(){const f=a=>{e.Z.error(`Fetching pipeline connections failed with status: ${a.message}`,"Could not retrieve pipeline connections")},g=(0,m.DC)(C.Z.ConnectionsController.list().url);(0,D.ZP)("GET",g).then(a=>{this.connections=a,this.trigger({connections:a})},f)},connectToStream(f){const g=(0,m.DC)(C.Z.ConnectionsController.to_stream().url),i={stream_id:f.stream,pipeline_ids:f.pipelines};(0,D.ZP)("POST",g,i).then(s=>{this.connections.filter(r=>r.stream_id===s.stream_id)[0]?this.connections=this.connections.map(r=>r.stream_id===s.stream_id?s:r):this.connections.push(s),this.trigger({connections:this.connections}),e.Z.success("Pipeline connections updated successfully")},this._failUpdateCallback)},connectToPipeline(f){const g=(0,m.DC)(C.Z.ConnectionsController.to_pipeline().url),i={pipeline_id:f.pipeline,stream_ids:f.streams};(0,D.ZP)("POST",g,i).then(s=>{s.forEach(r=>{this.connections.filter(u=>u.stream_id===r.stream_id)[0]?this.connections=this.connections.map(u=>u.stream_id===r.stream_id?r:u):this.connections.push(r)}),this.trigger({connections:this.connections}),e.Z.success("Pipeline connections updated successfully")},this._failUpdateCallback)},_failUpdateCallback(f){e.Z.error(`Updating pipeline connections failed with status: ${f.message}`,"Could not update pipeline connections")}}))},"RU4i+ZYB":(W,U,t)=>{t.d(U,{X:()=>a,o:()=>g});var L=t("JnTtTRmZ"),c=t.n(L),e=t("VPaD/Np4"),C=t.n(e),m=t("jAGDuYSC"),D=t("MdYBRjRJ"),E=t("U1Iufsob"),l=t("eFxcQyPT"),M=t("gyRmhZSW"),f=t("IA3Ku5lS");const g=(0,f.ei)("core.Pipelines",()=>c().createActions({delete:{asyncResult:!0},list:{asyncResult:!0},listPaginated:{asyncResult:!0},get:{asyncResult:!0},save:{asyncResult:!0},update:{asyncResult:!0},parse:{asyncResult:!0}})),i=s=>{m.Z.error(`Fetching pipelines failed with status: ${s.message}`,"Could not retrieve processing pipelines")},a=(0,f.dS)("core.Pipelines",()=>c().createStore({listenables:[g],pipelines:void 0,getInitialState(){return{pipelines:this.pipelines}},_updatePipelinesState(s){this.pipelines?this.pipelines.some(u=>u.id===s.id)?this.pipelines=this.pipelines.map(u=>u.id===s.id?s:u):this.pipelines.push(s):this.pipelines=[s],this.trigger({pipelines:this.pipelines})},list(){const s=(0,D.DC)(E.Z.PipelinesController.list().url);return(0,l.ZP)("GET",s).then(r=>{this.pipelines=r,this.trigger({pipelines:r})},i)},listPaginated({page:s,perPage:r,query:u}){const p=(0,M.Z)(E.Z.PipelinesController.paginatedList().url,s,r,u),T=(0,l.ZP)("GET",(0,D.DC)(p)).then(Z=>({list:C().List(Z.pipelines),pagination:{page:Z.page,perPage:Z.per_page,query:Z.query,count:Z.count,total:Z.total}}));return T.catch(i),g.listPaginated.promise(T),T},get(s){const r=T=>{m.Z.error(`Fetching pipeline failed with status: ${T.message}`,`Could not retrieve processing pipeline "${s}"`)},u=(0,D.DC)(E.Z.PipelinesController.get(s).url);(0,l.ZP)("GET",u).then(this._updatePipelinesState,r)},save(s){const r=Z=>{m.Z.error(`Saving pipeline failed with status: ${Z.message}`,"Could not save processing pipeline")},u=(0,D.DC)(E.Z.PipelinesController.create().url),p={title:s.title,description:s.description,source:s.source},T=(0,l.ZP)("POST",u,p);T.then(Z=>{this._updatePipelinesState(Z),m.Z.success(`Pipeline "${p.title}" created successfully`)},r),g.save.promise(T)},update(s){const r=Z=>{m.Z.error(`Updating pipeline failed with status: ${Z.message}`,"Could not update processing pipeline")},u=(0,D.DC)(E.Z.PipelinesController.update(s.id).url),p={id:s.id,title:s.title,description:s.description,source:s.source},T=(0,l.ZP)("PUT",u,p);T.then(Z=>{this._updatePipelinesState(Z),m.Z.success(`Pipeline "${p.title}" updated successfully`)},r),g.update.promise(T)},delete(s){const r=T=>{m.Z.error(`Deleting pipeline failed with status: ${T.message}`,`Could not delete processing pipeline "${s}"`)},u=(0,D.DC)(E.Z.PipelinesController.delete(s).url),p=(0,l.ZP)("DELETE",u).then(()=>{const T=this.pipelines||[];this.pipelines=T.filter(Z=>Z.id!==s),this.trigger({pipelines:this.pipelines}),m.Z.success(`Pipeline "${s}" deleted successfully`)},r);return g.delete.promise(p),p},parse(s,r){const u=(0,D.DC)(E.Z.PipelinesController.parse().url),p={title:s.title,description:s.description,source:s.source};return(0,l.ZP)("POST",u,p).then(()=>{r([])},T=>{T.status===400&&r(T.additional.body)})}}))},sRNsEgBM:(W,U,t)=>{t.d(U,{G:()=>g,W:()=>f});var L=t("JnTtTRmZ"),c=t.n(L),e=t("4E3oowBb"),C=t("jAGDuYSC"),m=t("MdYBRjRJ"),D=t("gyRmhZSW"),E=t("U1Iufsob"),l=t("eFxcQyPT"),M=t("IA3Ku5lS");const f=(0,M.ei)("core.Rules",()=>c().createActions({delete:{asyncResult:!0},list:{asyncResult:!0},get:{asyncResult:!0},save:{asyncResult:!0},update:{asyncResult:!0},parse:{asyncResult:!0},simulate:{asyncResult:!0},multiple:{asyncResult:!0},loadFunctions:{asyncResult:!0},loadMetricsConfig:{asyncResult:!0},updateMetricsConfig:{asyncResult:!0},listPaginated:{asyncResult:!0}})),g=(0,M.dS)("core.Rules",()=>c().createStore({listenables:[f],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(i){this.rules?this.rules.some(s=>s.id===i.id)?this.rules=this.rules.map(s=>s.id===i.id?i:s):this.rules.push(i):this.rules=[i],this.trigger({rules:this.rules,functionDescriptors:this.functionDescriptors})},_updateFunctionDescriptors(i){i&&(this.functionDescriptors=i.sort((a,s)=>(0,e.S)(a.name,s.name))),this.trigger({rules:this.rules,functionDescriptors:this.functionDescriptors})},list(){const i=s=>{C.Z.error(`Fetching rules failed with status: ${s.message}`,"Could not retrieve processing rules")},a=(0,m.DC)(E.Z.RulesController.list().url);return(0,l.ZP)("GET",a).then(s=>{this.rules=s,this.trigger({rules:s,functionDescriptors:this.functionDescriptors})},i)},listPaginated({page:i,perPage:a,query:s}){const r=(0,D.Z)(E.Z.RulesController.paginatedList().url,i,a,s),u=(0,l.ZP)("GET",(0,m.DC)(r)).then(p=>({list:p.rules,context:p.context,pagination:{count:p.count,total:p.total,page:p.page,perPage:p.per_page,query:p.query}}));return u.catch(p=>{(!p.additional||p.additional.status!==404)&&C.Z.error(`Loading rules list failed with status: ${p}`,"Could not load rules.")}),f.listPaginated.promise(u),u},get(i){const a=u=>{C.Z.error(`Fetching rule "${i}" failed with status: ${u.message}`,`Could not retrieve processing rule "${i}"`)},s=(0,m.DC)(E.Z.RulesController.get(i).url),r=(0,l.ZP)("GET",s);return r.then(this._updateRulesState,a),f.get.promise(r),r},save(i){const a=p=>{C.Z.error(`Saving rule "${i.title}" failed with status: ${p.message}`,`Could not save processing rule "${i.title}"`)},s=(0,m.DC)(E.Z.RulesController.create().url),r={title:i.title,description:i.description,source:i.source,simulator_message:i.simulator_message},u=(0,l.ZP)("POST",s,r);return u.then(p=>(this._updateRulesState(p),C.Z.success(`Rule "${p.title}" created successfully`),p),a),f.save.promise(u),u},update(i){const a=p=>{C.Z.error(`Updating rule "${i.title}" failed with status: ${p.message}`,`Could not update processing rule "${i.title}"`)},s=(0,m.DC)(E.Z.RulesController.update(i.id).url),r={id:i.id,title:i.title,description:i.description,source:i.source,simulator_message:i.simulator_message},u=(0,l.ZP)("PUT",s,r);return u.then(p=>(this._updateRulesState(p),C.Z.success(`Rule "${p.title}" updated successfully`),p),a),f.update.promise(u),u},delete(i){const a=u=>{C.Z.error(`Deleting rule "${i.title}" failed with status: ${u.message}`,`Could not delete processing rule "${i.title}"`)},s=(0,m.DC)(E.Z.RulesController.delete(i.id).url),r=(0,l.ZP)("DELETE",s).then(()=>{var u;this.rules=(u=this.rules)==null?void 0:u.filter(p=>p.id!==i.id),this.trigger({rules:this.rules,functionDescriptors:this.functionDescriptors}),C.Z.success(`Rule "${i.title}" was deleted successfully`)},a);return f.delete.promise(r),r},parse(i,a){const s=(0,m.DC)(E.Z.RulesController.parse().url),r={title:i.title,description:i.description,source:i.source};return(0,l.ZP)("POST",s,r).then(u=>(a([]),u),u=>{u.status===400&&a(u.additional.body)})},simulate(i,a,s){const r=(0,m.DC)(a!=null&&a.rule_builder?E.Z.RuleBuilderController.simulate().url:E.Z.RulesController.simulate().url),u={message:i,rule_source:void 0,rule_builder_dto:void 0};if(a!=null&&a.rule_builder){const{source:p,...T}=a;u.rule_builder_dto={title:T.title,description:T.description,rule_builder:T.rule_builder}}else u.rule_source={title:a.title,description:a.description,source:a.source};return(0,l.ZP)("POST",r,u).then(s,()=>{})},multiple(i,a){const s=(0,m.DC)(E.Z.RulesController.multiple().url),r=(0,l.ZP)("POST",s,{rules:i});return r.then(a),r},loadFunctions(){if(this.functionDescriptors)return;const i=(0,m.DC)(E.Z.RulesController.functions().url);return(0,l.ZP)("GET",i).then(this._updateFunctionDescriptors)},loadMetricsConfig(){const i=(0,m.DC)(E.Z.RulesController.metricsConfig().url),a=(0,l.ZP)("GET",i);a.then(s=>{this.metricsConfig=s,this.trigger({rules:this.rules,functionDescriptors:this.functionDescriptors,metricsConfig:this.metricsConfig})},s=>{C.Z.error(`Couldn't load rule metrics config: ${s.message}`,"Couldn't load rule metrics config")}),f.loadMetricsConfig.promise(a)},updateMetricsConfig(i){const a=(0,m.DC)(E.Z.RulesController.metricsConfig().url),s=(0,l.ZP)("PUT",a,i);s.then(r=>{this.metricsConfig=r,this.trigger({rules:this.rules,functionDescriptors:this.functionDescriptors,metricsConfig:this.metricsConfig}),C.Z.success("Successfully updated rule metrics config")},r=>{C.Z.error(`Couldn't update rule metrics config: ${r.message}`,"Couldn't update rule metrics config")}),f.updateMetricsConfig.promise(s)}}))}}]);})();

//# sourceMappingURL=1255d548-2032.eaea4d7ded536fdf945d.js.map




© 2015 - 2024 Weber Informatics LLC | Privacy Policy