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

web-interface.assets.1255d548-4349.fdf67b80fb715647c1b2.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-4349"],{"Clzoet+M":(F,O,o)=>{o.d(O,{Z:()=>T});var R=o("pmX897Fv"),k=o.n(R),d=o("DjJvgDaP"),e=o.n(d),P=e()(k());P.push([F.id,`/*
 * Copyright (C) 2020 Graylog, Inc.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the Server Side Public License, version 1,
 * as published by MongoDB, Inc.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * Server Side Public License for more details.
 *
 * You should have received a copy of the Server Side Public License
 * along with this program. If not, see
 * .
 */
._WOp2bWqXDYrxvBkNQVa {
    max-width: 400px;
}

.ZB8sCgEwW7KZwhU6vhHF {
    margin-right: 5px;
}
`,"",{version:3,sources:["webpack://./src/components/lookup-tables/ErrorPopover.css"],names:[],mappings:"AAAA;;;;;;;;;;;;;;;EAeE;AACF;IACI,gBAAgB;AACpB;;AAEA;IACI,iBAAiB;AACrB",sourcesContent:[`/*
 * Copyright (C) 2020 Graylog, Inc.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the Server Side Public License, version 1,
 * as published by MongoDB, Inc.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * Server Side Public License for more details.
 *
 * You should have received a copy of the Server Side Public License
 * along with this program. If not, see
 * .
 */
:local(.overlay) {
    max-width: 400px;
}

:local(.trigger) {
    margin-right: 5px;
}
`],sourceRoot:""}]),P.locals={overlay:"_WOp2bWqXDYrxvBkNQVa",trigger:"ZB8sCgEwW7KZwhU6vhHF"};const T=P},eCBhU9Q5:(F,O,o)=>{o.d(O,{Z:()=>T});var R=o("pmX897Fv"),k=o.n(R),d=o("DjJvgDaP"),e=o.n(d),P=e()(k());P.push([F.id,`/*
 * Copyright (C) 2020 Graylog, Inc.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the Server Side Public License, version 1,
 * as published by MongoDB, Inc.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * Server Side Public License for more details.
 *
 * You should have received a copy of the Server Side Public License
 * along with this program. If not, see
 * .
 */
.eooimJB8iUwv4GuS5OgP {
    cursor: help;
    padding: 0 0 0 2px;
    margin-left: 5px;
}

.EM8rNPeHI3I13MdYidzw {
    max-width: 500px;
    min-width: 350px;
}

/* styles for table columns */
.oNIxQlLcjvvFY27jyODI {
    width: 15%;
}
.jXZIhUCAUZtfWZKKiLy0 {
    max-width: 50%;
    width: 35%
}
.Ii_DwC6G4wRm7thBYSKE {
    width: 15%;
}
.q54g6XMj1D9X2J48jgrw {
    width: 15%;
}
.wFLgXxYT9cnZwrNRg6DJ {
    width: 15%;
}
.mk2GxDtbjbYu9RWQh_nL {
    min-width: 100px;
}

overviewTable {
    width: 100%;
    table-layout: fixed;
}
`,"",{version:3,sources:["webpack://./src/components/lookup-tables/Overview.css"],names:[],mappings:"AAAA;;;;;;;;;;;;;;;EAeE;AACF;IACI,YAAY;IACZ,kBAAkB;IAClB,gBAAgB;AACpB;;AAEA;IACI,gBAAgB;IAChB,gBAAgB;AACpB;;AAEA,6BAA6B;AAC7B;IACI,UAAU;AACd;AACA;IACI,cAAc;IACd;AACJ;AACA;IACI,UAAU;AACd;AACA;IACI,UAAU;AACd;AACA;IACI,UAAU;AACd;AACA;IACI,gBAAgB;AACpB;;AAEA;IACI,WAAW;IACX,mBAAmB;AACvB",sourcesContent:[`/*
 * Copyright (C) 2020 Graylog, Inc.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the Server Side Public License, version 1,
 * as published by MongoDB, Inc.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * Server Side Public License for more details.
 *
 * You should have received a copy of the Server Side Public License
 * along with this program. If not, see
 * .
 */
:local(.searchHelpButton) {
    cursor: help;
    padding: 0 0 0 2px;
    margin-left: 5px;
}

:local(.popoverWide) {
    max-width: 500px;
    min-width: 350px;
}

/* styles for table columns */
:local(.rowTitle) {
    width: 15%;
}
:local(.rowDescription) {
    max-width: 50%;
    width: 35%
}
:local(.rowName) {
    width: 15%;
}
:local(.rowCache) {
    width: 15%;
}
:local(.rowAdapter) {
    width: 15%;
}
:local(.rowActions) {
    min-width: 100px;
}

:local(overviewTable) {
    width: 100%;
    table-layout: fixed;
}
`],sourceRoot:""}]),P.locals={searchHelpButton:"eooimJB8iUwv4GuS5OgP",popoverWide:"EM8rNPeHI3I13MdYidzw",rowTitle:"oNIxQlLcjvvFY27jyODI",rowDescription:"jXZIhUCAUZtfWZKKiLy0",rowName:"Ii_DwC6G4wRm7thBYSKE",rowCache:"q54g6XMj1D9X2J48jgrw",rowAdapter:"wFLgXxYT9cnZwrNRg6DJ",rowActions:"mk2GxDtbjbYu9RWQh_nL"};const T=P},SfPIQIJE:(F,O,o)=>{o.d(O,{Z:()=>u});var R=o("Z7aTuO5B"),k=o("J6y4/h8P"),d=o("uZqmR+ju"),e=o("ty2gyrHp"),P=o("/GOzvPf6"),T=o("NV1/EHMi");const n=(0,k.default)(d.ButtonToolbar)`
  margin-bottom: 10px;
`,m=(0,k.default)(d.Button)(({theme:i})=>(0,k.css)`
  font-family: ${i.fonts.family.navigation};
  font-size: ${i.fonts.size.navigation};

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

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

    &:hover {
      ${(0,T.RF)(i)}
    }

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

      ${(0,T.A7)(i)}

      &:hover,
      &:focus {
        ${(0,T.A7)(i)}
      }
    }
  }
