(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[941],{8283:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/file-manager",function(){return t(9132)}])},8610:function(e,n,t){"use strict";var r=t(5893),o=t(8216),i=t(7212),u=t(8462),l=t(7357),a=t(4690),c=t(7750);function s(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var x=function(e){var n=e.onClearIndicatorClick,t=w(e,["onClearIndicatorClick"]),i=t.sx,u=t.value,a=w(t,["sx","value"]),c=(0,l.useMemo)((function(){var e;return O((j(e={},"& .".concat(o.Z.icon),{color:g.s7}),j(e,"& .".concat(y.Z.root),{marginRight:".8em"}),j(e,"& .".concat(p.Z.root),{color:g.s7,visibility:"hidden"}),j(e,"&:hover .".concat(y.Z.root," .").concat(p.Z.root,",\n &.").concat(v.Z.focused," .").concat(y.Z.root," .").concat(p.Z.root),{visibility:"visible"}),e),i)}),[i]),s=(0,l.useMemo)((function(){return String(u).length>0&&n&&(0,r.jsx)(m.Z,{position:"end",children:(0,r.jsx)(h.Z,{onClick:n,children:(0,r.jsx)(d.Z,{fontSize:"small"})})})}),[n,u]);return(0,r.jsx)(b.Z,O({endAdornment:s,value:u},a,{sx:c}))};function S(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function k(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var Z=function(e){var n=e.id,t=e.label,d=e.selectItems,y=e.checkItem,p=e.disableItem,v=e.formControlProps,m=e.hideItem,h=e.inputLabelProps,b=void 0===h?{}:h,g=e.isReadOnly,j=void 0!==g&&g,O=e.messageBoxProps,w=void 0===O?{}:O,Z=e.name,C=e.onBlur,A=e.onChange,I=e.onFocus,E=e.required,M=e.selectProps,D=void 0===M?{}:M,U=D.multiple,T=D.sx,L=e.value,F=e.isCheckableItems,V=void 0===F?U:F,R=P(e.selectProps,["multiple","sx"]),_=(0,l.useMemo)((function(){return j?k(S({},"& .".concat(o.Z.icon),{visibility:"hidden"}),T):T}),[j,T]),H=(0,l.useCallback)((function(e){return V&&(0,r.jsx)(i.Z,{checked:null===y||void 0===y?void 0:y.call(null,e)})}),[y,V]),N=(0,l.useCallback)((function(e,t){return(0,r.jsxs)(c.Z,{disabled:null===p||void 0===p?void 0:p.call(null,e),sx:{display:(null===m||void 0===m?void 0:m.call(null,e))?"none":void 0},value:e,children:[H(e),t]},"".concat(n,"-").concat(e))}),[H,p,m,n]),$=(0,l.useMemo)((function(){return"".concat(n,"-select-element")}),[n]),B=(0,l.useMemo)((function(){return(0,r.jsx)(s.Z,{id:n,label:t})}),[n,t]),W=(0,l.useMemo)((function(){return t&&(0,r.jsx)(f.Z,k({htmlFor:$,isNotifyRequired:E},b,{children:t}))}),[b,E,t,$]),z=(0,l.useMemo)((function(){return d.map((function(e){var n="string"===typeof e?{value:e}:e,t=n.value,r=n.displayValue;return N(t,void 0===r?t:r)}))}),[N,d]);return(0,r.jsxs)(u.Z,k({fullWidth:!0},v,{children:[W,(0,r.jsx)(x,k({id:$,input:B,multiple:U,name:Z,onBlur:C,onChange:A,onFocus:I,readOnly:j,value:L},R,{sx:_,children:z})),(0,r.jsx)(a.Z,k({},w))]}))}},3906:function(e,n,t){"use strict";var r=t(5893),o=t(7294),i=t(6607),u=t(8610);function l(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e){for(var n=1;n0}),[d.length]),v=(0,o.useMemo)((function(){return f.length>1}),[f.length]),m=(0,o.useCallback)((function(e){var n=e.confirmDialogProps,t=void 0===n?{}:n,o=e.formSummaryProps,i=void 0===o?{}:o,l=e.getConfirmDialogTitle,s=e.onProceedAppend,f=e.renderEntry;return a({actionProceedText:"Delete",content:(0,r.jsx)(u.Z,a({entries:c,maxDepth:0,renderEntry:f},i)),onProceedAppend:s,proceedColour:"red",titleText:l(d.length)},t)}),[c,d.length]),h=(0,o.useCallback)((function(e){return c[e]}),[c]),b=(0,o.useCallback)((function(){return s({})}),[]),g=(0,o.useCallback)((function(e){return s(f.reduce((function(n,t){return e&&(n[t]=e),n}),{}))}),[f]),j=(0,o.useCallback)((function(e,n){return s((0,i.ZP)(e,n||void 0))}),[]);return{buildDeleteDialogProps:m,checklist:c,checks:d,getCheck:h,hasAllChecks:y,hasChecks:p,multipleItems:v,resetChecks:b,setAllChecks:g,setCheck:j}}},6632:function(e,n,t){"use strict";var r=t(7294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}n.Z=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.actionProceedText,t=void 0===n?"":n,o=e.content,l=void 0===o?"":o,a=e.titleText,c=void 0===a?"":a,s=u(e,["actionProceedText","content","titleText"]);return(0,r.useState)(i({actionProceedText:t,content:l,titleText:c},s))}},7791:function(e,n,t){"use strict";var r=t(8100),o=t(2029),i=t(1200);function u(e,n){if(null==e)return{};var t,r,o=function(e,n){if(null==e)return{};var t,r,o={},i=Object.keys(e);for(r=0;r=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}n.Z=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=n.fetcher,l=void 0===t?i.Z:t,a=n.baseUrl,c=void 0===a?o.Z:a,s=u(n,["fetcher","baseUrl"]),f=(0,r.ZP)("".concat(c).concat(e),l,s),d=f.data,y=f.error,p=!y&&!d;return{data:d,error:y,loading:p}}},8669:function(e,n,t){"use strict";t.d(n,{Z:function(){return o}});var r=function(e){return e.reduce((function(e,n){var t=n.hostName,r=n.hostType,o=n.hostUUID;return e[o]={name:t,type:r,uuid:o},e}),{})},o=function(e){return e.reduce((function(e,n){var t=n.anvilDescription,o=n.anvilName,i=n.anvilUUID,u=n.hosts;return e[i]={description:t,hosts:r(u),name:o,uuid:i},e}),{})}},9132:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return Ue}});var r=t(5893),o=t(9008),i=t(8750),u=t(4490),l=t(7294),a=t(2029),c=[["iso",["application/x-cd-image","ISO (optical disc)"]],["other",["text/plain","Other file type"]],["script",["text/plain","Script (program)"]]],s=new Map(c),f=t(2175),d=t(5934),y=t(46),p=t(4390),v=t(4825);function m(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t1&&void 0!==arguments[1]?arguments[1]:{},t=n.build,r=void 0===t?function(e,n){return{children:n,type:"warning"}}:t,o=n.chain,i=void 0===o?"":o;return Object.entries(e).reduce((function(e,n){var t=g(n,2),o=t[0],u=t[1],l=String(i).length?[i,o].join("."):o;return"object"===typeof u?b({},e,j(u,{chain:l})):(e[l]=r(l,u),e)}),{})},O=j,w=t(3457),x=t(6486),S=t(4690),k=t(6125),P=t(6284),Z=t(3679),C=t(2519),A=t(7750),I=t(4188),E=t(3675);function M(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}function T(e){return function(e){if(Array.isArray(e))return M(e)}(e)||function(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,n){if(!e)return;if("string"===typeof e)return M(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return M(e,n)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function L(e){var n=function(e,n){if("object"!==F(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,n||"default");if("object"!==F(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(e)}(e,"string");return"symbol"===F(n)?n:String(n)}var F=function(e){return e&&"undefined"!==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e};var V=(0,l.forwardRef)((function(e,n){var t=e.input,r=e.onChange,o=void 0===r?function(e){for(var n,t,r=e.handlers,o=r.base,i=r.origin,u=arguments.length,l=new Array(u>1?u-1:0),a=1;ae.length)&&(n=e.length);for(var t=0,r=new Array(n);t1}),[i.values,o]),O=(0,l.useMemo)((function(){return(0,r.jsx)(R,{input:(0,r.jsx)(P.Z,{id:p,label:"File name",name:p,onBlur:s,onChange:d,value:i.values[o].name})})}),[d,i.values,o,s,p]),I=(0,l.useMemo)((function(){return u&&(0,r.jsx)(Z.TZ,{header:"Sync with node(s)",panelProps:{mb:0,mt:0,width:"100%"},children:(0,r.jsx)(k.Z,{allowCheckAll:j("anvils"),allowCheckItem:!0,edit:!0,header:!0,listItems:n,getListCheckboxProps:function(){return b("anvils")},getListItemCheckboxProps:function(e){return g("anvils",e)},renderListItem:function(e,n){var t=n.description,o=n.name;return(0,r.jsxs)(A.Ac,{children:[o,": ",t]})}})})}),[n,j,b,g,u]),E=(0,l.useMemo)((function(){return u&&(0,r.jsx)(Z.TZ,{header:"Sync with DR host(s)",panelProps:{mb:0,mt:0,width:"100%"},children:(0,r.jsx)(k.Z,{allowCheckAll:j("drHosts"),allowCheckItem:!0,edit:!0,header:!0,listItems:t,getListCheckboxProps:function(){return b("drHosts")},getListItemCheckboxProps:function(e){return g("drHosts",e)},renderListItem:function(e,n){var t=n.hostName;return(0,r.jsx)(A.Ac,{children:t})}})})}),[t,j,b,g,u]),M=(0,l.useMemo)((function(){return a&&(0,r.jsx)(C.Z,{id:m,label:"File type",name:m,onBlur:s,onChange:f,selectItems:c.map((function(e){var n=H(e,2),t=n[0];return{displayValue:H(n[1],2)[1],value:t}})),value:i.values[o].type})}),[i.values,o,s,f,a,m]);return(0,r.jsxs)(w.Z,{sx:{"& > :not(:first-child)":{marginTop:"1em"}},children:[(0,r.jsxs)(S.Z,{sm:"row",xs:"column",children:[O,M]}),I,E]})},$=t(1770),B=t(8187),W=t(7869),z=t(6310);function q(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var G=function(e,n){return e&&Object.keys(e).reduce((function(e,t){return function(e){for(var n=1;n :first-child":{minWidth:100,overflow:"hidden",overflowWrap:"normal",textOverflow:"ellipsis",whiteSpace:"nowrap",width:{xs:"100%",md:200},wordBreak:"keep-all"},"& > :last-child":{flexGrow:1}},children:[(0,r.jsx)(A.Ac,{children:n}),(0,r.jsx)(ne.ko,{progressPercentage:t})]},"upload-".concat(o))}))})},re=t(2749);function oe(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);te.length)&&(n=e.length);for(var t=0,r=new Array(n);te.length)&&(n=e.length);for(var t=0,r=new Array(n);t0&&void 0!==arguments[0]?arguments[0]:{},n=e.onError,t=e.onData,r=e.url,o=void 0===r?"":r,i=we((0,re.Z)(!1),2),u=i[0],a=i[1],c=(0,l.useCallback)((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r="".concat(o).concat(e);r&&(a(!0),p.Z.get(r).then((function(e){var n=e.data;null===t||void 0===t||t.call(null,n)})).catch((function(e){var t=(0,$.Z)(e);null===n||void 0===n||n.call(null,t)})).finally((function(){a(!1)})))}),[o,a,n,t]);return{fetch:c,loading:u}},Se=t(3906),ke=t(6632),Pe=t(7791);function Ze(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}function Ee(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){var t=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var r,o,i=[],u=!0,l=!1;try{for(t=t.call(e);!(u=(r=t.next()).done)&&(i.push(r.value),!n||i.length!==n);u=!0);}catch(a){l=!0,o=a}finally{try{u||null==t.return||t.return()}finally{if(l)throw o}}return i}}(e,n)||function(e,n){if(!e)return;if("string"===typeof e)return Ze(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Ze(e,n)}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var Me=function(e){return e.reduce((function(e,n){var t=Ee(n,5),r=t[0],o=t[1],i=t[2],u=t[3],l=t[4];return e[r]={checksum:l,name:o,size:i,type:u,uuid:r},e}),{})},De=function(){var e=(0,l.useRef)(null),n=(0,l.useRef)({}),t=(0,l.useRef)(null),o=(0,l.useRef)({}),i=Ee((0,ke.Z)(),2),c=i[0],f=i[1],d=(0,l.useState)(!1),y=d[0],v=d[1],m=Ee((0,re.Z)(void 0),2),h=m[0],b=m[1],g=Ee((0,re.Z)(void 0),2),j=g[0],O=g[1],w=(0,ge.Z)("".concat(a.Z,"/file"),{onSuccess:function(e){O(Me(e))}}).isLoading,x=xe({onData:function(e){return O(Me(e))},url:"/file"}),P=x.fetch,C=x.loading,I=(0,l.useMemo)((function(){return w||C}),[C,w]),E=(0,Se.Z)({list:j}),M=E.buildDeleteDialogProps,D=E.checks,U=E.getCheck,T=E.hasAllChecks,L=E.hasChecks,F=E.multipleItems,V=E.resetChecks,R=E.setAllChecks,_=E.setCheck,H=(0,l.useCallback)((function(e){var n;return null===(n=o.current.setMessage)||void 0===n?void 0:n.call(null,"api",e)}),[]),N=xe({onData:function(e){return b(function(e){var n=e[0];if(n){var t=Ee(n,5),r=t[0],o=t[1],i=t[2],u=t[3],l=t[4];return e.reduce((function(e,n){var t=n[5],r=n[6],o=n[7],i=n[8],u=n[9],l=n[10],a=n[11],c=n[12];e.anvils[o]||(e.anvils[o]={description:u,locationUuids:[],name:i,uuid:o}),e.hosts[l]||(e.hosts[l]={locationUuids:[],name:a,type:c,uuid:l}),"dr"===c?e.hosts[l].locationUuids.push(t):e.anvils[o].locationUuids.push(t);var s=1===Number(r);return e.locations[t]={anvilUuid:o,active:s,hostUuid:l,uuid:t},e}),{anvils:{},checksum:l,hosts:{},locations:{},name:o,size:i,type:u,uuid:r})}}(e))},onError:function(e){var n=e.children,t=Ie(e,["children"]);H(Ae({children:(0,r.jsxs)(r.Fragment,{children:["Failed to get file detail. ",n]})},t))},url:"/file/"}),$=N.fetch,B=N.loading,z=(0,Pe.Z)("/anvil",{onError:function(e){H({children:(0,r.jsxs)(r.Fragment,{children:["Failed to get node list. ",e]}),type:"warning"})}}),q=z.data,G=z.loading,K=(0,l.useMemo)((function(){return q&&(0,se.Z)(q)}),[q]),J=(0,Pe.Z)("/host?types=dr",{onError:function(e){H({children:(0,r.jsxs)(r.Fragment,{children:["Failed to get DR host list. ",e]}),type:"warning"})}}),X=J.data,Q=J.loading,Y=(0,l.useMemo)((function(){return(0,r.jsx)(k.Z,{allowCheckAll:F,allowEdit:!0,allowItemButton:y,disableDelete:!L,edit:y,getListCheckboxProps:function(){return{checked:T,onChange:function(e,n){R(n)}}},getListItemCheckboxProps:function(e){return{checked:U(e),onChange:function(n,t){_(e,t)}}},header:!0,listEmpty:"No file(s) found.",listItems:j,onAdd:function(){var n;null===(n=e.current)||void 0===n||n.setOpen(!0)},onDelete:function(){var e;f(M({onProceedAppend:function(){var e=D.map((function(e){return p.Z.delete("/file/".concat(e))}));Promise.all(e).then((function(){return P()})),V()},getConfirmDialogTitle:function(e){return"Delete the following ".concat(e," file(s)?")},renderEntry:function(e){var n=e.key;return(0,r.jsx)(A.Ac,{children:null===j||void 0===j?void 0:j[n].name})}})),null===(e=n.current.setOpen)||void 0===e||e.call(null,!0)},onEdit:function(){v((function(e){return!e}))},onItemClick:function(e,n){var r;null===(r=t.current)||void 0===r||r.setOpen(!0),$(n)},renderListItem:function(e,n){var t,o=n.checksum,i=n.name,l=n.size,a=n.type;return(0,r.jsxs)(S.Z,{columnSpacing:0,fullWidth:!0,md:"row",xs:"column",children:[(0,r.jsxs)(S.Z,{spacing:0,flexGrow:1,children:[(0,r.jsxs)(S.Z,{row:!0,spacing:".5em",children:[(0,r.jsx)(A.$_,{children:i}),(0,r.jsx)(ye.Z,{flexItem:!0,orientation:"vertical"}),(0,r.jsx)(A.Ac,{children:null===(t=s.get(a))||void 0===t?void 0:t[1]})]}),(0,r.jsx)(A.Ac,{children:(0,u._d)(l,{toUnit:"ibyte"})})]}),(0,r.jsx)(A.$_,{children:o})]})}})}),[M,D,y,j,U,$,P,T,L,F,V,R,_,f]),ee=(0,l.useMemo)((function(){return I?(0,r.jsx)(je.Z,{}):Y}),[I,Y]),ne=(0,l.useMemo)((function(){return(0,r.jsx)(W.Z,{count:1,ref:o,usePlaceholder:!1})}),[]),te=(0,l.useMemo)((function(){return w||G||Q}),[G,Q,w]),oe=(0,l.useMemo)((function(){return w||G||Q||B}),[G,Q,B,w]),ie=(0,l.useMemo)((function(){return K&&X&&(0,r.jsx)(ce,{anvils:K,drHosts:X})}),[K,X]),ue=(0,l.useMemo)((function(){return K&&X&&h&&(0,r.jsx)(be,{anvils:K,drHosts:X,onSuccess:function(){P()},previous:h})}),[K,X,h,P]);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(Z.s_,{children:[(0,r.jsx)(Z.V9,{children:(0,r.jsx)(A.z,{children:"Files"})}),ne,ee]}),(0,r.jsx)(de.Js,{header:"Add file(s)",loading:te,ref:e,showClose:!0,wide:!0,children:ie}),(0,r.jsx)(de.Js,{header:"Update file ".concat(null===h||void 0===h?void 0:h.name),loading:oe,ref:t,showClose:!0,wide:!0,children:ue}),(0,r.jsx)(fe.Z,Ae({closeOnProceed:!0,wide:!0},c,{ref:n}))]})},Ue=function(){return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(o.default,{children:(0,r.jsx)("title",{children:"File Manager"})}),(0,r.jsx)(i.Z,{}),(0,r.jsx)(De,{})]})}}},function(e){e.O(0,[662,498,910,894,839,213,176,668,284,157,48,774,888,179],(function(){return n=8283,e(e.s=n);var n}));var n=e.O();_N_E=n}]);