/
proc
/
1387183
/
root
/
snap
/
lxd
/
current
/
share
/
lxd-ui
/
assets
/
File Upload :
llllll
Current File: //proc/1387183/root/snap/lxd/current/share/lxd-ui/assets/StorageVolumeForm-BktJTI1i.js
import{d as t,r as V,j as s,cd as z,a7 as E,T as C,n as I,F as P,ce as R,cf as Z,cg as r,o as D,k as L,aE as q,b as A,ch as B,ci as H,V as g}from"./index-dL2n30-Z.js";import{F as _,k as K,n as O,l as u,A as U,x as y,D as $}from"./FormMenuItem-DRePjRCl.js";import{i as W}from"./snapshots-AS6hXv2C.js";import{o as h}from"./instanceOptions-D4bz_1Ev.js";import{S as G,g as j}from"./FormFooterLayout-Bmq4RXkd.js";import{D as Y}from"./DiskSizeSelector-DZsA03GF.js";import{S as J}from"./StoragePoolSelector-BbIrdWMX.js";const M="Main configuration",w="Snapshots",T="Filesystem",N="ZFS",Q=({active:e,setActive:a,formik:l,poolDriver:o,contentType:c})=>{var p;const n=t.useNotify(),i={active:e,setActive:a},d=l.values.name.length>0?void 0:"Please enter a volume name to enable this section",b=()=>{C("form-navigation","p-bottom-controls")};return V.useEffect(b,[(p=n.notification)==null?void 0:p.message]),t.useListener(window,b,"resize",!0),s.jsx("div",{className:"p-side-navigation--accordion form-navigation",children:s.jsx("nav",{"aria-label":"Storage volume form navigation",children:s.jsxs("ul",{className:"p-side-navigation__list",children:[s.jsx(_,{label:M,...i}),s.jsx(_,{label:w,...i,disableReason:d}),c==="filesystem"&&z.includes(o)&&s.jsx(_,{label:T,...i,disableReason:d}),o===E&&s.jsx(_,{label:N,...i,disableReason:d})]})})})},X=(e,a,l)=>{var n;const o=a.find(i=>i.name===e),c=(n=l==null?void 0:l.environment)==null?void 0:n.storage_supported_drivers.find(i=>i.Name===(o==null?void 0:o.driver));return c?!c.Remote:!1},k=({formik:e,poolError:a,clusterMembers:l=[],pools:o=[],settings:c})=>s.jsxs(G,{children:[s.jsx(t.Row,{children:s.jsxs(t.Col,{size:12,children:[s.jsx(t.Label,{forId:"storage-pool-selector-volume",required:e.values.isCreating,children:"Storage pool"}),s.jsx(J,{value:e.values.pool,setValue:n=>{e.setFieldValue("pool",n),X(n,o,c)&&l.length>0?e.setFieldValue("clusterMember",l[0].server_name):e.setFieldValue("clusterMember",void 0)},selectProps:{id:"storage-pool-selector-volume",disabled:!e.values.isCreating,error:a,help:e.values.isCreating?void 0:"Use the migrate button in the header to move the volume to a different storage pool."}}),e.values.clusterMember!==void 0&&e.values.clusterMember!=="none"&&s.jsx(t.Select,{id:"clusterMember",label:"Cluster member",onChange:n=>{e.setFieldValue("clusterMember",n.target.value)},value:e.values.clusterMember,options:l.map(n=>({label:n.server_name,value:n.server_name})),disabled:!e.values.isCreating,required:e.values.isCreating,help:e.values.isCreating?void 0:"Cluster member is immutable after creation."}),s.jsx(t.Input,{...F(e,"name"),type:"text",label:"Name",disabled:!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(Y,{label:"Size",value:e.values.size,help:e.values.volumeType==="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:n=>{K(e),e.setFieldValue("size",n)},disabled:!!e.values.editRestriction||e.values.volumeType!=="custom"}),s.jsx(t.Select,{...F(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:n=>{n.target.value==="block"&&(e.setFieldValue("block_filesystem",void 0),e.setFieldValue("block_mount_options",void 0),e.setFieldValue("block_type",void 0),e.setFieldValue("security_shifted",void 0),e.setFieldValue("security_unmapped",void 0)),e.setFieldValue("content_type",n.target.value)},disabled:!e.values.isCreating})]})}),e.values.content_type==="filesystem"&&s.jsx(O,{rows:[u({formik:e,label:"Security shifted",name:"security_shifted",defaultValue:"",disabled:e.values.security_unmapped==="true",disabledReason:"This setting can't be changed while security unmapped is set to true",children:s.jsx(t.Select,{options:h})}),u({formik:e,label:"Security unmapped",name:"security_unmapped",defaultValue:"",disabled:e.values.security_shifted==="true",disabledReason:"This setting can't be changed while security shifted is set to true",children:s.jsx(t.Select,{options:h})})]})]}),ee=({formik:e})=>{const a=I(),{project:l}=P(),o=W(l);return s.jsxs(s.Fragment,{children:[o&&s.jsx(t.Notification,{severity:"caution",title:`Snapshot creation has been disabled for volumes in the project ${l==null?void 0:l.name}`,children:s.jsx(U,{project:l})}),s.jsx(y,{rows:[u({formik:e,label:"Snapshot name pattern",name:"snapshots_pattern",defaultValue:"",children:s.jsx(t.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:`${a}/reference/instance_options/#instance-options-snapshots-names`,target:"_blank",rel:"noopener noreferrer",children:"Automatic snapshot names"})]}),type:"text"})}),u({formik:e,label:"Expire after",name:"snapshots_expiry",defaultValue:"",children:s.jsx(t.Input,{placeholder:"Enter expiry expression",type:"text",help:"Expects an expression like 1M 2H 3d 4w 5m 6y"})}),u({formik:e,label:"Schedule",name:"snapshots_schedule",defaultValue:"",children:s.jsx($,{value:e.values.snapshots_schedule,setValue:c=>void e.setFieldValue("snapshots_schedule",c)})})]})]})},se=({formik:e,poolDriver:a})=>s.jsx(y,{rows:[u({formik:e,label:"Block filesystem",name:"block_filesystem",defaultValue:"",children:s.jsx(t.Select,{options:[{label:"auto",value:""},{label:"btrfs",value:"btrfs"},{label:"ext4",value:"ext4"},{label:"xfs",value:"xfs"}]})}),u({formik:e,label:"Block mount options",name:"block_mount_options",defaultValue:"",children:s.jsx(t.Input,{type:"text",help:s.jsxs(s.Fragment,{children:["For a list of available options visit"," ",s.jsx("a",{target:"_blank",rel:"noopener noreferrer",href:"https://manpages.ubuntu.com/manpages/jammy/en/man8/mount.8.html#filesystem-independent%20mount%20options",children:"mount manpages"})]})})}),...a===R?[u({formik:e,label:"Block type",name:"block_type",defaultValue:"thin",children:s.jsx(t.Select,{options:[{label:"thin",value:"thin"},{label:"thick",value:"thick"}]})})]:[]]}),te=({formik:e})=>s.jsx(y,{rows:[u({formik:e,label:"ZFS blocksize",name:"zfs_blocksize",defaultValue:"",children:s.jsx(t.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"}]})}),u({formik:e,label:"ZFS block mode",name:"zfs_block_mode",defaultValue:"",children:s.jsx(t.Select,{options:h})}),u({formik:e,label:"ZFS delegate",name:"zfs_delegate",defaultValue:"",children:s.jsx(t.Select,{options:h})}),u({formik:e,label:"ZFS remove snapshots",name:"zfs_remove_snapshots",defaultValue:"",children:s.jsx(t.Select,{options:h})}),u({formik:e,label:"ZFS use refquota",name:"zfs_use_refquota",defaultValue:"",children:s.jsx(t.Select,{options:h})}),u({formik:e,label:"ZFS reserve space",name:"zfs_reserve_space",defaultValue:"",children:s.jsx(t.Select,{options:h})})]}),ce=(e,a,l)=>{var d;const o=(d=e.size)==null?void 0:d.match(/^\d/),c=j((l==null?void 0:l.config)||{},Z()),n={name:e.name,config:{size:o?e.size:void 0,[r("security_shifted")]:e.security_shifted,[r("security_unmapped")]:e.security_unmapped,[r("snapshots_expiry")]:e.snapshots_expiry,[r("snapshots_pattern")]:e.snapshots_pattern,[r("snapshots_schedule")]:e.snapshots_schedule,[r("block_filesystem")]:e.block_filesystem,[r("block_mount_options")]:e.block_mount_options,[r("block_type")]:e.block_type,[r("zfs_blocksize")]:e.zfs_blocksize,[r("zfs_block_mode")]:e.zfs_block_mode,[r("zfs_delegate")]:e.zfs_delegate,[r("zfs_remove_snapshots")]:e.zfs_remove_snapshots,[r("zfs_use_refquota")]:e.zfs_use_refquota,[r("zfs_reserve_space")]:e.zfs_reserve_space,...c},project:a,type:e.volumeType,content_type:e.content_type,description:"",location:"",created_at:"",pool:e.pool},i=Object.keys(n),m=j(l||{},new Set(i));return{...n,...m}},F=(e,a)=>({id:a,name:a,onBlur:e.handleBlur,onChange:e.handleChange,value:e.values[a]??"",error:e.touched[a]?e.errors[a]:null,placeholder:`Enter ${a.replaceAll("_"," ")}`}),de=({formik:e,section:a,setSection:l})=>{var x,f;const o=t.useNotify(),{project:c}=D();if(!c)return s.jsx(s.Fragment,{children:"Missing project"});const{data:n=[]}=L(),{data:i=[],error:m}=q(),{data:d}=A();m&&o.failure("Loading storage pools failed",m);const b=()=>{C("form","p-bottom-controls")};V.useEffect(b,[(x=o.notification)==null?void 0:x.message]),t.useListener(window,b,"resize",!0);const p=((f=i.find(v=>v.name===e.values.pool))==null?void 0:f.driver)??"";if(i.length>0){const v=[];z.includes(p)||v.push(...B()),p!=="zfs"&&v.push(...H());for(const S of v)e.values[S]!==void 0&&e.setFieldValue(S,void 0)}return s.jsxs(t.Form,{onSubmit:e.handleSubmit,className:"form",children:[s.jsx(t.Input,{type:"submit",hidden:!0,value:"Hidden input"}),s.jsx(Q,{active:a,setActive:l,formik:e,poolDriver:p,contentType:e.values.content_type}),s.jsx(t.Row,{className:"form-contents",children:s.jsxs(t.Col,{size:12,children:[a===g(M)&&s.jsx(k,{formik:e,clusterMembers:n,pools:i,settings:d}),a===g(w)&&s.jsx(ee,{formik:e}),a===g(T)&&s.jsx(se,{formik:e,poolDriver:p}),a===g(N)&&s.jsx(te,{formik:e})]})})]})};export{M,k as S,de as a,ee as b,X as h,ce as v};
Copyright ©2k19 -
Hexid
|
Tex7ure