`);m.displayName="Button";const u=({items:i})=>R.createElement(n,null,i.map(({path:h,title:S,permissions:N,exactPathMatch:M})=>h?R.createElement(P.AE,{permissions:N!=null?N:[],key:h},R.createElement(e.J,{to:h,relativeActive:!M},R.createElement(m,{bsStyle:"link"},R.createElement(T.ZP,null,S)))):null))},XyJ0Mvpg:(F,O,o)=>{o.d(O,{Z:()=>e});var R=o("Z7aTuO5B"),k=o("rVdVsuGH");const e=(P,T)=>function(m){const g=(0,k.ZP)(T==null?void 0:T.pageSizes);return R.createElement(P,{...m,paginationQueryParameter:g})}},w4Oqfrlu:(F,O,o)=>{o.d(O,{Z:()=>n});var R=o("Z7aTuO5B"),k=o("SfPIQIJE"),d=o("d4kzUuQm"),e=o("uZqmR+ju");const P=[{title:"Lookup Tables",path:d.ZP.SYSTEM.LOOKUPTABLES.OVERVIEW,exactPathMatch:!0},{title:"Caches",path:d.ZP.SYSTEM.LOOKUPTABLES.CACHES.OVERVIEW},{title:"Data Adapters",path:d.ZP.SYSTEM.LOOKUPTABLES.DATA_ADAPTERS.OVERVIEW}],n=()=>R.createElement(e.Row,null,R.createElement(k.Z,{items:P}))},jgcyxQh5:(F,O,o)=>{o.d(O,{Ct:()=>la,rU:()=>ia,H7:()=>Je,HE:()=>ze,wP:()=>qe,M5:()=>aa,s$:()=>ya,UG:()=>Ra,$G:()=>Xe,$u:()=>Qe,pJ:()=>et,s8:()=>fa,M_:()=>re,Rl:()=>Jt,c1:()=>$e,QX:()=>Ht,pP:()=>Zt});var R=o("QL8i6bcz"),k=o("ii0bleBb"),d=o.n(k),e=o("Z7aTuO5B"),P=o("RCNj0OY4"),T=o("QdZ7Yq43"),n=o("uZqmR+ju"),m=o("/GOzvPf6");const g=({config:t,updateConfig:a,handleFormEvent:l,validationState:r,validationMessage:s})=>{const c=P.Z.isCloud(),p={IPINFO_STANDARD_LOCATION:"/etc/graylog/server/standard_location.mmdb",IPINFO_ASN:"/etc/graylog/server/asn.mmdb"},_=[{label:"IPinfo location database",value:"IPINFO_STANDARD_LOCATION"},{label:"IPinfo ASN database",value:"IPINFO_ASN"}];let E=[{label:"ASN database",value:"MAXMIND_ASN"},{label:"City database",value:"MAXMIND_CITY"},{label:"Country database",value:"MAXMIND_COUNTRY"}];c?E=_:E=E.concat(_);const b=(f,y,A,D)=>{const U=T.Z.clone(t);U[D]=A?f:0,U[`${D}_unit`]=y,a(U)},C=(f,y,A)=>{b(f,y,A,"check_interval")},v=f=>{const y=T.Z.clone(t);c&&(y.path=p[f]),y.database_type=f,a(y)};return e.createElement("fieldset",null,!c&&e.createElement(n.Input,{type:"text",id:"path",name:"path",label:"File path",autoFocus:!0,required:!0,onChange:l,help:s("path","The path to the database file."),bsStyle:r("path"),value:t.path,labelClassName:"col-sm-3",wrapperClassName:"col-sm-9"}),e.createElement(n.Input,{id:"database-type-select",label:"Database type",required:!0,autoFocus:!0,help:"Select the type of the database file",labelClassName:"col-sm-3",wrapperClassName:"col-sm-9"},e.createElement(m.Ph,{placeholder:"Select the type of database file",clearable:!1,options:E,matchProp:"label",onChange:v,value:t.database_type})),e.createElement(m.AX,{label:"Refresh file",help:"If enabled, the database file is checked for modifications and refreshed when it changed on disk.",update:C,value:t.check_interval,unit:t.check_interval_unit||"MINUTES",defaultEnabled:t.check_interval>0,labelClassName:"col-sm-3",wrapperClassName:"col-sm-9"}))};g.propTypes={config:d().object.isRequired,updateConfig:d().func.isRequired,handleFormEvent:d().func.isRequired,validationState:d().func.isRequired,validationMessage:d().func.isRequired};const u=g;var i=Object.defineProperty,h=(t,a,l)=>a in t?i(t,a,{enumerable:!0,configurable:!0,writable:!0,value:l}):t[a]=l,S=(t,a,l)=>(h(t,typeof a!="symbol"?a+"":a,l),l);class N extends e.Component{render(){const{config:a}=this.props.dataAdapter,l={MAXMIND_ASN:"ASN database",MAXMIND_CITY:"City database",MAXMIND_COUNTRY:"Country database",IPINFO_STANDARD_LOCATION:"IPinfo location database",IPINFO_ASN:"IPinfo ASN database"};return e.createElement("dl",null,e.createElement("dt",null,"Database file path"),e.createElement("dd",null,a.path),e.createElement("dt",null,"Database type"),e.createElement("dd",null,l[a.database_type]),e.createElement("dt",null,"Check interval"),e.createElement("dd",null,e.createElement(m.j1,{value:a.check_interval,unit:a.check_interval_unit})))}}S(N,"propTypes",{dataAdapter:d().object.isRequired});const M=N;class K extends e.Component{render(){const a=`{
    "city": { "geoname_id": 5375480, "names": { "en": "Mountain View" } },
    "location": {
      "accuracy_radius": 1000,
      "average_income": null,
      "latitude": 37.386,
      "longitude": -122.0838,
      "metro_code": 807,
      "population_density": null,
      "time_zone": "America/Los_Angeles"
    },
    "postal": { "code": "94035" },
    "subdivisions": [ { "geoname_id": 5332921, "iso_code": "CA", "names": { "en": "California" } } ],
}`,l=`{
    "continent": { "code": "NA", "geoname_id": 6255149, "names": { "en": "North America" } },
    "country": { "geoname_id": 6252001, "iso_code": "US", "names": { "en": "United States" } },
    "registered_country": { "geoname_id": 6252001, "iso_code": "US", "names": { } },
    "represented_country": { "geoname_id": null, "iso_code": "US", "names": { } },
    "traits": {
      "ip_address": "8.8.8.8",
      "is_anonymous_proxy": false,
      "is_legitimate_proxy": false,
      "is_satellite_provider": false,
      "isp": null,
      "organization": null,
    }
}`,r=`{
    "as_number": 15169,
    "as_organization": "Google LLC"
}`;return e.createElement("div",null,e.createElement("p",null,"The GeoIP data adapter supports reading MaxMind's GeoIP2 databases."),e.createElement(n.Alert,{style:{marginBottom:10},bsStyle:"info",title:"Limitations"},e.createElement("p",null,"Currently the ASN, city and country databases are supported."),e.createElement("p",null,"For support of additional database types, please visit our support channels.")),e.createElement("hr",null),e.createElement("h3",{style:{marginBottom:10}},"ASN database fields"),e.createElement("pre",null,r),e.createElement("h3",{style:{marginBottom:10}},"Country database fields"),e.createElement("pre",null,l),e.createElement("h3",{style:{marginBottom:10}},"City database fields"),e.createElement("p",null,"In addition to the fields provided by the country database, the city database also includes the following fields:"),e.createElement("pre",null,a),e.createElement("p",null,"For a complete documentation of the fields, please see MaxMind's ",e.createElement("a",{href:"http://maxmind.github.io/GeoIP2-java/",target:"_blank",rel:"noopener noreferrer"},"developer documentation")))}}const lt=K;R.G.register(new R.h({},{lookupTableAdapters:[{type:"maxmind_geoip",displayName:"Geo IP - MaxMind\u2122 or IPinfo Databases",formComponent:u,summaryComponent:M,documentationComponent:lt}]}));const nt=({config:t,handleFormEvent:a,validationState:l,validationMessage:r})=>e.createElement("fieldset",null,e.createElement(n.Input,{type:"text",id:"path",name:"path",label:"File path",autoFocus:!0,required:!0,onChange:a,help:r("path","The path to the CSV file."),bsStyle:l("path"),value:t.path,labelClassName:"col-sm-3",wrapperClassName:"col-sm-9"}),e.createElement(n.Input,{type:"number",id:"check_interval",name:"check_interval",label:"Check interval",required:!0,onChange:a,help:"The interval to check if the CSV file needs a reload. (in seconds)",value:t.check_interval,labelClassName:"col-sm-3",wrapperClassName:"col-sm-9"}),e.createElement(n.Input,{type:"text",id:"separator",name:"separator",label:"Separator",required:!0,onChange:a,help:"The delimiter to use for separating entries.",value:t.separator,labelClassName:"col-sm-3",wrapperClassName:"col-sm-9"}),e.createElement(n.Input,{type:"text",id:"quotechar",name:"quotechar",label:"Quote character",required:!0,onChange:a,help:"The character to use for quoted elements.",value:t.quotechar,labelClassName:"col-sm-3",wrapperClassName:"col-sm-9"}),e.createElement(n.Input,{type:"text",id:"key_column",name:"key_column",label:"Key column",required:!0,onChange:a,help:"The column name that should be used for the key lookup.",value:t.key_column,labelClassName:"col-sm-3",wrapperClassName:"col-sm-9"}),e.createElement(n.Input,{type:"text",id:"value_column",name:"value_column",label:"Value column",required:!0,onChange:a,help:"The column name that should be used as the value for a key.",value:t.value_column,labelClassName:"col-sm-3",wrapperClassName:"col-sm-9"}),e.createElement(n.Input,{type:"checkbox",id:"case_insensitive_lookup",name:"case_insensitive_lookup",label:"Allow case-insensitive lookups",checked:t.case_insensitive_lookup,onChange:a,help:"Enable if the key lookup should be case-insensitive.",wrapperClassName:"col-md-offset-3 col-md-9"}),e.createElement(n.Input,{type:"checkbox",id:"cidr_lookup",name:"cidr_lookup",label:"CIDR lookup",checked:t.cidr_lookup,onChange:a,help:"Enable if the keys in the lookup table are in CIDR notation and lookups will be done with IPs",wrapperClassName:"col-md-offset-3 col-md-9"})),rt=({dataAdapter:t})=>{const{config:a}=t;return e.createElement("dl",null,e.createElement("dt",null,"File path"),e.createElement("dd",null,a.path),e.createElement("dt",null,"Separator"),e.createElement("dd",null,e.createElement("code",null,a.separator)),e.createElement("dt",null,"Quote character"),e.createElement("dd",null,e.createElement("code",null,a.quotechar)),e.createElement("dt",null,"Key column"),e.createElement("dd",null,a.key_column),e.createElement("dt",null,"Value column"),e.createElement("dd",null,a.value_column),e.createElement("dt",null,"Check interval"),e.createElement("dd",null,a.check_interval," seconds"),e.createElement("dt",null,"Case-insensitive lookup"),e.createElement("dd",null,a.case_insensitive_lookup?"yes":"no"),e.createElement("dt",null,"CIDR lookup"),e.createElement("dd",null,a.cidr_lookup?"yes":"no"))},ot=()=>{const t=`"ipaddr","hostname"
"127.0.0.1","localhost"
"10.0.0.1","server1"
"10.0.0.2","server2"`,a=`'ipaddr';'lladdr';'hostname'
'127.0.0.1';'e4:b2:11:d1:38:14';'localhost'
'10.0.0.1';'e4:b2:12:d1:48:28';'server1'
'10.0.0.2';'e4:b2:11:d1:58:34';'server2'`,l=`"cidr","subnet"
"192.168.100.0/24","Finance Department subnet"
"192.168.101.0/24","IT Department subnet"
"192.168.102.0/24","HR Department subnet"`;return e.createElement("div",null,e.createElement("p",null,"The CSV data adapter can read key value pairs from a CSV file."),e.createElement("p",null,"Please make sure your CSV file is formatted according to your configuration settings."),e.createElement(n.Alert,{style:{marginBottom:10},bsStyle:"info",title:"CSV file requirements"},e.createElement("ul",{className:"no-padding"},e.createElement("li",null,"The first line in the CSV file needs to be a list of field/column names"),e.createElement("li",null,"The file uses ",e.createElement("strong",null,"utf-8")," encoding"),e.createElement("li",null,"The file is readable by ",e.createElement("strong",null,"every")," Graylog server node"))),e.createElement("hr",null),e.createElement("h3",{style:{marginBottom:10}},"Example 1"),e.createElement("h5",{style:{marginBottom:10}},"Configuration"),e.createElement("p",{style:{marginBottom:10,padding:0}},"Separator: ",e.createElement("code",null,","),e.createElement("br",null),"Quote character: ",e.createElement("code",null,'"'),e.createElement("br",null),"Key column: ",e.createElement("code",null,"ipaddr"),e.createElement("br",null),"Value column: ",e.createElement("code",null,"hostname")),e.createElement("h5",{style:{marginBottom:10}},"CSV File"),e.createElement("pre",null,t),e.createElement("h3",{style:{marginBottom:10}},"Example 2"),e.createElement("h5",{style:{marginBottom:10}},"Configuration"),e.createElement("p",{style:{marginBottom:10,padding:0}},"Separator: ",e.createElement("code",null,";"),e.createElement("br",null),"Quote character: ",e.createElement("code",null,"'"),e.createElement("br",null),"Key column: ",e.createElement("code",null,"ipaddr"),e.createElement("br",null),"Value column: ",e.createElement("code",null,"hostname")),e.createElement("h5",{style:{marginBottom:10}},"CSV File"),e.createElement("pre",null,a),e.createElement("h3",{style:{marginBottom:10}},"CIDR Lookups"),e.createElement("p",{style:{marginBottom:10,padding:0}},"If this data adapter will be used to lookup IP address keys against CIDR addresses",e.createElement("br",null),"then it should be marked as a CIDR lookup. For example:",e.createElement("br",null)),e.createElement("h5",{style:{marginBottom:10}},"Configuration"),e.createElement("p",{style:{marginBottom:10,padding:0}},"Separator: ",e.createElement("code",null,","),e.createElement("br",null),"Quote character: ",e.createElement("code",null,'"'),e.createElement("br",null),"Key column: ",e.createElement("code",null,"cidr"),e.createElement("br",null),"Value column: ",e.createElement("code",null,"subnet"),e.createElement("br",null),"CIDR lookup: ",e.createElement("code",null,"true")),e.createElement("h5",{style:{marginBottom:10}},"CSV File"),e.createElement("pre",null,l),e.createElement("p",null,"Given this CSV file and configuration looking up the key 192.168.101.64 would return 'IT Department subnet'."))};var st=Object.defineProperty,it=(t,a,l)=>a in t?st(t,a,{enumerable:!0,configurable:!0,writable:!0,value:l}):t[a]=l,ie=(t,a,l)=>(it(t,typeof a!="symbol"?a+"":a,l),l);class De extends e.Component{constructor(){super(...arguments),ie(this,"_onLookupTypeSelect",a=>{const{config:l,updateConfig:r}=this.props,s=T.Z.clone(l);s.lookup_type=a,r(s)}),ie(this,"updateCacheTTLOverride",(a,l,r)=>{this._updateCacheTTLOverride(a,l,r,"cache_ttl_override")}),ie(this,"_updateCacheTTLOverride",(a,l,r,s)=>{const{config:c,updateConfig:p}=this.props,_=T.Z.clone(c);r&&a?(_[s]=r&&a?a:null,_[`${s}_enabled`]=r):(_[s]=null,_[`${s}_enabled`]=!1),_[`${s}_unit`]=r?l:null,p(_)})}render(){const{config:a,handleFormEvent:l,validationMessage:r,validationState:s}=this.props,c=[{label:"Resolve hostname to IPv4 address (A)",value:"A"},{label:"Resolve hostname to IPv6 address (AAAA)",value:"AAAA"},{label:"Resolve hostname to IPv4 and IPv6 addresses (A and AAAA)",value:"A_AAAA"},{label:"Reverse lookup (PTR)",value:"PTR"},{label:"Text lookup (TXT)",value:"TXT"}];return e.createElement("fieldset",null,e.createElement(n.Input,{label:"DNS Lookup Type",id:"lookup-type",required:!0,autoFocus:!0,help:"Select the type of DNS lookup to perform.",labelClassName:"col-sm-3",wrapperClassName:"col-sm-9"},e.createElement(m.Ph,{placeholder:"Select the type of DNS lookup",clearable:!1,options:c,matchProp:"label",onChange:this._onLookupTypeSelect,value:a.lookup_type})),e.createElement(n.Input,{type:"text",id:"server_ips",name:"server_ips",label:"DNS Server IP Address",onChange:l,help:r("server_ips","An optional comma-separated list of DNS server IP addresses."),bsStyle:s("server_ips"),value:a.server_ips,labelClassName:"col-sm-3",wrapperClassName:"col-sm-9"}),e.createElement(n.Input,{type:"number",id:"request_timeout",name:"request_timeout",label:"DNS Request Timeout",required:!0,onChange:l,help:r("request_timeout","DNS request timeout in milliseconds."),bsStyle:s("request_timeout"),value:a.request_timeout,labelClassName:"col-sm-3",wrapperClassName:"col-sm-9"}),e.createElement(m.AX,{label:"Cache TTL Override",help:"If enabled, the cache TTL will be overridden with the specified value.",update:this.updateCacheTTLOverride,value:a.cache_ttl_override,unit:a.cache_ttl_override_unit||"MINUTES",units:["MILLISECONDS","SECONDS","MINUTES","HOURS","DAYS"],enabled:a.cache_ttl_override_enabled,labelClassName:"col-sm-3",wrapperClassName:"col-sm-9"}))}}ie(De,"propTypes",{config:d().shape({request_timeout:d().number.isRequired,server_ips:d().string}).isRequired,updateConfig:d().func.isRequired,handleFormEvent:d().func.isRequired,validationMessage:d().func.isRequired,validationState:d().func.isRequired});const ut=De,Ne=({dataAdapter:t})=>{const{config:a}=t,l={A:"Resolve hostname to IPv4 address (A)",AAAA:"Resolve hostname to IPv6 address (AAAA)",A_AAAA:"Resolve hostname to IPv4 and IPv6 address (A and AAAA)",PTR:"Reverse lookup (PTR)",TXT:"Text lookup (TXT)"};return e.createElement("dl",null,e.createElement("dt",null,"DNS Lookup Type"),e.createElement("dd",null,l[a.lookup_type]),e.createElement("dt",null,"DNS Server IP Address"),e.createElement("dd",null,a.server_ips||"n/a"),e.createElement("dt",null,"DNS Request Timeout"),e.createElement("dd",null,a.request_timeout," ms"),e.createElement("dt",null,"Cache TTL Override"),e.createElement("dd",null,a.cache_ttl_override_enabled?e.createElement(m.j1,{value:a.cache_ttl_override,unit:a.cache_ttl_override_unit}):"n/a"))};Ne.propTypes={dataAdapter:d().shape({config:d().shape({lookup_type:d().string.isRequired,request_timeout:d().number.isRequired})}).isRequired};const ct=Ne;var Z=o("J6y4/h8P");const ae=Z.default.pre(({theme:t})=>(0,Z.css)`
  font-size: ${t.fonts.size.small};
