"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[2651],{"./public/app/core/hooks/useNavModel.ts":(e,t,s)=>{s.d(t,{q:()=>a});var n=s("./node_modules/react-redux/es/index.js"),r=s("./public/app/core/selectors/navModel.ts");const a=e=>{const t=(0,n.useSelector)((e=>e.navIndex));return(0,r.h)(t,e)}},"./public/app/features/live/pages/PipelineAdminPage.tsx":(e,t,s)=>{s.r(t),s.d(t,{default:()=>f});var n,r,a,l=s("./node_modules/react/index.js"),o=s("./packages/grafana-runtime/src/index.ts"),i=s("./packages/grafana-ui/src/index.ts"),u=s("./public/app/core/components/Page/Page.tsx"),c=s("./public/app/core/hooks/useNavModel.ts"),d=s("./node_modules/@emotion/css/dist/emotion-css.esm.js"),p=s("./node_modules/react/jsx-runtime.js");const h=[{label:"Converter",value:"converter"},{label:"Processor",value:"processor"},{label:"Output",value:"output"}],v=e=>{const{rule:t,isOpen:s,onClose:n}=e,[r,a]=(0,l.useState)("converter");return(0,p.jsxs)(i.Modal,{isOpen:s,title:t.pattern,onDismiss:n,closeOnEscape:!0,children:[(0,p.jsx)(i.TabsBar,{children:h.map(((e,t)=>(0,p.jsx)(i.Tab,{label:e.label,active:e.value===r,onChangeTab:()=>{a(e.value)}},t)))}),(0,p.jsxs)(i.TabContent,{children:["converter"===r&&(0,p.jsx)(g,Object.assign({},e)),"processor"===r&&(0,p.jsx)(j,Object.assign({},e)),"output"===r&&(0,p.jsx)(x,Object.assign({},e))]})]})},g=({rule:e})=>{const{converter:t}=e.settings;return t?(0,p.jsx)(i.CodeEditor,{height:600,value:JSON.stringify(t,null,"\t"),showLineNumbers:!0,readOnly:!0,language:"json",showMiniMap:!1}):n||(n=(0,p.jsx)("div",{children:"No converter defined"}))},j=({rule:e})=>{const{processor:t}=e.settings;return t?(0,p.jsx)(i.CodeEditor,{height:600,value:JSON.stringify(t,null,"\t"),showLineNumbers:!0,readOnly:!0,language:"json",showMiniMap:!1}):r||(r=(0,p.jsx)("div",{children:"No processor defined"}))},x=({rule:e})=>{const{output:t}=e.settings;return t?(0,p.jsx)(i.CodeEditor,{height:600,value:JSON.stringify(t,null,"\t"),showLineNumbers:!0,readOnly:!0,language:"json",showMiniMap:!1}):a||(a=(0,p.jsx)("div",{children:"No output defined"}))};var m;function b(e,t){var s,n,r;return null!=t&&t.type?null!==(s=t.multiple)&&void 0!==s&&null!==(n=s.outputs)&&void 0!==n&&n.length?null===(r=t.multiple)||void 0===r?void 0:r.outputs.map(((t,s)=>b(`${e}-${s}`,t))):(0,p.jsx)(i.Tag,{name:t.type},e):null}function f(){const[e,t]=(0,l.useState)([]),[s,n]=(0,l.useState)(!1),[r,a]=(0,l.useState)(),[d,h]=(0,l.useState)([]),g=(0,c.q)("live-pipeline"),[j,x]=(0,l.useState)(),f=(0,i.useStyles)(N);(0,l.useEffect)((()=>{(0,o.getBackendSrv)().get("api/live/channel-rules").then((e=>{t(e.rules),h(e.rules)})).catch((e=>{e.data&&x(JSON.stringify(e.data,null,2))}))}),[]);const C=t=>{const s=t.target.getAttribute("data-pattern"),r=t.target.getAttribute("data-column");console.log("show:",r),a(e.filter((e=>e.pattern===s))[0]),n(!0)};return(0,p.jsx)(u.Z,{navModel:g,children:(0,p.jsxs)(u.Z.Contents,{children:[j&&(0,p.jsx)("pre",{children:j}),(0,p.jsx)("div",{className:"page-action-bar",children:(0,p.jsx)("div",{className:"gf-form gf-form--grow",children:(0,p.jsx)(i.Input,{placeholder:"Search pattern...",onChange:s=>{s.target.value?(t(e.filter((e=>e.pattern.toLowerCase().includes(s.target.value.toLowerCase())))),console.log(s.target.value,e)):t(d)}})})}),(0,p.jsx)("div",{className:"admin-list-table",children:(0,p.jsxs)("table",{className:"filter-table filter-table--hover form-inline",children:[m||(m=(0,p.jsx)("thead",{children:(0,p.jsxs)("tr",{children:[(0,p.jsx)("th",{children:"Pattern"}),(0,p.jsx)("th",{children:"Converter"}),(0,p.jsx)("th",{children:"Processor"}),(0,p.jsx)("th",{children:"Output"})]})})),(0,p.jsx)("tbody",{children:e.map((e=>{var t,s,n,r,a;return(0,p.jsxs)("tr",{onClick:C,className:f.row,children:[(0,p.jsx)("td",{"data-pattern":e.pattern,"data-column":"pattern",children:e.pattern}),(0,p.jsx)("td",{"data-pattern":e.pattern,"data-column":"converter",children:null===(t=e.settings)||void 0===t||null===(s=t.converter)||void 0===s?void 0:s.type}),(0,p.jsx)("td",{"data-pattern":e.pattern,"data-column":"processor",children:null===(n=e.settings)||void 0===n||null===(r=n.processor)||void 0===r?void 0:r.type}),(0,p.jsx)("td",{"data-pattern":e.pattern,"data-column":"output",children:b("out",null===(a=e.settings)||void 0===a?void 0:a.output)})]},e.pattern)}))})]})}),s&&r&&(0,p.jsx)(v,{rule:r,isOpen:s,onClose:()=>n(!1)})]})})}const N=e=>({row:d.css`
      cursor: pointer;
    `})}}]);
//# sourceMappingURL=PipelineAdminPage.8128b05ac04b15cbf98d.js.map