Linux ip-172-26-2-223 5.4.0-1018-aws #18-Ubuntu SMP Wed Jun 24 01:15:00 UTC 2020 x86_64
Apache
: 172.26.2.223 | : 3.144.237.31
Cant Read [ /etc/named.conf ]
8.1.13
www
www.github.com/MadExploits
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
CPANEL RESET
CREATE WP USER
BLACK DEFEND!
README
+ Create Folder
+ Create File
/
snap /
lxd /
33085 /
share /
lxd-ui /
assets /
[ HOME SHELL ]
Name
Size
Permission
Action
font
[ DIR ]
drwxr-xr-x
img
[ DIR ]
drwxr-xr-x
js
[ DIR ]
drwxr-xr-x
scripts
[ DIR ]
drwxr-xr-x
AutoExpandingTextArea-BXFyAEiG...
151
B
-rw-r--r--
BaseLayout-CiF2D8RH.js
280
B
-rw-r--r--
BulkDeleteButton-B-fvVwh0.js
1.08
KB
-rw-r--r--
CancelOperationBtn-BW2TAzI_.js
1.08
KB
-rw-r--r--
CertificateAdd-BGVwf-VB.js
2.84
KB
-rw-r--r--
CertificateGenerate-bNGS6BFl.j...
9.87
KB
-rw-r--r--
ClusterGroupForm-BiXmM-NU.js
3.25
KB
-rw-r--r--
ClusterList-CZFDB46f.js
5.17
KB
-rw-r--r--
ClusterMemberSelector-B2lzDpCI...
3.71
KB
-rw-r--r--
ClusterSpecificInput-BdiLVA9B....
1.97
KB
-rw-r--r--
ClusterSpecificSelect-DrKUzNev...
2.2
KB
-rw-r--r--
ConfigFieldDescription-BnRkdbo...
335
B
-rw-r--r--
CreateClusterGroup-C6s3qbZf.js
463
B
-rw-r--r--
CreateInstance-BXX4Xa4W.js
27.97
KB
-rw-r--r--
CreateInstanceFromImageBtn-BiE...
527
B
-rw-r--r--
CreateNetwork-BQw2A27w.js
2.88
KB
-rw-r--r--
CreateNetworkForward-BgZF8duA....
1.71
KB
-rw-r--r--
CreateProfile-CCJYKSCK.js
4.04
KB
-rw-r--r--
CreateProject-DTBqJzUb.js
2.83
KB
-rw-r--r--
CreateStoragePool-CuOutvs3.js
2.46
KB
-rw-r--r--
CreateStorageVolume-B0HvyGnH.j...
2.47
KB
-rw-r--r--
CustomIsoList-CQVv4whx.js
5.48
KB
-rw-r--r--
DeleteStoragePoolBtn-BeXLuEnA....
1.62
KB
-rw-r--r--
DeleteStorageVolumeBtn-DIIVYGa...
1.88
KB
-rw-r--r--
DiskSizeSelector-IT5APek6.js
1010
B
-rw-r--r--
EditClusterGroup-DiNIL0Lx.js
761
B
-rw-r--r--
EditNetworkForward-DtcWepYC.js
1.99
KB
-rw-r--r--
ExpandableList-EDeaeb6c.js
323
B
-rw-r--r--
FormEditButton-Cs2eW7Js.js
278
B
-rw-r--r--
FormFooterLayout-B3kcadYt.js
738
B
-rw-r--r--
FormLink-BaU-zsbe.js
879
B
-rw-r--r--
FormMenuItem-ChXfQsFA.js
2.23
MB
-rw-r--r--
FormMenuItem-DyX1CsEw.css
66.66
KB
-rw-r--r--
GroupOrIdentityChangesTable-DQ...
5.11
KB
-rw-r--r--
GroupSelectionActions-Dq47oQd-...
3.18
KB
-rw-r--r--
HelpLink-4LTOsqZO.js
294
B
-rw-r--r--
ImageList-yKBGTFZU.js
11.7
KB
-rw-r--r--
InstanceDetail-BV9hr65t.js
481.49
KB
-rw-r--r--
InstanceDetail-Beg8tuEN.css
3.88
KB
-rw-r--r--
InstanceLinkChip-DfVC8U01.js
4.24
KB
-rw-r--r--
InstanceList-CTEYE5e7.js
24.67
KB
-rw-r--r--
ItemName-DSOx0T0r.js
185
B
-rw-r--r--
Login-CsUYa7ns.js
1.41
KB
-rw-r--r--
Meter-BsdJ73XW.js
487
B
-rw-r--r--
NetworkDetail-RgSS_6Vw.js
12.8
KB
-rw-r--r--
NetworkForwardForm-C18aehvo.js
6.49
KB
-rw-r--r--
NetworkList-B4gWmGGm.js
6.32
KB
-rw-r--r--
NetworkListTable-Ba2LzF-J.js
3.31
KB
-rw-r--r--
NotificationRow-CotZPNAQ.js
157
B
-rw-r--r--
OperationList-D4--05cO.js
3.35
KB
-rw-r--r--
PageHeader-CExPjRLH.js
549
B
-rw-r--r--
PermissionGroups-CkGxgQmn.js
30.89
KB
-rw-r--r--
PermissionIdentities-DDmb7V-C....
12.93
KB
-rw-r--r--
PermissionIdpGroups-yggiVbcG.j...
13.38
KB
-rw-r--r--
ProfileDetail-CQHhNWwW.js
10.94
KB
-rw-r--r--
ProfileDetailsForm-C-rMcUGO.js
2.45
KB
-rw-r--r--
ProfileInstances-DeravO8Q.js
1.46
KB
-rw-r--r--
ProfileList-C7yC3g6E.js
7.11
KB
-rw-r--r--
ProgressBar-CQ2HKUqQ.js
170
B
-rw-r--r--
ProjectConfiguration-rKP8dZtz....
9.04
KB
-rw-r--r--
ProjectForm-GhClr0iv.js
15.12
KB
-rw-r--r--
ProtectedRoute-DYKGChU3.js
214
B
-rw-r--r--
ProxyDeviceForm-B5UDgi1V.js
38.9
KB
-rw-r--r--
RenameHeader-fmgiouA6.js
13.29
KB
-rw-r--r--
ResourceIcon-DZQOrBLA.js
532
B
-rw-r--r--
ResourceLabel-PzB_6v5p.js
317
B
-rw-r--r--
ResourceLink-CS7mH0C3.js
302
B
-rw-r--r--
ScrollableContainer-MJpEXCww.j...
646
B
-rw-r--r--
ScrollableTable-DWT33Lms.js
561
B
-rw-r--r--
SelectableMainTable-C8l8QdDe.j...
2.21
KB
-rw-r--r--
SelectedTableNotification-2DZb...
974
B
-rw-r--r--
Settings-BYi8qROs.js
9.75
KB
-rw-r--r--
SidePanel-DNeaRMst.js
2.84
KB
-rw-r--r--
SnapshotForm-DF9sGEzn.js
1.49
KB
-rw-r--r--
StoragePoolDetail-DT58PBIr.js
6.45
KB
-rw-r--r--
StoragePoolForm-Z62B6Fuh.js
17.07
KB
-rw-r--r--
StoragePoolSelectTable-CXuxJSN...
1.61
KB
-rw-r--r--
StoragePoolSelector-DEvMjaMu.j...
1.48
KB
-rw-r--r--
StoragePoolSize-DyBNKBKy.js
467
B
-rw-r--r--
StoragePools-DK0Gkjq9.js
3.99
KB
-rw-r--r--
StorageUsedBy-sdKGRlgM.js
2.12
KB
-rw-r--r--
StorageVolumeDetail-fQzbPWNW.j...
24.87
KB
-rw-r--r--
StorageVolumeForm-ZPfwK39D.js
8.42
KB
-rw-r--r--
StorageVolumes-DPotlIN6.js
7.26
KB
-rw-r--r--
StorageVolumesFilter-B7pR3OeF....
1.01
KB
-rw-r--r--
TabLinks-BIG_Rdvk.js
360
B
-rw-r--r--
UploadCustomIso-DG12FhN0.js
2.83
KB
-rw-r--r--
UsedByItem-VHA3kVFG.js
945
B
-rw-r--r--
VolumeAddSnapshotBtn-8Qz9xFE-....
4.87
KB
-rw-r--r--
WarningList-DZNTQSpg.js
1.99
KB
-rw-r--r--
YamlNotification-BnmI52ws.js
634
B
-rw-r--r--
YamlSwitch-BXLuxWUh.js
40.62
KB
-rw-r--r--
certificate-kcThcTS9.js
279.99
KB
-rw-r--r--
clusterGroups-BWQNdGSD.js
3.63
KB
-rw-r--r--
images-Du2fhDUO.js
1.22
KB
-rw-r--r--
index-BeIaaTgz.css
661.94
KB
-rw-r--r--
index-BkTFFYvy.js
690.52
KB
-rw-r--r--
index-DW_MHI2K.js
34.19
KB
-rw-r--r--
index.esm-auJ3G_FM.js
38.36
KB
-rw-r--r--
instanceDelete-Bn3xn_NE.js
12.2
KB
-rw-r--r--
instanceOptions-BuFjjn-P.js
1.19
KB
-rw-r--r--
network-forwards-B-h1Yzp9.js
856
B
-rw-r--r--
operations-DIvBacJG.js
757
B
-rw-r--r--
projects-CvA2zMPN.js
789
B
-rw-r--r--
scroll-DPmbgfny.js
26.97
KB
-rw-r--r--
searchAndFilter-DtC_P-vv.js
361
B
-rw-r--r--
snapshots-CEDJtMaf.js
670
B
-rw-r--r--
storage-volumes-tfXkh9eB.js
2.46
KB
-rw-r--r--
useGroups-CCX3qCzO.js
2.91
KB
-rw-r--r--
useImages-LgCYWVgs.js
1.64
KB
-rw-r--r--
useNetworks-D3nHf8AE.js
3.63
KB
-rw-r--r--
useSmallScreen-BvsjT919.js
169
B
-rw-r--r--
useSortTableData-BoXaK1oA.js
393
B
-rw-r--r--
useVolumes-BvpfNVaA.js
1.27
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : ProxyDeviceForm-B5UDgi1V.js
import{j as e,y as R,d as s,aN as J,aS as de,G as ue,aO as he,a7 as ve,aT as pe,L as E,l as me,r as F,p as k,ai as ee,aU as ge,c as xe,q as G,B as be,H as je,s as ye,aV as T,aQ as Y,aW as Ne,D as M,aX as Ce,aY as Ie,aZ as $e,ay as De,g as te,a_ as Re,n as Fe,a$ as we,b0 as _,u as Pe,b1 as Se,aR as W,b2 as fe,b3 as Be,b4 as Le}from"./index-BkTFFYvy.js";import{n as $,k as f,i as N,o as B,p as q,q as H,t as Ee,u as O,v as Ve}from"./FormMenuItem-ChXfQsFA.js";import{S as _e}from"./StoragePoolSelector-DEvMjaMu.js";import{D as Me}from"./DiskSizeSelector-IT5APek6.js";import{f as V,S as z}from"./FormFooterLayout-B3kcadYt.js";import{S as se}from"./ScrollableTable-DWT33Lms.js";import{N as Oe}from"./NotificationRow-CotZPNAQ.js";import{u as Ae}from"./projects-CvA2zMPN.js";import{a as Ue}from"./useVolumes-BvpfNVaA.js";import{v as Ge,S as Te}from"./StorageVolumeForm-ZPfwK39D.js";import{c as qe,a as He}from"./index.esm-auJ3G_FM.js";import{c as ze}from"./storage-volumes-tfXkh9eB.js";import{B as ae,F as X}from"./FormLink-BaU-zsbe.js";import{g as Ke}from"./useNetworks-D3nHf8AE.js";import{C as ne}from"./ConfigFieldDescription-BnRkdboG.js";import{p as Qe,a as Ye}from"./instanceOptions-BuFjjn-P.js";const S=({id:t,label:i,inheritValue:d,inheritSource:c,readOnly:n,overrideValue:l,overrideForm:r,addOverride:u,clearOverride:v,isDeactivated:x,className:o,disabledReason:a})=>$({className:R("no-border-top",o),configuration:t?!n&&l?e.jsx(s.Label,{forId:t,className:R({"u-text--muted":x}),children:i}):e.jsx("p",{className:R("p-form__label u-no-margin--bottom u-no-padding--top",{"u-text--muted":x}),children:i}):e.jsx("div",{className:R({"u-text--muted":x}),children:i}),inherited:d&&e.jsxs("div",{className:R({"u-text--muted":l||x,"u-text--line-through":l||x}),children:[e.jsx("div",{className:"mono-font",children:e.jsx("b",{children:d})}),c&&e.jsxs("div",{className:"p-text--small u-text--muted u-no-margin--bottom",children:["From: ",c]})]}),override:n?l?e.jsx("div",{className:"mono-font",children:e.jsx("b",{children:l})}):"":l?e.jsxs("div",{className:"override-form",children:[e.jsx("div",{children:r}),v&&e.jsx("div",{children:e.jsx(s.Button,{onClick:v,type:"button",appearance:"base",title:a??"Clear override",hasIcon:!0,className:"u-no-margin--bottom",disabled:!!a,children:e.jsx(s.Icon,{name:"close",className:"clear-configuration-icon"})})})]}):u&&e.jsx(s.Button,{onClick:u,type:"button",appearance:"base",title:a??"Create override",className:"u-no-margin--bottom",hasIcon:!0,disabled:!!a,children:e.jsx(s.Icon,{name:"edit"})})}),We=({formik:t,pools:i,profiles:d})=>{const c=t.values.readOnly,n=t.values.devices.findIndex(J),l=n!==-1,r=t.values.devices[n],u=t.values.entityType==="instance"&&!t.values.isCreating,[v,x]=de(t.values,d),o=()=>{var j;const a=[...t.values.devices];a.push({type:"disk",name:v!=null&&v.name?v.name:"root",path:"/",pool:v?v.pool:((j=i[0])==null?void 0:j.name)??void 0}),t.setFieldValue("devices",a)};return e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"p-heading--4",children:"Root storage"}),e.jsx(f,{rows:[$({className:"override-with-form",configuration:e.jsx("b",{className:"device-name",children:"Root storage"}),inherited:"",override:l?e.jsx("div",{children:e.jsx(s.Button,{onClick:()=>{N(t),B(n,t)},type:"button",appearance:"base",title:t.values.editRestriction??"Clear override",hasIcon:!0,className:"u-no-margin--bottom",disabled:!!t.values.editRestriction,children:e.jsx(s.Icon,{name:"close",className:"clear-configuration-icon"})})}):e.jsx(s.Button,{onClick:()=>{N(t),o()},type:"button",appearance:"base",title:t.values.editRestriction??"Create override",className:"u-no-margin--bottom",hasIcon:!0,disabled:!!t.values.editRestriction,children:e.jsx(s.Icon,{name:"edit"})})}),S({label:"Pool",id:"storage-pool-selector-disk",className:"override-with-form",inheritValue:(v==null?void 0:v.pool)??"",inheritSource:x,readOnly:c,disabledReason:t.values.editRestriction,overrideValue:l&&e.jsxs(e.Fragment,{children:[r==null?void 0:r.pool,t.values.entityType==="profile"&&e.jsx(s.Button,{onClick:()=>{N(t),V("storage-pool-selector")},type:"button",appearance:"base",title:t.values.editRestriction??"Edit",className:"u-no-margin--bottom",hasIcon:!0,disabled:!!t.values.editRestriction,children:e.jsx(s.Icon,{name:"edit"})})]}),overrideForm:e.jsx(e.Fragment,{children:e.jsx(_e,{value:(r==null?void 0:r.pool)??"",setValue:a=>void t.setFieldValue(`devices.${n}.pool`,a),selectProps:{id:"storage-pool-selector-disk",className:u?"":"u-no-margin--bottom",disabled:u,help:u?"Use the migrate button in the header to change root storage.":""}})})}),S({label:"Size",id:"limits_disk",className:"override-with-form",inheritValue:(v==null?void 0:v.size)??(v?"unlimited":""),inheritSource:x,readOnly:c,disabledReason:t.values.editRestriction,overrideValue:l&&e.jsxs(e.Fragment,{children:[(r==null?void 0:r.size)??"unlimited",e.jsx(s.Button,{onClick:()=>{N(t),V("limits_disk")},type:"button",appearance:"base",title:t.values.editRestriction??"Edit",className:"u-no-margin--bottom",hasIcon:!0,disabled:!!t.values.editRestriction,children:e.jsx(s.Icon,{name:"edit"})})]}),overrideForm:l&&e.jsxs(e.Fragment,{children:[e.jsx(Me,{value:(r==null?void 0:r.size)??"GiB",setMemoryLimit:a=>void t.setFieldValue(`devices.${n}.size`,a)}),e.jsx("p",{className:"p-form-help-text",children:"Size of root storage. If empty, root storage will not have a size limit."})]})})]}),ue(t.values,d)&&e.jsx("div",{className:"is-error ",children:e.jsxs("p",{className:"p-form-validation__message",children:[e.jsx("strong",{children:"Error:"})," Missing root storage. Create an override, or add a profile with root storage."]})})]})},oe=({onDetach:t,disabledReason:i})=>e.jsxs(s.ConfirmationButton,{appearance:"base",type:"button",title:i??"Detach disk",className:"has-icon u-no-margin--bottom is-dense",confirmationModalProps:{title:"Confirm disk detachment",children:e.jsxs("p",{children:["Are you sure you want to clear this disk attachment?",e.jsx("br",{}),"This action may result in data loss if the disk is still mounted."]}),confirmButtonLabel:"Detach",onConfirm:t},shiftClickEnabled:!0,showShiftClickHint:!0,disabled:!!i,children:[e.jsx(s.Icon,{name:"disconnect"}),e.jsx("span",{children:"Detach"})]}),Xe=({formik:t,inheritedDiskDevices:i})=>{const d=t.values.readOnly,c=[];return i.forEach(n=>{const l=q(n.key,t),r=l!==-1;c.push($({className:"no-border-top override-with-form",configuration:e.jsx("div",{className:R("device-name",{"u-text--muted":r}),children:e.jsx("b",{children:n.key})}),inherited:e.jsxs("div",{className:"p-text--small u-text--muted u-no-margin--bottom",children:["From: ",n.source]}),override:r?e.jsxs(s.Button,{appearance:"base",type:"button",title:t.values.editRestriction??"Reattach device",onClick:()=>{N(t),B(l,t)},className:"has-icon u-no-margin--bottom",disabled:!!t.values.editRestriction,children:[e.jsx(s.Icon,{name:"connected"}),e.jsx("span",{children:"Reattach"})]}):e.jsx(oe,{onDetach:()=>{N(t),H(n.key,t)},disabledReason:t.values.editRestriction})})),he(n.disk)?c.push(S({label:"Host path",inheritValue:n.disk.source,readOnly:d,isDeactivated:r,disabledReason:t.values.editRestriction})):c.push(S({label:"Pool / volume",inheritValue:e.jsxs(e.Fragment,{children:[n.disk.pool," / ",n.disk.source]}),readOnly:d,isDeactivated:r,disabledReason:t.values.editRestriction})),c.push(S({label:"Mount point",inheritValue:n.disk.path,readOnly:d,isDeactivated:r,disabledReason:t.values.editRestriction}))}),i.length>0?e.jsxs("div",{className:"inherited-devices",children:[e.jsx("h2",{className:"p-heading--4",children:"Inherited disk devices"}),e.jsx(f,{rows:c})]}):null},Ze=({project:t,primaryVolume:i,instanceLocation:d,onFinish:c,onCancel:n,onCreate:l,hasPrevStep:r})=>{const u=s.useNotify(),{canCreateStorageVolumes:v}=Ae(),{data:x}=ve(t),{data:o=[],error:a,isLoading:j,isFetching:p}=Ue(t,{refetchOnMount:h=>h.state.isInvalidated});a&&u.failure("Loading storage volumes failed",a);const m=h=>{u.clear(),c(h)},y=[{content:"Name"},{content:"Pool"},...d?[{content:"Location"}]:[],{content:"Content type"},{content:"Used by"},{"aria-label":"Actions",className:"actions"}],b=p?[]:o.sort((h,g)=>h.created_at>g.created_at?-1:1).map(h=>{var w;const g=!!h.location,C=d!==void 0&&g&&d!==h.location,I=C?`Instance location (${d}) does not match local volume location (${h.location}). `:void 0,D=()=>{I||m(h)};return{key:h.name,className:R("u-row",{"u-text--muted":C,"u-row--disabled":C}),columns:[{content:e.jsx("div",{className:"u-truncate iso-name",title:`Volume ${h.name}`,children:h.name}),role:"cell","aria-label":"Name",onClick:D},{content:h.pool,role:"cell","aria-label":"Storage pool",onClick:D},...d?[{content:h.location,role:"cell","aria-label":"Location",onClick:D}]:[],{content:pe(h),role:"cell","aria-label":"Content type",onClick:D},{content:(w=h.used_by)==null?void 0:w.length,role:"cell","aria-label":"Used by",onClick:D},{content:e.jsx(s.Button,{onClick:()=>{m(h)},dense:!0,appearance:(i==null?void 0:i.name)===h.name&&(i==null?void 0:i.type)===h.type&&(i==null?void 0:i.pool)==h.pool?"positive":"",title:C?I:`Select ${h.name}`,disabled:C,children:"Select"}),role:"cell","aria-label":"Actions",className:"u-align--right",onClick:D}]}});return e.jsxs(e.Fragment,{children:[e.jsx(Oe,{}),e.jsx(se,{dependencies:[o,b,u.notification],belowIds:["modal-footer"],tableId:"volume-select-table",children:e.jsx(s.MainTable,{id:"volume-select-table",headers:y,rows:b,sortable:!0,className:"u-selectable-table-rows u-table-layout--auto",emptyStateMsg:j||p?e.jsx(E,{text:"Loading volumes..."}):"No custom volumes found"})}),!j&&e.jsxs("footer",{className:"p-modal__footer",id:"modal-footer",children:[e.jsx(s.Button,{className:"u-no-margin--bottom",onClick:n,appearance:"base",children:r?"Back":"Cancel"}),e.jsx(s.Button,{className:"u-no-margin--bottom",appearance:o.length===0?"positive":"",onClick:l,disabled:!v(x),title:v(x)?"":"You do not have permission to create storage volumes in this project",children:"Create volume"})]})]})},Je=({project:t,instanceLocation:i,onCancel:d,onFinish:c})=>{var y;const n=s.useNotify(),l=me(),r=F.useState(null),{data:u}=k(),{data:v=[]}=ee(),x=qe().shape({name:He().test(...ge(t,"custom",r)).required("This field is required")}),o=b=>{var C;const h=v.find(I=>I.name===b),g=(C=u==null?void 0:u.environment)==null?void 0:C.storage_supported_drivers.find(I=>I.Name===(h==null?void 0:h.driver));return g?!g.Remote:!1},a=xe({initialValues:{content_type:"filesystem",name:"",project:t,pool:"",size:"GiB",volumeType:"custom",readOnly:!1,isCreating:!0,entityType:"storageVolume"},validationSchema:x,onSubmit:b=>{const h=Ge(b,t),g=o(b.pool)?i:void 0;ze(b.pool,t,h,g).then(()=>{l.invalidateQueries({queryKey:[G.storage]}),l.invalidateQueries({queryKey:[G.customVolumes,t]}),n.success(`Storage volume ${b.name} created.`),c(h)}).catch(C=>{n.failure("Storage volume creation failed",C)}).finally(()=>{a.setSubmitting(!1)})}}),j=!o(a.values.pool)||i!=="any",p=j?void 0:"Please select a remote storage pool, or set a cluster member for the instance",m=()=>{je("volume-create-form","p-modal__footer",32,void 0,[])};return F.useEffect(m,[(y=n.notification)==null?void 0:y.message]),be("resize",m),e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"volume-create-form",children:e.jsx(Te,{formik:a,poolError:p})}),e.jsxs("footer",{className:"p-modal__footer",children:[e.jsx(s.Button,{appearance:"base",className:"u-no-margin--bottom",onClick:d,children:"Back"}),e.jsx(s.ActionButton,{appearance:"positive",className:"u-no-margin--bottom",onClick:()=>void a.submitForm(),disabled:!a.isValid||!j,loading:a.isSubmitting,children:"Create volume"})]})]})},ke=t=>{const{data:i}=k();return!ye(i)||t.values.entityType!=="instance"?void 0:t.values.isCreating?t.values.target??"any":t.values.location},U="selectVolume",Q="createVolume",ie=({formik:t,project:i,onFinish:d,onCancel:c,onClose:n,title:l})=>{const[r,u]=F.useState(U),[v,x]=F.useState(void 0),o=ke(t),a=m=>{u(U),x(m)},j=()=>{u(U)};let p=l??"Choose custom volume";return r===Q&&(p=l?e.jsx(ae,{title:"Create volume",onClick:j,linkText:"Attach custom volume"}):"Create volume"),e.jsxs(s.Modal,{className:"custom-volume-modal",close:n,title:p,children:[r===U&&e.jsx(Ze,{project:i,primaryVolume:v,instanceLocation:o,onFinish:d,onCancel:c,onCreate:()=>{u(Q)},hasPrevStep:!!l}),r===Q&&e.jsx(Je,{project:i,instanceLocation:o,onCancel:j,onFinish:a})]})},et=({formik:t,children:i,buttonProps:d,project:c,setValue:n})=>{const{openPortal:l,closePortal:r,isOpen:u,Portal:v}=s.usePortal(),x=o=>{n(o),r()};return e.jsxs(e.Fragment,{children:[e.jsx(s.Button,{onClick:l,type:"button",hasIcon:!0,...d,children:i}),u&&e.jsx(v,{children:e.jsx(ie,{formik:t,project:c,onFinish:x,onCancel:r,onClose:r})})]})},K=({name:t,index:i,setName:d,disableReason:c})=>{const[n,l]=F.useState(!1);return e.jsx("div",{className:"rename-device device-name",children:n?e.jsx(s.Input,{autoFocus:!0,className:"u-no-margin--bottom",type:"text",value:t,onChange:r=>{d(r.target.value)},onBlur:()=>{l(!1)}}):e.jsxs(e.Fragment,{children:[e.jsx(s.Label,{forId:`device-${i}-name`,children:e.jsx("b",{children:t})}),e.jsx(s.Button,{id:`device-${i}-name`,hasIcon:!0,dense:!0,onClick:()=>{l(!0)},appearance:"base",className:"u-no-margin--bottom","aria-label":"Rename device",disabled:!!c,title:c,children:e.jsx(s.Icon,{name:"edit"})})]})})},tt=({formik:t,onFinish:i,onCancel:d,onClose:c,title:n})=>{const[l,r]=F.useState(""),[u,v]=F.useState(""),x=F.useRef({source:!1,path:!1});F.useEffect(()=>{V("host-path")},[]);const o=()=>{i({type:"disk",source:l,path:u})};return e.jsxs(s.Modal,{className:"host-path-device-modal",close:c,title:n,buttonRow:e.jsxs(e.Fragment,{children:[e.jsx(s.Button,{appearance:"base",className:"u-no-margin--bottom",type:"button",onClick:d,children:"Back"}),e.jsx(s.Button,{appearance:"",className:"u-no-margin--bottom",type:"button",loading:t.isSubmitting,disabled:!l||!u,onClick:o,children:"Attach"})]}),children:[e.jsx(s.Input,{id:"host-path",value:l,onChange:a=>{x.current.source=!0,r(a.target.value)},type:"text",label:"Host path",required:!0,error:!l&&x.current.source?"Host path is required":void 0,placeholder:"Enter full path (e.g. /home)"}),e.jsx(s.Input,{value:u,onChange:a=>{x.current.path=!0,v(a.target.value)},type:"text",label:"Mount point",required:!0,error:!u&&x.current.path?"Mount point is required":void 0,placeholder:"Enter full path (e.g. /data)"})]})},st=({close:t,formik:i,project:d,onFinish:c})=>{const[n,l]=F.useState("choose type"),r=o=>{o.key==="Escape"&&t()},u=()=>{l("choose type")},v=o=>{const a={type:"disk",pool:o.pool,source:o.name,path:o.content_type==="filesystem"?"":void 0};c(a)},x=n==="choose type"?"Choose disk type":e.jsx(ae,{title:n==="host path"?"Mount host path":"Attach custom volume",onClick:u,linkText:"Choose disk type"});return e.jsxs(e.Fragment,{children:[n==="choose type"&&e.jsx(s.Modal,{close:t,className:"migrate-instance-modal",title:x,onKeyDown:r,children:e.jsxs("div",{className:"choose-migration-type",children:[e.jsx(X,{icon:"add-logical-volume",title:"Attach custom volume",onClick:()=>{l("custom volume")}}),e.jsx(X,{icon:"mount",title:"Mount host path",onClick:()=>{l("host path")}})]})}),n==="custom volume"&&e.jsx(ie,{formik:i,project:d,onFinish:v,onCancel:u,onClose:t,title:x}),n==="host path"&&e.jsx(tt,{formik:i,onFinish:c,onCancel:u,onClose:t,title:x})]})},at=({formik:t,children:i,buttonProps:d,project:c,setValue:n})=>{const{openPortal:l,closePortal:r,isOpen:u,Portal:v}=s.usePortal(),x=o=>{n(o),r()};return e.jsxs(e.Fragment,{children:[e.jsx(s.Button,{onClick:l,type:"button",hasIcon:!0,...d,disabled:!!t.values.editRestriction,title:t.values.editRestriction,children:i}),u&&e.jsx(v,{children:e.jsx(st,{formik:t,project:c,onFinish:x,close:r})})]})},nt=({formik:t,project:i,profiles:d})=>{const c=t.values.readOnly,n=T(t.values,d),l=o=>{const a=[...t.values.devices],j={...o,name:O("disk-device",1,n)};a.push(j),t.setFieldValue("devices",a);const p=`devices.${a.length-1}.path`;V(p)},r=(o,a,j)=>{t.setFieldValue(`devices.${j}.pool`,o.pool),t.setFieldValue(`devices.${j}.source`,o.name),o.content_type==="filesystem"&&a.path===void 0&&t.setFieldValue(`devices.${j}.path`,""),o.content_type==="block"&&t.setFieldValue(`devices.${j}.path`,void 0)},u=o=>e.jsx(s.Button,{appearance:"base",className:"u-no-margin--bottom",hasIcon:!0,dense:!0,title:t.values.editRestriction??"Edit",onClick:()=>{N(t),V(o)},disabled:!!t.values.editRestriction,children:e.jsx(s.Icon,{name:"edit"})}),v=[];let x=0;for(let o=0;o<t.values.devices.length;o++){const a=t.values.devices[o];if(!Ee(a)||J(a))continue;v.push($({className:"no-border-top custom-device-name",configuration:e.jsx(K,{name:a.name,index:o,setName:m=>{N(t),t.setFieldValue(`devices.${o}.name`,m)},disableReason:t.values.editRestriction}),inherited:"",override:e.jsx(oe,{onDetach:()=>{N(t),B(o,t)},disabledReason:t.values.editRestriction})}));const j=()=>$({className:"no-border-top inherited-with-form",configuration:e.jsx(s.Label,{forId:`devices.${o}.pool`,children:"Pool / volume"}),inherited:e.jsxs("div",{className:"custom-disk-volume-source",children:[e.jsx("div",{className:R("mono-font","u-truncate"),title:`${a.pool} / ${a.source??""}`,children:e.jsxs("b",{children:[a.pool," / ",a.source]})}),e.jsx(et,{formik:t,project:i,setValue:m=>{N(t),r(m,a,o)},buttonProps:{id:`devices.${o}.pool`,appearance:"base",className:"u-no-margin--bottom",title:t.values.editRestriction??"Select storage volume",dense:!0,disabled:!!t.values.editRestriction},children:e.jsx(s.Icon,{name:"edit"})})]}),override:""}),p=()=>$({className:"no-border-top inherited-with-form",configuration:e.jsx(s.Label,{forId:`devices.${o}.source`,children:"Host path"}),inherited:c?e.jsxs("div",{className:"custom-disk-read-mode",children:[e.jsx("div",{className:"mono-font custom-disk-value u-truncate",children:e.jsx("b",{children:a.source})}),u(`devices.${o}.source`)]}):e.jsx(s.Input,{id:`devices.${o}.source`,name:`devices.${o}.source`,onBlur:t.handleBlur,onChange:m=>{t.setFieldValue(`devices.${o}.source`,m.target.value)},value:a.source,type:"text",placeholder:"Enter full host path (e.g. /data)",className:a.source?"u-no-margin--bottom":void 0,error:a.source?void 0:"Host path is required"}),override:""});if(v.push(Y(a)?j():p()),!Y(a)||a.path!==void 0){const m=Ne(t,o);v.push($({className:"no-border-top inherited-with-form",configuration:e.jsx(s.Label,{forId:`devices.${o}.path`,required:!0,children:"Mount point"}),inherited:c?e.jsxs("div",{className:"custom-disk-read-mode",children:[e.jsx("div",{className:"mono-font custom-disk-value",children:e.jsx("b",{children:a.path})}),u(`devices.${o}.path`)]}):e.jsx(s.Input,{id:`devices.${o}.path`,name:`devices.${o}.path`,onBlur:t.handleBlur,onChange:y=>{t.setFieldValue(`devices.${o}.path`,y.target.value)},value:a.path,type:"text",placeholder:"Enter full path (e.g. /data)",className:m?void 0:"u-no-margin--bottom",error:m?"Path is required":void 0}),override:""}))}x++}return e.jsxs("div",{className:"custom-devices",children:[x>0&&e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"p-heading--4 custom-devices-heading",children:"Custom disk devices"}),e.jsx(f,{rows:v})]}),e.jsxs(at,{formik:t,project:i,setValue:o=>{N(t),l(o)},children:[e.jsx(s.Icon,{name:"plus"}),e.jsx("span",{children:"Attach disk device"})]})]})},Dt=({formik:t,project:i})=>{const d=s.useNotify(),{data:c=[],isLoading:n,error:l}=M(i);l&&d.failure("Loading profiles failed",l);const{data:r=[],isLoading:u,error:v}=ee();if(v&&d.failure("Loading storage pools failed",v),n||u)return e.jsx(E,{});const x=Ce(t.values,c);return e.jsx("div",{className:R("disk-device-form","device-form",{"disk-device-form--edit":!t.values.readOnly}),children:e.jsxs(z,{children:[e.jsx(s.Input,{type:"submit",hidden:!0,value:"Hidden input"}),e.jsx(We,{formik:t,pools:r,profiles:c}),e.jsx(Xe,{formik:t,inheritedDiskDevices:x}),e.jsx(nt,{formik:t,project:i,profiles:c})]})})},Rt=({formik:t,project:i})=>{const d=s.useNotify(),{data:c=[],isLoading:n,error:l}=M(i);l&&d.failure("Loading profiles failed",l);const{data:r=[],isLoading:u,error:v}=Ke(i);if(F.useEffect(()=>{v&&d.failure("Loading networks failed",v)},[v]),n||u)return e.jsx(E,{});const x=r.filter(h=>h.managed),o=h=>{V(`devices.${h}.name`)},a=h=>{const g=[...t.values.devices];g.splice(h,1),t.setFieldValue("devices",g)},j=T(t.values,c),p=()=>{var g;const h=[...t.values.devices];h.push({type:"nic",name:O("eth",1,j),network:((g=x[0])==null?void 0:g.name)??""}),t.setFieldValue("devices",h),o(h.length-1)},m=()=>{const h=x.map(g=>({label:g.name,value:g.name,disabled:!1}));return h.unshift({label:h.length===0?"No networks available":"Select option",value:"",disabled:!0}),h},y=Ie(t.values,c),b=t.values.readOnly;return e.jsx(Ve,{className:"device-form",rows:[...y.map(h=>{var g;return $({configuration:e.jsx(e.Fragment,{children:e.jsx("b",{children:h.key})}),inherited:e.jsxs("div",{children:[e.jsx("div",{className:"mono-font",children:e.jsx("b",{children:(g=h.network)==null?void 0:g.network})}),e.jsxs("div",{className:"p-text--small u-text--muted",children:["From: ",h.source]})]}),override:e.jsx(s.Tooltip,{message:`This network is inherited from a profile or project. To change it, edit it in the profile or project it originates from, or remove the originating item`,position:"btm-left",children:e.jsx(s.Icon,{name:"information"})})})}),...t.values.devices.map((h,g)=>{var I;if(!((I=h.type)!=null&&I.includes("nic")))return{};const C=t.values.devices[g];return $({configuration:e.jsx(e.Fragment,{children:b||C.type==="custom-nic"?C.name:e.jsx(s.Input,{label:"Device name",required:!0,name:`devices.${g}.name`,id:`devices.${g}.name`,onBlur:t.handleBlur,onChange:t.handleChange,value:t.values.devices[g].name,type:"text",placeholder:"Enter name",error:$e(t,g)?"Device name is required":void 0})}),inherited:"",override:C.type==="custom-nic"?e.jsxs(e.Fragment,{children:["custom network"," ",e.jsx(s.Tooltip,{message:"A custom network can be viewed and edited only from the YAML configuration",children:e.jsx(s.Icon,{name:"information"})})," "]}):e.jsxs("div",{className:"network-device",children:[e.jsx("div",{children:b?e.jsx("div",{children:t.values.devices[g].network}):e.jsx(s.Select,{label:"Network",name:`devices.${g}.network`,id:`devices.${g}.network`,onBlur:t.handleBlur,onChange:t.handleChange,value:t.values.devices[g].network,options:m()})}),e.jsxs("div",{children:[b&&e.jsx(s.Button,{onClick:()=>{N(t),o(g)},type:"button",appearance:"base",title:t.values.editRestriction??"Edit network",className:"u-no-margin--top",hasIcon:!0,dense:!0,disabled:!!t.values.editRestriction,children:e.jsx(s.Icon,{name:"edit"})}),e.jsxs(s.Button,{className:"delete-device u-no-margin--top",onClick:()=>{N(t),a(g)},type:"button",appearance:"base",hasIcon:!0,dense:!0,title:t.values.editRestriction??"Detach network",disabled:!!t.values.editRestriction,children:[e.jsx(s.Icon,{name:"disconnect"}),e.jsx("span",{children:"Detach"})]})]})]},g)})}),$({configuration:"",inherited:"",override:e.jsxs(s.Button,{onClick:()=>{N(t),p()},type:"button",hasIcon:!0,disabled:!!t.values.editRestriction,title:t.values.editRestriction,children:[e.jsx(s.Icon,{name:"plus"}),e.jsx("span",{children:"Attach network"})]})})].filter(h=>Object.values(h).length>0),emptyStateMsg:"No networks defined"})},ot=({onSelect:t,onClose:i})=>{var v,x;const{canViewResources:d}=De(),{data:c,isLoading:n}=te({queryKey:[G.resources],queryFn:async()=>Re(),enabled:d()}),l=[{content:"Vendor"},{content:"Driver"},{content:"PCI address"},{content:"ID"},{"aria-label":"Actions",className:"actions"}],r=n?[]:(x=(v=c==null?void 0:c.gpu)==null?void 0:v.cards)==null?void 0:x.map(o=>{var j;const a=()=>{t(o)};return{key:o.pci_address,className:"u-row",columns:[{content:o.vendor,role:"cell","aria-label":"Vendor",onClick:a},{content:e.jsxs(e.Fragment,{children:[o.driver," ",e.jsx("span",{className:"u-text--muted",children:o.driver_version})]}),role:"cell","aria-label":"Driver",onClick:a},{content:o.pci_address,role:"cell","aria-label":"PCI Address",onClick:a},{content:((j=o.drm)==null?void 0:j.id)??"-",role:"cell","aria-label":"ID",onClick:a},{content:e.jsx(s.Button,{onClick:a,dense:!0,"aria-label":`Select ${o.pci_address}`,children:"Select"}),role:"cell","aria-label":"Actions",className:"u-align--right",onClick:a}]}}),u=()=>d()?e.jsx(se,{dependencies:[c,r],belowIds:["modal-footer"],tableId:"gpu-select-table",children:e.jsx(s.MainTable,{id:"gpu-select-table",headers:l,rows:r,sortable:!0,className:"u-selectable-table-rows u-table-layout--auto",emptyStateMsg:n?e.jsx(E,{text:"Loading GPUs..."}):"No GPUs found"})}):e.jsx(s.Notification,{severity:"caution",title:"Restricted permissions",children:"You do not have permission to view available GPUs on the server."});return e.jsxs(s.Modal,{close:i,title:"Select GPU",children:[u(),e.jsx("footer",{className:"p-modal__footer",id:"modal-footer",children:e.jsx(s.Button,{className:"u-no-margin--bottom",onClick:()=>{t({pci_address:""})},children:"Enter details manually"})})]})},it=({onSelect:t,disabledReason:i})=>{const{openPortal:d,closePortal:c,isOpen:n,Portal:l}=s.usePortal(),r=u=>{c(),t(u)};return e.jsxs(e.Fragment,{children:[e.jsxs(s.Button,{onClick:d,type:"button",hasIcon:!0,disabled:!!i,title:i,children:[e.jsx(s.Icon,{name:"plus"}),e.jsx("span",{children:"Attach GPU"})]}),n&&e.jsx(l,{children:e.jsx(ot,{onClose:c,onSelect:r})})]})},ct=({device:t,onChange:i,disableReason:d})=>{const[c,n]=F.useState(t.pci?"pci":"id"),l=c==="pci",r=`device.${t.name}.${l?"pci":"id"}`;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"u-sv1",children:[e.jsx(s.RadioInput,{inline:!0,labelClassName:"margin-right",label:"ID",checked:!l,onClick:()=>{n("id")},disabled:!!d}),e.jsx(s.RadioInput,{inline:!0,label:"PCI",checked:l,onClick:()=>{n("pci")},disabled:!!d})]}),e.jsx(s.Input,{type:"text",label:l?"PCI Address":"ID",value:l?t.pci:t.id,onChange:u=>i==null?void 0:i(l?u.target.value:void 0,l?void 0:u.target.value),disabled:!!d},r)]})},Ft=({formik:t,project:i})=>{const d=Fe(),c=s.useNotify(),{data:n=[],isLoading:l,error:r}=M(i);r&&c.failure("Loading profiles failed",r);const u=we(t.values,n),v=T(t.values,n),x=p=>{var b;const m=(b=p.drm)!=null&&b.id?p.drm.id.toString():void 0,y=[...t.values.devices];y.push({type:"gpu",gputype:"physical",pci:p.pci_address,id:p.pci_address===void 0?m:void 0,name:O("gpu",1,v)}),t.setFieldValue("devices",y)},o=t.values.devices.some(p=>p.type==="gpu"),a=[];u.forEach(p=>{const m=q(p.key,t),y=m!==-1;a.push($({className:"no-border-top override-with-form",configuration:e.jsx("div",{className:R("device-name",{"u-text--muted":y}),children:e.jsx("b",{children:p.key})}),inherited:e.jsxs("div",{className:"p-text--small u-text--muted u-no-margin--bottom",children:["From: ",p.source]}),override:y?e.jsxs(s.Button,{appearance:"base",type:"button",title:"Reattach GPU",onClick:()=>{N(t),B(m,t)},className:"has-icon u-no-margin--bottom",children:[e.jsx(s.Icon,{name:"connected"}),e.jsx("span",{children:"Reattach"})]}):e.jsxs(s.Button,{appearance:"base",type:"button",onClick:()=>{N(t),H(p.key,t)},className:"has-icon u-no-margin--bottom",dense:!0,title:t.values.editRestriction??"Detach GPU",disabled:!!t.values.editRestriction,children:[e.jsx(s.Icon,{name:"disconnect"}),e.jsx("span",{children:"Detach"})]})})),Object.keys(p.gpu).forEach(b=>{if(b==="name"||b==="type")return null;a.push(S({label:_(b),inheritValue:p.gpu[b],readOnly:!1,isDeactivated:y}))})});const j=[];return t.values.devices.forEach((p,m)=>{if(p.type!=="gpu")return;const y=t.values.devices[m];j.push($({className:"no-border-top custom-device-name",configuration:e.jsx(K,{name:y.name,index:m,setName:b=>{N(t),t.setFieldValue(`devices.${m}.name`,b)},disableReason:t.values.editRestriction}),inherited:"",override:e.jsxs(s.Button,{className:"u-no-margin--top u-no-margin--bottom",onClick:()=>{N(t),B(m,t)},type:"button",appearance:"base",hasIcon:!0,dense:!0,title:t.values.editRestriction??"Detach GPU",disabled:!!t.values.editRestriction,children:[e.jsx(s.Icon,{name:"disconnect"}),e.jsx("span",{children:"Detach"})]})})),Object.keys(y).forEach(b=>{if(b==="name"||b==="type"||b==="pci"||b==="id")return null;j.push(S({label:_(b),inheritValue:y[b],readOnly:!1}))}),j.push(S({label:"Identify by",inheritValue:e.jsx(ct,{device:y,onChange:(b,h)=>{N(t),t.setFieldValue(`devices.${m}.pci`,b),t.setFieldValue(`devices.${m}.id`,h)},disableReason:t.values.editRestriction}),readOnly:!1}))}),l?e.jsx(E,{}):e.jsxs(z,{className:"device-form",children:[e.jsx(s.Input,{type:"submit",hidden:!0,value:"Hidden input"}),e.jsxs(s.Notification,{severity:"information",title:"GPU passthrough",children:["Learn more about"," ",e.jsx("a",{href:`${d}/reference/devices_gpu/#devices-gpu`,target:"_blank",rel:"noopener noreferrer",children:"GPU devices"})," ","and"," ",e.jsx("a",{href:`${d}/howto/container_gpu_passthrough_with_docker/#container-gpu-passthrough-with-docker`,target:"_blank",rel:"noopener noreferrer",children:"how to pass an NVIDIA GPU to a container"})]}),a.length>0&&e.jsxs("div",{className:"inherited-devices",children:[e.jsx("h2",{className:"p-heading--4",children:"Inherited GPU devices"}),e.jsx(f,{rows:a})]}),o&&e.jsxs("div",{className:"custom-devices",children:[e.jsx("h2",{className:"p-heading--4 custom-devices-heading",children:"Custom GPU devices"}),e.jsx(f,{rows:j})]}),e.jsx(it,{onSelect:p=>{N(t),x(p)},disabledReason:t.values.editRestriction})]})},wt=({formik:t,project:i})=>{const d=s.useNotify(),c=t.values.entityType==="instance",n=c&&t.values.instanceType==="container",l=c&&t.values.instanceType==="virtual-machine",{hasMetadataConfiguration:r}=Pe(),{data:u,isLoading:v}=te({queryKey:[G.configOptions],queryFn:async()=>Be(r)}),{data:x=[],isLoading:o,error:a}=M(i);a&&d.failure("Loading profiles failed",a);const j=Se(t.values,x),p=T(t.values,x),m=()=>{const g=[...t.values.devices];g.push({type:"usb",name:O("custom-device",1,p)}),t.setFieldValue("devices",g)};if(o||v)return e.jsx(E,{});const y=t.values.devices.some(W),b=[];j.forEach(g=>{const C=q(g.key,t),I=C!==-1;b.push($({className:"no-border-top override-with-form",configuration:e.jsx("div",{className:R("device-name",{"u-text--muted":I}),children:e.jsx("b",{children:g.key})}),inherited:e.jsxs("div",{className:"p-text--small u-text--muted u-no-margin--bottom",children:["From: ",g.source]}),override:I?e.jsxs(s.Button,{className:"u-no-margin--top u-no-margin--bottom",onClick:()=>{N(t),B(C,t)},type:"button",appearance:"base",hasIcon:!0,dense:!0,title:"Attach device",children:[e.jsx(s.Icon,{name:"connected"}),e.jsx("span",{children:"Reattach"})]}):e.jsxs(s.Button,{className:"u-no-margin--top u-no-margin--bottom",onClick:()=>{N(t),H(g.key,t)},type:"button",appearance:"base",hasIcon:!0,dense:!0,title:t.values.editRestriction??"Detach device",disabled:!!t.values.editRestriction,children:[e.jsx(s.Icon,{name:"disconnect"}),e.jsx("span",{children:"Detach"})]})})),Object.keys(g.device).forEach(D=>{if(D==="name")return null;b.push(S({label:_(D),inheritValue:g.device[D],readOnly:!1,isDeactivated:I}))})});const h=[];return t.values.devices.forEach((g,C)=>{if(!W(g))return;const I=t.values.devices[C],D=I.type==="usb"?"unix-usb":I.type,w=`device-${D}`,L=u==null?void 0:u.configs[w],ce=L?fe(L):[];h.push($({className:"no-border-top custom-device-name",configuration:e.jsx(K,{name:I.name,index:C,setName:P=>{N(t),t.setFieldValue(`devices.${C}.name`,P)},disableReason:t.values.editRestriction}),inherited:"",override:e.jsxs(s.Button,{className:"u-no-margin--top u-no-margin--bottom",onClick:()=>{N(t),B(C,t)},type:"button",appearance:"base",hasIcon:!0,dense:!0,title:t.values.editRestriction??"Detach GPU",disabled:!!t.values.editRestriction,children:[e.jsx(s.Icon,{name:"disconnect"}),e.jsx("span",{children:"Detach"})]})})),h.push($({className:"no-border-top inherited-with-form",configuration:e.jsx(s.Label,{forId:`devices.${C}.type`,children:"Type"}),inherited:e.jsx(s.Select,{name:`devices.${C}.type`,id:`devices.${C}.type`,className:"u-no-margin--bottom",onBlur:t.handleBlur,onChange:P=>{N(t),t.setFieldValue(`devices.${C}`,{type:P.target.value,name:I.name})},value:I.type,options:[{label:"Infiniband (Containers only)",value:"infiniband",disabled:l},{label:"PCI (VMs only)",value:"pci",disabled:n},{label:"TPM",value:"tpm"},{label:"Unix Block (Containers only)",value:"unix-block",disabled:l},{label:"Unix Char (Containers only)",value:"unix-char",disabled:l},{label:"Unix Hotplug (Containers only)",value:"unix-hotplug",disabled:l},{label:"USB",value:"usb"}],disabled:!!t.values.editRestriction,title:t.values.editRestriction}),override:""})),ce.forEach(P=>{const A=`devices.${C}.${P.key}`,le=I[P.key];P.key!=="name"&&h.push($({className:"no-border-top inherited-with-form",configuration:e.jsx(s.Label,{forId:A,children:_(P.key)}),inherited:e.jsx(s.Input,{name:A,id:A,onBlur:t.handleBlur,onChange:re=>{N(t),t.handleChange(re)},value:le,type:"text",placeholder:P.default,help:e.jsx(ne,{description:P.shortdesc}),className:"u-no-margin--bottom",disabled:!!t.values.editRestriction,title:t.values.editRestriction},`${A}-${D}`),override:""}))})}),e.jsxs(z,{className:"device-form",children:[e.jsx(s.Input,{type:"submit",hidden:!0,value:"Hidden input"}),b.length>0&&e.jsxs("div",{className:"inherited-devices",children:[e.jsx("h2",{className:"p-heading--4",children:"Inherited devices"}),e.jsx(f,{rows:b})]}),y&&e.jsxs("div",{className:"custom-devices",children:[e.jsx("h2",{className:"p-heading--4 custom-devices-heading",children:"Custom devices"}),e.jsx(f,{rows:h})]}),e.jsxs(s.Button,{onClick:()=>{N(t),m()},type:"button",hasIcon:!0,disabled:!!t.values.editRestriction,title:t.values.editRestriction,children:[e.jsx(s.Icon,{name:"plus"}),e.jsx("span",{children:"Attach custom device"})]})]})},lt=({onSelect:t,disabledReason:i})=>e.jsxs(s.Button,{onClick:t,type:"button",hasIcon:!0,disabled:!!i,title:i,children:[e.jsx(s.Icon,{name:"plus"}),e.jsx("span",{children:"New Proxy Device"})]}),Z=(t,i,d,c,n,l)=>{var o;const r=((o=i[c])==null?void 0:o.split(":"))||[],u=r.length>0?r[0]:"tcp",v=r.length>1?r[1]:"",x=r.length>2?r[2]:"";t.push($({className:"no-border-top inherited-with-form p-heading--6",configuration:l,inherited:"",override:""})),t.push($({className:"no-border-top inherited-with-form",configuration:e.jsx(s.Label,{forId:`devices.${d}.${c}`,children:"Type"}),inherited:e.jsx(s.Select,{id:`devices.${d}.${c}`,onChange:a=>{var p;N(n);const j=a.target.value;if(n.setFieldValue(`devices.${d}.${c}`,`${j}:${v}:${x}`),i.nat==="true"){const m=((p=i.connect)==null?void 0:p.split(":"))||[],y=m.length>1?m[1]:"",b=m.length>2?m[2]:"";n.setFieldValue(`devices.${d}.connect`,`${j}:${y}:${b}`)}},value:u,options:Qe,className:"u-no-margin--bottom",disabled:!!n.values.editRestriction||c==="connect"&&i.nat==="true",title:n.values.editRestriction??(i.nat?"This is determined by the listen type when nat mode is enabled":void 0)}),override:""})),t.push($({className:"no-border-top inherited-with-form",configuration:u==="unix"?e.jsx(s.Label,{forId:`devices.${d}.${c}.unixsocket`,required:!0,children:"Socket path"}):e.jsx(s.Label,{forId:`devices.${d}.${c}.address`,required:!0,children:"Address"}),inherited:u==="unix"?e.jsx(s.Input,{id:`devices.${d}.${c}.unixsocket`,onChange:a=>{N(n);const j=a.target.value;n.setFieldValue(`devices.${d}.${c}`,`unix:${j}`)},value:v,placeholder:"/<socket_path>",type:"text",className:"u-no-margin--bottom",disabled:!!n.values.editRestriction,title:n.values.editRestriction}):e.jsx(s.Input,{id:`devices.${d}.${c}.address`,onChange:a=>{N(n);const j=a.target.value;n.setFieldValue(`devices.${d}.${c}`,`${u}:${j}:${x}`)},value:v,placeholder:"127.0.0.1",type:"text",className:"u-no-margin--bottom",disabled:!!n.values.editRestriction,title:n.values.editRestriction}),override:""})),u!=="unix"&&t.push($({className:"no-border-top inherited-with-form",configuration:e.jsx(s.Label,{forId:`devices.${d}.${c}.port`,required:!0,children:"Port"}),inherited:e.jsx(s.Input,{id:`devices.${d}.${c}.port`,onChange:a=>{N(n);const j=a.target.value;n.setFieldValue(`devices.${d}.${c}`,`${u}:${v}:${j}`)},value:x,placeholder:"00[-00]",type:"text",className:"u-no-margin--bottom",disabled:!!n.values.editRestriction,title:n.values.editRestriction}),override:""}))},Pt=({formik:t,project:i})=>{const d=s.useNotify(),{data:c=[],isLoading:n,error:l}=M(i);l&&d.failure("Loading profiles failed",l);const r=Le(t.values,c),u=[];u.push(...r.map(p=>p.key)),u.push(...t.values.devices.map(p=>p.name));const v=()=>{const p=[...t.values.devices];p.push({type:"proxy",name:O("proxy",1,u)}),t.setFieldValue("devices",p)},x=t.values.devices.some(p=>p.type==="proxy"),o=(p,m,y,b,h,g,C,I)=>{const D=`devices.${y}.${m}`;return $({className:"no-border-top inherited-with-form",configuration:e.jsx(s.Label,{forId:D,children:p}),inherited:e.jsx(s.Select,{name:D,id:D,onBlur:t.handleBlur,onChange:w=>{N(t),t.setFieldValue(D,w.target.value),C==null||C(w.target.value)},value:h??"",options:b,help:e.jsx(ne,{description:g}),className:"u-no-margin--bottom",disabled:!!I||!!t.values.editRestriction,title:t.values.editRestriction??I},D),override:""})},a=[];r.forEach(p=>{const m=q(p.key,t),y=m!==-1;a.push($({className:"no-border-top override-with-form",configuration:e.jsx("div",{className:R("device-name",{"u-text--muted":y}),children:e.jsx("b",{children:p.key})}),inherited:e.jsxs("div",{className:"p-text--small u-text--muted u-no-margin--bottom",children:["From: ",p.source]}),override:y?e.jsxs(s.Button,{appearance:"base",type:"button",title:"Reattach volume",onClick:()=>{N(t),B(m,t)},className:"has-icon u-no-margin--bottom",children:[e.jsx(s.Icon,{name:"connected"}),e.jsx("span",{children:"Reattach"})]}):e.jsxs(s.Button,{disabled:!!t.values.editRestriction,title:t.values.editRestriction,appearance:"base",type:"button",onClick:()=>{N(t),H(p.key,t)},className:"has-icon u-no-margin--bottom",dense:!0,children:[e.jsx(s.Icon,{name:"disconnect"}),e.jsx("span",{children:"Detach"})]})})),Object.keys(p.proxy).forEach(b=>{if(b==="name"||b==="type")return null;a.push(S({label:_(b),inheritValue:p.proxy[b],readOnly:!1,isDeactivated:y}))})});const j=[];return t.values.devices.forEach((p,m)=>{var D,w;if(p.type!=="proxy")return;const y=t.values.devices[m],b=((D=y.listen)==null?void 0:D.split(":"))||[],h=b.length>0?b[0]:"tcp",g=((w=y.connect)==null?void 0:w.split(":"))||[],C=g.length>1?g[1]:"",I=g.length>2?g[2]:"";j.push($({className:"no-border-top custom-device-name",configuration:e.jsx(K,{name:y.name,index:m,setName:L=>{N(t),t.setFieldValue(`devices.${m}.name`,L)},disableReason:t.values.editRestriction}),inherited:"",override:e.jsxs(s.Button,{className:"u-no-margin--top u-no-margin--bottom",onClick:()=>{N(t),B(m,t)},type:"button",appearance:"base",hasIcon:!0,dense:!0,disabled:!!t.values.editRestriction,title:t.values.editRestriction??"Detach Proxy",children:[e.jsx(s.Icon,{name:"disconnect"}),e.jsx("span",{children:"Detach"})]})})),j.push(o("Bind","bind",m,[{label:"Select option",value:"",disabled:!0},{label:"Host",value:"host"},{label:"Instance",value:"instance"}],y.bind,"Whether to bind the listen address to the instance or host",L=>{L==="instance"&&t.setFieldValue(`devices.${m}.nat`,void 0)})),j.push(o("NAT mode","nat",m,Ye,y.nat,void 0,L=>{L==="true"&&t.setFieldValue(`devices.${m}.connect`,`${h}:${C}:${I}`)},y.bind==="instance"?"Only host-bound proxies can use NAT":void 0)),Z(j,y,m,"listen",t,"Listen"),Z(j,y,m,"connect",t,"Connect")}),n?e.jsx(E,{}):e.jsxs(z,{className:"device-form",children:[e.jsx(s.Input,{type:"submit",hidden:!0,value:"Hidden input"}),a.length>0&&e.jsxs("div",{className:"inherited-devices",children:[e.jsx("h2",{className:"p-heading--4",children:"Inherited Proxy devices"}),e.jsx(f,{rows:a})]}),x&&e.jsxs("div",{className:"custom-devices",children:[e.jsx("h2",{className:"p-heading--4 custom-devices-heading",children:"Custom Proxy devices"}),e.jsx(f,{rows:j})]}),e.jsx(lt,{onSelect:()=>{N(t),v()},disabledReason:t.values.editRestriction})]})};export{Dt as D,Ft as G,Rt as N,wt as O,Pt as P};
Close