`),mt=()=>{const t={marginBottom:10},a=`{
  "single_value": "34.239.63.98",
  "multi_value": {
    "results": [
      {
        "ip_address": "34.239.63.98",
        "dns_ttl": 60
      },
      {
        "ip_address": "34.238.48.57",
        "dns_ttl": 60
      }
    ]
  },
  "ttl": 60000
}`,l=`{
  "single_value": "2307:f8b0:3000:800:0:0:0:200e",
  "multi_value": {
    "results": [
      {
        "ip_address": "2307:f8b0:3000:800:0:0:0:200e",
        "dns_ttl": 77
      }
    ]
  },
  "ttl": 77000
}`,r=`{
  "single_value": "144.222.6.132",
  "multi_value": {
    "results": [
      {
        "ip_address": "144.222.6.132",
        "dns_ttl": 32,
        "ip_version": "IPv4"
      },
      {
        "ip_address": "1207:f8b1:6003:b01:0:0:0:8a",
        "dns_ttl": 299,
        "ip_version": "IPv6"
      }
    ]
  },
  "ttl": 32000
}`,s=`{
  "single_value": "c-45-216-65-41.hd1.fl.someisp.co.uk",
  "multi_value": {
    "domain": "someisp.co.uk",
    "full_domain": "c-45-216-65-41.hd1.fl.someisp.co.uk",
    "dns_ttl": "300",
  },
  "ttl": 300000
}`,c=`{
  "single_value": null,
  "multi_value": {
    "results": [
      {
        "value": "Some text value that lives in a TXT DNS",
        "dns_ttl": 300
      },
      {
        "value": "v=spf1 include:some-email-domain.org ~all.",
        "dns_ttl": 200
      }
    ]
  },
  "ttl": 200000
}`;return e.createElement("div",null,e.createElement("h3",{style:t},"Configuration"),e.createElement("h5",{style:t},"DNS Lookup Type"),e.createElement("p",{style:t},e.createElement("strong",null,"Resolve hostname to IPv4 address (A)"),": Returns both a ",e.createElement("code",null,"single_value")," containing one of the IPv4 addresses that the hostname resolves to, and a ",e.createElement("code",null,"multi_value")," containing all IPv4 addresses that the hostname resolves to. Input for this type must be a pure domain name (eg. ",e.createElement("code",null,"api.graylog.com"),")."),e.createElement(ae,null,a),e.createElement("p",{style:t},e.createElement("strong",null,"Resolve hostname to IPv6 address (AAAA)"),": Returns both a ",e.createElement("code",null,"single_value")," containing one of the IPv6 addresses that the hostname resolves to, and a ",e.createElement("code",null,"multi_value")," containing all IPv6 addresses that the hostname resolves to. Input for this type must be a pure domain name (eg. ",e.createElement("code",null,"api.graylog.com"),")."),e.createElement(ae,null,l),e.createElement("p",{style:t},e.createElement("strong",null,"Resolve hostname to IPv4 and IPv6 address (A and AAAA)"),": Returns both a ",e.createElement("code",null,"single_value")," containing one of the IPv4 or IPv6 addresses that the hostname resolves to (will return IPv4 if available), and a ",e.createElement("code",null,"multi_value")," containing all IPv4 and IPv6 addresses that the hostname resolves to. Input for this type must be a pure domain name (eg. ",e.createElement("code",null,"api.graylog.com"),")."),e.createElement(ae,null,r),e.createElement("p",{style:t},e.createElement("strong",null,"Reverse lookup (PTR)"),": Returns a ",e.createElement("code",null,"single_value")," containing the PTR value if defined for the IP address. The ",e.createElement("code",null,"domain")," field displays the domain name (with no subdomains). The ",e.createElement("code",null,"full_domain")," field displays the full un-trimmed host name/PTR value. The input for this type must be a pure IPv4 or IPv6 address (eg. ",e.createElement("code",null,"10.0.0.1")," or ",e.createElement("code",null,"2622:f3b0:4000:812::200c"),")."),e.createElement(ae,null,s),e.createElement("p",{style:t},e.createElement("strong",null,"Text lookup (TXT)"),": Returns a ",e.createElement("code",null,"multi_value")," with all TXT records defined for the hostname. Input for this type must be a pure domain name (eg. ",e.createElement("code",null,"api.graylog.com"),")."),e.createElement(ae,null,c),e.createElement("h5",{style:t},"DNS Server IP Addresses"),e.createElement("p",{style:t},"A comma-separated list of DNS server IP addresses and optional ports to use (eg. ",e.createElement("code",null,"192.168.1.1:5353, 192.168.1.244"),"). Leave this blank to use the DNS server defined for your local system. All requests use port 53 unless otherwise specified."),e.createElement("h5",{style:t},"DNS Request Timeout"),e.createElement("p",{style:t},"The DNS request timeout in milliseconds."),e.createElement("h5",{style:t},"Cache TTL Override"),e.createElement("p",{style:t},"If enabled, the TTL for this adapter's cache will be overridden with the specified value."))},Re=({handleFormEvent:t,validationState:a,validationMessage:l,config:r})=>e.createElement("fieldset",null,e.createElement(m.zX,{label:"File URL",onChange:t,validationMessage:l("url","The URL of the DSV file."),validationState:a("url"),url:r.url,labelClassName:"col-sm-3",wrapperClassName:"col-sm-9"}),e.createElement(n.Input,{type:"number",id:"refresh_interval",name:"refresh_interval",label:"Refresh interval",required:!0,onChange:t,help:"The interval to check if the DSV file needs a reload. (in seconds)",value:r.refresh_interval,labelClassName:"col-sm-3",wrapperClassName:"col-sm-9"}),e.createElement(n.Input,{type:"text",id:"separator",name:"separator",label:"Separator",required:!0,onChange:t,help:"The delimiter to use for separating columns of entries.",value:r.separator,labelClassName:"col-sm-3",wrapperClassName:"col-sm-9"}),e.createElement(n.Input,{type:"text",id:"line_separator",name:"line_separator",label:"Line Separator",required:!0,onChange:t,help:"The delimiter to use for separating lines.",value:r.line_separator,labelClassName:"col-sm-3",wrapperClassName:"col-sm-9"}),e.createElement(n.Input,{type:"text",id:"quotechar",name:"quotechar",label:"Quote character",required:!0,onChange:t,help:"The character to use for quoted elements.",value:r.quotechar,labelClassName:"col-sm-3",wrapperClassName:"col-sm-9"}),e.createElement(n.Input,{type:"text",id:"ignorechar",name:"ignorechar",label:"Ignore characters",required:!0,onChange:t,help:"Ignore lines starting with these characters.",value:r.ignorechar,labelClassName:"col-sm-3",wrapperClassName:"col-sm-9"}),e.createElement(n.Input,{type:"text",id:"key_column",name:"key_column",label:"Key column",required:!0,onChange:t,help:"The column number that should be used for the key lookup.",value:r.key_column,labelClassName:"col-sm-3",wrapperClassName:"col-sm-9"}),e.createElement(n.Input,{type:"text",id:"value_column",name:"value_column",label:"Value column",required:!0,onChange:t,help:"The column number that should be used as the value for a key.",value:r.value_column,labelClassName:"col-sm-3",wrapperClassName:"col-sm-9"}),e.createElement(n.Input,{type:"checkbox",id:"case_insensitive_lookup",name:"case_insensitive_lookup",label:"Allow case-insensitive lookups",checked:r.case_insensitive_lookup,onChange:t,help:"Enable if the key lookup should be case-insensitive.",wrapperClassName:"col-md-offset-3 col-md-9"}),e.createElement(n.Input,{type:"checkbox",id:"check_presence_only",name:"check_presence_only",label:"Check Presence Only",checked:r.check_presence_only,onChange:t,help:"Only check if key is present in table, returns boolean instead of value.",wrapperClassName:"col-md-offset-3 col-md-9"}));Re.propTypes={config:d().object.isRequired,handleFormEvent:d().func.isRequired,validationState:d().func.isRequired,validationMessage:d().func.isRequired};const dt=Re,pt=({dataAdapter:t})=>{const{config:a}=t;return e.createElement("dl",null,e.createElement("dt",null,"File URL"),e.createElement("dd",null,a.url),e.createElement("dt",null,"Separator"),e.createElement("dd",null,e.createElement("code",null,a.separator)),e.createElement("dt",null,"Line Separator"),e.createElement("dd",null,e.createElement("code",null,a.line_separator)),e.createElement("dt",null,"Quote character"),e.createElement("dd",null,e.createElement("code",null,a.quotechar)),e.createElement("dt",null,"Ignore lines starting with"),e.createElement("dd",null,e.createElement("code",null,a.ignorechar)),e.createElement("dt",null,"Key column"),e.createElement("dd",null,a.key_column),e.createElement("dt",null,"Value column"),e.createElement("dd",null,a.value_column),e.createElement("dt",null,"Check interval"),e.createElement("dd",null,a.check_interval," seconds"),e.createElement("dt",null,"Case-insensitive lookup"),e.createElement("dd",null,a.case_insensitive_lookup?"yes":"no"))},ht=()=>{const t=`"127.0.0.1","localhost"
"10.0.0.1","server1"
"10.0.0.2","server2"`,a=`'127.0.0.1';'e4:b2:11:d1:38:14'
'10.0.0.1';'e4:b2:12:d1:48:28'
'10.0.0.2';'e4:b2:11:d1:58:34'`;return e.createElement("div",null,e.createElement("p",null,"The DSV data adapter can read key value pairs (or check for the presence of a key) from a DSV file."),e.createElement("p",null,"Please make sure your DSV file is formatted according to your configuration settings."),e.createElement(n.Alert,{style:{marginBottom:10},bsStyle:"info",title:"CSV file requirements"},e.createElement("ul",{className:"no-padding"},e.createElement("li",null,"The file uses ",e.createElement("strong",null,"utf-8")," encoding"),e.createElement("li",null,"The file is accessible using the same URL by ",e.createElement("strong",null,"every")," Graylog server node"))),e.createElement("hr",null),e.createElement("h3",{style:{marginBottom:10}},"Example 1"),e.createElement("h5",{style:{marginBottom:10}},"Configuration"),e.createElement("p",{style:{marginBottom:10,padding:0}},"Separator: ",e.createElement("code",null,","),e.createElement("br",null),"Quote character: ",e.createElement("code",null,'"'),e.createElement("br",null)),e.createElement("h5",{style:{marginBottom:10}},"DSV File"),e.createElement("pre",null,t),e.createElement("h3",{style:{marginBottom:10}},"Example 2"),e.createElement("h5",{style:{marginBottom:10}},"Configuration"),e.createElement("p",{style:{marginBottom:10,padding:0}},"Separator: ",e.createElement("code",null,";"),e.createElement("br",null),"Quote character: ",e.createElement("code",null,"'"),e.createElement("br",null)),e.createElement("h5",{style:{marginBottom:10}},"DSV File"),e.createElement("pre",null,a))};class ke extends e.Component{constructor(){super(...arguments),this.onHTTPHeaderUpdate=a=>{const{config:l,updateConfig:r}=this.props,s=T.Z.clone(l);s.headers=a,r(s)}}render(){const{config:a,handleFormEvent:l,validationMessage:r,validationState:s}=this.props;return e.createElement("fieldset",null,e.createElement(m.zX,{label:"Lookup URL",onChange:l,validationMessage:r("url","The URL for the lookup. (this is a template - see documentation)"),validationState:s("url"),url:a.url,labelClassName:"col-sm-3",wrapperClassName:"col-sm-9",urlType:"regex"}),e.createElement(n.Input,{type:"text",id:"single_value_jsonpath",name:"single_value_jsonpath",label:"Single value JSONPath",required:!0,onChange:l,help:r("single_value_jsonpath","The JSONPath string to get the single value from the response."),bsStyle:s("single_value_jsonpath"),value:a.single_value_jsonpath,labelClassName:"col-sm-3",wrapperClassName:"col-sm-9"}),e.createElement(n.Input,{type:"text",id:"multi_value_jsonpath",name:"multi_value_jsonpath",label:"Multi value JSONPath",onChange:l,help:r("multi_value_jsonpath","The JSONPath string to get the multi value from the response. Needs to return a list or map. (optional)"),bsStyle:s("multi_value_jsonpath"),value:a.multi_value_jsonpath,labelClassName:"col-sm-3",wrapperClassName:"col-sm-9"}),e.createElement(n.Input,{type:"text",id:"user_agent",name:"user_agent",label:"HTTP User-Agent",required:!0,onChange:l,help:"The User-Agent header to use for the HTTP request.",value:a.user_agent,labelClassName:"col-sm-3",wrapperClassName:"col-sm-9"}),e.createElement(n.Input,{id:"http_headers",label:"HTTP Headers",help:"The custom HTTP headers to use for the HTTP request. Multiple values must be comma-separated.",labelClassName:"col-sm-3",wrapperClassName:"col-sm-9"},e.createElement(m.vu,{pairs:a.headers||{},editable:!0,onChange:this.onHTTPHeaderUpdate})))}}ke.propTypes={config:d().object.isRequired,updateConfig:d().func.isRequired,handleFormEvent:d().func.isRequired,validationState:d().func.isRequired,validationMessage:d().func.isRequired};const Et=ke,Ie=({dataAdapter:t})=>{const{config:a}=t;return e.createElement("dl",null,e.createElement("dt",null,"Lookup URL"),e.createElement("dd",null,a.url),e.createElement("dt",null,"Single value JSONPath"),e.createElement("dd",null,e.createElement("code",null,a.single_value_jsonpath)),e.createElement("dt",null,"Multi value JSONPath"),e.createElement("dd",null,e.createElement("code",null,a.multi_value_jsonpath)),e.createElement("dt",null,"HTTP User-Agent"),e.createElement("dd",null,a.user_agent),e.createElement("dt",null,"HTTP Headers"),e.createElement("dd",null,e.createElement(m.vu,{pairs:a.headers||{}})))};Ie.propTypes={dataAdapter:d().object.isRequired};const gt=Ie,_t=()=>{const t=`{
  "user": {
    "login": "jane",
    "full_name": "Jane Doe",
    "roles": ["admin", "developer"],
    "contact": {
      "email": "[email protected]",
      "cellphone": "+49123456789"
    }
  }
}`,a='{"value": "Jane Doe"}',l=`{
  "login": "jane",
  "full_name": "Jane Doe",
  "roles": ["admin", "developer"],
  "contact": {
    "email": "[email protected]",
    "cellphone": "+49123456789"
  }
}`,r=`{
  "email": "[email protected]",
  "cellphone": "+49123456789"
}`,s=`{
  "value": ["admin", "developer"]
}`,c=`rule "lookup user"
when has_field("user_login")
then
  // Get the user login from the message
  let userLogin = to_string($message.user_login);
  // Lookup the single value, in our case the full name, in the user-api lookup table
  let userName = lookup_value("user-api", userLogin);
  // Set the field "user_name" in the message
  set_field("user_name", userName)

  // Lookup the multi value in the user-api lookup table
  let userData = lookup("user-api", userLogin);
  // Set the email and cellphone as fields in the message
  set_field("user_email", userData["email"]);
  set_field("user_cellphone", userData["cellphone"]);
end`;return e.createElement("div",null,e.createElement("p",null,"The HTTPJSONPath data adapter executes ",e.createElement("em",null,"HTTP GET")," requests to lookup a key and parses the result based on configured JSONPath expressions."),e.createElement(n.Alert,{style:{marginBottom:10},bsStyle:"info"},"Every lookup table result has two values. A ",e.createElement("em",null,"single value")," and a ",e.createElement("em",null,"multi value"),". The single value will be used when the lookup result is expected to be a string, number or boolean. The multi value will be used when the lookup result is expected to be a map or list."),e.createElement("h3",{style:{marginBottom:10}},"Configuration"),e.createElement("h5",{style:{marginBottom:10}},"Lookup URL"),e.createElement("p",{style:{marginBottom:10,padding:0}},"The URL that will be used for the HTTP request. To use the ",e.createElement("em",null,"lookup key")," in the URL, the",e.createElement("code",null,"${key}"),"value can be used. This variable will be replaced by the actual key that is passed to a lookup function. ",e.createElement("br",null),"(example: ",e.createElement("code",null,"https://example.com/api/lookup?key=${key}"),")"),e.createElement("h5",{style:{marginBottom:10}},"Single value JSONPath"),e.createElement("p",{style:{marginBottom:10,padding:0}},"This JSONPath expression will be used to parse the ",e.createElement("em",null,"single value")," of the lookup result. (example: ",e.createElement("code",null,"$.user.full_name"),")"),e.createElement("h5",{style:{marginBottom:10}},"Multi value JSONPath"),e.createElement("p",{style:{marginBottom:10,padding:0}},"This JSONPath expression will be used to parse the ",e.createElement("em",null,"multi value")," of the lookup result. (example: ",e.createElement("code",null,"$.users[*]"),") The multi value JSONPath setting is ",e.createElement("em",null,"optional"),". Without it, the single value is also present in the multi value result."),e.createElement("h5",{style:{marginBottom:10}},"HTTP User-Agent"),e.createElement("p",{style:{marginBottom:10,padding:0}},"This is the ",e.createElement("em",null,"User-Agent")," header that will be used for the HTTP requests. You should include some contact details so owners of the services you query know whom to contact if issues arise. (like excessive API requests from your Graylog cluster)"),e.createElement("hr",null),e.createElement("h3",{style:{marginBottom:10}},"Example"),e.createElement("p",null,"This shows an example configuration and the values that will be returned from a lookup.",e.createElement("br",null),"The configured URL is ",e.createElement("strong",null,"https://example.com/api/users/${key}")," and the ",e.createElement("code",null,"${key}"),"gets replaced by ",e.createElement("strong",null,"jane")," during the lookup request."),e.createElement("p",null,"This is the resulting JSON document:"),e.createElement("pre",null,t),e.createElement(n.Row,null,e.createElement(n.Col,{md:4},e.createElement("h5",{style:{marginBottom:10}},"Configuration"),e.createElement("p",{style:{marginBottom:10,padding:0}},"Single value JSONPath: ",e.createElement("code",null,"$.user.full_name"),e.createElement("br",null),"Multi value JSONPath: ",e.createElement("em",null,"empty"),e.createElement("br",null))),e.createElement(n.Col,{md:8},e.createElement("h5",{style:{marginBottom:10}},"Result"),e.createElement("p",{style:{marginBottom:10,padding:0}},"Single value: ",e.createElement("code",null,"Jane Doe"),e.createElement("br",null),"Multi value:"),e.createElement("pre",null,a))),e.createElement(n.Row,null,e.createElement(n.Col,{md:4},e.createElement("h5",{style:{marginBottom:10}},"Configuration"),e.createElement("p",{style:{marginBottom:10,padding:0}},"Single value JSONPath: ",e.createElement("code",null,"$.user.full_name"),e.createElement("br",null),"Multi value JSONPath: ",e.createElement("code",null,"$.user"),e.createElement("br",null))),e.createElement(n.Col,{md:8},e.createElement("h5",{style:{marginBottom:10}},"Result"),e.createElement("p",{style:{marginBottom:10,padding:0}},"Single value: ",e.createElement("code",null,"Jane Doe"),e.createElement("br",null),"Multi value:"),e.createElement("pre",null,l))),e.createElement(n.Row,null,e.createElement(n.Col,{md:4},e.createElement("h5",{style:{marginBottom:10}},"Configuration"),e.createElement("p",{style:{marginBottom:10,padding:0}},"Single value JSONPath: ",e.createElement("code",null,"$.user.contact.email"),e.createElement("br",null),"Multi value JSONPath: ",e.createElement("code",null,"$.user.roles[*]"),e.createElement("br",null))),e.createElement(n.Col,{md:8},e.createElement("h5",{style:{marginBottom:10}},"Result"),e.createElement("p",{style:{marginBottom:10,padding:0}},"Single value: ",e.createElement("code",null,"[email protected]"),e.createElement("br",null),"Multi value:"),e.createElement("pre",null,s))),e.createElement(n.Row,null,e.createElement(n.Col,{md:4},e.createElement("h5",{style:{marginBottom:10}},"Configuration"),e.createElement("p",{style:{marginBottom:10,padding:0}},"Single value JSONPath: ",e.createElement("code",null,"$.user.full_name"),e.createElement("br",null),"Multi value JSONPath: ",e.createElement("code",null,"$.user.contact"),e.createElement("br",null))),e.createElement(n.Col,{md:8},e.createElement("h5",{style:{marginBottom:10}},"Result"),e.createElement("p",{style:{marginBottom:10,padding:0}},"Single value: ",e.createElement("code",null,"Jane Doe"),e.createElement("br",null),"Multi value:"),e.createElement("pre",null,r))),e.createElement("h5",{style:{marginBottom:10}},"Pipeline Rule"),e.createElement("p",null,"This is an example pipeline rule that uses the example data from our last configuration example."),e.createElement("pre",null,c))};R.G.register(new R.h({},{lookupTableAdapters:[{type:"csvfile",displayName:"CSV File",formComponent:nt,summaryComponent:rt,documentationComponent:ot},{type:"dnslookup",displayName:"DNS Lookup",formComponent:ut,summaryComponent:ct,documentationComponent:mt},{type:"dsvhttp",displayName:"DSV File from HTTP",formComponent:dt,summaryComponent:pt,documentationComponent:ht},{type:"httpjsonpath",displayName:"HTTP JSONPath",formComponent:Et,summaryComponent:gt,documentationComponent:_t}]}));const vt=()=>null,ft=e.forwardRef(vt),yt=()=>e.createElement("p",null,"This cache has no configuration.");var V=o("UiXZqrDE");const Ct=({config:t},a)=>{var l;const{values:r,setValues:s,errors:c}=(0,V.useFormikContext)(),[p,_]=e.useState({...t});e.useEffect(()=>_({...t}),[t]);const E=()=>{const C={};return r.config.max_size||(C.max_size="Required"),r.config.max_size<0&&(C.max_size="Must be 0 or a positive number"),C};e.useImperativeHandle(a,()=>({validate:()=>E()}));const b=C=>(v,f,y)=>{const A={...p},D={...r.config};A[C]=y?v:0,A[`${C}_unit`]=f,D[C]=y?v:0,D[`${C}_unit`]=f,_(A),s({...r,config:D})};return e.createElement("fieldset",{ref:a},e.createElement(m.Fe,{type:"text",name:"config.max_size",label:"* Maximum entries",required:!0,help:(l=c.config)!=null&&l.max_size?null:"The limit of the number of entries the cache keeps in memory.",labelClassName:"col-sm-3",wrapperClassName:"col-sm-9"}),e.createElement(m.AX,{label:"Expire after access",help:"If enabled, entries are removed from the cache after the specified time from when they were last used.",update:b("expire_after_access"),name:"config.expire_after_access",unitName:"config.expire_after_access_unit",value:p.expire_after_access,unit:p.expire_after_access_unit||"SECONDS",defaultEnabled:t.expire_after_access>0,labelClassName:"col-sm-3",wrapperClassName:"col-sm-9"}),e.createElement(m.AX,{label:"Expire after write",help:"If enabled, entries are removed from the cache after the specified time from when they were first used.",update:b("expire_after_write"),name:"config.expire_after_write",unitName:"config.expire_after_write_unit",value:p.expire_after_write,unit:p.expire_after_write_unit||"SECONDS",defaultEnabled:t.expire_after_write>0,labelClassName:"col-sm-3",wrapperClassName:"col-sm-9"}))},bt=e.forwardRef(Ct),Oe=Z.default.div`
  display: inline-block;
  margin: 16px 0;
