UNPKG

@redocly/asyncapi-docs

Version:

Async API docs for Redocly Realm

2 lines (1 loc) 3.46 kB
var g=function(r,c){var s={};for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&c.indexOf(i)<0&&(s[i]=r[i]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,i=Object.getOwnPropertySymbols(r);a<i.length;a++)c.indexOf(i[a])<0&&Object.prototype.propertyIsEnumerable.call(r,i[a])&&(s[i[a]]=r[i[a]]);return s};import{jsx as n,jsxs as t,Fragment as u}from"react/jsx-runtime";import{useState as m}from"react";import{JsonViewer as b}from"@redocly/theme";import{BindingPanel as y,HeaderWrapper as l,TagStyled as d,TopicConfiguration as o,TopicConfigurationWrapper as C,MoreDetailsButton as j}from"./common";import{useProtocolLabels as x}from"../hooks";const B=({binding:r})=>{const[c,s]=m(!1),{getProtocolLabel:i}=x({amqp:Object.assign({},r.value||{})}),a=()=>{s(!c)},p=({key:h,value:e})=>{const{bindingVersion:O}=e,f=g(e,["bindingVersion"]);switch(h){case"kafka":return t(u,{children:[e.topic&&t(l,{children:[n("span",{"data-testid":"topic-label",children:"Topic"}),n("span",{children:n(d,{borderless:!0,"data-testid":"topic-value",children:e.topic})})]}),e.partitions&&t(l,{children:[n("span",{"data-testid":"partitions-label",children:"Partitions"}),n("span",{children:n(d,{borderless:!0,color:"blue","data-testid":"partitions-value",children:e.partitions})})]}),e.replicas&&t(l,{children:[n("span",{"data-testid":"replicas-label",children:"Replicas"}),n("span",{children:n(d,{borderless:!0,color:"green","data-testid":"replicas-value",children:e.replicas})})]}),e.topicConfiguration&&t("div",{children:[n(l,{expandable:!0,onClick:a,children:n(j,{expanded:c})}),c&&t(C,{children:[e.topicConfiguration["cleanup.policy"]&&t(o,{children:[n("span",{children:"\u0421leanup policy"}),n("span",{children:e.topicConfiguration["cleanup.policy"].join(", ")})]}),e.topicConfiguration["retention.ms"]&&t(o,{children:[n("span",{children:"Retention, ms"}),n("span",{children:e.topicConfiguration["retention.ms"]})]}),e.topicConfiguration["retention.bytes"]&&t(o,{children:[n("span",{children:"Retention, bytes"}),n("span",{children:e.topicConfiguration["retention.bytes"]})]}),e.topicConfiguration["delete.retention.ms"]&&t(o,{children:[n("span",{children:"Delete retention, ms"}),n("span",{children:e.topicConfiguration["delete.retention.ms"]})]}),e.topicConfiguration["max.message.bytes"]&&t(o,{children:[n("span",{children:"Max message bytes"}),n("span",{children:e.topicConfiguration["max.message.bytes"]})]}),e.topicConfiguration["confluent.key.schema.validation"]&&t(o,{children:[n("span",{children:"Confluent key schema validation"}),n("span",{children:String(e.topicConfiguration["confluent.key.schema.validation"])})]}),e.topicConfiguration["confluent.key.subject.name.strategy"]&&t(o,{children:[n("span",{children:"Confluent key subject name strategy"}),n("span",{children:e.topicConfiguration["confluent.key.subject.name.strategy"]})]}),e.topicConfiguration["confluent.value.schema.validation"]&&t(o,{children:[n("span",{children:"Confluent value schema validation"}),n("span",{children:String(e.topicConfiguration["confluent.value.schema.validation"])})]}),e.topicConfiguration["confluent.value.subject.name.strategy"]&&t(o,{children:[n("span",{children:"Confluent value subject name strategy"}),n("span",{children:e.topicConfiguration["confluent.value.subject.name.strategy"]})]})]})]})]});default:return n(b,{data:f,expandLevel:3,hideHeader:!0})}};return n(y,{header:i("channelBinding"),children:p(r)})};export{B as ChannelBinding};