%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /snap/lxd/current/share/lxd-ui/assets/
Upload File :
Create Path :
Current File : //snap/lxd/current/share/lxd-ui/assets/StorageVolumeForm-228515f8.js

import{r as _,j as s,d as a,f as x,q as f,ba as j,L as V,bu as w,bC as q,aI as h,l as I,m as R,A as E,G as y,bD as o}from"./index-13b2882d.js";import{u as L}from"./updateMaxHeight-325b3cd4.js";import{S as Z,M,a as N,F as O,Z as T}from"./StorageVolumeFormMenu-e90b9f5c.js";import{g as P,C as g}from"./ConfigurationTable-1a9d4d6f.js";import{D as A}from"./DiskSizeSelector-dd5e138a.js";const D=[{label:"minute",value:"* * * * *"},{label:"hour",value:"@hourly"},{label:"day",value:"@daily"},{label:"week",value:"@weekly"},{label:"month",value:"@monthly"},{label:"year",value:"@yearly"}],B=({value:e,setValue:t})=>{const[l,r]=_.useState(!(e!=null&&e.startsWith("@")));return s.jsxs("div",{children:[s.jsxs("div",{className:"snapshot-schedule",children:[s.jsx(a.RadioInput,{label:"Cron syntax",checked:l,onChange:()=>{r(!0),t("")}}),s.jsx(a.RadioInput,{label:"Choose interval",checked:!l,onChange:()=>{r(!1),t("@daily")}})]}),l?s.jsx(a.Input,{id:"snapshots_schedule",name:"snapshots_schedule",label:"Cron expression",placeholder:"Enter cron expression",help:"<minute> <hour> <dom> <month> <dow>, a comma-separated list of schedule aliases (@hourly, @daily, @midnight, @weekly, @monthly, @annually, @yearly), or empty to disable automatic snapshots (the default)",type:"text",value:e,onChange:u=>t(u.target.value)}):s.jsx(a.Select,{id:"snapshots_schedule",name:"snapshots_schedule",label:"Every",value:e,onChange:u=>t(u.target.value),options:D})]})},K=({project:e,value:t,setValue:l,selectProps:r})=>{const u=a.useNotify(),{data:d=[],error:c,isLoading:m}=x({queryKey:[f.storage],queryFn:()=>j(e)});if(_.useEffect(()=>{!t&&d.length>0&&l(d[0].name)},[t,d]),m)return s.jsx(V,{text:"Loading storage pools..."});c&&u.failure("Loading storage pools failed",c);const b=()=>{const i=d.map(p=>({label:p.name,value:p.name,disabled:!1}));return i.unshift({label:d.length===0?"No storage pool available":"Select option",value:"",disabled:!0}),i};return s.jsx(a.Select,{id:"storage-pool-selector",name:"pool",options:b(),onChange:i=>l(i.target.value),value:t,...r})},n=({formik:e,name:t,label:l,children:r,defaultValue:u,disabled:d=!1,disabledReason:c,help:m})=>{const i=e.values[t],p=i!==void 0,{data:v}=x({queryKey:[f.storage,e.values.pool,e.values.project],queryFn:()=>w(e.values.pool,e.values.project),enabled:e.values.isCreating}),[F,z]=q(t,v),C=e.values.isReadOnly;return P({formik:e,name:t,label:l,children:r,defaultValue:u,disabled:d,disabledReason:c,help:m,isOverridden:p,inheritedValue:F,inheritSource:z,isReadOnly:C,value:i,overrideValue:i===""?"-":i})},H=({formik:e,project:t})=>s.jsxs(s.Fragment,{children:[s.jsx(a.Row,{children:s.jsxs(a.Col,{size:8,children:[e.values.isCreating&&s.jsxs(s.Fragment,{children:[s.jsx(a.Label,{forId:"storage-pool-selector",required:!0,children:"Storage pool"}),s.jsx(K,{project:t,value:e.values.pool,setValue:l=>void e.setFieldValue("pool",l)})]}),s.jsx(a.Input,{...S(e,"name"),type:"text",label:"Name",disabled:e.values.isReadOnly||!e.values.isCreating,required:e.values.isCreating,help:e.values.isCreating?void 0:"Click the name in the header to rename the volume"}),s.jsx(A,{label:"Size",value:e.values.size,help:e.values.type==="custom"?"Size of storage volume. If empty, volume will not have a size limit within its storage pool.":"Size is immutable for non-custom volumes.",setMemoryLimit:l=>void e.setFieldValue("size",l),disabled:e.values.isReadOnly||e.values.type!=="custom"}),s.jsx(a.Select,{...S(e,"content_type"),options:[{label:"filesystem",value:"filesystem"},{label:"block",value:"block"}],label:"Content type",help:e.values.isCreating?"Type filesystem is ready to mount and write files to. Type block can only be attached to VMs, and is treated like an empty block device.":"Content type is immutable after creation.",onChange:l=>{l.target.value==="block"&&(e.setFieldValue("block_filesystem",void 0),e.setFieldValue("block_mount_options",void 0),e.setFieldValue("security_shifted",void 0),e.setFieldValue("security_unmapped",void 0)),e.setFieldValue("content_type",l.target.value)},disabled:e.values.isReadOnly||!e.values.isCreating})]})}),e.values.content_type==="filesystem"&&s.jsx(g,{rows:[n({formik:e,label:"Security shifted",name:"security_shifted",defaultValue:"",help:"Enable id shifting overlay (allows attach to multiple isolated instances)",disabled:e.values.security_unmapped==="true",disabledReason:"This setting can't be changed while security unmapped is set to true",children:s.jsx(a.Select,{options:h})}),n({formik:e,label:"Security unmapped",name:"security_unmapped",defaultValue:"",help:"Disable id mapping for the volume",disabled:e.values.security_shifted==="true",disabledReason:"This setting can't be changed while security shifted is set to true",children:s.jsx(a.Select,{options:h})})]})]}),U=({formik:e})=>{const t=I();return s.jsx(g,{rows:[n({formik:e,label:"Snapshot name pattern",name:"snapshots_pattern",defaultValue:"",children:s.jsx(a.Input,{placeholder:"Enter name pattern",help:s.jsxs(s.Fragment,{children:["Pongo2 template string that represents the snapshot name (used for scheduled snapshots and unnamed snapshots), see"," ",s.jsx("a",{href:`${t}/reference/instance_options/#instance-options-snapshots-names`,target:"_blank",rel:"noreferrer",children:"Automatic snapshot names"})]}),type:"text"})}),n({formik:e,label:"Expire after",name:"snapshots_expiry",help:"Controls when snapshots are to be deleted",defaultValue:"",children:s.jsx(a.Input,{placeholder:"Enter expiry expression",type:"text",help:"Expects an expression like 1M 2H 3d 4w 5m 6y"})}),n({formik:e,label:"Schedule",name:"snapshots_schedule",defaultValue:"",children:s.jsx(B,{value:e.values.snapshots_schedule,setValue:l=>void e.setFieldValue("snapshots_schedule",l)})})]})},G=({formik:e})=>s.jsx(g,{rows:[n({formik:e,label:"Block filesystem",name:"block_filesystem",defaultValue:"",help:"Filesystem of the storage volume",children:s.jsx(a.Select,{options:[{label:"auto",value:""},{label:"btrfs",value:"btrfs"},{label:"ext4",value:"ext4"},{label:"xfs",value:"xfs"}]})}),n({formik:e,label:"Block mount options",name:"block_mount_options",defaultValue:"",help:"Mount options for block devices",children:s.jsx(a.Input,{type:"text",help:s.jsxs(s.Fragment,{children:["For a list of available options visit"," ",s.jsx("a",{target:"_blank",rel:"noreferrer",href:"https://manpages.ubuntu.com/manpages/jammy/en/man8/mount.8.html#filesystem-independent%20mount%20options",children:"mount manpages"})]})})})]}),W=({formik:e})=>s.jsx(g,{rows:[n({formik:e,label:"ZFS blocksize",name:"zfs_blocksize",defaultValue:"",help:"Size of the ZFS blocks",children:s.jsx(a.Select,{options:[{label:"default",value:""},{label:"512",value:"512"},{label:"1024",value:"1024"},{label:"2048",value:"2048"},{label:"4096",value:"4096"},{label:"8192",value:"8192"},{label:"16384",value:"16384"}]})}),n({formik:e,label:"ZFS block mode",name:"zfs_block_mode",defaultValue:"",help:"Whether to use a formatted zvol rather than a dataset (zfs.block_mode can be set only for custom storage volumes; use volume.zfs.block_mode to enable ZFS block mode for all storage volumes in the pool, including instance volumes)",children:s.jsx(a.Select,{options:h})}),n({formik:e,label:"ZFS delegate",name:"zfs_delegate",defaultValue:"",help:"Controls whether to delegate the ZFS dataset and anything underneath it to the container(s) using it. Allows the use of the zfs command in the container.",children:s.jsx(a.Select,{options:h})}),n({formik:e,label:"ZFS remove snapshots",name:"zfs_remove_snapshots",defaultValue:"",help:"Remove snapshots as needed",children:s.jsx(a.Select,{options:h})}),n({formik:e,label:"ZFS use refquota",name:"zfs_use_refquota",defaultValue:"",help:"Use refquota instead of quota for space",children:s.jsx(a.Select,{options:h})}),n({formik:e,label:"ZFS reserve space",name:"zfs_reserve_space",defaultValue:"",help:"Use reservation/refreservation along with quota/refquota",children:s.jsx(a.Select,{options:h})})]}),ee=(e,t)=>{var r;const l=(r=e.size)==null?void 0:r.match(/^\d/);return{name:e.name,config:{size:l?e.size:void 0,[o("security_shifted")]:e.security_shifted,[o("security_unmapped")]:e.security_unmapped,[o("snapshots_expiry")]:e.snapshots_expiry,[o("snapshots_pattern")]:e.snapshots_pattern,[o("snapshots_schedule")]:e.snapshots_schedule,[o("block_filesystem")]:e.block_filesystem,[o("block_mount_options")]:e.block_mount_options,[o("zfs_blocksize")]:e.zfs_blocksize,[o("zfs_block_mode")]:e.zfs_block_mode,[o("zfs_delegate")]:e.zfs_delegate,[o("zfs_remove_snapshots")]:e.zfs_remove_snapshots,[o("zfs_use_refquota")]:e.zfs_use_refquota,[o("zfs_reserve_space")]:e.zfs_reserve_space},project:t,type:e.type,content_type:e.content_type,description:"",location:"",created_at:"",pool:e.pool}},S=(e,t)=>({id:t,name:t,onBlur:e.handleBlur,onChange:e.handleChange,value:e.values[t]??"",error:e.touched[t]?e.errors[t]:null,stacked:!0,placeholder:`Enter ${t.replaceAll("_"," ")}`}),se=({formik:e,section:t,setSection:l})=>{var i,p;const r=a.useNotify(),{project:u}=R();if(!u)return s.jsx(s.Fragment,{children:"Missing project"});const{data:d=[],error:c}=x({queryKey:[f.storage],queryFn:()=>j(u)});c&&r.failure("Loading storage pools failed",c);const m=()=>{L("form","p-bottom-controls")};_.useEffect(m,[(i=r.notification)==null?void 0:i.message]),E("resize",m);const b=((p=d.find(v=>v.name===e.values.pool))==null?void 0:p.driver)??"";return s.jsxs(a.Form,{onSubmit:e.handleSubmit,stacked:!0,className:"form",children:[s.jsx(a.Input,{type:"submit",hidden:!0}),s.jsx(Z,{active:t,setActive:l,formik:e,poolDriver:b,contentType:e.values.content_type,isCreating:e.values.isCreating}),s.jsx(a.Row,{className:"form-contents",children:s.jsxs(a.Col,{size:12,children:[t===y(M)&&s.jsx(H,{formik:e,project:u}),t===y(N)&&s.jsx(U,{formik:e}),t===y(O)&&s.jsx(G,{formik:e}),t===y(T)&&s.jsx(W,{formik:e})]})})]})};export{B as S,K as a,H as b,se as c,ee as v};

Zerion Mini Shell 1.0