`,ue=Z.default.div`
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
`,ce=Z.default.span`
  font-weight: bold;
  min-width: 180px;
`,me=Z.default.span`
  padding: 6px 10px;
  width: 100%;
  min-width: 130px;
`,Tt=({cache:t})=>e.createElement(Oe,null,e.createElement(ue,null,e.createElement(ce,null,"Maximum entries:"),e.createElement(me,{style:{borderBottom:"1px solid #eee"}},t.config.max_size)),e.createElement(ue,null,e.createElement(ce,null,"Expire after access:"),e.createElement(me,{style:{borderBottom:"1px solid #eee"}},e.createElement(m.j1,{value:t.config.expire_after_access,unit:t.config.expire_after_access_unit}))),e.createElement(ue,null,e.createElement(ce,null,"Expire after write:"),e.createElement(me,null,e.createElement(m.j1,{value:t.config.expire_after_write,unit:t.config.expire_after_write_unit})))),At=()=>e.createElement("div",null,e.createElement("p",null,"The in-memory cache maintains recently used values from data adapters."),e.createElement("p",null,"Please make sure your Graylog servers have enough heap to accomodate the cached entries and monitor the cache efficiency."),e.createElement(n.Alert,{style:{marginBottom:10},bsStyle:"info",title:"Implementation details"},e.createElement("p",null,"The cache is local to each Graylog server, they do not share the entries."),e.createElement("p",null,"For example, if you have two servers, they will maintain a completely independent cache from each other.")),e.createElement("hr",null),e.createElement("h3",{style:{marginBottom:10}},"Cache size"),e.createElement("p",null,"Every cache has a maximum number of entries, unbounded caches are not supported."),e.createElement("h3",{style:{marginBottom:10}},"Time-based expiration"),e.createElement("h5",{style:{marginBottom:10}},"Expire after access"),e.createElement("p",{style:{marginBottom:10,padding:0}},"The cache will remove entries after a fixed time since they have been used the last time.",e.createElement("br",null),"This results in the cache behaving as a space limited least recently used cache."),e.createElement("h5",{style:{marginBottom:10}},"Expire after write"),e.createElement("p",{style:{marginBottom:10,padding:0}},"The cache will remove entries after a fixed time since they have been entered into the cache.",e.createElement("br",null),"This results in entries that are never older than the given time, which can be important for regularly changing data, such as configuration state of external systems."));R.G.register(new R.h({},{lookupTableCaches:[{type:"none",displayName:"Do not cache values",formComponent:ft,summaryComponent:yt,documentationComponent:null},{type:"guava_cache",displayName:"Node-local, in-memory cache",formComponent:bt,summaryComponent:Tt,documentationComponent:At}]}));var W=o("ty2gyrHp"),x=o("d4kzUuQm"),j=o("xPjmrmtt"),J=o("leXY1Rul"),le=o("/7OuCFNo"),ne=o("8OvTct/Z"),X=o("v4GbOr/o");const Pt=(0,Z.default)(n.ButtonToolbar)`
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
`,Le=({table:t,cache:a,dataAdapter:l,errors:r})=>{const s=(0,le.Z)(),c=(0,ne.Z)(),{loadingScopePermissions:p,scopePermissions:_}=(0,J.Z)(t),E=e.useCallback(()=>{c(X.A.LUT.DELETED,{app_pathname:"lut",app_section:"lut"}),window.confirm(`Are you sure you want to delete lookup table "${t.title}"?`)&&j.H.delete(t.id).then(()=>{j.H.reloadPage()})},[t.id,t.title,c]),b=e.useCallback(()=>{s.push(x.ZP.SYSTEM.LOOKUPTABLES.edit(t.name))},[s,t.name]);return e.createElement("tbody",null,e.createElement("tr",null,e.createElement("td",null,r.table&&e.createElement(re,{placement:"right",errorText:r.table,title:"Lookup Table problem"}),e.createElement(W.r,{to:x.ZP.SYSTEM.LOOKUPTABLES.show(t.name)},t.title)),e.createElement("td",null,t.description),e.createElement("td",null,t.name),e.createElement("td",null,r.cache&&e.createElement(re,{placement:"bottom",errorText:r.cache,title:"Cache problem"}),e.createElement(W.r,{to:x.ZP.SYSTEM.LOOKUPTABLES.CACHES.show(a.name)},a.title)),e.createElement("td",null,r.dataAdapter&&e.createElement(re,{placement:"bottom",errorText:r.dataAdapter,title:"Data adapter problem"}),e.createElement(W.r,{to:x.ZP.SYSTEM.LOOKUPTABLES.DATA_ADAPTERS.show(l.name)},l.title)),e.createElement("td",null,p?e.createElement(m.$j,null):_.is_mutable&&e.createElement(Pt,null,e.createElement(n.Button,{bsSize:"xsmall",onClick:b,role:"button",name:"edit"},"Edit"),e.createElement(n.Button,{bsSize:"xsmall",bsStyle:"danger",onClick:E,role:"button",name:"delete"},"Delete")))))};Le.defaultProps={errors:{table:null,cache:null,dataAdapter:null}};const St=Le;var ge=o("XyJ0Mvpg"),Dt=o("dFpwyWHg"),we=o.n(Dt),Nt=o("C2ikvoS0"),Be=o.n(Nt),Rt=o("1IntWRSu"),xe=o.n(Rt),kt=o("8nGWeFnd"),Me=o.n(kt),It=o("TeAcaicX"),Ue=o.n(It),Ot=o("eE3+5goe"),Fe=o.n(Ot),de=o("eCBhU9Q5"),Q={};Q.styleTagTransform=Fe(),Q.setAttributes=Me(),Q.insert=xe().bind(null,"head"),Q.domAPI=Be(),Q.insertStyleElement=Ue();var $a=we()(de.Z,Q);const L=de.Z&&de.Z.locals?de.Z.locals:void 0,Lt=Z.default.div`
  overflow-x: auto;
