%PDF- %PDF-
Direktori : /snap/lxd/28373/share/lxd-ui/assets/ |
Current File : //snap/lxd/28373/share/lxd-ui/assets/ConfigurationTable-1a9d4d6f.js |
import{j as e,aa as I,at as B,d as s}from"./index-13b2882d.js";import{C as m}from"./ConfigFieldDescription-00c1a193.js";const w=({formik:n,name:t,label:o,children:a,defaultValue:x,disabled:c=!1,disabledReason:l,help:p,inputHelp:g,isOverridden:i,inheritedValue:d,inheritSource:j,isReadOnly:f,value:N,overrideValue:C})=>{const u=()=>{i?n.setFieldValue(t,void 0):(n.setFieldValue(t,x),setTimeout(()=>{var r;return(r=document.getElementById(t))==null?void 0:r.focus()},100))},v=()=>e.jsxs("div",{className:"override-form",children:[h(e.jsx("div",{children:B.cloneElement(a,{id:t,name:t,onBlur:n.handleBlur,onChange:n.handleChange,value:N,disabled:c,help:e.jsx(m,{description:g,className:"p-form-help-text"})})})),e.jsx("div",{children:e.jsx(s.Button,{onClick:u,type:"button",appearance:"base",title:"Clear override",hasIcon:!0,children:e.jsx(s.Icon,{name:"close",className:"clear-configuration-icon"})})})]}),b=i?e.jsx(s.Label,{forId:t,children:e.jsx("b",{children:o})}):e.jsx("b",{children:o}),h=r=>c&&l?e.jsx(s.Tooltip,{message:l,position:"right",children:r}):r;return F({configuration:e.jsxs(e.Fragment,{children:[b,e.jsx(m,{description:p,className:"configuration-help"})]}),inherited:e.jsxs("div",{className:I({"u-text--muted":i,"u-text--line-through":i}),children:[e.jsx("div",{className:"mono-font",children:e.jsx("b",{children:d})}),d&&e.jsxs("div",{className:"p-text--small u-text--muted",children:["From: ",j]})]}),override:f?C:i?v():h(e.jsx(s.Button,{onClick:u,className:"u-no-margin--bottom",type:"button",disabled:c,appearance:"base",title:"Create override",hasIcon:!0,children:e.jsx(s.Icon,{name:"edit"})}))})},F=({configuration:n,inherited:t,override:o,className:a})=>({className:a,columns:[{content:n,className:"configuration"},{content:t,className:"inherited"},{content:o,className:"override"}]}),D=({rows:n,configurationExtra:t,emptyStateMsg:o})=>{const a=[{content:e.jsxs("span",{children:["Configuration",t]}),className:"configuration"},{content:e.jsx("span",{children:"Inherited"}),className:"inherited"},{content:e.jsx("span",{children:"Override"}),className:"override"}];return e.jsx(s.MainTable,{className:"configuration-table",emptyStateMsg:o,headers:a,rows:n})};export{D as C,F as a,w as g};