%PDF- %PDF-
Direktori : /proc/self/root/snap/lxd/29351/share/lxd-ui/assets/ |
Current File : //proc/self/root/snap/lxd/29351/share/lxd-ui/assets/StorageVolumeCreate-76138e07.js |
import{e as j,d as a,i as v,r as m,G as u,m as b,j as e,bd as h,B as x,b as C,be as N,q as l}from"./index-13b2882d.js";import{c as q,a as F,u as V}from"./index.esm-82c30f37.js";import{S as k}from"./updateMaxHeight-325b3cd4.js";import{c as B,v as R}from"./StorageVolumeForm-228515f8.js";import{M as $}from"./StorageVolumeFormMenu-e90b9f5c.js";import"./ConfigurationTable-1a9d4d6f.js";import"./ConfigFieldDescription-00c1a193.js";import"./DiskSizeSelector-dd5e138a.js";import"./FormMenuItem-c8a1a121.js";const A=()=>{const r=j(),i=a.useNotify(),n=v(),[c,d]=m.useState(u($)),p=m.useState(null),{project:t}=b();if(!t)return e.jsx(e.Fragment,{children:"Missing project"});const g=q().shape({name:F().test(...h(t,"custom",p)).required("This field is required")}),s=V({initialValues:{content_type:"filesystem",type:"custom",name:"",project:t,pool:"",size:"GiB",isReadOnly:!1,isCreating:!0},validationSchema:g,onSubmit:o=>{const S=R(o,t);N(o.pool,t,S).then(()=>{n.invalidateQueries({queryKey:[l.storage]}),n.invalidateQueries({queryKey:[l.projects,t]}),r(`/ui/project/${t}/storage/volumes`,i.queue(i.success(`Storage volume ${o.name} created.`)))}).catch(y=>{s.setSubmitting(!1),i.failure("Storage volume creation failed",y)})}}),f=()=>{s.submitForm()};return e.jsxs(x,{title:"Create volume",contentClassName:"storage-volume-form",children:[e.jsx(C,{}),e.jsx(B,{formik:s,section:c,setSection:o=>d(u(o))}),e.jsxs("div",{className:"l-footer--sticky p-bottom-controls",children:[e.jsx("hr",{}),e.jsx(a.Row,{className:"u-align--right",children:e.jsxs(a.Col,{size:12,children:[e.jsx(a.Button,{appearance:"base",onClick:()=>r(`/ui/project/${t}/storage/volumes`),children:"Cancel"}),e.jsx(k,{isSubmitting:s.isSubmitting,isDisabled:!s.isValid,onClick:f,buttonLabel:"Create"})]})})]})]})};export{A as default};