Server IP : 13.213.54.232 / Your IP : 216.73.216.166 Web Server : Apache/2.4.52 (Ubuntu) System : Linux ip-172-31-17-110 6.8.0-1029-aws #31~22.04.1-Ubuntu SMP Thu Apr 24 21:16:18 UTC 2025 x86_64 User : www-data ( 33) PHP Version : 7.1.33-67+ubuntu22.04.1+deb.sury.org+1 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /snap/lxd/current/share/lxd-ui/assets/ |
Upload File : |
import{e as v,d as r,i as x,m as S,r as l,G as d,n as q,f as F,j as t,L as O,z as B,B as L,b as M,q as i,p as A}from"./index-13b2882d.js";import{c as I,a as R,u as $}from"./index.esm-82c30f37.js";import{S as G}from"./updateMaxHeight-325b3cd4.js";import{c as K,a as Q}from"./networks-5caac489.js";import{N as T,M as V,t as p}from"./NetworkForm-ffe61c80.js";import{y as Y,d as z}from"./instanceValidation-45cfba9a.js";import{i as D,s as E}from"./settings-c23f9009.js";import{Y as U}from"./ProfileFormMenu-3458e77a.js";import"./FormMenuItem-c8a1a121.js";import"./ConfigurationTable-1a9d4d6f.js";import"./ConfigFieldDescription-00c1a193.js";import"./AutoExpandingTextArea-3a779a81.js";import"./instanceConfigInheritance-fbf987f8.js";const ne=()=>{const n=v(),o=r.useNotify(),y=x(),{project:a}=S(),[f,k]=l.useState(d(V)),N=l.useState(null),{data:c,isLoading:w}=q(),m=D(c),b=E(c),{data:h=[]}=F({queryKey:[i.cluster,i.members],queryFn:A,enabled:m});if(!a)return t.jsx(t.Fragment,{children:"Missing project"});if(w)return t.jsx(O,{});const j=I().shape({name:R().test("deduplicate","A network with this name already exists",e=>B(e,a,N,"networks")).required("Network name is required")}),s=$({initialValues:{readOnly:!1,isCreating:!0,name:"",type:b?"ovn":"bridge"},validationSchema:j,onSubmit:e=>{const u=e.yaml?Y(e.yaml):p(e);(m&&e.type!=="ovn"?()=>K(u,a,h):()=>Q(u,a))().then(()=>{y.invalidateQueries({queryKey:[i.networks]}),n(`/ui/project/${a}/networks`,o.queue(o.success(`Network ${e.name} created.`)))}).catch(C=>{s.setSubmitting(!1),o.failure("Network creation failed",C)})}}),g=()=>{const e=p(s.values);return z(e)};return t.jsxs(L,{title:"Create a network",contentClassName:"create-network",children:[t.jsx(M,{}),t.jsx(T,{formik:s,getYaml:g,project:a,section:f,setSection:e=>{s.values.yaml&&e!==U&&s.setFieldValue("yaml",void 0),k(d(e))}}),t.jsxs("div",{className:"p-bottom-controls",children:[t.jsx("hr",{}),t.jsx(r.Row,{className:"u-align--right",children:t.jsxs(r.Col,{size:12,children:[t.jsx(r.Button,{appearance:"base",onClick:()=>n(`/ui/project/${a}/networks`),children:"Cancel"}),t.jsx(G,{isSubmitting:s.isSubmitting,isDisabled:!s.isValid||!s.values.name||s.values.type==="ovn"&&!s.values.network,buttonLabel:"Create",onClick:()=>void s.submitForm()})]})})]})]})};export{ne as default};