`,wt=()=>e.createElement(n.Popover,{id:"search-query-help",className:L.popoverWide,title:"Search Syntax Help"},e.createElement("p",null,e.createElement("strong",null,"Available search fields")),e.createElement(n.Table,{condensed:!0},e.createElement("thead",null,e.createElement("tr",null,e.createElement("th",null,"Field"),e.createElement("th",null,"Description"))),e.createElement("tbody",null,e.createElement("tr",null,e.createElement("td",null,"id"),e.createElement("td",null,"Lookup Table ID")),e.createElement("tr",null,e.createElement("td",null,"title"),e.createElement("td",null,"The title of the lookup table")),e.createElement("tr",null,e.createElement("td",null,"name"),e.createElement("td",null,"The reference name of the lookup table")),e.createElement("tr",null,e.createElement("td",null,"description"),e.createElement("td",null,"The description of lookup table")))),e.createElement("p",null,e.createElement("strong",null,"Examples")),e.createElement("p",null,"Find lookup tables by parts of their names:",e.createElement("br",null),e.createElement("kbd",null,"name:geoip"),e.createElement("br",null),e.createElement("kbd",null,"name:geo")),e.createElement("p",null,"Searching without a field name matches against the ",e.createElement("code",null,"title")," field:",e.createElement("br",null),e.createElement("kbd",null,"geoip")," ",e.createElement("br",null),"is the same as",e.createElement("br",null),e.createElement("kbd",null,"title:geoip"))),Bt=e.createElement(m.Ox,{trigger:"click",rootClose:!0,placement:"right",overlay:wt()},e.createElement(n.Button,{bsStyle:"link",className:L.searchHelpButton},e.createElement(m.JO,{name:"question-circle",fixedWidth:!0}))),xt=({table:t,caches:a,dataAdapters:l,errorStates:r})=>{const s=(b,C)=>{const v={title:"none"};return C&&C[b]||v},c=()=>{if(r.dataAdapters&&l){const b=l[t.data_adapter_id];return b?r.dataAdapters[b.name]:null}return null},p=s(t.cache_id,a),_=s(t.data_adapter_id,l),E={table:r.tables[t.name],cache:null,dataAdapter:c()};return e.createElement(St,{table:t,cache:p,dataAdapter:_,errors:E})},Mt=({query:t})=>e.createElement("tbody",null,e.createElement("tr",null,e.createElement("td",{colSpan:6},t?e.createElement(m.pJ,null,'No tables found with title "',t,'"'):e.createElement(m.dX,null,"There are no data adapters to list")))),Ut=({tables:t,caches:a,dataAdapters:l,query:r,errorStates:s})=>t.length>0?e.createElement(e.Fragment,null,t.map(c=>e.createElement(xt,{key:`table-item-${c.id}`,table:c,caches:a,dataAdapters:l,errorStates:s}))):e.createElement(Mt,{query:r}),Ft=({tables:t,caches:a,dataAdapters:l,pagination:r,errorStates:s,paginationQueryParameter:c})=>{const[p,_]=e.useState(!1),[E,b]=e.useState({currentPage:c.page||1,currentPageSize:c.pageSize||10,currentQuery:r.query?decodeURI(r.query):"",resetPage:c.resetPage,setPagination:c.setPagination});e.useEffect(()=>{const{currentPage:y,currentPageSize:A,currentQuery:D}=E;j.H.searchPaginated(y,A,D).then(()=>_(!1))},[E]);const C=e.useCallback((y,A)=>{b({...E,currentPage:y,currentPageSize:A})},[E]),v=e.useCallback(y=>{E.resetPage(),E.setPagination({page:1,pageSize:E.currentPageSize}),b({...E,currentPage:1,currentQuery:y})},[E]),f=e.useCallback(()=>{E.resetPage(),E.setPagination({page:1,pageSize:E.currentPageSize}),b({...E,currentPage:1,currentQuery:""})},[E]);return e.createElement(n.Row,{className:"content"},e.createElement(n.Col,{md:12},e.createElement("h2",{style:{marginBottom:16}},"Configured lookup tables ",e.createElement("small",null,r.total," total")),e.createElement(m.l9,{activePage:E.currentPage,pageSize:E.currentPageSize,onChange:C,totalItems:r.total},e.createElement(m.UI,{onSearch:v,onReset:f,queryHelpComponent:Bt}),e.createElement(Lt,null,e.createElement(n.Table,{condensed:!0,hover:!0,className:L.overviewTable},e.createElement("thead",null,e.createElement("tr",null,e.createElement("th",{className:L.rowTitle},"Title"),e.createElement("th",{className:L.rowDescription},"Description"),e.createElement("th",{className:L.rowName},"Name"),e.createElement("th",{className:L.rowCache},"Cache"),e.createElement("th",{className:L.rowAdapter},"Data Adapter"),e.createElement("th",{className:L.rowActions},"Actions"))),p?e.createElement(m.$j,{text:"Loading data adapters"}):e.createElement(Ut,{tables:t,caches:a,dataAdapters:l,query:E.currentQuery,errorStates:s}))))))},Zt=(0,ge.Z)(Ft);var Ze=o("yAXMqwrl");const pe={value:"",valid:!1},Ht=({table:t,cache:a,dataAdapter:l})=>{const r=(0,Ze.useNavigate)(),{loadingScopePermissions:s,scopePermissions:c}=(0,J.Z)(t),[p,_]=e.useState(pe),[E,b]=e.useState(pe),[C,v]=e.useState(null),f=I=>()=>{r(x.ZP.SYSTEM.LOOKUPTABLES.edit(I))},y=I=>{const $=I.target.name==="purgekey"?{...p}:{...E};switch($.valid=I.target.value&&I.target.value.replace(/\s/g,"").length>0,$.value=I.target.value,I.target.name){case"purgekey":_($);break;case"lookupkey":b($),v(null);break;default:break}},A=I=>{I.preventDefault(),p.valid&&j.H.purgeKey(t,p.value).then(()=>{_(pe)})},D=I=>{I.preventDefault(),j.H.purgeAll(t)},U=I=>{I.preventDefault(),E.valid&&j.H.lookup(t.name,E.value).then($=>{v(JSON.stringify($,null,2)),b(pe)})};return e.createElement(n.Row,{className:"content"},e.createElement(n.Col,{md:6},e.createElement("h2",null,t.title),e.createElement("p",null,t.description),e.createElement("dl",null,e.createElement("dt",null,"Data adapter"),e.createElement("dd",null,e.createElement(W.r,{to:x.ZP.SYSTEM.LOOKUPTABLES.DATA_ADAPTERS.show(l.name)},l.title)),e.createElement("dt",null,"Cache"),e.createElement("dd",null,e.createElement(W.r,{to:x.ZP.SYSTEM.LOOKUPTABLES.CACHES.show(a.name)},a.title))),!s&&(c==null?void 0:c.is_mutable)&&e.createElement(n.Button,{bsStyle:"success",onClick:f(t.name),role:"button",name:"edit"},"Edit"),(t.default_single_value||t.default_multi_value)&&e.createElement("dl",null,e.createElement("dt",null,"Default single value"),e.createElement("dd",null,e.createElement("code",null,t.default_single_value)," ","(",t.default_single_value_type.toLowerCase(),")"),e.createElement("dt",null,"Default multi value"),e.createElement("dd",null,e.createElement("code",null,t.default_multi_value)," ","(",t.default_multi_value_type.toLowerCase(),")")),e.createElement("hr",null),e.createElement("h2",null,"Purge Cache"),e.createElement("p",null,"You can purge the complete cache for this lookup table or only the cache entry for a single key."),e.createElement("form",{onSubmit:A},e.createElement("fieldset",null,e.createElement(n.Input,{type:"text",id:"purge-key",name:"purgekey",placeholder:"Insert key which should be purged",label:"Key",onChange:y,help:"Key to purge from cache",required:!0,value:p.value}),e.createElement(n.ButtonToolbar,null,e.createElement(n.Button,{type:"submit",bsStyle:"success",disabled:!p.valid},"Purge key"),e.createElement(n.Button,{type:"button",bsStyle:"info",onClick:D},"Purge all"))))),e.createElement(n.Col,{md:6},e.createElement("h2",null,"Test lookup"),e.createElement("p",null,"You can manually query the lookup table using this form. The data will be cached as configured by Graylog."),e.createElement("form",{onSubmit:U},e.createElement("fieldset",null,e.createElement(n.Input,{type:"text",id:"key",name:"lookupkey",placeholder:"Insert key that should be looked up",label:"Key",required:!0,onChange:y,help:"Key to look up a value for.",value:E.value}),e.createElement(n.Button,{type:"submit",name:"lookupbutton",bsStyle:"success",disabled:!E.valid},"Look up"))),C&&e.createElement("div",{style:{marginTop:"16px"}},e.createElement("h4",null,"Lookup result"),e.createElement("pre",null,C))))};var $t=o("RjO1iR6D"),Kt=o.n($t);const He={id:void 0,title:"",description:"",name:"",cache_id:void 0,data_adapter_id:void 0,enable_single_value:!1,default_single_value:"",default_single_value_type:"NULL",enable_multi_value:!1,default_multi_value:"",default_multi_value_type:"NULL",content_pack:null},_e=({saved:t,create:a,table:l})=>{const{loadingScopePermissions:r,scopePermissions:s}=(0,J.Z)(l),c=(0,le.Z)(),p=(0,ne.Z)(),_=f=>{const y={};return["title","name","cache_id","data_adapter_id","cache_id","default_single_value","default_multi_value"].forEach(D=>{if(!f[D]){if(D==="default_single_value"&&!f.enable_single_value||D==="default_multi_value"&&!f.enable_multi_value)return;y[D]="Required"}}),y},E=f=>{p(X.A.LUT[a?"CREATED":"UPDATED"],{app_pathname:"lut",app_section:"lut"});let y;const A=Kt()(f,["enable_single_value","enable_multi_value"]);return a?y=j.H.create(A):y=j.H.update(A),y.then(()=>{t()})},b={...He,...l,enable_single_value:l.default_single_value!=="",enable_multi_value:l.default_multi_value!==""},C=()=>c.push(x.ZP.SYSTEM.LOOKUPTABLES.OVERVIEW),v=!a&&!r&&(s==null?void 0:s.is_mutable);return e.createElement(V.Formik,{initialValues:b,validate:_,enableReinitialize:!0,onSubmit:async(f,y)=>{const A=await y.validateForm();return Object.keys(A).length===0?E(f):Promise.resolve()}},({values:f,errors:y,touched:A,setFieldValue:D,setFieldTouched:U,setValues:I,isSubmitting:$})=>e.createElement(V.Form,{className:"form form-horizontal"},e.createElement("fieldset",null,e.createElement(m.Fe,{type:"text",name:"title",label:"Title",help:A.title&&y.title?void 0:"A short title for this lookup table.",labelClassName:"col-sm-3",wrapperClassName:"col-sm-9"}),e.createElement(m.Fe,{type:"text",name:"description",label:"Description",help:"Description of the lookup table.",labelClassName:"col-sm-3",wrapperClassName:"col-sm-9"}),e.createElement(m.Fe,{type:"text",name:"name",label:"Name",help:A.name&&y.name?void 0:"The name that is being used to refer to this lookup table. Must be unique.",labelClassName:"col-sm-3",wrapperClassName:"col-sm-9"}),e.createElement(n.Input,{id:"enable_single_value",name:"enable_single_value",type:"checkbox",label:"Enable single default value",help:"Enable if the lookup table should provide a default for the single value.",wrapperClassName:"col-md-offset-3 col-md-9",checked:f.enable_single_value,onChange:()=>{D("enable_single_value",!f.enable_single_value),f.enable_single_value&&(D("default_single_value",""),D("default_single_value_type","NULL"))}}),f.enable_single_value&&e.createElement(m.Ii,{label:"Default single value",help:A.default_single_value&&y.default_single_value||"The single value that is being used as lookup result if the data adapter or cache does not find a value.",validationState:A.default_single_value&&y.default_single_value?"error":void 0,onBlur:()=>U("default_single_value",!0),update:(oe,se)=>{I({...f,default_single_value:oe,default_single_value_type:se})},value:f.default_single_value,valueType:f.default_single_value_type||"NULL",allowedTypes:["STRING","NUMBER","BOOLEAN","NULL"],labelClassName:"col-sm-3",wrapperClassName:"col-sm-9"}),e.createElement(n.Input,{id:"enable_multi_value",name:"enable_multi_value",type:"checkbox",label:"Enable multi default value",help:"Enable if the lookup table should provide a default for the multi value.",wrapperClassName:"col-md-offset-3 col-md-9",checked:f.enable_multi_value,onChange:()=>{D("enable_multi_value",!f.enable_multi_value),f.enable_multi_value&&(D("default_multi_value",""),D("default_multi_value_type","NULL"))}}),f.enable_multi_value&&e.createElement(m.Ii,{label:"Default multi value",help:A.default_multi_value&&y.default_multi_value||"The multi value that is being used as lookup result if the data adapter or cache does not find a value.",validationState:A.default_multi_value&&y.default_multi_value?"error":void 0,onBlur:()=>U("default_multi_value",!0),update:(oe,se)=>{I({...f,default_multi_value:oe,default_multi_value_type:se})},value:f.default_multi_value,valueType:f.default_multi_value_type||"NULL",allowedTypes:["OBJECT","NULL"],labelClassName:"col-sm-3",wrapperClassName:"col-sm-9"})),e.createElement(et,null,e.createElement(Qe,null)),e.createElement(qe,null,e.createElement(ze,null)),e.createElement("fieldset",null,e.createElement(n.Row,null,e.createElement(n.Col,{mdOffset:3,md:9},a&&e.createElement(m.Ow,{submitButtonText:"Create lookup table",submitLoadingText:"Creating lookup table...",isSubmitting:$,isAsyncSubmit:!0,onCancel:C}),v&&e.createElement(m.Ow,{submitButtonText:"Update lookup table",submitLoadingText:"Updating lookup table...",isSubmitting:$,isAsyncSubmit:!0,onCancel:C}))))))};_e.propTypes={saved:d().func.isRequired,create:d().bool,table:d().object},_e.defaultProps={create:!0,table:He};const $e=_e;var Wt=Object.defineProperty,jt=(t,a,l)=>a in t?Wt(t,a,{enumerable:!0,configurable:!0,writable:!0,value:l}):t[a]=l,ve=(t,a,l)=>(jt(t,typeof a!="symbol"?a+"":a,l),l);class fe extends e.Component{constructor(){super(...arguments),ve(this,"state",{table:void 0})}render(){return e.createElement("div",null,e.createElement(n.Row,{className:"content"},e.createElement(n.Col,{lg:8},e.createElement($e,{saved:this.props.saved,create:!0,validate:this.props.validate,validationErrors:this.props.validationErrors}))))}}ve(fe,"propTypes",{saved:d().func.isRequired,validate:d().func,validationErrors:d().object}),ve(fe,"defaultProps",{validate:null,validationErrors:{}});const Jt=fe;var ee=o("nKnTKuph"),Ke=o("zkmy/ViL"),Y=o("s67As4Iu"),zt=o("CrIFpfDF");const Vt=(0,Z.default)(zt.Z)`
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
`,Yt=({cache:t})=>{const a=(0,le.Z)(),{loadingScopePermissions:l,scopePermissions:r}=(0,J.Z)(t),s=(0,ne.Z)(),c={requests:`org.graylog2.lookup.caches.${t.id}.requests`,hits:`org.graylog2.lookup.caches.${t.id}.hits`,misses:`org.graylog2.lookup.caches.${t.id}.misses`},p={count:`org.graylog2.lookup.caches.${t.id}.entries`},_=v=>{const f=Object.keys(v).reduce((y,A)=>y+(Number.isNaN(v[A].count.metric.value)?0:v[A].count.metric.value),0);return f<0?"N/A":Ke.Z.formatNumber(f)},E=v=>{const f=Object.keys(v).reduce((U,I)=>U+(Number.isNaN(v[I].hits.metric.rate.total)?0:v[I].hits.metric.rate.total),0),y=Object.keys(v).reduce((U,I)=>U+(Number.isNaN(v[I].misses.metric.rate.total)?0:v[I].misses.metric.rate.total),0),A=f+y;if(A<1)return"N/A";const D=f*100/A;return`${Ke.Z.formatNumber(D)}%`},b=e.useCallback(()=>{a.push(x.ZP.SYSTEM.LOOKUPTABLES.CACHES.edit(t.name))},[a,t.name]),C=e.useCallback(()=>{window.confirm(`Are you sure you want to delete cache "${t.title}"?`)&&Y.Z.delete(t.id).then(()=>{s(X.A.LUT.CACHE_DELETED,{app_pathname:"lut",app_section:"lut_cache"}),Y.Z.reloadPage()})},[t.title,t.id,s]);return e.createElement("tbody",null,e.createElement("tr",null,e.createElement("td",null,e.createElement(W.r,{to:x.ZP.SYSTEM.LOOKUPTABLES.CACHES.show(t.name)},t.title)),e.createElement("td",null,t.description),e.createElement("td",null,t.name),e.createElement("td",null,e.createElement(ee.Jt,{map:p,computeValue:_})),e.createElement("td",null,e.createElement(ee.Jt,{map:c,computeValue:E})),e.createElement("td",null,e.createElement(ee.CL,{name:`org.graylog2.lookup.caches.${t.id}.requests`},e.createElement(ee.qb,{suffix:"lookups/s"}))),e.createElement("td",null,l?e.createElement(m.$j,null):r.is_mutable&&e.createElement(Vt,null,e.createElement(n.Button,{bsSize:"xsmall",onClick:b,role:"button",name:"edit"},"Edit"),e.createElement(n.Button,{bsSize:"xsmall",bsStyle:"danger",onClick:C,role:"button",name:"delete"},"Delete")))))},qt=Z.default.div`
  overflow-x: auto;
