/
snap
/
lxd
/
current
/
share
/
lxd-ui
/
assets
/
File Upload :
llllll
Current File: //snap/lxd/current/share/lxd-ui/assets/instances-D13BkiL4.js
import{a_ as g,C as p,ax as y,ay as m,az as d,aw as S,bL as f,cd as j,bM as I,bN as P}from"./index-B3cgCbnJ.js";const R=["can_access_console","can_delete","can_edit","can_exec","can_manage_backups","can_manage_snapshots","can_update_state"],C=async(e,a,t)=>{const n=new URLSearchParams;return n.set("project",a),n.set("recursion","2"),I(n,t,R),fetch(`/1.0/instances/${encodeURIComponent(e)}?${n.toString()}`).then(P).then(s=>s)},L=async(e,a)=>{const t=new URLSearchParams;return t.set("recursion","2"),e?t.set("project",e):t.set("all-projects","true"),I(t,a,R),fetch(`/1.0/instances?${t.toString()}`).then(p).then(n=>n.metadata)},T=async(e,a,t)=>{const n=new URLSearchParams;return n.set("project",a),g(n,t),fetch(`/1.0/instances?${n.toString()}`,{method:"POST",headers:{"Content-Type":"application/json"},body:e}).then(p).then(s=>s)},b=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(p).then(n=>n)},O=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(p).then(s=>s)},_=async(e,a,t,n,s)=>{const r=new URLSearchParams;return r.set("project",a),g(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(p).then(c=>c)},k=async e=>h(e.name,e.project,"start"),E=async(e,a)=>h(e.name,e.project,"stop",a),N=async e=>h(e.name,e.project,"freeze"),x=async e=>h(e.name,e.project,"unfreeze"),J=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(p).then(r=>r)},z=async(e,a,t)=>{const n=[];return new Promise((s,r)=>{Promise.allSettled(e.map(async({name:c,project:o,action:u})=>{const l={name:c,type:"instance",href:S(o,c)};await h(c,o,u,a).then(i=>{t.set(i.metadata.id,()=>{y(n,l)},U=>{m(n,U,l)},()=>{d(n,e.length,s)})}).catch(i=>{m(n,i instanceof Error?i.message:"",l),d(n,e.length,s)})})).catch(r)})},$=async e=>{const a=new URLSearchParams;return a.set("project",e.project),fetch(`/1.0/instances/${encodeURIComponent(e.name)}?${a.toString()}`,{method:"DELETE"}).then(p).then(t=>t)},B=async(e,a)=>{const t=[];return new Promise((n,s)=>{Promise.allSettled(e.map(async r=>{const c={name:r.name,type:"instance",href:S(r.name,r.project)};await $(r).then(o=>{a.set(o.metadata.id,()=>{y(t,c)},u=>{m(t,u,c)},()=>{d(t,e.length,n)})}).catch(o=>{m(t,o instanceof Error?o.message:"",c),d(t,e.length,n)})})).catch(s)})},D=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(p).then(s=>s)},F=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(p).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(p).then(n=>n)},M=async(e,a)=>{const t=new URLSearchParams;return t.set("project",a),fetch(`/1.0/instances/${encodeURIComponent(e)}/console?${t.toString()}`).then(f).then(n=>n)},A=async(e,a)=>{const t=new URLSearchParams;return t.set("project",a),fetch(`/1.0/instances/${encodeURIComponent(e)}/logs?${t.toString()}`).then(p).then(n=>n.metadata)},q=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(f).then(s=>s)},v=async(e,a,t,n,s,r)=>{const c=new URLSearchParams;return t&&c.set("project",t),j.post(`/1.0/instances?${c.toString()}`,e,{headers:{"Content-Type":"application/octet-stream","X-LXD-name":a,"X-LXD-pool":n},onUploadProgress:o=>{s({percentage:o.progress?Math.floor(o.progress*100):0,loaded:o.loaded,total:o.total})},signal:r.signal}).then(o=>o.data)},V=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(p).then(s=>s)};export{b as a,D as b,T as c,F as d,X as e,M as f,q as g,A as h,V as i,z as j,B as k,x as l,_ as m,E as n,N as o,J as p,$ as q,O as r,k as s,L as t,v as u,C as v};
Copyright ©2k19 -
Hexid
|
Tex7ure