1(()=>{try{let K=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},xe=new K.Error().stack;xe&&(K._sentryDebugIds=K._sentryDebugIds||{},K._sentryDebugIds[xe]="93bb430d-d6b1-4812-b9db-a89edfe05a5b",K._sentryDebugIdIdentifier="sentry-dbid-93bb430d-d6b1-4812-b9db-a89edfe05a5b")}catch{}{let K=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};K.SENTRY_RELEASE={id:"26.7.0-8250.g744dbdf5f076c"}}(self.webpackChunkaiven=self.webpackChunkaiven||[]).push([[174],{6613:K=>{K.exports={qV:"aiven-6613-qV","FlinkApplicationVersionPipeline-truncate":"aiven-6613-qV",si:"aiven-6613-si","FlinkApplicationVersionPipeline-no-wrap":"aiven-6613-si",Up:"aiven-6613-Up","FlinkApplicationVersionPipeline-shadow":"aiven-6613-Up",Tq:"aiven-6613-Tq","FlinkApplicationVersionPipeline-connector":"aiven-6613-Tq",$q:"aiven-6613-$q","FlinkApplicationVersionPipeline-status-ring":"aiven-6613-$q",error:"aiven-6613-error",warning:"aiven-6613-warning",info:"aiven-6613-info",kX:"aiven-6613-kX",success:"aiven-6613-kX",be:"aiven-6613-be","FlinkApplicationVersionPipeline-skeleton":"aiven-6613-be",hJ:"aiven-6613-hJ","FlinkApplicationVersionPipeline-logo":"aiven-6613-hJ",ym:"aiven-6613-ym","FlinkApplicationVersionPipeline-table":"aiven-6613-ym",jY:"aiven-6613-jY","FlinkApplicationVersionPipeline-script":"aiven-6613-jY",nv:"aiven-6613-nv","FlinkApplicationVersionPipeline-statement":"aiven-6613-nv"}},21654:K=>{K.exports={yI:"aiven-21654-yI",FlinkServiceIntegrationCard:"aiven-21654-yI",b0:"aiven-21654-b0","FlinkServiceIntegrationCard-isSelectable":"aiven-21654-b0",EE:"aiven-21654-EE","FlinkServiceIntegrationCard-isSelected":"aiven-21654-EE",TK:"aiven-21654-TK","FlinkServiceIntegrationCard-info":"aiven-21654-TK",p$:"aiven-21654-p$","FlinkServiceIntegrationCard-title":"aiven-21654-p$",nK:"aiven-21654-nK","FlinkServiceIntegrationCard-description":"aiven-21654-nK"}},74411:(K,xe,f)=>{f.r(xe),f.d(xe,{default:()=>ut});var e=f(74848),X=f(53165),A=f(22704),xn=f(15973),p=f(96540),y=f(59335),bn=f(13546),Z=f(42111),n=f(47435),vn=f(46921),jn=f(64661),An=f(62416),De=f(62463),te=f(60727),le=f(93
1603),Ye=f(21204),ce=f(96624),de=f(38338),kn=f(33162),ye=f(90955),yn=f(32186),O=f(24927),U=f(87254),Re=f(48710),W=f(66288),Me=f(3094),S=f(88032),ue=f(74070),be=f(56074);const Ke=()=>{const t=(0,ce.O)(),d=(0,de.o)(),{applicationId:s}=(0,X.g)(),{data:o,isLoading:a,error:h,refetch:i}=(0,O.RR)(t&&d&&s?{projectName:t,serviceName:d,applicationId:s}:ue.hT,{pollingInterval:be.jy,skipPollingIfUnfocused:!0});return{applicationDetails:o,isLoadingApplicationDetails:a,applicationDetailsError:h,getApplicationDetails:i}};var Tn=f(23431),Cn=f(64151),In=f(27279),Xe=f(21958),Sn=f(32485),Je=f.n(Sn),We=f(56632),ie=f(2635),ze=f(88389);const Bn="aiven-3543-R",Ze=({initialValue:t,error:d,onChange:s,onEditorMount:o,sinks:a,sources:h})=>{const[i,b]=p.useState(null),[u,r]=p.useState(null),g=p.useRef({});function v(x,m){b(m),r(x),o&&o(x,m)}function C(x){u&&(g.current=(0,S.BP)(u.getValue())),s&&s(x)}function L(x){const m=u?.getModel();if(!i||!m||!x)return[];if(!m.getValue().trim())return[];const l=(0,S.hf)(x.position)??m.getFullModelRange();return[{message:x.message||"",severity:i.MarkerSeverity.Error,startLineNumber:l.startLineNumber,endLineNumber:l.endLineNumber,startColumn:l.startColumn,endColumn:l.endColumn}]}const F=p.useMemo(()=>({triggerCharacters:[" ","."],provideCompletionItems(x,m){if(!i)return null;const l=x.getWordUntilPosition(m),k=(0,ie.tb)(x,m,i),j={startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:l.startColumn,endColumn:l.endColumn};if(!k)return{suggestions:[]};if((0,ie.b0)(k.value))return{suggestions:a.map(T=>({label:T.table_name??"",kind:i.languages.CompletionItemKind.Method,insertText:T.table_name??"",range:j}))??[]};if((0,ie.L$)(k.value)||(0,ie.yM)(k.value))return{suggestions:h.map(T=>({label:T.table_name??"",kind:i.languages.CompletionItemKind.Method,insertText:T.table_name??"",range:j}))??[]};const E=h.concat(a).find(T=>T.table_name===k.value||T.table_name&&g.current[T.table_name]===k.value?T:void 0),D=(0,ie.r_)(x,m,i);return E&&D?.value==="."?{suggestions:E.columns?.map(T=>({label:T.name,detail:T.data_type,kind:i.languages.CompletionItemKind.Method,insertText:T.name,range:j}))??[]}:{suggestions:[]}}}),[i,h,a]),B=p.useMemo(()=>({provideHover(x,m){const l=x.getWordAtPosition(m);if(!l)return null;const k=h.concat(a).find(j=>j.table_name===l.word||j.table_name&&g.current[j.table_name]===l.word?j:void 0);return k?.table_name?{contents:[{value:"```sql\n"+k.create_table+"\n```"}],range:{startLineNumber:m.lineNumber,startColumn:l.startColumn,endLineNumber:m.lineNumber,endColumn:l.endColumn}}:null}}),[a,h]);return(0,e.jsx)(n.Box,{className:Bn,children:(0,e.jsx)(te.TY,{onMount:v,onChange:C,markers:L(d),completionItemProvider:F,hoverProvider:B,placeholder:(0,e.jsx)(n.Typography,{color:"muted",children:(0,e.jsxs)("code",{children:["-- Single statement"," ",(0,e.jsx)("br",{}),"INSERT INTO sink_table ",(0,e.jsx)("br",{})," SELECT * FROM source_table;",(0,e.jsx)("br",{}),(0,e.jsx)("br",{}),"-- Multiple statements"," ",(0,e.jsx)("br",{}),"EXECUTE STATEMENT SET ",(0,e.jsx)("br",{})," BEGIN ",(0,e.jsx)("br",{}),"\u2003INSERT INTO sink_table_1 SELECT * FROM source_table; ",(0,e.jsx)("br",{}),"\u2003INSERT INTO sink_table_2 SELECT * FROM source_table; ",(0,e.jsx)("br",{}),"\u2003INSERT INTO sink_table_3 SELECT * FROM source_table; ",(0,e.jsx)("br",{}),"END"]})}),options:(0,ze.X)({language:"sql",folding:!1,value:t||"",readOnly:!s})})})};var _e=f(69007);const qe=({initialValue:t,tableType:d,validationResult:s,connectors:o,onChange:a,onEditorMount:h})=>{const[i,b]=p.useState(null),[u,r]=p.useState(null);function g(x,m){b(m),r(x),h&&h(x,m)}function v(x){a&&a(x)}const C=p.useCallback(()=>{u&&u.trigger("","editor.action.triggerSuggest",{})},[u]),L=p.useMemo(()=>({triggerCharacters:[" "],provideCompletionItems(x,m){if(!i||!u||!u.getModel())return null;if(!x.getValue())return{suggestions:o.filter(j=>j.scopes.includes(d)).map(({connector:j,documentation:E,documentation_url:D})=>({label:`${j} connector`,kind:i.languages.CompletionItemKind.Function,detail:`Connector: ${j}`,range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:1,endColumn:1},documentation:{value:`<p>${E}</p><br/> 2<a href="${D}" target="_blank">${D}</a>`,supportHtml:!0,isTrusted:!0},insertText:(0,S.a_)(j),insertTextRules:i.languages.CompletionItemInsertTextRule.InsertAsSnippet}))};const l=x.getWordUntilPosition(m),k={startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:l.startColumn,endColumn:l.endColumn};if((0,S.x)(x,m,i)){if(!(0,S.no)(x,i))return{suggestions:[{kind:i.languages.CompletionItemKind.Method,label:S.s8.Connector,detail
2:S.s8.Connector,documentation:"Specify what connector to use",range:k,insertText:`'${S.s8.Connector}' = '\${1:}'`,insertTextRules:i.languages.CompletionItemInsertTextRule.InsertAsSnippet,command:{id:"editor.action.triggerSuggest",title:"retrigger to suggest property value"}}]};const E=(0,ie.hv)(x,m,i);if(E?.value===S.s8.Connector)return{suggestions:o.filter(c=>c.scopes.includes(d)).map(({connector:c,documentation:R,documentation_url:N})=>({kind:i.languages.CompletionItemKind.Method,label:c,detail:c,documentation:{value:`<p>${R}</p><br /> 3<a href="${N}" target="_blank">${N}</a>`,supportHtml:!0,isTrusted:!0},range:k,insertText:c}))};const D=(0,S.dC)(x,i);if(!D)return null;const T=o.find(({connector:c})=>c===D.value);if(!T)return null;const $=(0,ie.r_)(x,m,i);if(!$)return null;const w=T.options.find(c=>c.name===E?.value);if(w?.values&&!["(",","].includes($.value))return{suggestions:w.values.map(({value:c,documentation:R})=>({kind:i.languages.CompletionItemKind.Method,label:c??"",detail:c??"",documentation:R??"",range:k,insertText:c??""}))};if(T.options&&["(",","].includes($.value))return{suggestions:T.options.filter(c=>!x.getValue().includes(c.name)).map(({name:c,documentation:R,documentation_url:N,ignore:Q})=>({kind:i.languages.CompletionItemKind.Function,label:c,detail:c,documentation:{value:`<p>${R}</p><p>${Q?"This property will be resolved and overwritten at job runtime. You can leave it empty.":""}</p><br /> 4<a href="${N}" target="_blank">${N}</a>`,supportHtml:!0,isTrusted:!0},range:k,insertText:S.i5[c]??`'${c}' = '\${1:}'`,insertTextRules:i.languages.CompletionItemInsertTextRule.InsertAsSnippet,command:{id:"editor.action.triggerSuggest",title:"retrigger to suggest value"}}))}}return(0,S.o)(x,m,i)?{suggestions:S.a9.map(j=>({kind:i.languages.CompletionItemKind.Method,insertText:j,label:j,range:k}))}:{suggestions:[]}}}),[i,u,d,o]),F=p.useMemo(()=>({provideHover(x,m){if(!i)return null;if((0,S.x)(x,m,i)){const l=(0,ie.kg)(x,m,i);if(!l)return null;const k=(0,S.dC)(x,i);if(!k)return null;const j=o.find(({connector:$})=>$===k.value);if(!j)return null;let E=j.options.find(({name:$})=>$===l.value);if(E)return{contents:[{value:l.value},{value:`<p>${E.documentation}</p><p>${E.ignore?"<b>Note:</b> This property will be resolved and overwritten at job runtime. You can leave it empty.":""}</p>`,supportHtml:!0},{value:`<a href="${E.documentation_url}" target="_blank">${E.documentation_url}</a>`,isTrusted:!0,supportHtml:!0}],range:l.range};const D=(0,ie.hv)(x,m,i);if(!D||(E=j.options.find(({name:$})=>$===D.value),!E))return null;const T=E.values?.find(({value:$})=>$===l.value);if(T)return{contents:[{value:l.value},{value:`<p>${T.documentation}</p>`,supportHtml:!0},{value:`<a href="${T.documentation_url}" target="_blank">${T.documentation_url}</a>`,isTrusted:!0,supportHtml:!0}],range:l.range}}return null}}),[o,i]);function B(x){const m=u?.getModel();if(!i||!m||!x)return[];if(!m.getValue().trim())return[];const l=(0,S.hf)(x.position)??m.getFullModelRange();return l?[{message:x.message||"",severity:i.MarkerSeverity.Error,startLineNumber:l.startLineNumber,endLineNumber:l.endLineNumber,startColumn:l.startColumn,endColumn:l.endColumn}]:[]}return(0,e.jsx)(te.TY,{onMount:g,onChange:v,onFocus:C,completionItemProvider:L,hoverProvider:F,markers:B(s),placeholder:(0,e.jsx)(n.Typography,{color:"muted",children:(0,e.jsxs)("code",{children:["CREATE TABLE ",S.c_.Kafka," ( ",(0,e.jsx)("br",{}),"\u2003 id STRING ",(0,e.jsx)("br",{}),") WITH ( ",(0,e.jsx)("br",{}),"\u2003 ",'"',S.s8.Connector,'"'," = ",'"',S.c_.Kafka,'"',", ",(0,e.jsx)("br",{}),"\u2003 ",'"',S.s8.PropertiesBootstrapServers,'"'," = ",'"','"',", ",(0,e.jsx)("br",{}),"\u2003 ",'"',S.s8.ScanStartupMode,'"'," = ",'"',S.vu.EarliestOffset,'"',", ",(0,e.jsx)("br",{}),"\u2003 ",'"',S.s8.Topic,'"'," = ",'"','"',", ",(0,e.jsx)("br",{}),"\u2003 ",'"',S.s8.ValueFormat,'"'," = ",'"',S.vu.JSON,'"'," ",(0,e.jsx)("br",{}),")"]})}),options:(0,ze.X)({language:"sql",value:t,folding:!1,readOnly:!a})})};var En=f(75841),Vn=f(43132),Fn=f(18162),Ne=f(4506),pe=f(21654);const Dn=({analyticsId:t,analyticsContexts:d,integration:s,onClick:o,isSelected:a=!1})=>{const h=!!(s.source_service_type&&(0,Fn.n4)(s.source_service_type));return(0,e.jsxs)(En.A,{analyticsId:(0,y._A)(t,"flink-service-integration-card"),analyticsContexts:d,className:Je()({[pe.yI]:!0,[pe.EE]:a,[pe.b0]:!!o}),onClick:()=>o?.(s),disabled:a,type:"button","data-testid":s.service_integration_id,children:[(0,e.jsx)("div",{children:(0,e.jsx)(Vn.A,{serviceType:(0,Ne.Q6)(s.source_service_type),size:40,variant:"default"})}),(0,e.jsxs)("div",{className:pe.TK,children:[(0,e.jsx)("div",{className:pe.p$,children:h?s.source_endpoint:s.source_service}),(0,e.jsx)("div",{className:pe.nK,children:(0,Ne.QE)(s.source_service_type,h)})]})]})},Rn=({connector:t,description:d})=>(0,e.jsxs)(n.Box.Flex,{flexDirection:"row",gap:"4",paddingX:"4",paddingY:"2",children:[(0,e.jsx)(n.Box,{children:(0,e.jsx)(We.A,{image:(0,S.dU)(t),width:40,height:40,alt:""})}),(0,e.jsxs)(n.Box,{children:[(0,e.jsx)(n.Typography,{children:t}),(0,e.jsx)(n.Typography.Small,{color:"muted",children:d})]})]}),en=({analyticsId:t,analyticsContexts:d,table:s,handleClose:o})=>{const a=(0,ce.O)(),h=(0,de.o)(),i=(0,Re.X2)({projectName:a,serviceName:h}),b=(0,O.hB)({projectName:a,serviceName:h}),u=s.options?.connector,r=i.data?.service_integrations.find(v=>
4s.integration_id===v.service_integration_id),g=b.data?.find(v=>v.connector===u)?.documentation??"";return(0,e.jsxs)(_e.A,{analyticsId:(0,y._A)("flink-table-details","modal"),title:"View table details",cancelAction:o,cancelTitle:"Close",size:"md",children:[b.isLoading&&(0,e.jsx)(ye.A,{}),(0,e.jsx)(le.A,{error:b.error,marginBottom:"5"}),b.data&&(0,e.jsxs)(p.Fragment,{children:[(0,e.jsxs)(n.Box,{marginTop:"2",marginBottom:"4",children:[r&&(0,e.jsx)(Dn,{analyticsId:(0,y._A)(t,"flink-service-integration-card"),analyticsContexts:d,integration:r}),!!(!r&&u)&&(0,e.jsx)(Rn,{connector:u,description:g})]}),(0,e.jsx)(n.Box,{style:{height:"400px"},children:(0,e.jsx)(qe,{initialValue:s.create_table,tableType:A.Hk.SOURCE,connectors:b.data})})]})]})};var J=f(6613);const nn="flink-application-version",Mn=({version:t,application:d})=>(0,e.jsxs)(n.Box,{display:"flex",justifyContent:"space-evenly",children:[(0,e.jsx)(n.Box,{display:"flex",flexDirection:"column",className:J.ym,gap:"5",children:t.sources.map(s=>(0,e.jsx)(an,{table:s,position:"left"},s.table_id))}),(0,e.jsx)(on,{tables:t.sources.length}),(0,e.jsx)(n.Box,{display:"flex",flexDirection:"column",className:J.jY,children:(0,e.jsx)(Nn,{version:t,application:d})}),(0,e.jsx)(on,{tables:t.sinks.length}),(0,e.jsx)(n.Box,{display:"flex",flexDirection:"column",className:J.ym,gap:"5",children:t.sinks.map(s=>(0,e.jsx)(an,{table:s,position:"right"},s.table_id))})]}),tn=({children:t})=>(0,e.jsx)(n.Box,{className:J.Up,borderRadius:4,borderWidth:1,borderColor:"muted",children:t}),an=({table:t,position:d})=>{const[s,o]=p.useState(!1),a=()=>{o(!0)},h=()=>{o(!1)};return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(tn,{children:[(0,e.jsxs)(n.Box,{display:"flex",paddingX:"4",paddingY:"4",alignItems:"center",justifyContent:"space-between",children:[(0,e.jsxs)(n.Box,{display:"flex",alignItems:"center",gap:"4",children:[(0,e.jsx)(We.A,{image:(0,S.dU)(t.options?.connector??null),className:J.hJ,alt:""}),(0,e.jsx)(n.Typography.Small,{className:J.qV,children:t.table_name})]}),(0,e.jsx)(n.Button,{analyticsId:(0,y._A)(nn,"view-integration-item"),kind:"ghost",dense:!0,onClick:()=>{a()},children:(0,e.jsx)("span",{className:J.si,children:"View"})})]}),(0,e.jsx)(we,{position:d})]}),s&&(0,e.jsx)(en,{analyticsId:(0,y._A)(nn,"table-details-modal"),table:t,handleClose:h})]})},on=({tables:t})=>{const d=Math.max(0,t-1),s=d*52,o=d*16,a=s+o;return(0,e.jsx)(n.Box,{marginLeft:"5",marginRight:"5",children:(0,e.jsx)("div",{style:{height:a},className:J.be})})},we=({position:t})=>(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:Je()(J.$q,J.kX),style:{left:t==="left"?void 0:-8,right:t==="right"?void 0:-8}}),(0,e.jsx)("div",{className:J.Tq,style:{left:t==="left"?void 0:-16,right:t==="right"?void 0:-16}})]}),Nn=({version:t})=>(0,e.jsxs)(tn,{children:[(0,e.jsx)(we,{position:"left"}),(0,e.jsx)(n.Box,{paddingX:"5",paddingY:"4",children:(0,e.jsx)(n.Typography.DefaultStrong,{children:"Statement"})}),(0,e.jsx)(n.Divider,{}),(0,e.jsx)(n.Box,{paddingY:"5",className:J.nv,style:{height:400},children:(0,e.jsx)(Ze,{sources:t.sources,sinks:t.sinks,initialValue:t.statement})}),(0,e.jsx)(we,{position:"right"})]}),wn=Mn,Ln=({projectName:t,serviceName:d,versionId:s,application:o})=>{const{data:a,isLoading:h,error:i}=(0,O.bd)({projectName:t,serviceName:d,applicationId:o.id,applicationVersionId:s});return h?(0,e.jsx)(Xe.A,{}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(le.A,{error:i,marginBottom:"6"}),a&&(0,e.jsx)(wn,{version:a,application:o})]})};var On=f(38824),$n=f(37547),Pn=f(71832);const Hn="flink-application-details-tab";var Qn=(t=>(t.UPDATE="UPDATE",t.DELETE="DELETE",t))(Qn||{});const Un=()=>{const t=(0,kn.A)(Pn.A),d=(0,U.j)(),s=(0,X.Zp)(),o=(0,ce.O)(),a=(0,de.o)(),{data:h}=(0,Re.X2)({projectName:o,serviceName:a}),{applicationDetails:i,isLoadingApplicationDetails:b,applicationDetailsError:u}=Ke(),r=(0,bn.A)(i?.application_versions,"created_at").reverse(),g=r.at(0)?.id??"",v=(0,X.g)(),{accountId:C,applicationId:L}=v,[F,B]=p.useState(!1),[x,m]=p.useState(!1),[l,k]=p.useState(!1),[j,E]=p.useState(!1),[D,T]=p.useState(!1),[$,w]=p.useState(),[c,R]=p.useState(g),N=r.find(M=>M.id===c);(0,p.useEffect)(()=>{!c&&g&&R(g)},[g,c]);const[Q,P]=(0,O.zA)(),[se,G]=(0,O.dd)(),[_,z]=(0,O.ZQ)(),[ae,q]=(0,O.$n)(),[oe,Y]=(0,O.B4)(),[re,ee]=(0,O.$w)();function V(){k(!0)}function ge(){B(!1),s((0,W.D$)({accountId:C,projectName:o,serviceName:a,applicationId:L}))}function H(){B(!0)}function he(M){o&&a&&i&&Q({projectName:o,serviceName:a,applicationId:i.id,payload:M}).unwrap().then(()=>{d(A.oR({variant:"default",message:"Successfully deployed application version"})),B(!1)}).catch(Z.A)}function je(){s((0,W.kQ)({projectName:o,serviceName:a,applicationId:L,accountId:C}))}function Ae(){E(!0)}function Ce(M){o&&i&&se({projectName:o,serviceName:a,applicationId:i.id,deploymentId:M}).unwrap().then(()=>{d(A.oR({variant:"default",message:"Stopped application deployment!"})),E(!1)}).catch(Z.A)}function Ie(M){o&&i&&ae({projectName:o,serviceName:a,applicationId:i.id,deploymentId:M}).unwrap().then(()=>{d(A.oR({variant:"default",message:"Stopped application deployment!"})),E(!1)}).catch(Z.A)}function Se(){r.length?s((0,W._P)({projectName:o,serviceName:a,accountId:C,applicationId:L,applicationVersionId:g})):je()}function Be(){o&&i&&oe({projectName:o,serviceName:a,applicationId:i.id}).unwrap().then(M=>{s((0,W.Hx)({projectName:o,serviceName:a,accountId:C})),A.oR({variant:"default",message:`Successfully deleted application ${M.name}`})}).catch(Z.A)}function $e(M){o&&i&&re({projectName:o,serviceName:a,applicationId:i.id,payload:M}).unwrap().then(()=>{k(!1),d(A.oR({variant:"default",message:"Application has been successfully updated"}))}).catch(Z.A)}function Pe(){!c||!N||_({projectName:o,serviceName:a,applicationId:L,versionId:c}).unwrap().then(()=>{d(A.oR({variant:"default",message:`Version ${N.version} was deleted.`})),T(!1)}).catch(M=>{d(A.oR({variant:"danger",message:M.message})),T(!1)})}function Ee(){T(!1),z.reset()}if(!o||!a)return null;if(b)return(0,e.jsx)(ye.A,{});if(!i)return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(le.A,{error:u}
4),(0,e.jsx)(yn.A,{title:"Application details not found."})]});const Ve=!!r.length,fe=(0,S.WQ)(i.current_deployment),ne=(0,S.y)(i.current_deployment),ke=r.find(M=>M.id===$?.version_id)?.version;function He(){const M=h?.service_uri,Fe=i?.current_deployment?.job_id;if(M)return Fe?(0,S.PN)(M,Fe):(0,S._S)(M)}const Qe=He(),Ue=(0,e.jsxs)(n.DropdownMenu.Items,{children:[(0,e.jsx)(n.DropdownMenu.Item,{icon:vn.A,children:"Update application"},"UPDATE"),(0,e.jsx)(n.DropdownMenu.Item,{icon:De.A,kind:"danger",children:"Delete application"},"DELETE")]}),Ge=M=>{switch(M){case"UPDATE":{V();break}case"DELETE":m(!0);break}};return(0,e.jsxs)(n.Box,{children:[(0,e.jsx)(Ye.A,{title:i.name,analyticsId:(0,y._A)(Hn,"page-header"),breadcrumbs:[(0,e.jsx)(n.Breadcrumbs.Crumb,{to:(0,W.Hx)({projectName:o,serviceName:a,accountId:C}),children:Me.je.APPLICATIONS},"all"),(0,e.jsx)(n.Breadcrumbs.Crumb,{children:i.name},"app-details-view")],secondaryAction:{text:"Deployment history",onClick:()=>s((0,W.D$)({projectName:o,serviceName:a,applicationId:L,accountId:C})),analyticsId:"deployment-history"},primaryAction:{text:fe?"Stop deployment":"Create deployment",analyticsId:fe?"stop-deployment":"create-deployment",onClick:fe?Ae:H,disabled:fe?void 0:!Ve||!ne},menu:Ue,menuAriaLabel:"flink-application-action-menu",onAction:Ge}),(0,e.jsx)(le.A,{error:u,marginBottom:"5"}),(0,e.jsxs)(n.Box.Flex,{alignItems:"center",marginBottom:"4",children:[(0,e.jsx)(n.Typography.Small,{htmlTag:"div",children:(0,e.jsx)(n.Chip,{text:"SQL"})}),(0,e.jsx)(n.Box,{marginLeft:"4",children:(0,e.jsx)(n.Typography.Small,{htmlTag:"div",children:(0,e.jsx)(n.Chip,{icon:jn.A,text:`${r.length} versions`})})}),!!i.current_deployment&&(0,e.jsxs)(n.Box,{marginLeft:"4",children:["Latest deployment:"," ",(0,e.jsxs)(n.Button,{kind:"ghost",dense:!0,analyticsId:(0,y._A)("application","view-deployment-details"),onClick:()=>w(i.current_deployment),children:[i.current_deployment.id.slice(-12)," ",(0,e.jsx)(n.StatusChip,{text:i.current_deployment.status,dense:!0,status:(0,S.NS)(i.current_deployment.status)})]})]})]}),Ve?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(n.Divider,{}),(0,e.jsxs)(n.Box.Flex,{justifyContent:"space-between",alignItems:"center",paddingTop:"4",paddingBottom:"4",children:[(0,e.jsx)(n.Box,{style:{width:"300px"},paddingRight:"3",children:(0,e.jsx)(n.NativeSelect,{onChange:M=>R(M.target.value),value:c,reserveSpaceForError:!1,children:r.map(M=>(0,e.jsxs)(n.Option,{value:M.id,children:["Version: ",M.version," ",g===M.id?"(latest)":""]},M.id))})}),(0,e.jsxs)(n.Box.Flex,{alignItems:"center",gap:"4",children:[(0,e.jsxs)(n.DropdownMenu,{analyticsId:(0,y._A)("flink-application-details","version-action-menu"),onAction:()=>T(!0),children:[(0,e.jsx)(n.DropdownMenu.Trigger,{children:(0,e.jsx)(n.Button.Icon,{analyticsId:(0,y._A)("flink-application-details","toggle-version-action-menu"),"aria-label":"flink-application-version-action-menu",icon:An.A})}),(0,e.jsx)(n.DropdownMenu.Items,{children:(0,e.jsx)(n.DropdownMenu.Item,{icon:De.A,kind:"danger",children:"Delete version"},1)})]}),(0,e.jsx)(n.Button,{analyticsId:(0,y._A)("flink-application-details","create-new-version"),kind:"secondary",onClick:Se,tooltip:"Create new version from the latest version",children:"Create new version"})]})]}),c&&(0,e.jsx)(n.Box,{marginTop:"8",children:(0,e.jsx)(Ln,{projectName:o,serviceName:a,application:i,versionId:c})})]}):(0,e.jsx)(te.pp,{layout:n.EmptyStateLayout.Vertical,fullHeight:!1,title:"Build your first data processing pipeline",image:t,primaryAction:{onClick:je,text:"Create first version"},children:"Set up data tables and create your first Flink job to discover the power of real-time data stream processing."}),x&&(0,e.jsx)(Cn.A,{application:i,useDeploymentsQuery:O.Vf,onDelete:Be,onCleanup:()=>{m(!1),s((0,W.D$)({projectName:o,serviceName:a,applicationId:L,accountId:C})),Y.reset()},onClose:()=>{m(!1),Y.reset()},isSubmitting:Y.isLoading,error:Y.error}),F&&(0,e.jsx)(On.A,{projectName:o,serviceName:a,applicationId:i.id,applicationType:A.Xr.SQL,applicationVersions:r,onClose:()=>{B(!1),P.reset()},onDeploy:he,onMaxLimitReached:ge,isSubmitting:P.isLoading,error:P.error}
4),l&&(0,e.jsx)($n.A,{applicationDetails:i,onUpdate:$e,onClose:()=>{k(!1),ee.reset()},isSubmitting:ee.isLoading,error:ee.error}),j&&!!i.current_deployment&&(0,e.jsx)(In.A,{deploymentId:i.current_deployment.id,application:i,onStop:Ce,onCancel:Ie,onClose:()=>{E(!1),G.reset(),q.reset()},isSubmitting:G.isLoading||q.isLoading,error:G.error??q.error}),D&&!!N&&(0,e.jsx)(n.Dialog,{analyticsId:(0,y._A)("flink-application-details","confirm-delete-version-modal"),title:"Delete confirmation",type:"danger",open:!0,onClose:Ee,primaryAction:{text:"Delete version",onClick:Pe,loading:z.isLoading},secondaryAction:{text:"Cancel",onClick:Ee,disabled:z.isLoading},children:`Are you sure you want to delete version ${N.version}?`}),!!$&&!!ke&&(0,e.jsx)(Tn.A,{projectName:o,serviceName:a,applicationType:A.Xr.SQL,deployment:$,version:ke,jobOverviewURL:Qe,onClose:()=>w(void 0)})]})};var ln=f(67827),sn=f(26181),ve=f(90169);const rn=({interactiveQuery:t,jobDetails:d,isLoading:s})=>{if(s)return(0,e.jsx)(n.Box,{padding:"4",children:"Running query ..."});if(!t)return(0,e.jsxs)(n.Box,{padding:"4",children:["Press ","'Run'"," to see the output of the sql above"]});if(d?.state===ve.gg_.FAILED&&!t.rows.length)return(0,e.jsx)(n.Box,{padding:"4",children:"Looks like the provided sql failed to produce output data. Check the exceptions tab for potential issues."});if((0,S.k0)(d?.state)&&!t.rows.length)return(0,e.jsx)(n.Box,{padding:"4",children:"The query completed but no output data was produced."});if(!t.rows.length)return(0,e.jsx)(n.Box,{padding:"4",children:"No rows have been produced yet. This can take few seconds ..."});const o="Table",a=[{name:o,data_type:"string",nullable:!1}].concat(t.columns),h=(i,b,u)=>u===0&&b.name===o?i.table:(0,e.jsx)(te.dN,{value:i.data[b.name]});return(0,e.jsx)(n.Box,{children:(0,e.jsxs)(n.Table,{ariaLabel:"Output rows for the interactive query",children:[(0,e.jsx)(n.Table.Head,{children:a.map(i=>(0,e.jsx)(n.Table.Cell,{children:i.name},i.name))}),(0,e.jsx)(n.Table.Body,{children:t.rows.map(i=>(0,e.jsx)(n.Table.Row,{children:a.map((b,u)=>(0,e.jsx)(n.Table.Cell,{children:h(i,b,u)},u))},i.index))})]})})};var cn=f(39555),Le=f(5188);const dn=()=>{const t=(0,U.j)(),[d]=(0,O.SY)(),s=p.useCallback(async({projectName:a,serviceName:h,applicationId:i,payload:b})=>{t((0,A.EM)(!0)),d({projectName:a,serviceName:h,applicationId:i,payload:b}).unwrap().then(u=>{t((0,A.qJ)(u))}).catch(u=>{t((0,A.qJ)({sinks:b.sinks,sources:b.sources,statement:b.statement,statement_error:{message:(0,Le.u1)(u)}}))}).finally(()=>{t((0,A.EM)(!1))})},[t,d]),o=p.useCallback(({projectName:a,serviceName:h,applicationId:i,tableType:b,table:u})=>{d({projectName:a,serviceName:h,applicationId:i,payload:{sources:b===A.Hk.SOURCE?[u]:[],sinks:b===A.Hk.SINK?[u]:[]}}).unwrap().then(r=>{t((0,A.C9)(r))}).catch(r=>{const g={message:(0,Le.u1)(r),create_table:u.create_table};t((0,A.C9)({sources:b===A.Hk.SOURCE?[g]:[],sinks:b===A.Hk.SINK?[g]:[]}))})},[t,d]);return{validateApplicationVersion:s,validateApplicationTable:o}};var Te=f(60460);const Gn="aiven-36151-A";var Yn=(t=>(t[t.Output=1]="Output",t[t.Exceptions=2]="Exceptions",t))(Yn||{});const Oe=({analyticsId:t,analyticsContexts:d,tableType:s,integrationId:o,createTableSQL:a,validationResult:h,onIntegrationIdChange:i,onCreateTableSQLChange:b,onEditorMount:u})=>{const r=(0,U.j)(),g=(0,ce.O)(),v=(0,de.o)(),{data:C}=(0,Re.X2)({projectName:g,serviceName:v}),L=(0,X.g)(),{applicationId:F}=L,[B,x]=p.useState(1),m=(0,O.hB)({projectName:g,serviceName:v}),l=p.useRef(null),k=(0,S.Hx)(C,m.data,s),j=p.useRef(new AbortController),[E,D]=p.useState(!1),T=(0,U.G)(Te.zR),$=T?.job_id||"",w=(0,U.G)(Te.Qx)||"",c=100,R=T?.rows.length===c,N=!!w&&!R&&!E,Q=N&&!!$,{currentData:P}=(0,O.YE)(g&&v&&$&&Q?{projectName:g,serviceName:v,jobId:$}:ue.hT,{pollingInterval:be.Z2*5,skipPollingIfUnfocused:!0});(0,O.vW)(g&&v&&F&&w&&N?{projectName:g,serviceName:v,applicationId:F,queryId:w}:ue.hT,{pollingInterval:be.Z2*5,skipPollingIfUnfocused:!0});const[se,{isLoading:G}]=(0,O.EH)(),[_,{isLoading:z}]=(0,O.$X)(),[ae]=(0,O.$X)(),q=s===A.Hk.SOURCE&&!!a&&!!h&&!h?.message&&!G&&!z&&!N&&!Q,{validateApplicationTable:oe}=dn();function Y(H,he){l.current=H.onDidChangeModelContent(()=>{r((0,A.C9)(void 0))}),u&&u(H,he)}const re=H=>{i(H.target.value)},ee=H=>{b(H)};
4function V(){w?(_({projectName:g,serviceName:v,applicationId:F,interactiveQueryId:w}),r((0,A.Yv)())):(j.current.abort(),j.current=new AbortController,r((0,A.Yv)()))}function ge(){q&&(r((0,A.Yv)()),D(!1),x(1),se({projectName:g,serviceName:v,applicationId:F,payload:{sources:[{integration_id:o||void 0,create_table:a}],max_rows:c},signal:j.current.signal}).unwrap().then(H=>{r((0,A.J5)(H.query_id))}).catch(Z.A))}return p.useEffect(()=>{const H=j.current;return()=>{H.abort(),w&&_({projectName:g,serviceName:v,applicationId:F,interactiveQueryId:w}),r((0,A.Yv)()),r((0,A.C9)(void 0))}},[r]),p.useEffect(()=>{function H(){g&&v&&a&&oe({projectName:g,serviceName:v,applicationId:F,tableType:s,table:{integration_id:o||void 0,create_table:a}})}H()},[o,a,F,r,g,v,s,oe]),p.useEffect(()=>{!N&&w&&r(O.Ay.endpoints.serviceFlinkApplicationVersionGetQuery.initiate({projectName:g,serviceName:v,applicationId:F,queryId:w},{subscribe:!1,forceRefetch:!0})).unwrap().then(()=>{ae({projectName:g,serviceName:v,applicationId:F,interactiveQueryId:w})}).catch(Z.A)},[r,N]),p.useEffect(()=>{P?.state===ve.gg_.FAILED&&x(2),(0,S.k0)(P?.state)&&D(!0)},[r,P?.state]),m.isLoading?(0,e.jsx)(ye.A,{}):(0,e.jsxs)(n.Box,{children:[(0,e.jsx)(le.A,{error:m.error,marginBottom:"5"}),m.data&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(n.NativeSelect,{labelText:"Integrated service:",name:"integration_id",helpTooltip:"The service that will be used as the datasource for this table",onChange:re,value:o,disabled:!k.length,children:[(0,e.jsx)(n.Option,{value:"",children:"No integrated service"}),k.map(H=>(0,e.jsxs)(n.Option,{value:H.service_integration_id||"",children:[H.source_endpoint?H.source_endpoint:H.source_service," - ",(0,Ne.QE)(H.source_service_type,!!H.source_endpoint)]},H.service_integration_id))]}),(0,e.jsx)(n.Label,{labelText:"Table SQL",helpTooltip:(0,e.jsxs)(e.Fragment,{children:["The statement which will be used to create the table. To learn more about flink tables, please refer to the official"," ",(0,e.jsx)(n.Link,{analyticsId:(0,y._A)("flink-application-version-table","apache-docs"),href:"https://nightlies.apache.org/flink/flink-docs-master/docs/dev/table/sql/create/#create-table",target:"_blank",children:"documentation"}),". To learn more about the available connectors, please refer to our developer"," ",(0,e.jsx)(n.Link,{analyticsId:(0,y._A)("flink-application-version-table","aiven-docs"),href:"https://aiven.io/docs/products/flink/howto/list-flink-table-integrations",target:"_blank",children:"documentation"})," ","for examples.",(0,e.jsx)("br",{})," ",(0,e.jsx)("br",{}),(0,e.jsx)("b",{children:"Note*"}),": Connection properties are resolved at job runtime."]})}),(0,e.jsxs)(n.Grid,{style:{border:"2px solid #EDEDF0",gridTemplateColumns:"minmax(0, 1fr)",gridTemplateRows:"auto min-content 500px"},children:[(0,e.jsx)(n.Grid.Item,{colStart:"1",colEnd:"2",rowStart:"1",rowEnd:"1",paddingTop:"4",paddingBottom:"4",children:(0,e.jsx)(n.Box,{style:{height:"500px"},children:(0,e.jsx)(qe,{tableType:s,validationResult:h,connectors:m.data,onChange:ee,onEditorMount:Y})})}),(0,e.jsx)(n.Grid.Item,{colStart:"1",colEnd:"2",rowStart:"2",rowEnd:"2",backgroundColor:"muted",children:(0,e.jsxs)(n.Box.Flex,{flexDirection:"row",alignItems:"center",children:[(0,e.jsx)(n.Box,{marginLeft:"3",children:G||N||Q?(0,e.jsx)(n.Button,{analyticsId:(0,y._A)("flink-application-version-table-editor","stop"),kind:"ghost",dense:!0,icon:sn.A,disabled:z,onClick:V,children:"Stop"}):(0,e.jsx)(n.Button,{analyticsId:(0,y._A)("flink-application-version-table-editor","run"),kind:"ghost",dense:!0,icon:ln.A,onClick:ge,disabled:!q,tooltip:s===A.Hk.SINK?"Not available for sink tables":"",children:"Run"})}),(0,e.jsx)(n.Box,{marginLeft:"3",children:G||N||Q?(0,e.jsx)(n.Typography.Small,{color:"muted",children:"the running query"}):(0,e.jsx)(n.Typography.Small,{color:"muted",children:"a sample query to see how the data is being pulled from the data source"})})]})}),(0,e.jsx)(n.Grid.Item,{colStart:"1",colEnd:"2",rowStart:"3",rowEnd:"3",style:{borderTop:"2px solid #EDEDF0",overflow:"auto"},children:(0,e.jsx)(n.Box,{className:Gn,children:(0,e.jsxs)(n.Tabs,{onChange:x,value:B,analyticsId:(0,y._A)(t,"tabs"),children:[(0,e.jsx)(n.Tabs.Tab,{title:"Output",value:1,children:(0,e.jsx)(rn,{interactiveQuery:T,jobDetails:P,isLoading:G})}),(0,e.jsx)(n.Tabs.Tab,{title:"Exceptions",value:2,status:P?.state===ve.gg_.FAILED?"error":void 0,children:(0,e.jsx)(cn.A,{analyticsId:(0,y._A)(t,"job-exceptions-tab"),analyticsContexts:d,projectName:g,serviceName:v,jobId:T?.job_id,isLoading:G})})]})})})]})]})]})},Kn="flink-application-version-add-table--modal",Xn=({type:t,sources:d,sinks:s,onSubmit:o,onClose:a})=>{const[h,i]=p.useState(""),[b,u]=p.useState(""),r=(0,U.G)(B=>B.flinkReducer.applicationTableValidationResult),g=L(),v=!!g&&!g?.message&&!!h;function C(B){return d.concat(s).some(x=>x.table_name===B.table_name)}function L(){let B;return t===A.Hk.SOURCE?B=r?.sources[0]:B=r?.sinks[0],B&&C(B)&&(B={create_table:B.create_table,message:`Table ${B.table_name} already exists.`}),B}function F(){o({create_table:h,integration_id:b,table_name:g?.table_name}),a()}return(0,e.jsx)(n.Modal,{analyticsId:Kn,title:`Add new ${t} table`,size:"full",open:!0,closeOnEsc:!1,onClose:a,primaryAction:{text:"Add table",onClick:F,disabled:!v,analyticsId:"add-table"},secondaryActions:[{text:"Cancel",onClick:a,analyticsId:"cancel"}],children:(0,e.jsx)(Oe,{analyticsId:(0,y._A)("flink-application-version-add-table-modal","table-editor"),tableType:t,integrationId:b,createTableSQL:h,validationResult:g,onIntegrationIdChange:u,onCreateTableSQLChange:i})})},Jn="flink-application-version-clone-table--modal",Wn=({type:t,sources:d,sinks:s,table:o,onSubmit:a,onClose:h})=>{const i=(0,U.j)(),[b,u]=p.useState(""),[r,g]=p.useState(""),v=(0,U.G)(l=>l.flinkReducer.applicationTableValidationResult),C=x(),L=!!C&&!C?.message&&!!b;p.useEffect(()=>{i((0,A.C9)())},[i]);function F(l){const k=o.create_table;g(o.integration_id??""),u(k),l.setValue(k)}function B(l){return d.concat(s).some(k=>k.table_name===l.table_name)}function x(){let l;return t===A.Hk.SOURCE?l=v?.sources[0]:l=v?.sinks[0],l&&B(l)&&(l={create_table:l.create_table,message:`Table ${l.table_name} already exists.`,position:void 0}),l}function m(){a({create_table:b,integration_id:r,table_name:C?.table_name}),h()}return(0,e.jsx)(n.Modal,{analyticsId:Jn,title:`Add new ${t} table`,size:"full",open:!0,closeOnEsc:!1,onClose:h,primaryAction:{analyticsId:"add-table",text:"Add table",onClick:m,disabled:!L},secondaryActions:[{analyticsId:"cancel",text:"Cancel",onClick:h}],children:(0,e.jsx)(Oe,{analyticsId:(0,y._A)("flink-application-version-clone-table-modal","table-editor"),tableType:t,integrationId:r,createTableSQL:b,validationResult:C,onIntegrationIdChange:g,onCreateTableSQLChange:u,onEditorMount:F})})},zn="flink-application-version-edit-table--modal",Zn=({type:t,sources:d,sinks:s,table:o,onSubmit:a,onClose:h})=>{const i=(0,U.j)(),[b,u]=p.useState(""),[r,g]=p.useState(""),v=(0,U.G)(l=>l.flinkReducer.applicationTableValidationResult),C=x(),L=!!C&&!C?.message&&!!b;p.useEffect(()=>{i((0,A.C9)())},[i]);function F(l){const k=o.create_table;g(o.integration_id??""),u(k),l.setValue(k)}function B(l){return d.concat(s).some(k=>k.table_name===l.table_name&&k.table_name!==o.table_name)}function x(){let l;return t===A.Hk.SOURCE?l=v?.sources[0]:l=v?.sinks[0],l&&B(l)&&(l={create_table:l.create_table,message:`Table ${l.table_name} already exists.`,position:void 0}),l}function m(){a({create_table:b,integration_id:r,table_name:C?.table_name}),h()}return(0,e.jsx)(n.Modal,{analyticsId:zn,title:`Edit ${t} table`,size:"full",open:!0,closeOnEsc:!1,onClose:h,primaryAction:{text:"Save changes",onClick:m,disabled:!L,analyticsId:"save-changes"},secondaryActions:[{text:"Cancel",onClick:h,analyticsId:"cancel"}],children:(0,e.jsx)(Oe,{analyticsId:(0,y._A)("flink-application-version-edit-table-modal","table-editor"),tableType:t,integrationId:r,createTableSQL:b,validationResult:C,onIntegrationIdChange:g,onCreateTableSQLChange:u,onEditorMount:F})})};var _n=f(26009);const qn=({onSubmit:t,onClose:d,type:s})=>{const o=(0,ce.O)(),a=(0,de.o)(),{data:h,isLoading:i,error:b}=(0,O.U3)({projectName:o,serviceName:a}),u=p.useRef({}),[r,g]=p.useState(),[v,C]=p.useState(),[L,F]=p.useState(),[B,x]=p.useState();function m(){const c=w(r,L,s,B);c&&t(c)}p.useEffect(()=>{if(F(void 0),g(void 0),o&&a&&v){const c=E(v);c?g(c):_n.wu.serviceFlinkGetApplication(o,a,v).then(R=>{D(v,R.data),g(R.data)}).catch(()=>F(void 0))}},[o,a,v]),p.useEffect(()=>{x(void 0)},[L]);const l=c=>{C(c.target.value)},k=c=>{F(c.target.value)},j=c=>{x(c.target.value)},E=c=>u.current[c],D=(c,R)=>{u.current[c]=R},T=(c,R)=>
4{if(!(!c||!R))return c.application_versions.find(N=>N.id===R)},$=(c,R,N)=>{const Q=T(c,R);return Q?N===A.Hk.SOURCE?Q.sources:Q.sinks:[]},w=(c,R,N,Q)=>$(c,R,N).find(P=>P.table_id===Q);return(0,e.jsxs)(_e.A,{analyticsId:(0,y._A)("flink-application-version-import-table","modal"),title:`Import existing ${s} table`,okAction:m,okTitle:"Next",okDisabled:!B,cancelAction:d,cancelTitle:"Cancel",size:"md",onHide:d,children:[(0,e.jsx)(le.A,{error:b}),i?(0,e.jsx)(Xe.A,{}):(0,e.jsxs)(n.Grid,{cols:"12",colGap:"3",children:[(0,e.jsx)(n.Grid.Item,{xs:4,children:(0,e.jsxs)(n.NativeSelect,{value:v,onChange:l,labelText:"Application",disabled:!h,children:[(0,e.jsx)(n.Option,{value:"",children:"Select application"}),h?.map(c=>(0,e.jsx)(n.Option,{value:c.id,children:c.name},c.id))]})}),(0,e.jsx)(n.Grid.Item,{xs:4,children:(0,e.jsxs)(n.NativeSelect,{value:L,onChange:k,disabled:!v||!r,labelText:"Version",children:[(0,e.jsx)(n.Option,{value:"",children:"Select version"}),r?.application_versions.map(c=>(0,e.jsx)(n.Option,{value:c.id,children:`Version ${c.version}`},c.id))]})}),(0,e.jsx)(n.Grid.Item,{xs:4,children:(0,e.jsxs)(n.NativeSelect,{value:B,onChange:j,disabled:!v||!L||!r,labelText:"Table",children:[(0,e.jsx)(n.Option,{value:"",children:"Select table"}),$(r,L,s).map(c=>(0,e.jsx)(n.Option,{value:c.table_id,children:c.table_name},c.table_id))]})})]})]})};var un=f(80681),et=f(4670),nt=f(55478);const tt=({analyticsId:t,analyticsContexts:d,title:s,defaultOpen:o=!1,children:a,...h})=>{const[i,b]=p.useState(o);return(0,e.jsxs)(n.Box,{marginBottom:"3",style:{cursor:"default"},children:[(0,e.jsx)(n.Box.Flex,{alignContent:"center",children:(0,e.jsx)(n.Button.Text,{analyticsId:t,analyticsContexts:d,"aria-label":`Toggle ${s}`,onClick:()=>b(!i),"aria-expanded":i,"aria-controls":s,children:(0,e.jsxs)(n.Typography,{...h,htmlTag:"span",children:[(0,e.jsx)(n.InlineIcon,{icon:i?et.A:nt.A,color:"muted",fontSize:"10"})," ",s]})})}),(0,e.jsx)(n.Box,{id:s,role:"region",paddingLeft:"3",marginTop:"1",marginLeft:"2",style:{borderLeft:"1px solid var(--aquarium-border-color-default)",display:i?"block":"none"},children:a})]})},it=t=>t.includes("INT")?"info":t.includes("STRING")?"success":"neutral",pn=({tables:t,analyticsId:d,analyticsContexts:s})=>t.length?(0,e.jsx)("ul",{"aria-label":"Flink data tables",children:t.map((o,a)=>(0,e.jsx)("li",{children:(0,e.jsx)(tt,{analyticsId:(0,y._A)(d,"table-item-toggle"),analyticsContexts:s,title:o.table_name??"",variant:"caption",defaultOpen:a===0,children:o.columns?.map(h=>(0,e.jsxs)(n.Box.Flex,{alignItems:"center",children:[(0,e.jsx)(n.Box,{title:h.name,children:(0,e.jsx)(n.Typography.Small,{color:"muted",htmlTag:"span",children:h.name})}),(0,e.jsx)(n.Box,{marginLeft:"2",children:(0,e.jsx)(n.StatusChip,{dense:!0,text:h.data_type,status:it(h.data_type)})})]},h.name))})},a))}):null,at="aiven-37641-Z";var ot=(t=>(t[t.Output=1]="Output",t[t.Exceptions=2]="Exceptions",t))(ot||{});const lt=({analyticsId:t,analyticsContexts:d,sources:s,sinks:o,statement:a,onStatementChange:h,onAddSourceTable:i,onAddSinkTable:b})=>{const u=(0,U.j)(),r=(0,ce.O)(),g=(0,de.o)(),v=(0,X.g)(),{applicationId:C}=v,[L,F]=p.useState(1),[B,x]=p.useState(!1),m=p.useRef(new AbortController),l=(0,U.G)(V=>V.flinkReducer.applicationVersionValidationResult),k=p.useRef(null),j=(0,U.G)(Te.zR),E=j?.job_id||"",D=(0,U.G)(Te.Qx)||"",T=100,$=j?.rows.length===T,w=!!D&&!$&&!B,c=w&&!!E,{currentData:R}=(0,O.YE)(r&&g&&E&&c?{projectName:r,serviceName:g,jobId:E}:ue.hT,{pollingInterval:be.Z2*5,skipPollingIfUnfocused:!0});(0,O.vW)(r&&g&&C&&D&&w?{projectName:r,serviceName:g,applicationId:C,queryId:D}:ue.hT,{pollingInterval:be.Z2*5,skipPollingIfUnfocused:!0});const{validateApplicationVersion:N}=dn(),[Q,{isLoading:P,error:se}]=(0,O.EH)(),[G,{isLoading:_}]=(0,O.$X)(),[z]=(0,O.$X)(),ae=!!a&&!!l&&!l?.statement_error?.message&&!P&&!_&&!w&&!c;function q(V){k.current=V.onDidChangeModelContent(()=>{u((0,A.EM)(!0))})}function oe(){i()}function Y(){b()}function re(){D?G({projectName:r,serviceName:g,applicationId:C,interactiveQueryId:D}):(m.current.abort(),m.current=new AbortController),u((0,A.Yv)())}function ee(){ae&&(u((0,A.Yv)()),x(!1),F(1),Q({projectName:r,serviceName:g,applicationId:C,payload:{sources:s.map(V=>({integration_id:V.integration_id?V.integration_id:void 0,create_table:V.create_table})),sinks:o.map(V=>({integration_id:V.integration_id?V.integration_id:void 0,create_table:V.create_table})),statement:a,max_rows:T},signal:m.current.signal}).unwrap().then(V=>u((0,A.J5)(V.query_id))).catch(Z.A))}return p.useEffect(()=>{const V=m.current;return()=>{V.abort(),D&&G({projectName:r,serviceName:g,applicationId:C,interactiveQueryId:D}),u((0,A.Yv)()),u((0,A.qJ)(void 0))}},[u]),p.useEffect(()=>{!w&&D&&u(O.Ay.endpoints.serviceFlinkApplicationVersionGetQuery.initiate({projectName:r,serviceName:g,applicationId:C,queryId:D},{subscribe:!1,forceRefetch:!0})).unwrap().then(()=>{z({projectName:r,serviceName:g,applicationId:C,interactiveQueryId:D})}).catch(Z.A)},[u,w]),p.useEffect(()=>{N({projectName:r,serviceName:g,applicationId:C,payload:{sources:s.map(V=>({create_table:V.create_table,integration_id:V.integration_id?V.integration_id:void 0})),sinks:o.map(V=>({create_table:V.create_table,integration_id:V.integration_id?V.integration_id:void 0})),statement:a}})},[N,r,g,C,o,s,a]),p.useEffect(()=>{R?.state===ve.gg_.FAILED&&F(2),(0,S.k0)(R?.state)&&x(!0)},[u,R?.state]),(0,e.jsxs)(n.Box,{children:[(0,e.jsx)(n.Box.Flex,{marginBottom:"4",alignItems:"center",marginTop:"6",children:(0,e.jsx)(n.Typography.Subheading,{children:"Statement"})}
4),l?(0,e.jsxs)(n.Grid,{style:{border:"2px solid #EDEDF0",gridTemplateColumns:"325px minmax(0, 1fr)",gridTemplateRows:"auto min-content 500px"},children:[(0,e.jsxs)(n.Grid.Item,{colStart:"1",colEnd:"1",rowStart:"1",rowEnd:"4",backgroundColor:"muted",style:{borderRight:"2px solid #EDEDF0",overflowY:"auto"},children:[(0,e.jsxs)(n.Box,{margin:"4",children:[(0,e.jsxs)(n.Box.Flex,{justifyContent:"space-between",children:[(0,e.jsx)(n.Typography.DefaultStrong,{children:"Sources"}),(0,e.jsx)(n.Button.Icon,{analyticsId:(0,y._A)(t,"add-source-table"),analyticsContexts:d,dense:!0,icon:un.A,tooltip:"Add source table",onClick:oe})]}),(0,e.jsx)(pn,{analyticsId:(0,y._A)("flink-application-version-statement","source-table-list"),tables:l.sources})]}),(0,e.jsx)(n.Box,{marginBottom:"4",marginTop:"6",children:(0,e.jsx)(n.Divider,{direction:"horizontal"})}),(0,e.jsxs)(n.Box,{margin:"4",children:[(0,e.jsxs)(n.Box.Flex,{justifyContent:"space-between",children:[(0,e.jsx)(n.Typography.DefaultStrong,{children:"Sinks"}),(0,e.jsx)(n.Button.Icon,{analyticsId:(0,y._A)(t,"add-sink-table"),analyticsContexts:d,dense:!0,icon:un.A,tooltip:"Add sink table",onClick:Y})]}),(0,e.jsx)(pn,{analyticsId:(0,y._A)(t,"sink-table-list"),analyticsContexts:d,tables:l.sinks})]})]}),(0,e.jsx)(n.Grid.Item,{colStart:"2",colEnd:"3",rowStart:"1",rowEnd:"2",paddingTop:"4",paddingBottom:"4",children:(0,e.jsx)(n.Box,{style:{height:"500px"},children:(0,e.jsx)(Ze,{initialValue:a,onChange:h,onEditorMount:q,sources:l.sources,sinks:l.sinks,error:l.statement_error})})}),(0,e.jsxs)(n.Grid.Item,{colStart:"2",colEnd:"3",rowStart:"2",rowEnd:"2",backgroundColor:"muted",children:[(0,e.jsx)(le.A,{error:se,getErrorMessage:V=>V.code==="ERR_CANCELED"?"Query was canceled":(0,Le.u1)(V)}),(0,e.jsxs)(n.Box.Flex,{flexDirection:"row",alignItems:"center",children:[(0,e.jsx)(n.Box,{marginLeft:"3",children:P||w||c?(0,e.jsx)(n.Button,{analyticsId:(0,y._A)(t,"stop"),analyticsContexts:d,kind:"ghost",dense:!0,disabled:_,icon:sn.A,onClick:re,children:"Stop"}):(0,e.jsx)(n.Button,{analyticsId:(0,y._A)(t,"run"),analyticsContexts:d,kind:"ghost",dense:!0,icon:ln.A,onClick:ee,disabled:!ae,children:"Run"})}),(0,e.jsx)(n.Box,{marginLeft:"3",children:P||w||c?(0,e.jsx)(n.Typography.Small,{color:"muted",children:"the running query"}):(0,e.jsx)(n.Typography.Small,{color:"muted",children:"a sample query to see how the data is being produced to the destination."})})]})]}),(0,e.jsx)(n.Grid.Item,{colStart:"2",colEnd:"3",rowStart:"3",rowEnd:"3",style:{borderTop:"2px solid #EDEDF0",overflow:"auto"},children:(0,e.jsx)(n.Box,{className:at,children:(0,e.jsxs)(n.Tabs,{onChange:F,value:L,analyticsId:(0,y._A)(t,"tabs"),children:[(0,e.jsx)(n.Tabs.Tab,{title:"Output",value:1,children:(0,e.jsx)(rn,{interactiveQuery:j,jobDetails:R,isLoading:P})}),(0,e.jsx)(n.Tabs.Tab,{title:"Exceptions",value:2,status:R?.state===ve.gg_.FAILED?"error":void 0,children:(0,e.jsx)(cn.A,{analyticsId:(0,y._A)(t,"job-exceptions-tab"),analyticsContexts:d,projectName:r,serviceName:g,jobId:j?.job_id,isLoading:P})})]})})})]}):(0,e.jsx)(n.Skeleton,{width:"100%",height:600})]})};var st=f(25413);const rt=({analyticsId:t,analyticsContexts:d,tables:s,emptyState:o,onViewClick:a,onCloneClick:h,onEditClick:i,onRemoveClick:b})=>s.length===0?(0,e.jsx)(n.Box,{children:o}):(0,e.jsxs)(n.Table,{ariaLabel:"Flink Tables",children:[(0,e.jsxs)(n.Table.Head,{children:[(0,e.jsx)(n.Table.Cell,{children:"Table name"}),(0,e.jsx)(n.Table.Cell,{})]}),(0,e.jsx)(n.Table.Body,{children:s.map((u,r)=>(0,e.jsxs)(n.Table.Row,{children:[(0,e.jsx)(n.Table.Cell,{children:u.table_name}),(0,e.jsx)(n.Table.Cell,{children:(0,e.jsxs)(n.Box,{display:"flex",gap:"4",justifyContent:"flex-end",children:[(0,e.jsx)(n.Button.Ghost,{analyticsId:(0,y._A)(t,"view"),analyticsContexts:d,onClick:()=>{a(u)},children:"View"}),(0,e.jsx)(n.Button.Ghost,{analyticsId:(0,y._A)(t,"clone"),analyticsContexts:d,onClick:()=>{h(u)},children:"Clone"}),(0,e.jsx)(n.Button.Ghost,{analyticsId:(0,y._A)(t,"edit"),analyticsContexts:d,onClick:()=>{i(r)},children:"Edit"}),(0,e.jsx)(n.Button.Icon,{analyticsId:(0,y._A)(t,"delete"),analyticsContexts:d,icon:De.A,tooltip:"Delete",onClick:()=>b(r)})]})})]},r))})]}),mn=({analyticsId:t,analyticsContexts:d,sources:s,sinks:o,tableType:a,onAddNewTableClick:h,onViewTableClick:i,onEditTableClick:b,onImportTableClick:u,onRemoveTableClick:r,onCloneTableClick:g,onManageIntegrationsClick:v})=>{function C(){return a===A.Hk.SOURCE?"Source table creates a mapping between the data coming from the selected datasource and flink. Source tables can be used as part of the statement."
4:"Sink table creates a mapping between the data coming from flink service and the destination service. Sink tables can be used as part of the statement."}return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(n.Box.Flex,{justifyContent:"space-between",alignItems:"flex-end",paddingBottom:"4",children:[(0,e.jsxs)(n.Typography.Subheading,{children:[(0,st.A)(a)," tables"]}),(0,e.jsxs)(n.Box.Flex,{alignItems:"center",gap:"4",children:[(0,e.jsx)(n.Button,{analyticsId:(0,y._A)(t,"manage-integrations"),analyticsContexts:d,kind:"secondary",onClick:v,children:"Manage integrations"}),(0,e.jsx)(n.Button,{analyticsId:(0,y._A)(t,"import-existing-table"),analyticsContexts:d,kind:"secondary",onClick:u,children:"Import existing table"}),(0,e.jsx)(n.Button,{analyticsId:(0,y._A)(t,"add-new-table"),analyticsContexts:d,kind:"secondary",onClick:h,children:"Add new table"})]})]}),(0,e.jsx)(rt,{analyticsId:(0,y._A)(t,"tables"),analyticsContexts:d,tables:a===A.Hk.SINK?o:s,tableType:a,onViewClick:i,onEditClick:b,onCloneClick:g,onRemoveClick:r,emptyState:(0,e.jsx)(te.pp,{layout:n.EmptyStateLayout.Vertical,fullHeight:!1,title:`Add your first ${a} table`,secondaryAction:{onClick:u,text:`Import existing ${a} table`},primaryAction:{onClick:h,text:`Add your first ${a} table`},children:C()})})]})};var ct=f(86753),dt=(t=>(t[t.Sources=1]="Sources",t[t.Sinks=2]="Sinks",t[t.Statement=3]="Statement",t))(dt||{});const me="flink-application-version-create",gn=({isFirstVersion:t})=>{const d=(0,U.j)(),s=(0,X.Zp)(),o=(0,ce.O)(),a=(0,de.o)(),h=(0,X.g)(),{accountId:i,applicationId:b,applicationVersionId:u}=h,{applicationDetails:r,applicationDetailsError:g}=Ke(),{data:v,error:C}=(0,O.bd)(o&&a&&b&&u?{projectName:o,serviceName:a,applicationId:b,applicationVersionId:u}:ue.hT),[L,F]=(0,O.Eo)(),B=(0,U.G)(I=>I.flinkReducer.applicationVersionIsBeingValidated),[x,m]=p.useState(1),[l,k]=p.useState([]),[j,E]=p.useState([]),[D,T]=p.useState(""),[$,w]=p.useState(!1),[c,R]=p.useState(!1),[N,Q]=p.useState(),[P,se]=p.useState(),[G,_]=p.useState(),[z,ae]=p.useState(),[q,oe]=p.useState(!1),Y=x===1?A.Hk.SOURCE:A.Hk.SINK,re=He(),ee=(0,W.xf)({projectName:o,serviceName:a,applicationId:b,accountId:i}),V=(0,U.G)(I=>I.flinkReducer.applicationVersionValidationResult),ge=!!D&&V?.sinks.every(I=>!I.message)&&V.sources.every(I=>!I.message)&&!V.statement_error&&!B;p.useEffect(()=>{o&&v&&!t&&(k(v.sources),E(v.sinks),T(v.statement),hn())},[d,o,a,v,t]);function H(){w(!0)}function he(I){ae(I)}function je(I){se(I)}function Ae(I){Q(I)}function Ce(){R(!0)}function Ie(I){_(I)}function Se(){oe(!0)}function Be(I){x===1?k([...l,I]):E([...j,I])}function $e(I){R(!1),Ae(I)}function Pe(I){P!==void 0&&(x===1?k(Object.assign([],l,{[P]:I})):E(Object.assign([],j,{[P]:I})))}function Ee(I){Be(I)}function Ve(I){x===1?k(ke(l,I)):E(ke(j,I)),ne()}function fe(I){T(I)}const ne=()=>{w(!1),R(!1),Q(void 0),se(void 0),_(void 0),ae(void 0)};function ke(I,gt){return I.filter((Lt,ht)=>gt!==ht)}function He(){if(P!==void 0)return Y===A.Hk.SOURCE?l[P]:j[P]}function Qe(){s((0,W.xf)({projectName:o??"",serviceName:a,applicationId:b,accountId:i}))}function Ue(){m(1)}function Ge(){m(2)}function M(){m(1)}function Fe(){m(2)}function hn(){m(3)}function fn(){m(2)}function pt(){m(3)}function mt(){o&&ge&&L({projectName:o,serviceName:a,applicationId:b,payload:{statement:D,sources:l.map(I=>({create_table:I.create_table,integration_id:I.integration_id?I.integration_id:void 0})),sinks:j.map(I=>({create_table:I.create_table,integration_id:I.integration_id?I.integration_id:void 0}))}}).unwrap().then(()=>{s((0,W.xf)({projectName:o,serviceName:a,applicationId:b,accountId:i}),{replace:!0})}).catch(Z.A)}return!r||u&&!v?(0,e.jsx)(ye.A,{}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(Ye.A,{title:r.name??Me.je.APPLICATIONS,analyticsId:(0,y._A)(me,"page-header"),breadcrumbs:[(0,e.jsx)(n.Breadcrumbs.Crumb,{to:(0,W.Hx)({projectName:o,serviceName:a,accountId:i}),children:Me.je.APPLICATIONS},"all"),r&&(0,e.jsx)(n.Breadcrumbs.Crumb,{to:`${ee}/${r.id}`,children:r.name},"name"),r&&(0,e.jsx)(n.Breadcrumbs.Crumb,{to:`${ee}/${r.id}/version`,children:"Create new version"},"version")]}),(0,e.jsx)(le.A,{error:g??C??F.error,marginBottom:"5"}),(0,e.jsxs)(te.EM,{activeStep:x,children:[(0,e.jsx)(te.EM.Step,{id:1,title:"1. Add source tables",backTitle:"Cancel",onBack:Qe,onClick:Ue,onNext:Ge,nextDisabled:!l.length,children:(0,e.jsx)(n.Box,{marginTop:"5",marginBottom:"5",children:(0,e.jsx)(mn,{analyticsId:(0,y._A)(me,"source-tables"),sources:l,sinks:j,tableType:A.Hk.SOURCE,onAddNewTableClick:H,onViewTableClick:he,onEditTableClick:je,onCloneTableClick:Ae,onImportTableClick:Ce,onRemoveTableClick:Ie,onManageIntegrationsClick:Se})})}),(0,e.jsx)(te.EM.Step,{id:2,title:"2. Add sink tables",onBack:M,onClick:Fe,onNext:hn,disabled:!l.length,nextDisabled:!j.length,children:(0,e.jsx)(n.Box,{marginTop:"5",marginBottom:"5",children:(0,e.jsx)(mn,{analyticsId:(0,y._A)(me,"sink-tables"),sources:l,sinks:j,tableType:A.Hk.SINK,onAddNewTableClick:H,onViewTableClick:he,onEditTableClick:je,onCloneTableClick:Ae,onImportTableClick:Ce,onRemoveTableClick:Ie,onManageIntegrationsClick:Se})})}),(0,e.jsx)(te.EM.Step,{id:3,title:"3. Create statement",onBack:fn,onClick:pt,onNext:mt,nextTitle:"Save and deploy later",disabled:!l.length||!j.length,nextDisabled:!ge,nextLo
4ading:F.isLoading,children:(0,e.jsx)(n.Box,{marginTop:"5",marginBottom:"5",children:(0,e.jsx)(lt,{analyticsId:(0,y._A)(me,"statement"),sources:l,sinks:j,statement:D,onStatementChange:fe,onAddSourceTable:M,onAddSinkTable:fn})})})]}),$&&(0,e.jsx)(Xn,{sources:l,sinks:j,type:Y,onClose:ne,onSubmit:Be}),P!==void 0&&re&&(0,e.jsx)(Zn,{sources:l,sinks:j,type:Y,table:re,onClose:ne,onSubmit:Pe}),N&&(0,e.jsx)(Wn,{sources:l,sinks:j,type:Y,table:N,onClose:ne,onSubmit:Ee}),c&&(0,e.jsx)(qn,{type:Y,onSubmit:$e,onClose:ne}),G!==void 0&&(0,e.jsx)(n.Dialog,{analyticsId:(0,y._A)(me,"delete-table-confirm"),title:"Delete table?",type:"danger",open:!0,onClose:ne,primaryAction:{text:"Confirm",onClick:()=>Ve(G)},secondaryAction:{text:"Cancel",onClick:ne},children:"Please confirm that you want to delete the table."}),z&&(0,e.jsx)(en,{analyticsId:(0,y._A)(me,"table-details-modal"),table:z,handleClose:ne}),q&&(0,e.jsx)(ct.A,{onClose:()=>oe(!1)})]})},ut=()=>(0,e.jsxs)(X.BV,{children:[(0,e.jsx)(X.qh,{index:!0,element:(0,e.jsx)(Un,{})}),(0,e.jsx)(X.qh,{path:"deployments",element:(0,e.jsx)(xn.A,{applicationType:A.Xr.SQL})}),(0,e.jsx)(X.qh,{path:"version",element:(0,e.jsx)(gn,{isFirstVersion:!0})}),(0,e.jsx)(X.qh,{path:"version/:applicationVersionId/edit",element:(0,e.jsx)(gn,{})})]})}}]);})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.