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

web-interface.assets.1255d548-5843.66b1420bce40c1dc2be0.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-5843"],{nPNjzYdu:(D,U,a)=>{a.d(U,{Z:()=>c});var v=a("pmX897Fv"),e=a.n(v),b=a("DjJvgDaP"),l=a.n(b),N=l()(e());N.push([D.id,`.bN2Fa5FgSGHUh4zYUYzt {
    font-family: "Roboto Mono", Menlo, Monaco, Consolas, "Courier New", monospace;
    font-size: 1rem; /* theme.fonts.size.body */
    overflow-wrap: break-word;
    white-space: pre-wrap;
}
`,"",{version:3,sources:["webpack://./src/components/event-notifications/event-notification-types/EmailNotificationSummary.css"],names:[],mappings:"AAAA;IACI,6EAA6E;IAC7E,eAAe,EAAE,0BAA0B;IAC3C,yBAAyB;IACzB,qBAAqB;AACzB",sourcesContent:[`:local(.bodyPreview) {
    font-family: "Roboto Mono", Menlo, Monaco, Consolas, "Courier New", monospace;
    font-size: 1rem; /* theme.fonts.size.body */
    overflow-wrap: break-word;
    white-space: pre-wrap;
}
`],sourceRoot:""}]),N.locals={bodyPreview:"bN2Fa5FgSGHUh4zYUYzt"};const c=N},MgIGZ5Gi:(D,U,a)=>{a.d(U,{Z:()=>c});var v=a("pmX897Fv"),e=a.n(v),b=a("DjJvgDaP"),l=a.n(b),N=l()(e());N.push([D.id,`.rKKIeiSYDcRNaNEaL85y {
    margin-bottom: 15px;
    overflow-wrap: break-word;
}
`,"",{version:3,sources:["webpack://./src/components/event-notifications/event-notification-types/LegacyNotificationCommonStyles.css"],names:[],mappings:"AAAA;IACI,mBAAmB;IACnB,yBAAyB;AAC7B",sourcesContent:[`:local(.legacyNotificationAlert) {
    margin-bottom: 15px;
    overflow-wrap: break-word;
}
`],sourceRoot:""}]),N.locals={legacyNotificationAlert:"rKKIeiSYDcRNaNEaL85y"};const c=N},SfPIQIJE:(D,U,a)=>{a.d(U,{Z:()=>T});var v=a("Z7aTuO5B"),e=a("J6y4/h8P"),b=a("uZqmR+ju"),l=a("ty2gyrHp"),N=a("/GOzvPf6"),c=a("NV1/EHMi");const S=(0,e.default)(b.ButtonToolbar)`
  margin-bottom: 10px;
`,f=(0,e.default)(b.Button)(({theme:y})=>(0,e.css)`
  font-family: ${y.fonts.family.navigation};
  font-size: ${y.fonts.size.navigation};

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

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

    &:hover {
      ${(0,c.RF)(y)}
    }

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

      ${(0,c.A7)(y)}

      &:hover,
      &:focus {
        ${(0,c.A7)(y)}
      }
    }
  }
`);f.displayName="Button";const T=({items:y})=>v.createElement(S,null,y.map(({path:C,title:A,permissions:g,exactPathMatch:d})=>C?v.createElement(N.AE,{permissions:g!=null?g:[],key:C},v.createElement(l.J,{to:C,relativeActive:!d},v.createElement(f,{bsStyle:"link"},v.createElement(c.ZP,null,A)))):null))},ava0cCRK:(D,U,a)=>{var v=a("QL8i6bcz"),e=a("Z7aTuO5B"),b=a("ii0bleBb"),l=a.n(b),N=a("IW7priiX"),c=a.n(N),S=a("/yh+QgO6"),f=a.n(S),r=a("/GOzvPf6"),T=a("Mx+G+HdB"),y=a.n(T),C=a("92lPlKXC"),A=a("0TVxnHwi"),g=a("q2j1bVbz"),d=a("hhdCSTZj");const o=i=>{const t=(0,e.useRef)();return e.createElement(d.Z,{ref:t,async:!0,...i})};o.propTypes=d.Z.propTypes;const s=o,u={page:1,perPage:50,query:"",total:0},p=i=>i.map(t=>({label:`${t.username} (${t.fullName})`,value:t.username})),_=({value:i,onChange:t})=>{const n=(0,g.Z)(),[h,E]=(0,e.useState)(),[P,R]=(0,e.useState)(!1),[M,H]=(0,e.useState)(!1),K=(0,e.useCallback)(($=u)=>{if((0,A.rq)(n.permissions,"users:list"))return R(!0),C.Z.loadUsersPaginated($).then(Z=>(R(!1),Z))},[n.permissions]),st=($,Z="")=>{K({...$,page:$.page+1,query:Z}).then(w=>{E(se=>{const ut=se.list.concat(w.list),dt={...se.pagination,...w.pagination};return{...se,list:ut,pagination:dt}})})},ot=y()(()=>{const{pagination:$,pagination:{total:Z},list:w}=h;Z>w.count()&&st($)},400);(0,e.useEffect)(()=>{h||K().then(E)},[]);const lt=y()(($,Z)=>{Z.action==="input-change"?(H(!0),K({...u,query:$}).then(w=>{H(!0),E(w)})):Z.action==="menu-close"&&K().then(E)},400);if(!h)return e.createElement("p",null,e.createElement(r.$j,{text:"Loading User select..."}));const{list:rt,pagination:{total:ct}}=h;return e.createElement(s,{id:"user-select-list",value:i,placeholder:"Select user(s)...",options:p(rt.toArray()),onInputChange:lt,loadOptions:P||M?()=>{}:ot,multi:!0,total:ct,onChange:t})};_.propTypes={};const O=_;var m=a("uZqmR+ju"),B=a("S6FuRS7B"),V=a("8wYeYPUw"),Y=Object.defineProperty,Q=(i,t,n)=>t in i?Y(i,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[t]=n,L=(i,t,n)=>(Q(i,typeof t!="symbol"?t+"":t,n),n);const Te=`--- [Event Definition] ---------------------------
Title:       \${event_definition_title}
Description: \${event_definition_description}
Type:        \${event_definition_type}
--- [Event] --------------------------------------
Alert Replay:         \${http_external_uri}alerts/\${event.id}/replay-search
Timestamp:            \${event.timestamp}
Message:              \${event.message}
Source:               \${event.source}
Key:                  \${event.key}
Priority:             \${event.priority}
Alert:                \${event.alert}
Timestamp Processing: \${event.timestamp}
Timerange Start:      \${event.timerange_start}
Timerange End:        \${event.timerange_end}
Fields:
\${foreach event.fields field}  \${field.key}: \${field.value}
\${end}
\${if backlog}
--- [Backlog] ------------------------------------
Last messages accounting for this alert:
\${foreach backlog message}
\${message}
\${end}
\${end}
`,Ae=`
Event Definition
Title\${event_definition_title}
Description\${event_definition_description}
Type\${event_definition_type}

