import{y,_ as A}from"./js-yaml-ahJ4l1wK.js";import{g as P,u as O}from"./traffic-3Lpl9nRz.js";import{d as Y,y as L,z as M,a as U,B as p,D as H,H as J,J as g,w as e,e as n,o as b,b as t,f as l,n as E,aa as j,ab as z,j as s,T as K,m as $,p as q,h as F,_ as G}from"./index-FX23dEwE.js";import{H as I}from"./request-dCC5BMJA.js";const _=f=>(q("data-v-ddd85243"),f=f(),F(),f),Q={class:"editorBox"},W={class:"bottom-action-footer"},X=_(()=>s("br",null,null,-1)),Z=_(()=>s("br",null,null,-1)),ee=_(()=>s("br",null,null,-1)),ae=_(()=>s("br",null,null,-1)),te=_(()=>s("br",null,null,-1)),le=_(()=>s("br",null,null,-1)),oe=Y({__name:"updateByYAMLView",setup(f){const m=L(M.PROVIDE_INJECT_KEY),h=U(),k=p(!1),C=p(!1),c=p(!1),x=p(8),u=p("");H(()=>{if(J.isNil(m.conditionRule))u.value="",S();else{const a=m.conditionRule;u.value=y.dump(a)}});const B=a=>{m.conditionRule=y.load(u.value)};async function S(){var o,d,i;let a=await P((o=h.params)==null?void 0:o.ruleName);if((a==null?void 0:a.code)===I.SUCCESS){const r=(d=h.params)==null?void 0:d.ruleName;if(r&&a.data.scope==="service"){const R=r==null?void 0:r.split(":");a.data.group=(i=R[2])==null?void 0:i.split(".")[0]}u.value=y.dump(a==null?void 0:a.data)}}const D=async()=>{var a;C.value=!0;try{const o=y.load(u.value);o.configVersion="v3.0",(await O((a=h.params)==null?void 0:a.ruleName,o)).code===I.SUCCESS&&($.success("update success"),await new Promise(i=>setTimeout(i,2e3)),m.conditionRule=null,await S())}finally{C.value=!1}};return(a,o)=>{const d=n("a-button"),i=n("a-flex"),r=n("a-space"),R=n("a-affix"),V=n("a-col"),v=n("a-descriptions-item"),N=n("a-descriptions"),w=n("a-card");return b(),g(w,null,{default:e(()=>[t(i,{style:{width:"100%"}},{default:e(()=>[t(V,{span:c.value?24-x.value:24,class:"left"},{default:e(()=>[t(i,{vertical:"",align:"end"},{default:e(()=>[t(d,{type:"text",style:{color:"#0a90d5"},onClick:o[0]||(o[0]=T=>c.value=!c.value)},{default:e(()=>[l(" 字段说明 "),c.value?(b(),g(E(z),{key:1})):(b(),g(E(j),{key:0}))]),_:1}),s("div",Q,[t(A,{modelValue:u.value,"onUpdate:modelValue":o[1]||(o[1]=T=>u.value=T),theme:"vs-dark",height:500,language:"yaml",readonly:k.value,onChange:B},null,8,["modelValue","readonly"])])]),_:1}),t(R,{"offset-bottom":10},{default:e(()=>[s("div",W,[t(r,{align:"center",size:"large"},{default:e(()=>[t(d,{type:"primary",loading:C.value,onClick:D},{default:e(()=>[l(" 确认")]),_:1},8,["loading"]),t(d,null,{default:e(()=>[l(" 取消")]),_:1})]),_:1})])]),_:1})]),_:1},8,["span"]),t(V,{span:c.value?x.value:0,class:"right"},{default:e(()=>[c.value?(b(),g(w,{key:0,class:"sliderBox"},{default:e(()=>[s("div",null,[t(N,{title:"字段说明",column:1},{default:e(()=>[t(v,{label:"key"},{default:e(()=>[l(" 作用对象"),X,l(" 可能的值：Dubbo应用名或者服务名 ")]),_:1}),t(v,{label:"scope"},{default:e(()=>[l(" 规则粒度"),Z,l(" 可能的值：application, service ")]),_:1}),t(v,{label:"force"},{default:e(()=>[l(" 容错保护"),ee,l(" 可能的值：true, false"),ae,l(" 描述：如果为true，则路由筛选后若没有可用的地址则会直接报异常；如果为false，则会从可用地址中选择完成RPC调用 ")]),_:1}),t(v,{label:"runtime"},{default:e(()=>[l(" 运行时生效"),te,l(" 可能的值：true, false"),le,l(" 描述：如果为true，则该rule下的所有路由将会实时生效；若为false，则只有在启动时才会生效 ")]),_:1})]),_:1})])]),_:1})):K("",!0)]),_:1},8,["span"])]),_:1})]),_:1})}}}),ie=G(oe,[["__scopeId","data-v-ddd85243"]]);export{ie as default};
