"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[65118],{332918(e,t,a){a.d(t,{A:()=>i});var l=a(296540),n=a(629318);const i=(0,a(51946).w)(e=>(0,l.createElement)("svg",(0,n.d)({viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em"},e),(0,l.createElement)("path",{d:"M16 5H4a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1Z",fill:"currentColor",className:e.twotonedclassname}),(0,l.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"m10.367 13.887 2.12-2.121a.5.5 0 1 0-.706-.708l-1.267 1.268V3.5a.5.5 0 0 0-1 0v8.827l-1.268-1.269a.5.5 0 0 0-.707.708l2.12 2.121a.502.502 0 0 0 .708 0ZM17 6a1 1 0 0 0-1-1h-3v1h3v10H4V6h3V5H4a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V6Z",fill:"currentColor",className:e.baseclassname}),(0,l.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.038 3a.75.75 0 0 1 .75.75v7.683l.479-.479a.747.747 0 0 1 1.06 0 .75.75 0 0 1 0 1.061l-1.767 1.768a.737.737 0 0 1-.53.22L9.958 14a.737.737 0 0 1-.47-.217L7.72 12.015a.752.752 0 0 1-.001-1.061.751.751 0 0 1 1.062 0l.507.507V3.75a.75.75 0 0 1 .75-.75ZM17 6.004a1 1 0 0 0-1-1h-3v1.5h2.5v9h-11v-9H7v-1.5H4a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-10Z",fill:"currentColor",className:e.fillclassname})))},542737(e,t,a){a.r(t),a.d(t,{default:()=>de});var l=a(296540),n=a(469733),i=a(951272),r=a(585702),m=a(727270),E=a(217439),c=a(705145),s=a(6510),o=a(870443),d=a(566723),A=a(294303),I=a(6176),u=a(916537),T=a(559478),_=a(602197),C=a(243938),N=a(546391);const S=[{id:"status",label:null,renderCell:({status:e,statusPulse:t})=>l.createElement(T.A,{status:e,pulsating:t,marginLeft:d.YC,marginRight:d.xO}),growthFactor:1,minWidth:30},{id:"name",label:l.createElement(u.sA,{id:"COMMON_NAME"}),renderCell:({name:e,model:t})=>l.createElement(A.A,{width:"100%"},l.createElement(I.A,{model:t,width:"18px",height:"18px"}),l.createElement(c.A,{size:"medium",isTruncated:!0,color:"inherit",style:{marginLeft:12}},e)),minWidth:60},{id:"state",label:l.createElement(u.sA,{id:"COMMON_STATUS"}),renderCell:({state:e})=>{let t="notice";return t=e===_.g.CONNECTED?"positive":e===_.g.DISCONNECTED?"text-2":"notice",l.createElement(E.A,{color:t,size:"medium"},l.createElement(u.sA,{id:C.A[e]}))},minWidth:50},{id:"model",label:l.createElement(u.sA,{id:"COMMON_MODEL"}),renderCell:({model:e})=>l.createElement(c.A,{isTruncated:!0,color:"inherit",size:"medium"},(0,s.Lm)(e)),minWidth:60},{id:"fw_version",label:l.createElement(u.sA,{id:"COMMON_VERSION"}),renderCell:({fw_version:e})=>l.createElement(c.A,{isTruncated:!0,color:"inherit",size:"medium"},e?.length>0?e:l.createElement(u.sA,{id:"COMMON_FALLBACK"})),minWidth:60}],O=o.A.object().shape({inform_ip:o.A.string().label("COMMON_LABEL_HOSTNAME_IP").matches(N.vz,{message:l.createElement(u.sA,{id:"COMMON_VALIDATION_VALID_IP"})}).required(),inform_port:o.A.number().label("COMMON_PORT").required()});var h,M=a(71479),R=a(126457),p=a(532419);!function(e){e.EXPORT_SITE="export-site",e.MIGRATE_SITE="migrate-site",e.MIGRATE_DEVICES="migrate-devices"}(h||(h={}));const g={inform_ip:"",inform_port:8080,macs:[]};var v=a(963070),f=a(162420),b=a(596441),G=a(822336);const x=(0,M.A)(A.A)`
  width: 100%;
  padding: 14px 16px;
  background: ${({theme:{themeName:e}})=>G.Ay[`desktop-color-neutral-02-${e}`]};
  border-radius: ${G.Ay["desktop-radius-base"]};

  > svg {
    margin-right: 12px !important;
  }
`,V=({children:e})=>l.createElement(x,null,e),D=(0,M.A)("div")`
  margin: 32px 0 20px;
`,L=({removeTableItems:e})=>l.createElement(A.A,{flexDirection:"column"},l.createElement(D,null,l.createElement(v.A,{idField:"mac",columns:S,items:e,headerHeight:32,rowHeight:b.I.ROW_HEIGHT,disableColumnFilters:!0,truncateHeaderCells:!0})),l.createElement(V,null,l.createElement(f.A,{size:"original",isActive:!0,variant:"fill"}),l.createElement(E.A,{size:"medium"},l.createElement(u.sA,{id:"SETTINGS_SITE_CONFIGURATION_REMOVE_MIGRATED_DEVICES",values:{b:u.b,br:u.br}}))));var w=a(758649),U=a(742920),F=a(675359),P=a(83344),z=a(323572),k=a(171073),H=a(705426);const y=({handleRemoveModalClose:e,handleExportModalClose:t})=>{const{values:a}=(0,i.j7)(),r=(0,n.useDispatch)(),m=(0,l.useCallback)(()=>{r((0,z.Yl)(a.macs)).then(()=>{a.macs.forEach(e=>{r((0,P.W)(e)),r((0,k.XL)(e))}),e(),t()}).catch(()=>{r((0,F.ox)({icon:U.C.danger,message:"API_ERROR_DEVICE_REMOVE"}))})},[r,t,e,a.macs]);return l.createElement(H.A,{title:l.createElement(u.sA,{id:"DEVICE_ACTIONS_REMOVE_LABEL_PLURAL"}),onRequestClose:e,actions:[{type:"button",text:l.createElement(u.sA,{id:"COMMON_ACTION_CANCEL"}),onClick:e},{type:"button",text:l.createElement(u.sA,{id:"COMMON_ACTION_REMOVE"}),onClick:m,variant:"danger"}],size:"small"},l.createElement(E.A,{size:"medium",color:"text-2"},l.createElement(u.sA,{id:"DEVICE_ACTIONS_REMOVE_CONFIRM_MESSAGE_PLURAL"})))},$=(0,M.A)("footer")`
  padding: ${d.S2} ${d.fS};
`,W=(0,M.A)("div")`
  margin-left: ${d.Ln};
`,j=({handleCancel:e,hasMigrationStarted:t,isMigrateActionEnabled:a})=>{const{handleSubmit:n}=(0,i.j7)(),[r,m]=(0,l.useState)();return l.createElement(l.Fragment,null,l.createElement($,null,l.createElement(A.A,{alignItems:"center",justifyContent:"flex-end"},l.createElement(w.A,{type:"button",size:"medium",onClick:e},l.createElement(u.sA,{id:"COMMON_ACTION_SKIP"})),l.createElement(W,null,l.createElement(w.A,{type:"button",variant:t?"danger":"primary",onClick:t?()=>{m(!0)}:()=>{n()},disabled:!t&&!a},l.createElement(u.sA,{id:t?"DEVICE_ACTIONS_REMOVE_LABEL_PLURAL":"SETTINGS_SITE_CONFIGURATION_MIGRATE_DEVICES"}))))),r?l.createElement(y,{handleRemoveModalClose:()=>m(!1),handleExportModalClose:e}):null)},B=(0,M.A)("div")`
  margin-left: 16px;
`,X=(0,M.A)("footer")`
  padding: 24px 32px;
`,Z=({handleNextStep:e,handleCancel:t})=>l.createElement(X,null,l.createElement(A.A,{alignItems:"center",justifyContent:"flex-end"},l.createElement(w.A,{type:"button",size:"medium",onClick:t},l.createElement(u.sA,{id:"COMMON_ACTION_CANCEL"})),l.createElement(B,null,l.createElement(w.A,{type:"button",size:"medium",variant:"primary",onClick:e},l.createElement(u.sA,{id:"COMMON_ACTION_CONTINUE"}))))),Y=(0,M.A)(E.A)`
  margin: 32px 0 20px;
`,q=function(){return l.createElement(A.A,null,l.createElement(Y,{size:"medium"},l.createElement(u.sA,{id:"SETTINGS_SITE_CONFIGURATION_MIGRATE_SITE_INSTRUCTION"})))};var K=a(143811);const J=(0,M.A)("div")`
  margin: ${d.fS} 0 ${d.Er};
`,Q=(0,M.A)(E.A)`
  margin: ${d.fS} 0 ${d.Er};
`,ee=(0,M.A)(E.A)`
  margin: 0 ${d.kc};
`,te=(0,M.A)("div")`
  width: 50%;
`,ae=[],le=({migrateTableItems:e})=>{const{setFieldValue:t}=(0,i.j7)();return l.createElement(A.A,{flexDirection:"column"},l.createElement(Q,{size:"medium"},l.createElement(u.sA,{id:"SETTINGS_SITE_CONFIGURATION_MIGRATE_DEVICES_INSTRUCTION"})),l.createElement(A.A,{alignItems:"baseline"},l.createElement(ee,{size:"medium",color:"text-3"},"http://"),l.createElement(K.A,{name:"inform_ip",variant:"secondary",label:"COMMON_LABEL_HOSTNAME_IP",helperMessage:"SETTINGS_SITE_CONFIGURATION_MIGRATE_DEVICES_INPUT_HELPER",full:!0}),l.createElement(ee,{size:"medium",color:"text-3"},":"),l.createElement(te,null,l.createElement(K.A,{name:"inform_port",variant:"secondary",label:"COMMON_PORT",full:!0})),l.createElement(ee,{size:"medium",color:"text-3"},"/inform")),l.createElement(J,null,e.length>0?l.createElement(v.A,{idField:"mac",columns:S,items:e,initialSelectedIds:ae,onChangeSelection:e=>{t("macs",e)},headerHeight:32,rowHeight:b.I.ROW_HEIGHT,multiSelectMode:!0,truncateHeaderCells:!0,disableColumnFilters:!0}):l.createElement(V,null,l.createElement(f.A,{size:"original",isActive:!0,variant:"fill"}),l.createElement(E.A,{size:"medium"},l.createElement(u.sA,{id:"SETTINGS_SITE_CONFIGURATION_MIGRATE_NO_DEVICES"})))))};var ne=a(300477),ie=a(332918),re=a(602021),me=a(441652);const Ee=(0,M.A)(E.A)`
  margin: 32px 0 20px;
`,ce=()=>{const{formatMessage:e}=(0,u.tz)(),t=(0,n.useDispatch)(),a=(0,n.useSelector)(re.Gd),[i,r]=(0,l.useState)(!1),m=a?.desc||"",E=(0,l.useCallback)(()=>{r(!0);const a=(0,ne.A)();t((0,F.ox)({id:a,downloads:[{id:`file-${a}`,filename:e({id:"SETTINGS_SYSTEM_MAINTENANCE_SUPPORT_INFORMATION_PREPARING"}),status:e({id:"SETTINGS_SYSTEM_MAINTENANCE_SUPPORT_INFORMATION_FETCHING"}),progress:0,onCancel:()=>{t((0,F.uU)(a)),r(!1)}}],duration:0,notificationType:"DownloadsToast"})),t((0,z.p5)()).then(({data:e})=>{t((0,me.LV)(e?.[0]?.url,a,()=>r(!1)))}).catch(()=>{r(!1),(0,F.uU)(a),t((0,F.ox)({icon:U.C.danger,message:"SETTINGS_SITE_CONFIGURATION_EXPORT_SITE_ERROR",values:{siteName:m}}))})},[m,t,e]);return l.createElement(A.A,{flexDirection:"column"},l.createElement(Ee,{size:"medium"},l.createElement(u.sA,{id:"SETTINGS_SITE_CONFIGURATION_EXPORT_SITE_INSTRUCTION"})),l.createElement(A.A,null,l.createElement(w.A,{name:"download-current-site",type:"button",variant:"inline",size:"medium",Icon:ie.A,iconProps:{size:"original",isActive:!i},onClick:E,disabled:i},l.createElement(u.sA,{id:"SETTINGS_SITE_CONFIGURATION_EXPORT_SITE_DOWNLOAD_BUTTON"}))))},se=(0,M.A)(H.A)`
  width: 600px !important;
`,oe=({hasMigrationStarted:e})=>{const t=(0,n.useDispatch)(),{values:{inform_ip:a,inform_port:r,macs:m}}=(0,i.j7)(),[E,c]=(0,l.useState)(h.EXPORT_SITE),s=(0,n.useSelector)((0,l.useMemo)(()=>(0,p.lj)(e),[e])),o=(0,l.useMemo)(()=>s.filter(({mac:e})=>m.includes(e)),[s,m]),d=a&&r&&m.length>0,A=(0,l.useCallback)(()=>{t((0,R.AS)())},[t]),I=(0,l.useCallback)(()=>{switch(E){case h.MIGRATE_DEVICES:return{modalTitle:"SETTINGS_SITE_CONFIGURATION_MIGRATE_DEVICES",modalFooter:l.createElement(j,{handleCancel:A,hasMigrationStarted:e,isMigrateActionEnabled:d}),modalViewContent:e?l.createElement(L,{removeTableItems:o}):l.createElement(le,{migrateTableItems:s})};case h.MIGRATE_SITE:return{modalTitle:"SETTINGS_SITE_CONFIGURATION_MIGRATE_SITE",modalFooter:l.createElement(Z,{handleNextStep:()=>{c(h.MIGRATE_DEVICES)},handleCancel:A}),modalViewContent:l.createElement(q,null)};default:return{modalTitle:"SETTINGS_SITE_CONFIGURATION_EXPORT_SITE",modalFooter:l.createElement(Z,{handleNextStep:()=>{c(h.MIGRATE_SITE)},handleCancel:A}),modalViewContent:l.createElement(ce,null)}}},[A,e,d,s,E,o]),{modalTitle:T,modalFooter:_,modalViewContent:C}=I();return l.createElement(se,{title:l.createElement(u.sA,{id:T}),footer:_,size:"medium"},C)},de=()=>{const e=(0,n.useDispatch)(),[t,a]=(0,l.useState)(!1),E=(0,l.useCallback)(t=>{const l={deviceMacs:t.macs,informUrl:`${m.DU}${t.inform_ip}:${t.inform_port}/inform`};a(!0),e((0,r.du)(l)).catch(()=>{a(!1)})},[e]);return l.createElement(i.l1,{initialValues:g,onSubmit:E,validationSchema:O},l.createElement(oe,{hasMigrationStarted:t}))}}}]);