/
snap
/
lxd
/
current
/
share
/
lxd-ui
/
assets
/
File Upload :
llllll
Current File: //snap/lxd/current/share/lxd-ui/assets/instances-DpqZE1nw.js
import{aW as u,B as o,av as l,aw as m,ax as d,b8 as g,bY as R,b9 as y,ba as U}from"./index-dL2n30-Z.js";const S=["can_access_console","can_delete","can_edit","can_exec","can_manage_backups","can_manage_snapshots","can_update_state"],$=async(e,a,t)=>{const n=new URLSearchParams;return n.set("project",a),n.set("recursion","2"),y(n,t,S),fetch(`/1.0/instances/${encodeURIComponent(e)}?${n.toString()}`).then(U).then(s=>s)},w=async(e,a)=>{const t=new URLSearchParams;return t.set("recursion","2"),e?t.set("project",e):t.set("all-projects","true"),y(t,a,S),fetch(`/1.0/instances?${t.toString()}`).then(o).then(n=>n.metadata)},C=async(e,a,t)=>{const n=new URLSearchParams;return n.set("project",a),u(n,t),fetch(`/1.0/instances?${n.toString()}`,{method:"POST",headers:{"Content-Type":"application/json"},body:e}).then(o).then(s=>s)},T=async(e,a)=>{const t=new URLSearchParams;return t.set("project",a),fetch(`/1.0/instances/${encodeURIComponent(e.name)}?${t.toString()}`,{method:"PUT",body:JSON.stringify(e),headers:{"Content-Type":"application/json","If-Match":e.etag??"invalid-etag"}}).then(o).then(n=>n)},L=async(e,a,t)=>{const n=new URLSearchParams;return n.set("project",t),fetch(`/1.0/instances/${encodeURIComponent(e)}?${n.toString()}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:a})}).then(o).then(s=>s)},b=async(e,a,t,n,s)=>{const r=new URLSearchParams;return r.set("project",a),u(r,t),fetch(`/1.0/instances/${encodeURIComponent(e)}?${r.toString()}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({migration:!0,pool:n,project:s})}).then(o).then(c=>c)},O=async e=>h(e.name,e.project,"start"),_=async(e,a)=>h(e.name,e.project,"stop",a),k=async e=>h(e.name,e.project,"freeze"),E=async e=>h(e.name,e.project,"unfreeze"),x=async(e,a)=>h(e.name,e.project,"restart",a),h=async(e,a,t,n)=>{const s=new URLSearchParams;return s.set("project",a),fetch(`/1.0/instances/${encodeURIComponent(e)}/state?${s.toString()}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:t,force:n})}).then(o).then(r=>r)},J=async(e,a,t)=>{const n=[];return new Promise((s,r)=>{Promise.allSettled(e.map(async({name:c,project:p,action:f})=>{await h(c,p,f,a).then(i=>{t.set(i.metadata.id,()=>{l(n)},I=>{m(n,I)},()=>{d(n,e.length,s)})}).catch(i=>{m(n,i instanceof Error?i.message:""),d(n,e.length,s)})})).catch(r)})},j=async e=>{const a=new URLSearchParams;return a.set("project",e.project),fetch(`/1.0/instances/${encodeURIComponent(e.name)}?${a.toString()}`,{method:"DELETE"}).then(o).then(t=>t)},N=async(e,a)=>{const t=[];return new Promise((n,s)=>{Promise.allSettled(e.map(async r=>{await j(r).then(c=>{a.set(c.metadata.id,()=>{l(t)},p=>{m(t,p)},()=>{d(t,e.length,n)})}).catch(c=>{m(t,c instanceof Error?c.message:""),d(t,e.length,n)})})).catch(s)})},B=async(e,a,t)=>{const n=new URLSearchParams;return n.set("project",a),n.set("wait","10"),fetch(`/1.0/instances/${encodeURIComponent(e)}/exec?${n.toString()}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:t.command.split(" "),"wait-for-websocket":!0,environment:t.environment.reduce((s,r)=>({...s,[r.key]:r.value}),{}),interactive:!0,group:t.group,user:t.user})}).then(o).then(s=>s)},z=async(e,a)=>{const t=new URLSearchParams;return t.set("project",a),t.set("wait","10"),fetch(`/1.0/instances/${encodeURIComponent(e)}/console?${t.toString()}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"vga",width:0,height:0})}).then(o).then(n=>n)},X=async(e,a)=>{const t=new URLSearchParams;return t.set("project",a),t.set("wait","10"),fetch(`/1.0/instances/${encodeURIComponent(e)}/console?${t.toString()}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({"wait-for-websocket":!0,type:"console"})}).then(o).then(n=>n)},D=async(e,a)=>{const t=new URLSearchParams;return t.set("project",a),fetch(`/1.0/instances/${encodeURIComponent(e)}/console?${t.toString()}`).then(g).then(n=>n)},F=async(e,a)=>{const t=new URLSearchParams;return t.set("project",a),fetch(`/1.0/instances/${encodeURIComponent(e)}/logs?${t.toString()}`).then(o).then(n=>n.metadata)},v=async(e,a,t)=>{const n=new URLSearchParams;return n.set("project",a),fetch(`/1.0/instances/${encodeURIComponent(e)}/logs/${encodeURIComponent(t)}?${n.toString()}`).then(g).then(s=>s)},A=async(e,a,t,n,s,r)=>{const c=new URLSearchParams;return t&&c.set("project",t),R.post(`/1.0/instances?${c.toString()}`,e,{headers:{"Content-Type":"application/octet-stream","X-LXD-name":a,"X-LXD-pool":n},onUploadProgress:p=>{s({percentage:p.progress?Math.floor(p.progress*100):0,loaded:p.loaded,total:p.total})},signal:r.signal}).then(p=>p.data)},M=async(e,a,t)=>{const n=new URLSearchParams;return n.set("project",a),fetch(`/1.0/instances/${encodeURIComponent(e)}/backups?${n.toString()}`,{method:"POST",headers:{"Content-Type":"application/json"},body:t}).then(o).then(s=>s)};export{B as a,T as b,C as c,z as d,X as e,D as f,v as g,F as h,j as i,M as j,J as k,N as l,b as m,E as n,_ as o,k as p,x as q,L as r,O as s,w as t,A as u,$ as v};
Copyright ©2k19 -
Hexid
|
Tex7ure