/
snap
/
lxd
/
current
/
share
/
lxd-ui
/
assets
/
File Upload :
llllll
Current File: //snap/lxd/current/share/lxd-ui/assets/networks-DBYE4DQa.js
import{a_ as w,C as d,bM as u,bN as l,bW as R,bX as k}from"./index-B3cgCbnJ.js";const S=["can_edit","can_delete"],g=async(n,e,s)=>{const t=new URLSearchParams;return t.set("project",n),t.set("recursion","1"),w(t,s),u(t,e,S),fetch(`/1.0/networks?${t.toString()}`).then(d).then(a=>a.metadata.filter(o=>!["loopback","unknown"].includes(o.type)))},$=async(n,e,s)=>new Promise((t,a)=>{Promise.allSettled(e.map(async c=>g(n,s,c.server_name))).then(c=>{const o=[];for(let r=0;r<e.length;r++){const i=e[r].server_name,h=c[r];h.status==="rejected"&&a(k(h,i)),h.status==="fulfilled"&&h.value.forEach(m=>o.push({...m,memberName:i}))}t(o)}).catch(a)}),p=async(n,e,s,t)=>{const a=new URLSearchParams;return a.set("project",e),w(a,t),u(a,s,S),fetch(`/1.0/networks/${encodeURIComponent(n)}?${a.toString()}`).then(l).then(c=>c)},_=async(n,e,s,t)=>new Promise((a,c)=>{Promise.allSettled(s.map(async o=>p(n,e,t,o.server_name))).then(o=>{const r=[];for(let i=0;i<s.length;i++){const h=s[i].server_name,m=o[i];if(m.status==="rejected"&&c(k(m,h)),m.status==="fulfilled"){const f=o[i];r.push({...f.value,memberName:h})}}a(r)}).catch(c)}),L=async(n,e,s)=>{const t=new URLSearchParams;return t.set("project",e),w(t,s),fetch(`/1.0/networks/${encodeURIComponent(n)}/state?${t.toString()}`).then(d).then(a=>a.metadata)},T=async(n,e,s,t,a)=>new Promise((c,o)=>{Promise.allSettled(s.map(async r=>{const i={name:n.name,type:n.type,config:{parent:t==null?void 0:t[r.server_name],"bridge.external_interfaces":a==null?void 0:a[r.server_name]}};return y(i,e,r.server_name)})).then(r=>{var h,m;const i=(h=r.find(f=>f.status==="rejected"))==null?void 0:h.reason;if(i){o(i);return}(m=n.config)==null||delete m.parent,y(n,e).then(c).catch(o)}).catch(o)}),y=async(n,e,s)=>{const t=new URLSearchParams;return t.set("project",e),w(t,s),new Promise((a,c)=>{fetch(`/1.0/networks?${t.toString()}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)}).then(d).then(a).catch(async o=>{o.message==="Failed to fetch"&&await p(n.name??"",e,!1,s)&&a(),c(o)})})},N=async(n,e,s)=>{const t=new URLSearchParams;return t.set("project",e),w(t,s),new Promise((a,c)=>{fetch(`/1.0/networks/${encodeURIComponent(n.name)}?${t.toString()}`,{method:"PUT",body:JSON.stringify(n),headers:{"Content-Type":"application/json","If-Match":n.etag??""}}).then(d).then(a).catch(async o=>{if(o.message==="Failed to fetch"){const r=await p(n.name??"",e,!1,s);R(n,r)&&a()}c(o)})})},O=async(n,e,s,t,a,c)=>new Promise((o,r)=>{Promise.allSettled(s.map(async i=>{const h=i.server_name,m={...c};t!=null&&t[h]&&(m.parent=t[h]),a!=null&&a[h]&&(m["bridge.external_interfaces"]=a[h]);const f={name:n.name,type:n.type,config:m};return N(f,e,h)})).then(i=>{var m;const h=(m=i.find(f=>f.status==="rejected"))==null?void 0:m.reason;if(h){r(h);return}N({...n,etag:""},e).then(o).catch(r)}).catch(r)}),v=async(n,e,s)=>{const t=new URLSearchParams;return t.set("project",s),new Promise((a,c)=>{fetch(`/1.0/networks/${encodeURIComponent(n)}?${t.toString()}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e})}).then(d).then(a).catch(async o=>{o.message==="Failed to fetch"&&await p(e,s,!1)&&a(),c(o)})})},F=async(n,e)=>{const s=new URLSearchParams;return s.set("project",e),new Promise((t,a)=>{fetch(`/1.0/networks/${encodeURIComponent(n)}?${s.toString()}`,{method:"DELETE"}).then(d).then(t).catch(async c=>{c.message==="Failed to fetch"&&(await fetch(`/1.0/networks/${encodeURIComponent(n)}?project=${encodeURIComponent(e)}`)).status===404&&t(),a(c)})})},j=async n=>{const e=new URLSearchParams;return e.set("project",n),e.set("recursion","1"),fetch(`/1.0/network-allocations?${e.toString()}`).then(d).then(s=>s.metadata)};export{y as a,N as b,T as c,F as d,L as e,p as f,j as g,g as h,$ as i,_ as j,v as r,O as u};
Copyright ©2k19 -
Hexid
|
Tex7ure