Event
Alert Replay\${http_external_uri}alerts/\${event.id}/replay-search
Timestamp\${event.timestamp}
Message\${event.message}
Source\${event.source}
Key\${event.key}
Priority\${event.priority}
Alert\${event.alert}
Timestamp Processing\${event.timestamp}
Timerange Start\${event.timerange_start}
Timerange End\${event.timerange_end}
Source Streams\${event.source_streams}
Fields
    \${foreach event.fields field}
  • \${field.key}:\${field.value}
  • \${end}
    \${if backlog}
    \${foreach backlog message} \${end}
    Backlog (Last messages accounting for this alert)
    \${message}
    \${end} `;class q extends e.Component{constructor(){super(...arguments),L(this,"propagateChange",(t,n)=>{const{config:h,onChange:E}=this.props,P=c()(h);P[t]=n,E(P)}),L(this,"handleChange",t=>{const{name:n}=t.target;this.propagateChange(n,(0,B.n6)(t.target))}),L(this,"handleTimeZoneChange",t=>{this.propagateChange("time_zone",t)}),L(this,"handleBodyTemplateChange",t=>{this.propagateChange("body_template",t)}),L(this,"handleHtmlBodyTemplateChange",t=>{this.propagateChange("html_body_template",t)}),L(this,"handleRecipientsChange",t=>n=>this.propagateChange(t,n===""?[]:n.split(",")))}render(){const{config:t,validation:n}=this.props;return e.createElement(e.Fragment,null,e.createElement(m.Input,{id:"notification-subject",name:"subject",label:"Subject",type:"text",bsStyle:n.errors.subject?"error":null,help:f()(n,"errors.subject[0]","The subject that should be used for the email notification."),value:t.subject||"",onChange:this.handleChange,required:!0}),e.createElement(m.Input,{id:"notification-replyto",name:"reply_to",label:"Reply-To (Optional)",type:"text",bsStyle:n.errors.replyto?"error":null,help:f()(n,"errors.reply_to[0]","The email address that recipients should use for replies."),value:t.reply_to||"",onChange:this.handleChange}),e.createElement(V.Z,null,e.createElement(m.Input,{id:"notification-sender",name:"sender",label:e.createElement(m.ControlLabel,null,"Sender ",e.createElement("small",{className:"text-muted"},"(Optional)")),type:"text",bsStyle:n.errors.sender?"error":null,help:f()(n,"errors.sender[0]","The email address that should be used as the notification sender. Leave it empty to use the default sender address."),value:t.sender||"",onChange:this.handleChange})),e.createElement(r.AE,{permissions:"users:list"},e.createElement(m.FormGroup,{controlId:"notification-user-recipients",validationState:n.errors.recipients?"error":null},e.createElement(m.ControlLabel,null,"User recipient(s) ",e.createElement("small",{className:"text-muted"},"(Optional)")),e.createElement(O,{id:"notification-user-recipients",value:Array.isArray(t.user_recipients)?t.user_recipients.join(","):"",onChange:this.handleRecipientsChange("user_recipients")}),e.createElement(m.HelpBlock,null,f()(n,"errors.recipients[0]","Select Graylog users that will receive this Notification.")))),e.createElement(m.FormGroup,{controlId:"notification-email-recipients",validationState:n.errors.recipients?"error":null},e.createElement(m.ControlLabel,null,"Email recipient(s) ",e.createElement("small",{className:"text-muted"},"(Optional)")),e.createElement(r.NU,{id:"notification-email-recipients",value:Array.isArray(t.email_recipients)?t.email_recipients.join(","):"",addLabelText:'Add email "{label}"?',placeholder:"Type email address",options:[],onChange:this.handleRecipientsChange("email_recipients"),allowCreate:!0}),e.createElement(m.HelpBlock,null,f()(n,"errors.recipients[0]","Add email addresses that will receive this Notification."))),e.createElement(m.Input,{id:"notification-time-zone",help:"Time zone used for timestamps in the email body.",label:e.createElement(e.Fragment,null,"Time zone for date/time values ",e.createElement("small",{className:"text-muted"},"(Optional)"))},e.createElement(r.Cc,{className:"timezone-select",name:"time_zone",value:t.time_zone,onChange:this.handleTimeZoneChange})),e.createElement(m.FormGroup,{controlId:"notification-body-template",validationState:n.errors.body?"error":null},e.createElement(m.ControlLabel,null,"Body Template"),e.createElement(r.KB,{id:"notification-body-template",mode:"text",theme:"light",value:t.body_template||"",onChange:this.handleBodyTemplateChange}),e.createElement(m.HelpBlock,null,f()(n,"errors.body[0]","The template that will be used to generate the email body."))),e.createElement(m.FormGroup,{controlId:"notification-body-template",validationState:n.errors.body?"error":null},e.createElement(m.ControlLabel,null,"HTML Body Template"),e.createElement(r.KB,{id:"notification-html-body-template",mode:"text",theme:"light",value:t.html_body_template||"",onChange:this.handleHtmlBodyTemplateChange}),e.createElement(m.HelpBlock,null,f()(n,"errors.body[0]","The template that will be used to generate the email HTML body."))))}}L(q,"propTypes",{config:l().object.isRequired,validation:l().object.isRequired,onChange:l().func.isRequired}),L(q,"defaultConfig",{sender:"",subject:"Graylog event notification: ${event_definition_title}",reply_to:"",body_template:Te,html_body_template:Ae,user_recipients:[],email_recipients:[],time_zone:"UTC"});const oe=q,le=i=>e.createElement(oe,{...i});le.propTypes={config:l().object.isRequired,validation:l().object.isRequired,onChange:l().func.isRequired};const Ne=le;var ee=a("KNFOZ/rv"),Re=a("dFpwyWHg"),re=a.n(Re),Ue=a("C2ikvoS0"),ce=a.n(Ue),De=a("1IntWRSu"),ue=a.n(De),Oe=a("8nGWeFnd"),de=a.n(Oe),Le=a("TeAcaicX"),me=a.n(Le),Ie=a("eE3+5goe"),pe=a.n(Ie),G=a("nPNjzYdu"),j={};j.styleTagTransform=pe(),j.setAttributes=de(),j.insert=ue().bind(null,"head"),j.domAPI=ce(),j.insertStyleElement=me();var mt=re()(G.Z,j);const W=G.Z&&G.Z.locals?G.Z.locals:void 0,te=({notification:i,...t})=>e.createElement(ee.Z,{notification:i,...t},e.createElement(e.Fragment,null,e.createElement("tr",null,e.createElement("td",null,"Sender"),e.createElement("td",null,i.config.sender)),e.createElement("tr",null,e.createElement("td",null,"Subject"),e.createElement("td",null,i.config.subject)),e.createElement("tr",null,e.createElement("td",null,"Reply-To"),e.createElement("td",null,i.config.reply_to)),e.createElement("tr",null,e.createElement("td",null,"User recipients"),e.createElement("td",null,i.config.user_recipients.join(", ")||"No users will receive this notification.")),e.createElement("tr",null,e.createElement("td",null,"Email recipients"),e.createElement("td",null,i.config.email_recipients.join(", ")||"No email addresses are configured to receive this notification.")),e.createElement("tr",null,e.createElement("td",null,"Email Body"),e.createElement("td",null,e.createElement(m.Well,{bsSize:"small",className:W.bodyPreview},i.config.body_template||e.createElement("em",null,"Empty body")))),e.createElement("tr",null,e.createElement("td",null,"Email HTML Body"),e.createElement("td",null,e.createElement(m.Well,{bsSize:"small",className:W.bodyPreview},i.config.html_body_template||e.createElement("em",null,"Empty HTML body"))))));te.propTypes={type:l().string.isRequired,notification:l().object,definitionNotification:l().object.isRequired},te.defaultProps={notification:{}};const Me=te;var $e=a("J6y4/h8P"),Ze=Object.defineProperty,Be=(i,t,n)=>t in i?Ze(i,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[t]=n,I=(i,t,n)=>(Be(i,typeof t!="symbol"?t+"":t,n),n);const ge=(0,$e.default)(m.Button)` clear: both; display: block; margin-bottom: 15px; `;class X extends e.Component{constructor(){super(),I(this,"propagateChange",(t,n)=>{const{config:h,onChange:E}=this.props,P=c()(h);P[t]=n,E(P)}),I(this,"handleChange",t=>{const{name:n}=t.target,h=B.n6(t.target);this.propagateChange(n,h)}),I(this,"handleSecretInputChange",t=>{const{name:n}=t.target,h=B.n6(t.target),E=h.length===0?{delete_value:!0}:{set_value:h};this.setState({[n]:h}),this.propagateChange(n,E)}),I(this,"onValidationChange",t=>{const{setIsSubmitEnabled:n}=this.props;n(t!=="error")}),I(this,"resetSecret",t=>{const{reset:n}=this.state;n[t]=!0,this.setState({reset:n}),this.propagateChange(t,{delete_value:!0}),this.setState({[t]:""})}),I(this,"undoResetSecret",t=>{const{reset:n}=this.state;n[t]=!1,this.setState({reset:n}),this.propagateChange(t,{keep_value:!0}),this.setState({[t]:"******"})}),this.state={api_secret:"",basic_auth:"",reset:{api_secret:!1,basic_auth:!1}}}componentDidMount(){var t,n;const{config:h,onChange:E}=this.props,P=c()(h);P.basic_auth=(t=h.basic_auth)!=null&&t.is_set?{keep_value:!0}:null,P.api_secret=(n=h.api_secret)!=null&&n.is_set?{keep_value:!0}:null,E(P),this.setState({basic_auth:h.basic_auth.is_set?"******":""}),this.setState({api_secret:h.api_secret.is_set?"******":""})}render(){const{config:t,validation:n}=this.props,{api_secret:h,basic_auth:E}=t,{reset:P}=this.state;return e.createElement(e.Fragment,null,e.createElement(r.zX,{label:"URL",onChange:this.handleChange,validationState:n.errors.url?"error":null,validationMessage:f()(n,"errors.url[0]","The URL to POST to when an Event occurs."),onValidationChange:this.onValidationChange,url:t.url,autofocus:!1}),e.createElement(m.Checkbox,{id:"skip_tls_verification",name:"skip_tls_verification",onChange:this.handleChange,checked:t.skip_tls_verification},"Skip TLS verification"),e.createElement(m.Row,null,e.createElement(m.Col,{md:12},E!=null&&E.keep_value?e.createElement(e.Fragment,null,e.createElement(m.ControlLabel,null,"Basic authentication"),e.createElement(ge,{bsStyle:"default",type:"button",onClick:()=>{this.resetSecret("basic_auth")}},"Reset Secret")):e.createElement(m.Input,{id:"basicAuth",label:e.createElement("span",null,"Basic authentication ",e.createElement("small",{className:"text-muted"},"(Optional)")),name:"basic_auth",type:"password",onChange:this.handleSecretInputChange,value:this.state.basic_auth||"",help:"The Basic authentication string needs to follow this format: ':'.",buttonAfter:P.basic_auth?e.createElement(m.Button,{type:"button",onClick:()=>{this.undoResetSecret("basic_auth")}},"Undo Reset"):void 0}))),e.createElement(m.Row,null,e.createElement(m.Col,{md:12},e.createElement(m.Input,{id:"api_key",name:"api_key",label:e.createElement("span",null,"API Key ",e.createElement("small",{className:"text-muted"},"(Optional)")),type:"text",onChange:this.handleChange,bsStyle:n.errors.api_key?"error":null,help:f()(n,"errors.api_key[0]","If an API secret is set, an API key must also be set."),value:t.api_key}))),e.createElement(m.Row,null,e.createElement(m.Col,{md:12},h!=null&&h.keep_value?e.createElement(e.Fragment,null,e.createElement(m.ControlLabel,null,"API Secret"),e.createElement(ge,{bsStyle:"default",type:"button",onClick:()=>{this.resetSecret("api_secret")}},"Reset Secret")):e.createElement(m.Input,{id:"apiSecret",label:e.createElement("span",null,"API Secret ",e.createElement("small",{className:"text-muted"},"(Optional)")),name:"api_secret",type:"password",onChange:this.handleSecretInputChange,bsStyle:n.errors.api_secret?"error":null,help:f()(n,"errors.api_secret[0]","If an API key is set, an API secret must also be set."),value:this.state.api_secret||"",buttonAfter:P.api_secret?e.createElement(m.Button,{type:"button",onClick:()=>{this.undoResetSecret("api_secret")}},"Undo Reset"):void 0}),e.createElement(m.Checkbox,{id:"api_key_as_header",name:"api_key_as_header",onChange:this.handleChange,checked:t.api_key_as_header},"Send API Key/Secret as Header"))))}}I(X,"propTypes",{config:l().object.isRequired,validation:l().object.isRequired,onChange:l().func.isRequired,setIsSubmitEnabled:l().func}),I(X,"defaultConfig",{url:"",api_key_as_header:!1,api_key:"",api_secret:{keep_value:!0},basic_auth:{keep_value:!0},skip_tls_verification:!1}),X.defaultProps={setIsSubmitEnabled:()=>{}};const fe=X;var Fe=Object.defineProperty,je=(i,t,n)=>t in i?Fe(i,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[t]=n,he=(i,t,n)=>(je(i,typeof t!="symbol"?t+"":t,n),n);class ne extends e.Component{render(){const{notification:t}=this.props;return e.createElement(ee.Z,{...this.props},e.createElement(e.Fragment,null,e.createElement("tr",null,e.createElement("td",null,"URL"),e.createElement("td",null,e.createElement("code",null,t.config.url)))))}}he(ne,"propTypes",{type:l().string.isRequired,notification:l().object,definitionNotification:l().object.isRequired}),he(ne,"defaultProps",{notification:{}});const xe=ne;var Ke=a("+qc3iAHh"),k=a("MgIGZ5Gi"),x={};x.styleTagTransform=pe(),x.setAttributes=de(),x.insert=ue().bind(null,"head"),x.domAPI=ce(),x.insertStyleElement=me();var pt=re()(k.Z,x);const J=k.Z&&k.Z.locals?k.Z.locals:void 0;var we=Object.defineProperty,We=(i,t,n)=>t in i?we(i,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[t]=n,F=(i,t,n)=>(We(i,typeof t!="symbol"?t+"":t,n),n);const ze=i=>Object.keys(i).map(t=>({label:`Legacy ${i[t].name}`,value:t}));class ae extends e.Component{constructor(){super(...arguments),F(this,"propagateMultiChange",t=>{const{config:n,onChange:h}=this.props,E={...n,...t};h(E)}),F(this,"propagateChange",(t,n)=>{const{config:h}=this.props,E={...h.configuration,[t]:n};this.propagateMultiChange({configuration:E})}),F(this,"getDefaultConfiguration",t=>{const{legacyTypes:n}=this.props,{configuration:h}=n[t],E={};return Object.keys(h).forEach(P=>{E[P]=h[P].default_value}),E}),F(this,"handleSelectNotificationChange",t=>{this.propagateMultiChange({callback_type:t,configuration:this.getDefaultConfiguration(t)})}),F(this,"handleFormFieldChange",(t,n)=>{this.propagateChange(t,n)})}renderNotificationForm(t,n){const{configuration:h}=n,E=Object.keys(h).map(P=>{const R=h[P],M=t.configuration[P];return e.createElement(Ke.nz,{key:P,typeName:t.callback_type,configField:R,configKey:P,configValue:M,onChange:this.handleFormFieldChange})});return e.createElement("fieldset",null,E)}render(){const{config:t,legacyTypes:n,validation:h}=this.props,E=t.callback_type,P=n[E];let R;return P?R=this.renderNotificationForm(t,P):E&&(R=e.createElement(m.Alert,{bsStyle:"danger",className:J.legacyNotificationAlert},"Unknown legacy alarm callback type: ",e.createElement("strong",null,E)," Please make sure the plugin is installed.")),e.createElement(e.Fragment,null,e.createElement("fieldset",null,e.createElement(m.FormGroup,{controlId:"notification-legacy-select",validationState:h.errors.callback_type?"error":null},e.createElement(m.ControlLabel,null,"Choose Legacy Notification"),e.createElement(r.Ph,{id:"notification-legacy-select",matchProp:"label",placeholder:"Select Legacy Notification",onChange:this.handleSelectNotificationChange,options:ze(n),value:E}),e.createElement(m.HelpBlock,null,f()(h,"errors.callback_type[0]","Select a Legacy Notification to use on this Event Definition.")))),e.createElement(m.Alert,{bsStyle:"danger",className:J.legacyNotificationAlert},"Legacy alarm callbacks are deprecated and will be removed with the next major release. Please switch to the new notification types as soon as possible!"),R)}}F(ae,"propTypes",{config:l().object.isRequired,validation:l().object.isRequired,onChange:l().func.isRequired,legacyTypes:l().object.isRequired}),F(ae,"defaultConfig",{callback_type:"",configuration:{}});const ye=ae;var Ee=a("8fnsnG21"),z=a("J7MaobQD"),He=Object.defineProperty,Ge=(i,t,n)=>t in i?He(i,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[t]=n,Xe=(i,t,n)=>(Ge(i,typeof t!="symbol"?t+"":t,n),n);class ve extends e.Component{componentDidMount(){const{notifications:t}=this.props;t.allLegacyTypes||z.e.listAllLegacyTypes()}render(){const{notifications:t}=this.props,{allLegacyTypes:n}=t;return n?e.createElement(ye,{...this.props,legacyTypes:n}):e.createElement("p",null,e.createElement(r.$j,{text:"Loading legacy notification information..."}))}}Xe(ve,"propTypes",{config:l().object.isRequired,validation:l().object.isRequired,onChange:l().func.isRequired,notifications:l().object.isRequired});const ke=(0,Ee.Z)(ve,{notifications:z.O});var Je=Object.defineProperty,Ve=(i,t,n)=>t in i?Je(i,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[t]=n,Ye=(i,t,n)=>(Ve(i,typeof t!="symbol"?t+"":t,n),n);class _e extends e.Component{render(){const{notification:t,legacyTypes:n}=this.props,h=t.config.configuration,E=t.config.callback_type,P=n[E];let R;if(P){const M=P.configuration;R=Object.entries(M).map(([H,K])=>e.createElement("tr",{key:H},e.createElement("td",null,K.human_name),e.createElement("td",null,h[H])))}else R=e.createElement("tr",{className:"danger"},e.createElement("td",null,"Type"),e.createElement("td",null,"Unknown legacy alarm callback type: ",e.createElement("code",null,E),". Please make sure the plugin is installed."));return e.createElement(e.Fragment,null,!P&&e.createElement(m.Alert,{bsStyle:"danger",className:J.legacyNotificationAlert},"Error in ",t.title||"Legacy Alarm Callback",": Unknown type ",e.createElement("code",null,E),", please ensure the plugin is installed."),e.createElement(ee.Z,{...this.props},e.createElement(e.Fragment,null,R)))}}Ye(_e,"propTypes",{type:l().string.isRequired,notification:l().object.isRequired,definitionNotification:l().object.isRequired,legacyTypes:l().object.isRequired});const Qe=_e;var qe=Object.defineProperty,et=(i,t,n)=>t in i?qe(i,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[t]=n,Ce=(i,t,n)=>(et(i,typeof t!="symbol"?t+"":t,n),n);class ie extends e.Component{componentDidMount(){z.e.listAllLegacyTypes()}render(){const{notifications:t}=this.props,{allLegacyTypes:n}=t;return n?e.createElement(Qe,{...this.props,legacyTypes:n}):e.createElement("p",null,e.createElement(r.$j,{text:"Loading legacy notification information..."}))}}Ce(ie,"propTypes",{type:l().string.isRequired,notification:l().object,notifications:l().object.isRequired,definitionNotification:l().object.isRequired}),Ce(ie,"defaultProps",{notification:{}});const tt=(0,Ee.Z)(ie,{notifications:z.O}),Pe=({notification:i})=>e.createElement(e.Fragment,null,e.createElement(r.mv,{label:"Sender",value:i.config.sender}),e.createElement(r.mv,{label:"Subject",value:i.config.subject}),e.createElement(r.mv,{label:"Reply-To",value:i.config.reply_to}),e.createElement(r.mv,{label:"User recipients",value:i.config.user_recipients.join(", ")||"No users will receive this notification."}),e.createElement(r.mv,{label:"Email recipients",value:i.config.email_recipients.join(", ")||"No email addresses are configured to receive this notification."}),e.createElement(r.mv,{label:"Time zone",value:i.config.time_zone}),e.createElement(r.mv,{label:"Email Body",value:e.createElement(m.Well,{bsSize:"small",className:W.bodyPreview},i.config.body_template||e.createElement("em",null,"Empty body"))}),e.createElement(r.mv,{label:"Email HTML Body",value:e.createElement(m.Well,{bsSize:"small",className:W.bodyPreview},i.config.html_body_template||e.createElement("em",null,"Empty body"))}));Pe.propTypes={notification:l().object.isRequired};const nt=Pe,be=({notification:i})=>{var t,n;const h=(t=i.config.api_secret)==null?void 0:t.is_set,E=i.config.api_key_as_header?"Header":"Query Parameter";return e.createElement(e.Fragment,null,e.createElement(r.mv,{label:"URL",value:i.config.url}),e.createElement(r.mv,{label:"Basic Authentication",value:(n=i.config.basic_auth)!=null&&n.is_set?"******":null}),e.createElement(r.mv,{label:"API Key/Secret Sent As",value:h?E:null}),e.createElement(r.mv,{label:"API Key",value:i.config.api_key}),e.createElement(r.mv,{label:"API Secret",value:h?"******":null}))};be.propTypes={notification:l().object.isRequired};const at=be,Se=({notification:i})=>{const[t,n]=(0,e.useState)(),h=i.config.configuration,E=i.config.callback_type,P=t==null?void 0:t[E];return(0,e.useEffect)(()=>{z.e.listAllLegacyTypes().then(R=>n(R.types))},[]),t?e.createElement(e.Fragment,null,!P&&e.createElement(m.Alert,{bsStyle:"danger",className:J.legacyNotificationAlert},"Error in ",i.title||"Legacy Alarm Callback",": Unknown type ",e.createElement("code",null,E),", please ensure the plugin is installed."),P&&Object.entries(P.configuration).map(([R,M])=>R==="body"||R==="script_args"?e.createElement(r.mv,{label:M.human_name,value:e.createElement(m.Well,{bsSize:"small",className:W.bodyPreview},h[R]||e.createElement("em",null,"Empty body"))}):e.createElement(r.mv,{label:M.human_name,value:h[R]}))):e.createElement("p",null,e.createElement(r.$j,{text:"Loading legacy notification information..."}))};Se.propTypes={notification:l().object.isRequired};const it=Se;v.G.register(new v.h({},{eventNotificationTypes:[{type:"email-notification-v1",displayName:"Email Notification",formComponent:Ne,summaryComponent:Me,detailsComponent:nt,defaultConfig:oe.defaultConfig},{type:"http-notification-v1",displayName:"HTTP Notification",formComponent:fe,summaryComponent:xe,detailsComponent:at,defaultConfig:fe.defaultConfig},{type:"legacy-alarm-callback-notification-v1",displayName:"Legacy Alarm Callbacks",formComponent:ke,summaryComponent:tt,detailsComponent:it,defaultConfig:ye.defaultConfig}]}))},jvpdvVQ7:(D,U,a)=>{a.d(U,{Z:()=>S});var v=a("Z7aTuO5B"),e=a("SfPIQIJE"),b=a("d4kzUuQm"),l=a("uZqmR+ju");const N=[{title:"Alerts & Events",path:b.ZP.ALERTS.LIST,exactPathMatch:!0},{title:"Event Definitions",path:b.ZP.ALERTS.DEFINITIONS.LIST},{title:"Notifications",path:b.ZP.ALERTS.NOTIFICATIONS.LIST}],S=()=>v.createElement(l.Row,null,v.createElement(e.Z,{items:N}))},"92lPlKXC":(D,U,a)=>{a.d(U,{Z:()=>d});var v=a("cSDA0Pof"),e=a("lDGobrly");const b=(0,e.Z)({action:v.X.create,success:o=>({message:`User "${o==null?void 0:o.first_name} ${o==null?void 0:o.last_name}" was created successfully`}),error:(o,s)=>({message:`Creating user "${s==null?void 0:s.first_name} ${s==null?void 0:s.last_name}" failed with status: ${o}`})}),l=(0,e.Z)({action:v.X.load,error:(o,s)=>({message:`Loading user with id "${s}" failed with status: ${o}`}),notFoundRedirect:!0}),N=(0,e.Z)({action:v.X.loadByUsername,error:(o,s)=>({message:`Loading user with username "${s}" failed with status: ${o}`}),notFoundRedirect:!0}),c=(0,e.Z)({action:v.X.update,success:(o,s,u)=>({message:`User "${u}" was updated successfully`}),error:(o,s,u,p)=>({message:`Updating user "${p}" failed with status: ${o}`})}),S=(0,e.Z)({action:v.X.delete,success:(o,s)=>({message:`User "${s}" was deleted successfully`}),error:(o,s,u)=>({message:`Deleting user "${u}" failed with status: ${o}`})}),f=(0,e.Z)({action:v.X.changePassword,success:()=>({message:"Password was changed successfully "}),error:(o,s)=>({message:`Changing password for user with id "${s}" failed with status: ${o}`})}),r=(0,e.Z)({action:v.X.createToken,success:(o,s)=>({message:`Token "${s}" created successfully`}),error:(o,s,u)=>({message:`Creating token "${u}" for user with id "${s}" failed with status: ${o}`})}),T=(0,e.Z)({action:v.X.loadTokens,error:(o,s)=>({message:`Loading tokens for user with id "${s}" failed with status: ${o}`})}),y=(0,e.Z)({action:v.X.deleteToken,success:(o,s,u)=>({message:`Token "${u}" deleted successfully`}),error:(o,s,u,p)=>({message:`Deleting token "${p}" for user with id "${s}" failed with status: ${o}`})}),C=(0,e.Z)({action:v.X.loadUsers,error:o=>({message:`Loading users failed with status: ${o}`})}),A=(0,e.Z)({action:v.X.loadUsersPaginated,error:o=>({message:`Loading users failed with status: ${o}`})}),g=(0,e.Z)({action:v.X.setStatus,success:(o,s)=>({message:`User "${o}" was set to ${s}`}),error:(o,s,u)=>({message:`Updating user ("${s}") to ${u} failed with status: ${o}`})}),d={create:b,load:l,loadByUsername:N,update:c,delete:S,changePassword:f,createToken:r,loadTokens:T,deleteToken:y,loadUsers:C,loadUsersPaginated:A,setStatus:g}},"nmSm+aR9":(D,U,a)=>{a.d(U,{Z:()=>b});var v=a("VPaD/Np4"),e=a.n(v);class b{constructor(c,S,f,r,T,y,C,A,g,d,o,s,u,p,_){this._value={id:c,username:S,fullName:f,email:r,roles:T,readOnly:y,external:C,sessionActive:A,clientAddress:g,lastActivity:d,enabled:o,authServiceId:s,authServiceUid:u,authServiceEnabled:p,accountStatus:_}}get id(){return this._value.id}get username(){return this._value.username}get name(){return this._value.username}get fullName(){return this._value.fullName}get description(){return this._value.fullName}get email(){return this._value.email}get roles(){return this._value.roles}get readOnly(){return this._value.readOnly}get external(){return this._value.external}get sessionActive(){return this._value.sessionActive}get clientAddress(){return this._value.clientAddress}get lastActivity(){return this._value.lastActivity}get enabled(){return this._value.enabled}get authServiceId(){return this._value.authServiceId}get authServiceUid(){return this._value.authServiceUid}get authServiceEnabled(){return this._value.authServiceEnabled}get accountStatus(){return this._value.accountStatus}toBuilder(){const{id:c,username:S,fullName:f,email:r,roles:T,readOnly:y,external:C,sessionActive:A,clientAddress:g,lastActivity:d,enabled:o,authServiceId:s,authServiceUid:u,authServiceEnabled:p,accountStatus:_}=this._value;return new l(v.Map({id:c,username:S,fullName:f,email:r,roles:T,readOnly:y,external:C,sessionActive:A,clientAddress:g,lastActivity:d,enabled:o,authServiceId:s,authServiceUid:u,authServiceEnabled:p,accountStatus:_}))}static create(c,S,f,r,T,y,C,A,g,d,o,s,u,p,_){return new b(c,S,f,r,T,y,C,A,g,d,o,s,u,p,_)}toJSON(){const{id:c,username:S,fullName:f,email:r,roles:T,readOnly:y,external:C,sessionActive:A,clientAddress:g,lastActivity:d,enabled:o,authServiceId:s,authServiceUid:u,authServiceEnabled:p,accountStatus:_}=this._value;return{id:c,username:S,full_name:f,email:r,roles:T.toArray(),read_only:y,external_user:C,session_active:A,client_address:g,last_activity:d,enabled:o,auth_service_id:s,auth_service_uid:u,auth_service_enabled:p,account_status:_}}static fromJSON(c){const{id:S,username:f,full_name:r,email:T,roles:y,read_only:C,external_user:A,session_active:g,client_address:d,last_activity:o,enabled:s,auth_service_id:u,auth_service_uid:p,auth_service_enabled:_,account_status:O}=c;return b.create(S,f,r,T,v.Set(y),C!=null?C:!1,A!=null?A:!1,g!=null?g:!1,d,o,s,u,p,_,O)}static builder(){return new l}}class l{constructor(c=v.Map()){this.value=c}id(c){return new l(this.value.set("id",c))}username(c){return new l(this.value.set("username",c))}fullName(c){return new l(this.value.set("fullName",c))}email(c){return new l(this.value.set("email",c))}roles(c){return new l(this.value.set("roles",c))}readOnly(c){return new l(this.value.set("readOnly",c))}external(c){return new l(this.value.set("external",c))}sessionActive(c){return new l(this.value.set("sessionActive",c))}clientAddress(c){return new l(this.value.set("clientAddress",c))}lastActivity(c){return new l(this.value.set("lastActivity",c))}enabled(c){return new l(this.value.set("enabled",c))}authServiceId(c){return new l(this.value.set("authServiceId",c))}authServiceUid(c){return new l(this.value.set("authServiceUid",c))}authServiceEnabled(c){return new l(this.value.set("authServiceEnabled",c))}accountStatus(c){return new l(this.value.set("accountStatus",c))}build(){const{id:c,username:S,fullName:f,email:r,roles:T,readOnly:y,external:C,sessionActive:A,clientAddress:g,lastActivity:d,enabled:o,authServiceId:s,authServiceUid:u,authServiceEnabled:p,accountStatus:_}=this.value.toObject();return new b(c,S,f,r,T,y,C,A,g,d,o,s,u,p,_)}}},J7MaobQD:(D,U,a)=>{a.d(U,{O:()=>A,e:()=>C});var v=a("JnTtTRmZ"),e=a.n(v),b=a("oCSEoDew"),l=a.n(b),N=a("u1Q00LVl"),c=a.n(N),S=a("MdYBRjRJ"),f=a("jAGDuYSC"),r=a("eFxcQyPT"),T=a("IA3Ku5lS"),y=a("gyRmhZSW");const C=(0,T.ei)("core.EventNotifications",()=>e().createActions({listAll:{asyncResult:!0},listAllLegacyTypes:{asyncResult:!0},listPaginated:{asyncResult:!0},searchPaginated:{asyncResult:!0},get:{asyncResult:!0},create:{asyncResult:!0},update:{asyncResult:!0},delete:{asyncResult:!0},test:{asyncResult:!0},testPersisted:{asyncResult:!0}})),A=(0,T.dS)("core.EventNotifications",()=>e().createStore({listenables:[C],sourceUrl:"/events/notifications",all:void 0,allLegacyTypes:void 0,notifications:void 0,query:void 0,pagination:{count:void 0,page:void 0,pageSize:void 0,total:void 0,grandTotal:void 0},getInitialState(){return this.getState()},propagateChanges(){this.trigger(this.getState())},getState(){return{all:this.all,allLegacyTypes:this.allLegacyTypes,notifications:this.notifications,query:this.query,pagination:this.pagination}},eventNotificationsUrl({segments:g=[],query:d={}}){const o=new(l())(this.sourceUrl),s=c()(o.segment(),g);return o.segmentCoded(s),o.query(d),S.DC(o.resource())},refresh(){this.all&&this.listAll(),this.pagination.page&&this.listPaginated({query:this.query,page:this.pagination.page,pageSize:this.pagination.pageSize})},listAll(){const g=(0,r.ZP)("GET",this.eventNotificationsUrl({query:{per_page:0}}));g.then(d=>(this.all=d.notifications,this.propagateChanges(),d)),C.listAll.promise(g)},listPaginated({query:g="",page:d=1,pageSize:o=10}){const s=(0,r.ZP)("GET",this.eventNotificationsUrl({query:{query:g,page:d,per_page:o}}));s.then(u=>(this.notifications=u.notifications,this.query=u.query,this.pagination={count:u.count,page:u.page,pageSize:u.per_page,total:u.total,grandTotal:u.grand_total},this.propagateChanges(),u)),C.listPaginated.promise(s)},searchPaginated(g,d,o,s){const u=(0,y.Z)(`${this.sourceUrl}/paginated`,g,d,o,s),p=(0,r.ZP)("GET",S.DC(u)).then(_=>{const{elements:O,query:m,attributes:B,pagination:{count:V,total:Y,page:Q,per_page:L}}=_;return{elements:O,attributes:B,pagination:{count:V,total:Y,page:Q,perPage:L,query:m}}});return C.searchPaginated.promise(p),p},get(g){const d=(0,r.ZP)("GET",this.eventNotificationsUrl({segments:[g]}));d.catch(o=>{o.status===404&&f.Z.error(`Unable to find Event Notification with id <${g}>, please ensure it wasn't deleted.`,"Could not retrieve Event Notification")}),C.get.promise(d)},create(g){const d=(0,r.ZP)("POST",this.eventNotificationsUrl({}),g);d.then(o=>(f.Z.success("Notification created successfully",`Notification "${g.title}" was created successfully.`),this.refresh(),o),o=>{(o.status!==400||!o.additional.body||!o.additional.body.failed)&&f.Z.error(`Creating Notification "${g.title}" failed with status: ${o}`,"Could not save Notification")}),C.create.promise(d)},update(g,d){const o=(0,r.ZP)("PUT",this.eventNotificationsUrl({segments:[g]}),d);o.then(s=>(f.Z.success("Notification updated successfully",`Notification "${d.title}" was updated successfully.`),this.refresh(),s),s=>{(s.status!==400||!s.additional.body||!s.additional.body.failed)&&f.Z.error(`Updating Notification "${d.title}" failed with status: ${s}`,"Could not update Notification")}),C.update.promise(o)},delete(g){const d=(0,r.ZP)("DELETE",this.eventNotificationsUrl({segments:[g.id]}));d.then(()=>{f.Z.success("Notification deleted successfully",`Notification "${g.title}" was deleted successfully.`),this.refresh()},o=>{f.Z.error(`Deleting Notification "${g.title}" failed with status: ${o}`,"Could not delete Notification")}),C.delete.promise(d)},test(g){const d=(0,r.ZP)("POST",this.eventNotificationsUrl({segments:["test"]}),g);C.test.promise(d)},testPersisted(g){const d=(0,r.ZP)("POST",this.eventNotificationsUrl({segments:[g.id,"test"]}));C.testPersisted.promise(d)},listAllLegacyTypes(){const g=(0,r.ZP)("GET",this.eventNotificationsUrl({segments:["legacy","types"]}));g.then(d=>(this.allLegacyTypes=d.types,this.propagateChanges(),d)),C.listAllLegacyTypes.promise(g)}}))},cSDA0Pof:(D,U,a)=>{a.d(U,{X:()=>d});var v=a("JnTtTRmZ"),e=a.n(v),b=a("VPaD/Np4"),l=a.n(b),N=a("oCSEoDew"),c=a.n(N),S=a("nmSm+aR9"),f=a("eFxcQyPT"),r=a("U1Iufsob"),T=a("IA3Ku5lS"),y=a("MdYBRjRJ"),C=a("gyRmhZSW"),A=a("vMorKP/N");const g=({url:s="",query:u={}})=>{const p=new(c())(s);return p.query(u),(0,y.DC)(p.resource())},d=(0,T.ei)("core.Users",()=>e().createActions({create:{asyncResult:!0},load:{asyncResult:!0},loadByUsername:{asyncResult:!0},update:{asyncResult:!0},delete:{asyncResult:!0},changePassword:{asyncResult:!0},createToken:{asyncResult:!0},loadTokens:{asyncResult:!0},deleteToken:{asyncResult:!0},loadUsersPaginated:{asyncResult:!0},loadUsers:{asyncResult:!0},setStatus:{asyncResult:!0}})),o=(0,T.dS)("core.Users",()=>e().createStore({listenables:[d],create(s){const u=(0,y.DC)(r.Z.UsersApiController.create().url),p=(0,f.ZP)("POST",u,s);return d.create.promise(p),p},load(s){const u=(0,y.DC)(r.Z.UsersApiController.load(encodeURIComponent(s)).url),p=(0,f.ZP)("GET",u).then(A.Z.fromJSON);return d.load.promise(p),p},loadByUsername(s){const u=(0,y.DC)(r.Z.UsersApiController.loadByUsername(encodeURIComponent(s)).url),p=(0,f.ZP)("GET",u).then(A.Z.fromJSON);return d.loadByUsername.promise(p),p},update(s,u){const p=(0,y.DC)(r.Z.UsersApiController.update(encodeURIComponent(s)).url),_=(0,f.ZP)("PUT",p,u);return d.update.promise(_),_},delete(s){const u=(0,y.DC)(r.Z.UsersApiController.delete(encodeURIComponent(s)).url),p=(0,f.ZP)("DELETE",u);return d.delete.promise(p),p},changePassword(s,u){const p=(0,y.DC)(r.Z.UsersApiController.changePassword(encodeURIComponent(s)).url),_=(0,f.ZP)("PUT",p,u);return d.changePassword.promise(_),_},createToken(s,u){const p=(0,y.DC)(r.Z.UsersApiController.create_token(encodeURIComponent(s),encodeURIComponent(u)).url),_=(0,f.ZP)("POST",p);return d.createToken.promise(_),_},loadTokens(s){const u=(0,y.DC)(r.Z.UsersApiController.list_tokens(encodeURIComponent(s)).url),p=(0,f.ZP)("GET",u).then(_=>_.tokens);return d.loadTokens.promise(p),p},deleteToken(s,u){const p=(0,y.DC)(r.Z.UsersApiController.delete_token(encodeURIComponent(s),encodeURIComponent(u)).url),_=(0,f.ZP)("DELETE",p);return d.deleteToken.promise(_),_},loadUsers(s={}){const u=g({url:r.Z.UsersApiController.list().url,query:s}),p=(0,f.ZP)("GET",u).then(({users:_})=>b.List(_.map(O=>S.Z.fromJSON(O))));return d.loadUsers.promise(p),p},loadUsersPaginated({page:s,perPage:u,query:p}){const _=(0,C.Z)(r.Z.UsersApiController.paginated().url,s,u,p),O=(0,f.ZP)("GET",(0,y.DC)(_)).then(m=>({adminUser:m.context.admin_user?S.Z.fromJSON(m.context.admin_user):void 0,list:b.List(m.users.map(B=>S.Z.fromJSON(B))),pagination:{page:m.page,perPage:m.per_page,query:m.query,count:m.count,total:m.total}}));return d.loadUsersPaginated.promise(O),O},setStatus(s,u){const p=(0,y.DC)(r.Z.UsersApiController.setStatus(s,u).url),_=(0,f.ZP)("PUT",p);return d.setStatus.promise(_),_}}))}}]);})(); //# sourceMappingURL=1255d548-5843.66b1420bce40c1dc2be0.js.map




    © 2015 - 2024 Weber Informatics LLC | Privacy Policy