Submit
Path:
~
/
/
snap
/
lxd
/
31333
/
share
/
lxd-ui
/
assets
/
File Content:
Settings-2fc8ab81.js
import{r as x,j as e,d as s,u as B,i as I,bo as L,q as S,l as R,f as D,n as P,L as q,B as T,H as V,b as E,S as K,bm as M}from"./index-13b2882d.js";import{C as k,t as _}from"./ConfigFieldDescription-00c1a193.js";const O=({initialValue:r,configField:t,onSubmit:l,onCancel:u})=>{const[n,c]=x.useState(r?r==="true":String(t.default)==="true"),o=String(t.default)!==String(n),p=()=>{c(String(t.default)==="true")};return e.jsxs(e.Fragment,{children:[e.jsx(s.Input,{"aria-label":t.key,id:b(t.key),wrapperClassName:"input-wrapper",type:"checkbox",checked:n,onChange:i=>c(i.target.checked),help:e.jsx(k,{description:t.longdesc,className:"p-form-help-text"})}),e.jsx(s.Button,{appearance:"base",onClick:u,children:"Cancel"}),e.jsx(s.Button,{appearance:"positive",onClick:()=>l(n),children:"Save"}),o&&e.jsxs(s.Button,{className:"reset-button",appearance:"base",onClick:p,hasIcon:!0,children:[e.jsx(s.Icon,{name:"restart",className:"flip-horizontally"}),e.jsx("span",{children:"Reset to default"})]})]})},Q=({initialValue:r,configField:t,onSubmit:l,onCancel:u})=>{const[n,c]=x.useState(r),o=()=>{switch(t.type){case"integer":return"number";default:return"text"}},p=String(t.default)!==String(n),i=()=>{c(t.default)};return e.jsxs(s.Form,{onSubmit:d=>{d.preventDefault(),l(n)},children:[e.jsx(s.Input,{type:"submit",hidden:!0}),e.jsx(s.Input,{"aria-label":t.key,id:b(t.key),wrapperClassName:"input-wrapper",type:o(),value:t.type==="bool"?void 0:String(n),onChange:d=>c(d.target.value),help:e.jsx(k,{description:t.longdesc,className:"p-form-help-text"})}),e.jsx(s.Button,{appearance:"base",onClick:u,children:"Cancel"}),e.jsx(s.Button,{appearance:"positive",onClick:()=>l(n),children:"Save"}),p&&e.jsxs(s.Button,{className:"reset-button",appearance:"base",onClick:i,hasIcon:!0,children:[e.jsx(s.Icon,{name:"restart",className:"flip-horizontally"}),e.jsx("span",{children:"Reset to default"})]})]})},z=({isSet:r,configField:t,onSubmit:l,onCancel:u})=>{const[n,c]=x.useState(!r),[o,p]=x.useState(!1),[i,d]=x.useState("");return e.jsxs(s.Form,{onSubmit:h=>{h.preventDefault(),l(i)},children:[e.jsx(s.Input,{type:"submit",hidden:!0}),n&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"input-row",children:[e.jsx(s.Input,{"aria-label":t.key,id:b(t.key),wrapperClassName:"input-wrapper",type:o?"text":"password",value:i,onChange:h=>d(h.target.value),help:e.jsx(k,{description:t.longdesc,className:"p-form-help-text"})}),e.jsx(s.Button,{appearance:"base",hasIcon:!0,onClick:()=>p(h=>!h),"aria-label":"toggle password visibility",children:e.jsx(s.Icon,{name:o?"hide":"show"})})]}),e.jsx(s.Button,{appearance:"base",onClick:u,children:"Cancel"}),e.jsx(s.Button,{appearance:"positive",onClick:()=>l(i),children:"Save"})]}),!n&&e.jsxs(e.Fragment,{children:[e.jsx(s.Button,{appearance:"base",onClick:u,children:"Cancel"}),e.jsx(s.Button,{onClick:()=>c(!0),children:"Change"}),e.jsx(s.Button,{appearance:"negative",onClick:()=>l(""),children:"Remove"})]})]})},b=r=>r.replace(".","___"),A=({configField:r,value:t,isLast:l})=>{const{isRestricted:u}=B(),[n,c]=x.useState(!1),o=s.useNotify(),p=I(),i=x.useRef(null),d=r.key==="core.trust_password",h=r.key==="loki.auth.password",y=d||h,j=m=>{const f={[r.key]:String(m)};L(f).then(()=>{o.success("Setting updated."),c(!1)}).catch(C=>{o.failure("Setting update failed",C)}).finally(()=>{p.invalidateQueries({queryKey:[S.settings]})})},g=()=>{c(!1)},a=()=>y?e.jsx("em",{children:t?"set":"not set"}):typeof t=="boolean"?String(t):t||"-";return x.useEffect(()=>{var m;n&&l&&((m=i.current)==null||m.scrollIntoView({behavior:"smooth"}))},[n]),e.jsxs(e.Fragment,{children:[n&&e.jsxs("div",{ref:i,children:[y&&e.jsx(z,{isSet:!!t,configField:r,onSubmit:j,onCancel:g}),!y&&e.jsx(e.Fragment,{children:r.type==="bool"?e.jsx(O,{initialValue:t,configField:r,onSubmit:j,onCancel:g}):e.jsx(Q,{initialValue:t??"",configField:r,onSubmit:j,onCancel:g})})]}),!n&&e.jsx(e.Fragment,{children:u?e.jsx("span",{children:t??"-"}):e.jsxs(s.Button,{appearance:"base",className:"readmode-button u-no-margin",onClick:()=>{c(!0)},hasIcon:!0,children:[e.jsx("div",{className:"readmode-value u-truncate",children:a()}),e.jsx(s.Icon,{name:"edit",className:"edit-icon"})]})})]})},U=()=>{const r=R(),[t,l]=x.useState(""),u=s.useNotify(),{data:n,isLoading:c}=D({queryKey:[S.configOptions],queryFn:M}),{data:o,error:p,isLoading:i}=P();if(c||i)return e.jsx(q,{});p&&u.failure("Loading settings failed",p);const d=a=>{for(const[m,f]of Object.entries((o==null?void 0:o.config)??{}))if(m===a.key)return f;if(a.type==="bool")return a.default==="true"?"true":"false";if(a.default!=="-")return a.default},h=[{content:"Group",className:"group"},{content:"Key",className:"key"},{content:"Value"}],y=_((n==null?void 0:n.configs.server)??{});y.push({key:"user.ui_title",category:"user",default:"",shortdesc:"Title for the LXD-UI web page. Shows the hostname when unset.",type:"string"});let j="";const g=y.filter(a=>t?a.key.toLowerCase().includes(t.toLowerCase()):!0).map((a,m,{length:f})=>{const C=!Object.keys((o==null?void 0:o.config)??{}).some(v=>v===a.key),w=d(a),N=j!==a.category;return j=a.category,{columns:[{content:N&&e.jsx("h2",{className:"p-heading--5",children:a.category}),role:"cell",className:"group","aria-label":"Group"},{content:e.jsxs("div",{className:"key-cell",children:[C?a.key:e.jsx("strong",{children:a.key}),e.jsx(k,{description:a.shortdesc,className:"p-text--small u-text--muted u-no-margin--bottom"})]}),role:"cell",className:"key","aria-label":"Key"},{content:e.jsx(A,{configField:a,value:w,isLast:m===f-1}),role:"cell","aria-label":"Value",className:"u-vertical-align-middle"}]}});return e.jsx(e.Fragment,{children:e.jsxs(T,{title:e.jsx(V,{href:`${r}/server/`,title:"Learn more about server configuration",children:"Settings"}),contentClassName:"settings",children:[e.jsx(E,{}),e.jsx(s.Row,{children:e.jsx(s.Col,{size:8,children:e.jsx(s.SearchBox,{name:"search-setting",type:"text",onChange:a=>{l(a)},placeholder:"Search",value:t})})}),e.jsx(s.Row,{children:e.jsx(K,{dependencies:[u.notification,g],children:e.jsx(s.MainTable,{headers:h,rows:g,emptyStateMsg:"No data to display"})})})]})})};export{U as default};
Submit
FILE
FOLDER
INFO
Name
Size
Permission
Action
data
---
0755
img
---
0755
AutoExpandingTextArea-3a779a81.js
352 bytes
0644
CancelOperationBtn-5e4a9f41.js
1454 bytes
0644
CertificateAdd-5762bbdd.js
2423 bytes
0644
CertificateGenerate-67a1d99d.js
9813 bytes
0644
ClusterGroupForm-f258bb5e.js
3146 bytes
0644
ClusterList-13b65a6c.js
4834 bytes
0644
ConfigFieldDescription-00c1a193.js
3588 bytes
0644
ConfigurationTable-1a9d4d6f.js
2213 bytes
0644
CreateClusterGroup-3b03283b.js
329 bytes
0644
CreateInstance-2dc2e316.js
15924 bytes
0644
CreateNetwork-9059effd.js
2293 bytes
0644
CreateProfile-fa64def5.js
3354 bytes
0644
CreateProject-3768bb7f.js
1942 bytes
0644
CreateStoragePool-e2d089cb.js
1809 bytes
0644
DiskSizeSelector-dd5e138a.js
1843 bytes
0644
EditClusterGroup-08d77b61.js
622 bytes
0644
FormMenuItem-c8a1a121.js
504 bytes
0644
Images-40cc8e59.js
4475 bytes
0644
InstanceDetail-ee6a9c3e.js
497285 bytes
0644
InstanceFormMenu-dff7cf6c.js
1710 bytes
0644
InstanceList-23508fa8.js
15982 bytes
0644
Login-a15594e3.js
1504 bytes
0644
NetworkDetail-c85f81d1.js
10357 bytes
0644
NetworkDevicesForm-bcf4be77.js
28882 bytes
0644
NetworkForm-ffe61c80.js
11091 bytes
0644
NetworkList-45862bf6.js
2938 bytes
0644
NetworkMap-30a0e19e.js
393598 bytes
0644
OperationList-b576a26c.js
3103 bytes
0644
ProfileDetail-1a7135fe.js
9972 bytes
0644
ProfileDetailsForm-809e7c02.js
856 bytes
0644
ProfileFormMenu-3458e77a.js
1542 bytes
0644
ProfileList-3777bd96.js
3396 bytes
0644
ProfileSelector-b579b8c7.js
1770 bytes
0644
ProjectConfiguration-e5324f11.js
7224 bytes
0644
ProjectForm-55619b78.js
14396 bytes
0644
ProtectedRoute-49eddddb.js
209 bytes
0644
RenameHeader-c74d9adb.js
1641 bytes
0644
SelectableMainTable-5a3f3fef.js
1514 bytes
0644
Settings-2fc8ab81.js
6119 bytes
0644
StoragePoolDetail-5cad7e82.js
5661 bytes
0644
StorageUsedBy-2e98cb1b.js
2208 bytes
0644
StorageVolumeCreate-76138e07.js
1794 bytes
0644
StorageVolumeDetail-513f1051.js
6918 bytes
0644
StorageVolumeForm-228515f8.js
9860 bytes
0644
StorageVolumeFormMenu-e90b9f5c.js
1378 bytes
0644
WarningList-74e9b259.js
1899 bytes
0644
certificate-3aff5cf1.js
283833 bytes
0644
clusterGroups-3fc1789d.js
3402 bytes
0644
formFields-fc140429.js
4724 bytes
0644
images-2ea813f2.js
702 bytes
0644
index-13b2882d.js
600882 bytes
0644
index-205b9caf.css
493180 bytes
0644
index.esm-82c30f37.js
70743 bytes
0644
instanceConfigInheritance-fbf987f8.js
1414 bytes
0644
instanceDelete-e714bd59.js
1559 bytes
0644
instanceEdit-cf20bafe.js
5416 bytes
0644
instanceValidation-26160179.css
52045 bytes
0644
instanceValidation-45cfba9a.js
2195634 bytes
0644
networks-5caac489.js
1747 bytes
0644
operations-beb03b33.js
433 bytes
0644
settings-c23f9009.js
183 bytes
0644
updateMaxHeight-325b3cd4.js
861 bytes
0644
useClusterMembers-dbf45674.js
3396 bytes
0644
N4ST4R_ID | Naxtarrr