`,Gt=()=>e.createElement(n.Popover,{id:"search-query-help",className:L.popoverWide,title:"Search Syntax Help"},e.createElement("p",null,e.createElement("strong",null,"Available search fields")),e.createElement(n.Table,{condensed:!0},e.createElement("thead",null,e.createElement("tr",null,e.createElement("th",null,"Field"),e.createElement("th",null,"Description"))),e.createElement("tbody",null,e.createElement("tr",null,e.createElement("td",null,"id"),e.createElement("td",null,"Cache ID")),e.createElement("tr",null,e.createElement("td",null,"title"),e.createElement("td",null,"The title of the cache")),e.createElement("tr",null,e.createElement("td",null,"name"),e.createElement("td",null,"The reference name of the cache")),e.createElement("tr",null,e.createElement("td",null,"description"),e.createElement("td",null,"The description of cache")))),e.createElement("p",null,e.createElement("strong",null,"Examples")),e.createElement("p",null,"Find caches by parts of their names:",e.createElement("br",null),e.createElement("kbd",null,"name:guava"),e.createElement("br",null),e.createElement("kbd",null,"name:gua")),e.createElement("p",null,"Searching without a field name matches against the ",e.createElement("code",null,"title")," field:",e.createElement("br",null),e.createElement("kbd",null,"guava")," ",e.createElement("br",null),"is the same as",e.createElement("br",null),e.createElement("kbd",null,"title:guava"))),Xt=({query:t})=>e.createElement("tbody",null,e.createElement("tr",null,e.createElement("td",{colSpan:7},t?e.createElement(m.pJ,null,'No caches found with title "',t,'"'):e.createElement(m.dX,null,"There are no caches to list")))),Qt=({caches:t,query:a})=>t.length>0?e.createElement(e.Fragment,null,t.map(l=>e.createElement(Yt,{key:`cache-item-${l.id}`,cache:l}))):e.createElement(Xt,{query:a}),ea=e.createElement(m.Ox,{trigger:"click",rootClose:!0,placement:"right",overlay:Gt()},e.createElement(n.Button,{bsStyle:"link",className:L.searchHelpButton},e.createElement(m.JO,{name:"question-circle",fixedWidth:!0}))),ta=({caches:t,pagination:a,paginationQueryParameter:l})=>{const[r,s]=e.useState(!1),[c,p]=e.useState({currentPage:l.page||1,currentPageSize:l.pageSize||10,currentQuery:a.query?decodeURI(a.query):"",resetPage:l.resetPage,setPagination:l.setPagination});e.useEffect(()=>{const{currentPage:C,currentPageSize:v,currentQuery:f}=c;Y.Z.searchPaginated(C,v,f).then(()=>s(!1))},[c]);const _=e.useCallback((C,v)=>{p({...c,currentPage:C,currentPageSize:v})},[c]),E=e.useCallback(C=>{c.resetPage(),c.setPagination({page:1,pageSize:c.currentPageSize}),p({...c,currentPage:1,currentQuery:C})},[c]),b=e.useCallback(()=>{c.resetPage(),c.setPagination({page:1,pageSize:c.currentPageSize}),p({...c,currentPage:1,currentQuery:""})},[c]);return e.createElement(n.Row,{className:"content"},e.createElement(n.Col,{md:12},e.createElement("h2",{style:{marginBottom:16}},"Configured lookup Caches ",e.createElement("small",null,a.total," total")),e.createElement(m.l9,{activePage:c.currentPage,pageSize:c.currentPageSize,onChange:_,totalItems:a.total},e.createElement(m.UI,{onSearch:E,onReset:b,queryHelpComponent:ea}),e.createElement(qt,null,e.createElement(n.Table,{condensed:!0,hover:!0,className:L.overviewTable},e.createElement("thead",null,e.createElement("tr",null,e.createElement("th",{className:L.rowTitle},"Title"),e.createElement("th",{className:L.rowDescription},"Description"),e.createElement("th",{className:L.rowName},"Name"),e.createElement("th",null,"Entries"),e.createElement("th",null,"Hit rate"),e.createElement("th",null,"Throughput"),e.createElement("th",{className:L.rowActions},"Actions"))),r?e.createElement(m.$j,{text:"Loading data adapters"}):e.createElement(Qt,{caches:t,query:c.currentQuery}))))))},aa=(0,ge.Z)(ta);var ye=o("0hhBr0/b");const la=({cache:t})=>{const a=(0,Ze.useNavigate)(),{loadingScopePermissions:l,scopePermissions:r}=(0,J.Z)(t),s=(0,ye.Z)("lookupTableCaches").find(p=>{var _;return p.type===((_=t.config)==null?void 0:_.type)});if(!s)return e.createElement("p",null,"Unknown cache type ",t.config.type,". Is the plugin missing?");const c=p=>()=>{a(x.ZP.SYSTEM.LOOKUPTABLES.CACHES.edit(p))};return e.createElement(n.Row,{className:"content"},e.createElement(n.Col,{md:12},e.createElement("h2",null,t.title," ",e.createElement("small",null,"(",s.displayName,")")),e.createElement(Oe,null,e.createElement(ue,null,e.createElement(ce,null,"Description:"),e.createElement(me,null,t.description||e.createElement("em",null,"No description.")))),e.createElement("h4",null,"Configuration"),e.createElement("div",null,e.createElement(s.summaryComponent,{cache:t})),!l&&(r==null?void 0:r.is_mutable)&&e.createElement(n.Button,{bsStyle:"success",onClick:c(t.name),role:"button",name:"edit"},"Edit")))};var na=o("oc9db6Tt"),ra=o.n(na);const oa=({title:t,typeName:a,create:l})=>{const r=l?"h3":"h2";return e.createElement(r,{style:{marginBottom:"12px"}},t," ",e.createElement("small",null,"(",a,")"))},We={id:void 0,title:"",description:"",name:"",config:{}},je=({type:t,saved:a,title:l,create:r,cache:s,validate:c,validationErrors:p})=>{const _=e.useRef(null),[E,b]=e.useState(r),{loadingScopePermissions:C,scopePermissions:v}=(0,J.Z)(s),f=(0,ne.Z)(),y=e.useMemo(()=>R.G.exports("lookupTableCaches").find(B=>B.type===t),[t]),A=e.useMemo(()=>y.displayName||t,[y,t]),D=e.useMemo(()=>y.documentationComponent,[y]),U=e.useMemo(()=>y?e.createElement(y.formComponent,{config:s.config,ref:_}):null,[y,s.config]),I=B=>B.trim().replace(/\W+/g,"-").toLocaleLowerCase(),$=(B,q)=>H=>{if(!E)return;const G=I(H.target.value);q({...B,title:H.target.value,name:G})},oe=B=>{var q;const H={};if(B.title||(H.title="Required"),B.name?c(B):H.name="Required",B.config.type!=="none"){const G=((q=_.current)==null?void 0:q.validate())||{};ra()(G)||(H.config=G)}return H},se=B=>(r?Y.Z.create(B):Y.Z.update(B)).then(()=>{var H;f(X.A.LUT[r?"CACHE_CREATED":"CACHE_UPDATED"],{app_pathname:"lut",app_section:"lut_cache",event_details:{type:(H=B==null?void 0:B.config)==null?void 0:H.type}}),a()}),ka=(0,le.Z)(),at=()=>ka.push(x.ZP.SYSTEM.LOOKUPTABLES.CACHES.OVERVIEW),Ia=!r&&!C&&(v==null?void 0:v.is_mutable);return e.createElement(e.Fragment,null,e.createElement(oa,{title:l,typeName:A,create:r}),e.createElement(n.Row,null,e.createElement(n.Col,{lg:6,style:{marginTop:10}},e.createElement(V.Formik,{initialValues:{...We,...s},validate:oe,validateOnBlur:!0,validateOnChange:!1,validateOnMount:!r,onSubmit:se,enableReinitialize:!0},({errors:B,values:q,setValues:H,isSubmitting:G})=>e.createElement(V.Form,{className:"form form-horizontal"},e.createElement("fieldset",null,e.createElement(m.Fe,{type:"text",name:"title",label:"* Title",required:!0,help:B.title?null:"A short title for this cache.",onChange:$(q,H),autoFocus:!0,labelClassName:"col-sm-3",wrapperClassName:"col-sm-9"}),e.createElement(m.Fe,{type:"text",name:"description",label:"Description",help:"Cache description.",labelClassName:"col-sm-3",wrapperClassName:"col-sm-9"}),e.createElement(m.Fe,{type:"text",name:"name",label:"* Name",required:!0,error:p.name?p.name[0]:null,onChange:()=>b(!1),help:B.name||p.name?null:"The name that is being used to refer to this cache. Must be unique.",labelClassName:"col-sm-3",wrapperClassName:"col-sm-9"})),U,e.createElement("fieldset",null,e.createElement(n.Row,null,e.createElement(n.Col,{mdOffset:3,sm:12},r&&e.createElement(m.Ow,{submitButtonText:"Create cache",submitLoadingText:"Creating cache...",isSubmitting:G,isAsyncSubmit:!0,onCancel:at}),Ia&&e.createElement(m.Ow,{submitButtonText:"Update cache",submitLoadingText:"Updating cache...",isAsyncSubmit:!0,isSubmitting:G,onCancel:at}))))))),e.createElement(n.Col,{lg:6,style:{marginTop:10}},D?e.createElement(D,null):null)))};je.defaultProps={create:!0,cache:We,validate:null,validationErrors:{}};const Je=je;var he=o("4E3oowBb");const sa={id:null,title:"",name:"",description:"",config:{type:"none"}},ia=({saved:t,types:a,validate:l,validationErrors:r})=>{const[s,c]=e.useState(null),p=(0,ye.Z)("lookupTableCaches"),_=e.useMemo(()=>p.reduce((v,f)=>(v[f.type]=f,v),{}),[p]),E=e.useMemo(()=>Object.values(a).map(v=>({value:v.type,label:_[v.type].displayName})).sort((v,f)=>(0,he.S)(v.label.toLowerCase(),f.label.toLowerCase())),[a,_]),b=e.useMemo(()=>{var v;return s?{...sa,config:{...(v=a[s])==null?void 0:v.default_config}}:null},[s,a]),C=v=>{c(v)};return e.createElement(e.Fragment,null,e.createElement(n.Row,{className:"content"},e.createElement(n.Col,{lg:6,className:"form form-horizontal"},e.createElement(n.Input,{id:"cache-type-select",label:"Cache Type",required:!0,autoFocus:!0,help:"The type of cache to configure.",labelClassName:"col-sm-3",wrapperClassName:"col-sm-9"},e.createElement(m.Ph,{placeholder:"Select Cache Type",clearable:!1,options:E,matchProp:"label",onChange:C,value:s})))),b&&e.createElement(n.Row,{className:"content"},e.createElement(n.Col,{lg:12},e.createElement(Je,{cache:b,type:s,title:"Configure Cache",create:!0,saved:t,validationErrors:r,validate:l}))))},Ce=({caches:t})=>{const[,{value:a,touched:l,error:r},{setTouched:s,setValue:c}]=(0,V.useField)("cache_id"),p=t.map(E=>({value:E.id,label:`${E.title} (${E.name})`})).sort((E,b)=>(0,he.S)(E.label.toLowerCase(),b.label.toLowerCase())),_=l?r:"";return e.createElement("fieldset",null,e.createElement(n.Input,{id:"cache-select",label:"Cache",required:!0,autoFocus:!0,bsStyle:_?"error":void 0,help:_||"Select an existing cache",labelClassName:"col-sm-3",wrapperClassName:"col-sm-9"},e.createElement(m.Ph,{placeholder:"Select a cache",clearable:!1,options:p,matchProp:"label",onBlur:()=>s(!0),onChange:c,value:a})))};Ce.propTypes={caches:d().array},Ce.defaultProps={caches:[]};const ze=Ce;var ua=o("D4SbLiE/"),Ve=o.n(ua),ca=o("JnTtTRmZ"),Ye=o.n(ca);const qe=Ve()({displayName:"CachesContainer",propTypes:{children:d().oneOfType([d().arrayOf(d().node),d().node])},mixins:[Ye().connect(Y.$)],getDefaultProps(){return{children:null}},componentDidMount(){Y.Z.searchPaginated(1,1e4,null)},render(){if(!this.state.caches)return e.createElement(m.$j,null);const t=e.Children.map(this.props.children,a=>e.cloneElement(a,{caches:this.state.caches,pagination:this.state.pagination}));return e.createElement("div",null,t)}});var z=o("xg2EYAWP");const ma=(0,Z.default)(n.ButtonToolbar)`
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
`,da=({adapter:t,error:a=null})=>{const l=(0,le.Z)(),{loadingScopePermissions:r,scopePermissions:s}=(0,J.Z)(t),c=(0,ne.Z)(),{name:p,title:_,description:E,id:b}=t,C=e.useCallback(()=>{l.push(x.ZP.SYSTEM.LOOKUPTABLES.DATA_ADAPTERS.edit(p))},[l,p]),v=e.useCallback(()=>{c(X.A.LUT.DATA_ADAPTER_DELETED,{app_pathname:"lut",app_section:"lut_data_adapter"}),window.confirm(`Are you sure you want to delete data adapter "${_}"?`)&&z.e.delete(t.id).then(()=>{z.e.reloadPage()})},[_,t.id,c]);return e.createElement("tbody",null,e.createElement("tr",null,e.createElement("td",null,a&&e.createElement(re,{errorText:a,title:"Lookup table problem",placement:"right"}),e.createElement(W.r,{to:x.ZP.SYSTEM.LOOKUPTABLES.DATA_ADAPTERS.show(p)},_)),e.createElement("td",null,E),e.createElement("td",null,p),e.createElement("td",null,e.createElement(ee.CL,{name:`org.graylog2.lookup.adapters.${b}.requests`},e.createElement(ee.qb,{suffix:"lookups/s"}))),e.createElement("td",null,r?e.createElement(m.$j,null):s.is_mutable&&e.createElement(ma,null,e.createElement(n.Button,{bsSize:"xsmall",onClick:C,role:"button",name:"edit"},"Edit"),e.createElement(n.Button,{bsSize:"xsmall",bsStyle:"danger",onClick:v,role:"button",name:"delete"},"Delete")))))},pa=Z.default.div`
  overflow-x: auto;
`,ha=()=>e.createElement(n.Popover,{id:"search-query-help",className:L.popoverWide,title:"Search Syntax Help"},e.createElement("p",null,e.createElement("strong",null,"Available search fields")),e.createElement(n.Table,{condensed:!0},e.createElement("thead",null,e.createElement("tr",null,e.createElement("th",null,"Field"),e.createElement("th",null,"Description"))),e.createElement("tbody",null,e.createElement("tr",null,e.createElement("td",null,"id"),e.createElement("td",null,"Data Adapter ID")),e.createElement("tr",null,e.createElement("td",null,"title"),e.createElement("td",null,"The title of the data adapter")),e.createElement("tr",null,e.createElement("td",null,"name"),e.createElement("td",null,"The reference name of the data adapter")),e.createElement("tr",null,e.createElement("td",null,"description"),e.createElement("td",null,"The description of data adapter")))),e.createElement("p",null,e.createElement("strong",null,"Example")),e.createElement("p",null,"Find data adapters by parts of their names:",e.createElement("br",null),e.createElement("kbd",null,"name:geoip"),e.createElement("br",null),e.createElement("kbd",null,"name:geo")),e.createElement("p",null,"Searching without a field name matches against the ",e.createElement("code",null,"title")," field:",e.createElement("br",null),e.createElement("kbd",null,"geoip")," ",e.createElement("br",null),"is the same as",e.createElement("br",null),e.createElement("kbd",null,"title:geoip"))),Ea=e.createElement(m.Ox,{trigger:"click",rootClose:!0,placement:"right",overlay:ha()},e.createElement(n.Button,{bsStyle:"link",className:L.searchHelpButton},e.createElement(m.JO,{name:"question-circle",fixedWidth:!0}))),ga=({query:t})=>e.createElement("tbody",null,e.createElement("tr",null,e.createElement("td",{colSpan:5},t?e.createElement(m.pJ,null,'No data adapters found with title "',t,'"'):e.createElement(m.dX,null,"There are no data adapters to list")))),_a=({dataAdapters:t,query:a,errors:l})=>t.length>0?e.createElement(e.Fragment,null,t.map(r=>e.createElement(da,{key:r.id,adapter:r,error:l[r.name]}))):e.createElement(ga,{query:a}),va=({dataAdapters:t,pagination:a,errorStates:l,paginationQueryParameter:r})=>{const[s,c]=e.useState(!1),[p,_]=e.useState({currentPage:r.page||1,currentPageSize:r.pageSize||10,currentQuery:a.query?decodeURI(a.query):"",resetPage:r.resetPage,setPagination:r.setPagination});e.useEffect(()=>{const{currentPage:v,currentPageSize:f,currentQuery:y}=p;z.e.searchPaginated(v,f,y).then(()=>c(!1))},[p]);const E=e.useCallback((v,f)=>{_({...p,currentPage:v,currentPageSize:f})},[p]),b=e.useCallback(v=>{p.resetPage(),p.setPagination({page:1,pageSize:p.currentPageSize}),_({...p,currentPage:1,currentQuery:v})},[p]),C=e.useCallback(()=>{p.resetPage(),p.setPagination({page:1,pageSize:p.currentPageSize}),_({...p,currentPage:1,currentQuery:""})},[p]);return e.createElement(n.Row,{className:"content"},e.createElement(n.Col,{md:12},e.createElement("h2",{style:{marginBottom:16}},"Configured lookup Data Adapters ",e.createElement("small",null,a.total," total")),e.createElement(m.l9,{activePage:p.currentPage,pageSize:p.currentPageSize,onChange:E,totalItems:a.total},e.createElement(m.UI,{onSearch:b,onReset:C,queryHelpComponent:Ea}),e.createElement(pa,null,e.createElement(n.Table,{condensed:!0,hover:!0,className:L.overviewTable},e.createElement("thead",null,e.createElement("tr",null,e.createElement("th",{className:L.rowTitle},"Title"),e.createElement("th",{className:L.rowDescription},"Description"),e.createElement("th",{className:L.rowName},"Name"),e.createElement("th",null,"Throughput"),e.createElement("th",{className:L.rowActions},"Actions"))),s?e.createElement(m.$j,{text:"Loading data adapters"}):e.createElement(_a,{dataAdapters:t,query:p.currentQuery,errors:l.dataAdapters}))))))},fa=(0,ge.Z)(va);var be=o("S6FuRS7B");const Ge=Z.default.div`
  dl {
    margin-top: 10px;

    dt {
      float: left;
      clear: left;
    }

    dd {
      margin-left: 185px;
      word-wrap: break-word;

      &:not(:last-child) {
        border-bottom: 1px solid #ececec;
        margin-bottom: 5px;
        padding-bottom: 5px;
      }
    }
  }
`,ya=({dataAdapter:t})=>{const[a,l]=e.useState(""),[r,s]=e.useState(null),{loadingScopePermissions:c,scopePermissions:p}=(0,J.Z)(t),_=A=>{l((0,be.n6)(A.target))},E=A=>{A.preventDefault(),z.e.lookup(t.name,a).then(D=>{s(D)})},b=(0,ye.Z)("lookupTableAdapters").find(A=>{var D;return A.type===((D=t.config)==null?void 0:D.type)});if(!b)return e.createElement("p",null,"Unknown data adapter type ",t.config.type,". Is the plugin missing?");const{title:C,description:v,name:f}=t,y=b.summaryComponent;return e.createElement(n.Row,{className:"content"},e.createElement(n.Col,{md:6},e.createElement("h2",null,C," ",e.createElement("small",null,"(",b.displayName,")")),e.createElement(Ge,null,e.createElement("dl",null,e.createElement("dt",null,"Description"),e.createElement("dd",null,v||e.createElement("em",null,"No description.")))),e.createElement("h4",null,"Configuration"),e.createElement(Ge,null,e.createElement(y,{dataAdapter:t})),!c&&(p==null?void 0:p.is_mutable)&&e.createElement(W.J,{to:x.ZP.SYSTEM.LOOKUPTABLES.DATA_ADAPTERS.edit(f)},e.createElement(n.Button,{bsStyle:"success",role:"button",name:"edit"},"Edit"))),e.createElement(n.Col,{md:6},e.createElement("h3",null,"Test lookup"),e.createElement("p",null,"You can manually trigger the data adapter using this form. The data will be not cached."),e.createElement("form",{onSubmit:E},e.createElement("fieldset",null,e.createElement(n.Input,{type:"text",id:"key",name:"key",label:"Key",required:!0,onChange:_,help:"Key to look up a value for.",value:a}),e.createElement(n.Button,{type:"submit",bsStyle:"success"},"Look up"))),r&&e.createElement("div",null,e.createElement("h4",null,"Lookup result"),e.createElement("pre",null,JSON.stringify(r,null,2)))))};var Ca=o("+KM7MH1U"),ba=o.n(Ca),Ta=o("N6x7vnl1"),Aa=o("BqxuktKK"),Pa=Object.defineProperty,Sa=(t,a,l)=>a in t?Pa(t,a,{enumerable:!0,configurable:!0,writable:!0,value:l}):t[a]=l,w=(t,a,l)=>(Sa(t,typeof a!="symbol"?a+"":a,l),l);class Te extends e.Component{constructor(a){super(a),w(this,"validationCheckTimer"),w(this,"_input"),w(this,"updateState",l=>{this.setState(this._initialState(l))}),w(this,"_initialState",l=>{const r=T.Z.clone(l),{create:s}=this.props;return{generateAdapterName:s,isFormDisabled:!1,dataAdapter:{id:r.id,title:r.title,description:r.description,name:r.name,custom_error_ttl_enabled:r.custom_error_ttl_enabled,custom_error_ttl:r.custom_error_ttl,custom_error_ttl_unit:r.custom_error_ttl_unit,config:r.config}}}),w(this,"_clearTimer",()=>{this.validationCheckTimer!==void 0&&(clearTimeout(this.validationCheckTimer),this.validationCheckTimer=void 0)}),w(this,"_setIsFormDisabled",l=>{this.setState({isFormDisabled:l})}),w(this,"_validate",l=>{const{validate:r}=this.props;this._clearTimer(),r&&(this.validationCheckTimer=setTimeout(()=>r(l),500))}),w(this,"_onChange",l=>{const{dataAdapter:r}=this.state,s=T.Z.clone(r);s[l.target.name]=(0,be.n6)(l.target);let{generateAdapterName:c}=this.state;c&&l.target.name==="title"&&(s.name=this._sanitizeTitle(s.title)),l.target.name==="name"&&(c=!1),this._validate(s),this.setState({dataAdapter:s,generateAdapterName:c})}),w(this,"_onConfigChange",l=>{const{dataAdapter:r}=this.state,s=T.Z.clone(r);s.config[l.target.name]=(0,be.n6)(l.target),this._validate(s),this.setState({dataAdapter:s})}),w(this,"_updateConfig",l=>{const{dataAdapter:r}=this.state,s=T.Z.clone(r);s.config=l,this._validate(s),this.setState({dataAdapter:s})}),w(this,"updateCustomErrorTTL",(l,r,s)=>{this._updateCustomErrorTTL(l,r,s,"custom_error_ttl")}),w(this,"_updateCustomErrorTTL",(l,r,s,c)=>{const{dataAdapter:p}=this.state,_=T.Z.clone(p);s&&l?(_[c]=s&&l?l:null,_[`${c}_enabled`]=s):(_[c]=null,_[`${c}_enabled`]=!1),_[`${c}_unit`]=s?r:null,this._validate(_),this.setState({dataAdapter:_})}),w(this,"_save",l=>{var r;l&&l.preventDefault();const{dataAdapter:s}=this.state,{create:c,saved:p,sendTelemetry:_}=this.props;_(X.A.LUT[c?"DATA_ADAPTER_CREATED":"DATA_ADAPTER_UPDATED"],{app_pathname:"lut",app_section:"lut_data_adapter",event_details:{type:(r=s==null?void 0:s.config)==null?void 0:r.type}});let E;c?E=z.e.create(s):E=z.e.update(s),E.then(()=>{p()})}),w(this,"_sanitizeTitle",l=>l.trim().replace(/\W+/g,"-").toLocaleLowerCase()),w(this,"_validationState",l=>{const{validationErrors:r}=this.props;return r[l]?"error":null}),w(this,"_validationMessage",(l,r)=>{const{validationErrors:s}=this.props;return s[l]?e.createElement("div",null,e.createElement("span",null,r),"\xA0",e.createElement("span",null,e.createElement("b",null,s[l][0]))):e.createElement("span",null,r)}),w(this,"_renderTitle",(l,r,s)=>{const c=s?"h3":"h2";return e.createElement(c,null,l," ",e.createElement("small",null,"(",r,")"))}),this.state=this._initialState(a.dataAdapter)}componentDidMount(){this._input.getInputDOMNode().focus();const{create:a,dataAdapter:l}=this.props;a||this._validate(l)}componentDidUpdate(a){const{type:l}=this.props;a.type!==l&&this._input.getInputDOMNode().focus();const{dataAdapter:r}=this.props;ba()(r,a.dataAdapter)||this.updateState(r)}componentWillUnmount(){this._clearTimer()}render(){const{dataAdapter:a,isFormDisabled:l}=this.state,{create:r,type:s,title:c,history:p}=this.props,E=R.G.exports("lookupTableAdapters").filter(D=>D.type===s),b=()=>p.push(x.ZP.SYSTEM.LOOKUPTABLES.DATA_ADAPTERS.OVERVIEW);let C=null,v=null,f=a.config.type;if(E&&E.length>0){const D=E[0];f=D.displayName,C=e.createElement(D.formComponent,{config:a.config,handleFormEvent:this._onConfigChange,updateConfig:this._updateConfig,validationMessage:this._validationMessage,validationState:this._validationState,setDisableFormSubmission:this._setIsFormDisabled}),D.documentationComponent&&(v=e.createElement(D.documentationComponent,{dataAdapterId:a.id}))}let y=null,A=8;return v&&(A=6,y=e.createElement(n.Col,{lg:A},v)),e.createElement(e.Fragment,null,e.createElement("p",null,this._renderTitle(c,f,r)),e.createElement(n.Row,null,e.createElement(n.Col,{lg:A},e.createElement("form",{className:"form form-horizontal",onSubmit:this._save},e.createElement("fieldset",null,e.createElement(n.Input,{type:"text",id:"title",name:"title",label:"Title",autoFocus:!0,required:!0,onChange:this._onChange,help:"A short title for this data adapter.",value:a.title,labelClassName:"col-sm-3",ref:D=>{this._input=D},wrapperClassName:"col-sm-9"}),e.createElement(n.Input,{type:"text",id:"description",name:"description",label:"Description",onChange:this._onChange,help:"Data adapter description.",value:a.description,labelClassName:"col-sm-3",wrapperClassName:"col-sm-9"}),e.createElement(n.Input,{type:"text",id:"name",name:"name",label:"Name",required:!0,onChange:this._onChange,help:this._validationMessage("name","The name that is being used to refer to this data adapter. Must be unique."),value:a.name,labelClassName:"col-sm-3",wrapperClassName:"col-sm-9",bsStyle:this._validationState("name")}),e.createElement(m.AX,{label:"Custom Error TTL",help:"Define a custom TTL for caching erroneous results. Otherwise the default of 5 seconds is used",update:this.updateCustomErrorTTL,value:a.custom_error_ttl,unit:a.custom_error_ttl_unit||"MINUTES",units:["MILLISECONDS","SECONDS","MINUTES","HOURS","DAYS"],enabled:a.custom_error_ttl_enabled,labelClassName:"col-sm-3",wrapperClassName:"col-sm-9"})),C,e.createElement("fieldset",null,e.createElement(n.Row,null,e.createElement(n.Col,{mdOffset:3,md:9},e.createElement(m.Ow,{submitButtonText:r?"Create adapter":"Update adapter",disabledSubmit:l,onCancel:b})))))),y))}}w(Te,"propTypes",{type:d().string.isRequired,title:d().string.isRequired,saved:d().func.isRequired,create:d().bool,dataAdapter:d().object,validate:d().func,validationErrors:d().object,sendTelemetry:d().func,history:d().object.isRequired}),w(Te,"defaultProps",{create:!0,dataAdapter:{id:void 0,title:"",description:"",name:"",custom_error_ttl_enabled:!1,custom_error_ttl:null,custom_error_ttl_unit:null,config:{}},validate:null,validationErrors:{},sendTelemetry:()=>{}});const Xe=(0,Aa.Z)((0,Ta.Z)(Te));var Da=Object.defineProperty,Na=(t,a,l)=>a in t?Da(t,a,{enumerable:!0,configurable:!0,writable:!0,value:l}):t[a]=l,Ae=(t,a,l)=>(Na(t,typeof a!="symbol"?a+"":a,l),l);class Pe extends e.Component{constructor(a){super(a),Ae(this,"_onTypeSelect",l=>{const{types:r}=this.props;this.setState({type:l,dataAdapter:{id:null,title:"",name:"",description:"",config:T.Z.clone(r[l].default_config)}})}),this.state={dataAdapter:void 0,type:void 0}}render(){const{types:a,validate:l,validationErrors:r,saved:s}=this.props,{type:c,dataAdapter:p}=this.state,_={};R.G.exports("lookupTableAdapters").forEach(b=>{_[b.type]=b});const E=Object.keys(a).map(b=>{const C=a[b];return _[C.type]===void 0?(console.error(`Plugin component for data adapter type ${C.type} is missing - invalid or missing plugin?`),{value:C.type,disabled:!0,label:`${C.type} - missing or invalid plugin`}):{value:C.type,label:_[C.type].displayName}}).sort((b,C)=>(0,he.S)(b.label.toLowerCase(),C.label.toLowerCase()));return e.createElement("div",null,e.createElement(n.Row,{className:"content"},e.createElement(n.Col,{lg:8},e.createElement("form",{className:"form form-horizontal",onSubmit:()=>{}},e.createElement(n.Input,{id:"data-adapter-type-select",label:"Data Adapter Type",required:!0,autoFocus:!0,help:"The type of data adapter to configure.",labelClassName:"col-sm-3",wrapperClassName:"col-sm-9"},e.createElement(m.Ph,{placeholder:"Select Data Adapter Type",clearable:!1,options:E,matchProp:"label",onChange:this._onTypeSelect,value:null}))))),p&&e.createElement(n.Row,{className:"content"},e.createElement(n.Col,{lg:12},e.createElement(Xe,{dataAdapter:p,type:c,create:!0,title:"Configure Adapter",validate:l,validationErrors:r,saved:s}))))}}Ae(Pe,"propTypes",{saved:d().func.isRequired,types:d().object.isRequired,validate:d().func,validationErrors:d().object}),Ae(Pe,"defaultProps",{validate:null,validationErrors:{}});const Ra=Pe,Se=({dataAdapters:t})=>{const[,{value:a,touched:l,error:r},{setTouched:s,setValue:c}]=(0,V.useField)("data_adapter_id"),p=t.map(E=>({value:E.id,label:`${E.title} (${E.name})`})).sort((E,b)=>(0,he.S)(E.label.toLowerCase(),b.label.toLowerCase())),_=l?r:"";return e.createElement("fieldset",null,e.createElement(n.Input,{id:"data-adapter-select",label:"Data Adapter",required:!0,autoFocus:!0,bsStyle:_?"error":void 0,help:_||"Select an existing data adapter",labelClassName:"col-sm-3",wrapperClassName:"col-sm-9"},e.createElement(m.Ph,{placeholder:"Select a data adapter",clearable:!1,options:p,matchProp:"label",onBlur:()=>s(!0),onChange:c,value:a})))};Se.propTypes={dataAdapters:d().array},Se.defaultProps={dataAdapters:[]};const Qe=Se,et=Ve()({displayName:"DataAdaptersContainer",propTypes:{children:d().oneOfType([d().arrayOf(d().node),d().node])},mixins:[Ye().connect(z.m)],getDefaultProps(){return{children:null}},componentDidMount(){z.e.searchPaginated(1,1e4,null)},render(){if(!this.state.dataAdapters)return e.createElement(m.$j,null);const t=e.Children.map(this.props.children,a=>e.cloneElement(a,{dataAdapters:this.state.dataAdapters,pagination:this.state.pagination}));return e.createElement("div",null,t)}});var Ee=o("Clzoet+M"),te={};te.styleTagTransform=Fe(),te.setAttributes=Me(),te.insert=xe().bind(null,"head"),te.domAPI=Be(),te.insertStyleElement=Ue();var Xa=we()(Ee.Z,te);const tt=Ee.Z&&Ee.Z.locals?Ee.Z.locals:void 0,re=({errorText:t,title:a="Error",placement:l="bottom"})=>{const r=e.createElement(n.Popover,{id:"error-popover",title:a,className:tt.overlay},t);return e.createElement(m.Ox,{trigger:["hover","focus"],placement:l,overlay:r},e.createElement("span",{className:tt.trigger},e.createElement(m.JO,{name:"exclamation-triangle",className:"text-danger"})))}},leXY1Rul:(F,O,o)=>{o.d(O,{Z:()=>m});var R=o("DUKaTDO2"),k=o("eFxcQyPT"),d=o("MdYBRjRJ"),e=o("U1Iufsob"),P=o("jAGDuYSC");function T(){return(0,k.ZP)("GET",(0,d.DC)(e.Z.EntityScopeController.getScope().url))}const m=g=>{var u;const{data:i,isLoading:h,error:S}=(0,R.useQuery)(["scope-permissions"],T,{onError:()=>P.Z.error(S.message),retry:1,cacheTime:108e5,staleTime:108e5}),N=((u=g==null?void 0:g._scope)==null?void 0:u.toUpperCase())||"DEFAULT",M=h?{is_mutable:!1}:i.entity_scopes[N];return{loadingScopePermissions:h,scopePermissions:M}}},N6x7vnl1:(F,O,o)=>{o.d(O,{Z:()=>e});var R=o("Z7aTuO5B"),k=o("/7OuCFNo");const e=P=>T=>{const n=(0,k.Z)();return R.createElement(P,{...T,history:n})}},c9JM82dZ:(F,O,o)=>{o.d(O,{Z:()=>e});var R=o("Z7aTuO5B"),k=o("yAXMqwrl");const e=P=>T=>{const n=(0,k.useParams)();return R.createElement(P,{...T,params:n})}},s67As4Iu:(F,O,o)=>{o.d(O,{$:()=>m,Z:()=>n});var R=o("JnTtTRmZ"),k=o.n(R),d=o("jAGDuYSC"),e=o("MdYBRjRJ"),P=o("eFxcQyPT"),T=o("IA3Ku5lS");const n=(0,T.ei)("core.LookupTableCaches",()=>k().createActions({searchPaginated:{asyncResult:!0},reloadPage:{asyncResult:!0},get:{asyncResult:!0},create:{asyncResult:!0},delete:{asyncResult:!0},update:{asyncResult:!0},getTypes:{asyncResult:!0},validate:{asyncResult:!0}})),m=(0,T.dS)("core.LookupTableCaches",()=>k().createStore({listenables:[n],cache:null,caches:null,types:null,pagination:{page:1,per_page:10,total:0,count:0,query:null},validationErrors:{},getInitialState(){return this.getState()},getState(){return{cache:this.cache,caches:this.caches,types:this.types,pagination:this.pagination,validationErrors:this.validationErrors}},propagateChanges(){this.trigger(this.getState())},reloadPage(){const g=this.searchPaginated(this.pagination.page,this.pagination.per_page,this.pagination.query);return n.reloadPage.promise(g),g},searchPaginated(g,u,i){let h;i?h=this._url(`caches?page=${g}&per_page=${u}&query=${encodeURIComponent(i)}`):h=this._url(`caches?page=${g}&per_page=${u}`);const S=(0,P.ZP)("GET",h);return S.then(N=>{this.pagination={count:N.count,total:N.total,page:N.page,per_page:N.per_page,query:N.query},this.caches=N.caches,this.propagateChanges()},this._errorHandler("Fetching lookup table caches failed","Could not retrieve the lookup caches")),n.searchPaginated.promise(S),S},get(g){const u=this._url(`caches/${g}`),i=(0,P.ZP)("GET",u);return i.then(h=>{this.cache=h,this.propagateChanges()},this._errorHandler(`Fetching lookup table cache ${g} failed`,"Could not retrieve lookup table cache")),n.get.promise(i),i},create(g){const u=this._url("caches"),i=(0,P.ZP)("POST",u,g);return i.then(h=>{this.cache=h,this.propagateChanges()},this._errorHandler("Creating lookup table cache failed",`Could not create lookup table cache "${g.name}"`)),n.create.promise(i),i},update(g){const u=this._url(`caches/${g.id}`),i=(0,P.ZP)("PUT",u,g);return i.then(h=>{this.cache=h,this.propagateChanges()},this._errorHandler("Updating lookup table cache failed",`Could not update lookup table cache "${g.name}"`)),n.update.promise(i),i},getTypes(){const g=this._url("types/caches"),u=(0,P.ZP)("GET",g);return u.then(i=>{this.types=i,this.propagateChanges()},this._errorHandler("Fetching available types failed","Could not fetch the available lookup table cache types")),n.getTypes.promise(u),u},delete(g){const u=this._url(`caches/${g}`),i=(0,P.ZP)("DELETE",u);return i.catch(this._errorHandler("Deleting lookup table cache failed",`Could not delete lookup table cache "${g}"`)),n.delete.promise(i),i},validate(g){const u=this._url("caches/validate"),i=(0,P.ZP)("POST",u,g);return i.then(h=>{this.validationErrors=h.errors,this.propagateChanges()},this._errorHandler("Lookup table cache validation failed",`Could not validate lookup table cache "${g.name}"`)),n.validate.promise(i),i},_errorHandler(g,u,i){return h=>{let S;try{S=h.additional.body.message}catch{S=h.message}d.Z.error(`${g}: ${S}`,u),i&&i(h)}},_url(g){return e.DC(`/system/lookup/${g}`)}}))},xg2EYAWP:(F,O,o)=>{o.d(O,{e:()=>n,m:()=>m});var R=o("JnTtTRmZ"),k=o.n(R),d=o("jAGDuYSC"),e=o("MdYBRjRJ"),P=o("eFxcQyPT"),T=o("IA3Ku5lS");const n=(0,T.ei)("core.LookupTableDataAdapters",()=>k().createActions({searchPaginated:{asyncResult:!0},reloadPage:{asyncResult:!0},get:{asyncResult:!0},create:{asyncResult:!0},delete:{asyncResult:!0},update:{asyncResult:!0},getTypes:{asyncResult:!0},lookup:{asyncResult:!0},validate:{asyncResult:!0}})),m=(0,T.dS)("core.LookupTableDataAdapters",()=>k().createStore({listenables:[n],dataAdapter:null,dataAdapters:void 0,types:null,pagination:{page:1,per_page:10,total:0,count:0,query:null},lookupResult:null,validationErrors:{},getInitialState(){return this.getState()},getState(){return{dataAdapter:this.dataAdapter,dataAdapters:this.dataAdapters,lookupResult:this.lookupResult,types:this.types,pagination:this.pagination,validationErrors:this.validationErrors}},propagateChanges(){this.trigger(this.getState())},reloadPage(){const g=this.searchPaginated(this.pagination.page,this.pagination.per_page,this.pagination.query);return n.reloadPage.promise(g),g},searchPaginated(g,u,i){let h;i?h=this._url(`adapters?page=${g}&per_page=${u}&query=${encodeURIComponent(i)}`):h=this._url(`adapters?page=${g}&per_page=${u}`);const S=(0,P.ZP)("GET",h);return S.then(N=>{this.pagination={count:N.count,total:N.total,page:N.page,per_page:N.per_page,query:N.query},this.dataAdapters=N.data_adapters,this.propagateChanges()},this._errorHandler("Fetching lookup table data adapters failed","Could not retrieve the lookup dataAdapters")),n.searchPaginated.promise(S),S},get(g){const u=this._url(`adapters/${g}`),i=(0,P.ZP)("GET",u);return i.then(h=>{this.dataAdapter=h,this.propagateChanges()},this._errorHandler(`Fetching lookup table data adapter ${g} failed`,"Could not retrieve lookup table data adapter")),n.get.promise(i),i},create(g){const u=this._url("adapters"),i=(0,P.ZP)("POST",u,g);return i.then(h=>{this.dataAdapter=h,this.propagateChanges()},this._errorHandler("Creating lookup table data adapter failed",`Could not create lookup table data adapter "${g.name}"`)),n.create.promise(i),i},update(g){const u=this._url(`adapters/${g.id}`),i=(0,P.ZP)("PUT",u,g);return i.then(h=>{this.dataAdapter=h,this.propagateChanges()},this._errorHandler("Updating lookup table data adapter failed",`Could not update lookup table data adapter "${g.name}"`)),n.update.promise(i),i},getTypes(){const g=this._url("types/adapters"),u=(0,P.ZP)("GET",g);return u.then(i=>{this.types=i,this.propagateChanges()},this._errorHandler("Fetching available types failed","Could not fetch the available lookup table data adapter types")),n.getTypes.promise(u),u},delete(g){const u=this._url(`adapters/${g}`),i=(0,P.ZP)("DELETE",u);return i.catch(this._errorHandler("Deleting lookup table data adapter failed",`Could not delete lookup table data adapter "${g}"`)),n.delete.promise(i),i},lookup(g,u){const i=(0,P.ZP)("GET",this._url(`adapters/${g}/query?key=${encodeURIComponent(u)}`));return i.then(h=>{this.lookupResult=h,this.propagateChanges()},this._errorHandler("Lookup failed",`Could not lookup value for key "${u}" in lookup table data adapter "${g}"`)),n.lookup.promise(i),i},validate(g){const u=this._url("adapters/validate"),i=(0,P.ZP)("POST",u,g);return i.then(h=>{this.validationErrors=h.errors,this.propagateChanges()},this._errorHandler("Lookup table data adapter validation failed",`Could not validate lookup table data adapter "${g.name}"`)),n.validate.promise(i),i},_errorHandler(g,u,i){return h=>{let S;try{S=h.additional.body.message}catch{S=h.message}d.Z.error(`${g}: ${S}`,u),i&&i(h)}},_url(g){return e.DC(`/system/lookup/${g}`)}}))},xPjmrmtt:(F,O,o)=>{o.d(O,{H:()=>m,m:()=>g});var R=o("JnTtTRmZ"),k=o.n(R),d=o("jAGDuYSC"),e=o("gyRmhZSW"),P=o("MdYBRjRJ"),T=o("eFxcQyPT"),n=o("IA3Ku5lS");const m=(0,n.ei)("core.LookupTables",()=>k().createActions({searchPaginated:{asyncResult:!0},reloadPage:{asyncResult:!0},get:{asyncResult:!0},create:{asyncResult:!0},delete:{asyncResult:!0},update:{asyncResult:!0},getErrors:{asyncResult:!0},lookup:{asyncResult:!0},purgeKey:{asyncResult:!0},purgeAll:{asyncResult:!0},validate:{asyncResult:!0}})),g=(0,n.dS)("core.LookupTables",()=>k().createStore({listenables:[m],pagination:{page:1,per_page:10,total:0,count:0,query:null},errorStates:{tables:{},caches:{},dataAdapters:{}},table:null,cache:null,dataAdapter:null,tables:null,caches:null,dataAdapters:null,lookupResult:null,validationErrors:{},getInitialState(){return this.getState()},getState(){return{errorStates:this.errorStates,table:this.table,cache:this.cache,dataAdapter:this.dataAdapter,tables:this.tables,caches:this.caches,dataAdapters:this.dataAdapters,lookupResult:this.lookupResult,validationErrors:this.validationErrors,pagination:this.pagination}},propagateChanges(){this.trigger(this.getState())},reloadPage(){const u=this.searchPaginated(this.pagination.page,this.pagination.per_page,this.pagination.query);return m.reloadPage.promise(u),u},searchPaginated(u,i,h=null,S=!0){const N=this._url((0,e.Z)("tables",u,i,h,{resolve:S})),M=(0,T.ZP)("GET",N);return M.then(K=>{this.pagination={count:K.count,total:K.total,page:K.page,per_page:K.per_page,query:K.query},this.tables=K.lookup_tables,this.caches=K.caches,this.dataAdapters=K.data_adapters,this.propagateChanges()},this._errorHandler("Fetching lookup tables failed","Could not retrieve the lookup tables")),m.searchPaginated.promise(M),M},get(u){const i=this._url(`tables/${u}?resolve=true`),h=(0,T.ZP)("GET",i);return h.then(S=>{const N=S.lookup_tables[0];this.table=N,this.cache=S.caches[N.cache_id],this.dataAdapter=S.data_adapters[N.data_adapter_id],this.propagateChanges()},this._errorHandler(`Fetching lookup table ${u} failed`,"Could not retrieve lookup table")),m.get.promise(h),h},create(u){const i=this._url("tables"),h=(0,T.ZP)("POST",i,u);return h.catch(this._errorHandler("Creating lookup table failed",`Could not create lookup table "${u.name}"`)),m.create.promise(h),h},update(u){const i=this._url(`tables/${u.id}`),h=(0,T.ZP)("PUT",i,u);return h.catch(this._errorHandler("Updating lookup table failed",`Could not update lookup table "${u.name}"`)),m.update.promise(h),h},delete(u){const i=this._url(`tables/${u}`),h=(0,T.ZP)("DELETE",i);return h.catch(this._errorHandler("Deleting lookup table failed",`Could not delete lookup table "${u}"`)),m.delete.promise(h),h},getErrors(u,i,h){const S={};u&&(S.tables=u),i&&(S.caches=i),h&&(S.data_adapters=h);const N=(0,T.ZP)("POST",this._url("errorstates"),S);return N.then(M=>{this.errorStates={tables:M.tables||{},caches:M.caches||{},dataAdapters:M.data_adapters||{}},this.propagateChanges()},this._errorHandler("Fetching lookup table error state failed.","Could not error states")),m.getErrors.promise(N),N},lookup(u,i){const h=(0,T.ZP)("GET",this._url(`tables/${u}/query?key=${encodeURIComponent(i)}`));return h.then(S=>{this.lookupResult=S,this.propagateChanges()},this._errorHandler("Lookup failed",`Could not lookup value for key "${i}" in lookup table "${u}"`)),m.lookup.promise(h),h},purgeKey(u,i){const h=(0,T.ZP)("POST",this._urlClusterWise(`tables/${u.id}/purge?key=${encodeURIComponent(i)}`));return h.then(()=>{d.Z.success(`Purging cache key "${i}" for lookup table "${u.name}"`,"Success!")},this._errorHandler(`Could not purge cache for key "${i}" in lookup table "${u.name}"`,"Failed!")),m.purgeKey.promise(h),h},purgeAll(u){const i=(0,T.ZP)("POST",this._urlClusterWise(`tables/${u.id}/purge`));return i.then(()=>{d.Z.success(`Purging cache for lookup table "${u.name}"`,"Success!")},this._errorHandler(`Could not purge cache for lookup table "${u.name}"`,"Failed!")),m.purgeAll.promise(i),i},validate(u){const i=this._url("tables/validate"),h=(0,T.ZP)("POST",i,u);return h.then(S=>{this.validationErrors=S.errors,this.propagateChanges()},this._errorHandler("Lookup table validation failed",`Could not validate lookup table "${u.name}"`)),m.validate.promise(h),h},_errorHandler(u,i,h){return S=>{try{if(S.additional.body[0].message_template)return}catch{}let N;try{N=S.additional.body.message}catch{N=S.message}d.Z.error(`${u}: ${N}`,i),h&&h(S)}},_url(u){return(0,P.DC)(`/system/lookup/${u}`)},_urlClusterWise(u){return(0,P.DC)(`/cluster/system/lookup/${u}`)}}))}}]);})();

//# sourceMappingURL=1255d548-4349.fdf67b80fb715647c1b2.js.map




© 2015 - 2024 Weber Informatics LLC | Privacy Policy