UNPKG

airdcpp-webui

Version:
2 lines 13.9 kB
"use strict";(self.webpackChunkairdcpp_webui=self.webpackChunkairdcpp_webui||[]).push([[336],{25364:(e,s,t)=>{t.d(s,{A:()=>r});var i=t(74848),n=(t(96540),t(46942)),o=t.n(n);const r=({className:e,percent:s,caption:t})=>(0,i.jsxs)("div",{className:o()("ui progress",e,{indeterminate:void 0===s}),"data-percent":s,children:[(0,i.jsx)("div",{className:"bar",style:{transitionDuration:"300ms",width:void 0===s?void 0:s+"%",minWidth:"0px"},children:(0,i.jsx)("div",{className:"progress"})}),!!t&&(0,i.jsx)("div",{className:"label",children:t})]})},27415:(e,s,t)=>{t.d(s,{f$:()=>h,vl:()=>_,qZ:()=>N,_q:()=>v,De:()=>x,Hi:()=>R.Hi});var i=t(58059),n=t(4425),o=t(86038),r=t(67749),a=t(48844);const d=(e,s)=>e.post(i.A.BUNDLES_URL+"/priority",{priority:s}),c={id:"removeCompleted",displayName:"Remove completed bundles",access:o.US.QUEUE_EDIT,icon:n.A.REMOVE,handler:({socket:e})=>e.post(i.A.BUNDLES_URL+"/remove_completed"),notifications:{onSuccess:"{{result.count}} completed bundles were removed"}},l={id:"pause",displayName:"Pause all bundles",access:o.US.QUEUE_EDIT,icon:n.A.PAUSE,handler:({socket:e})=>d(e,o.Fm.PAUSED_FORCED)},u={id:"resumeAll",displayName:"Resume all bundles",access:o.US.QUEUE_EDIT,icon:n.A.PLAY,handler:({socket:e})=>d(e,o.Fm.DEFAULT)},m={removeCompleted:c,divider:a.o,pause:l,resume:u},h={moduleData:{moduleId:r.KV.QUEUE},actions:m};var p=t(44054);const E=({itemData:e})=>e.status.id===i.S.COMPLETION_VALIDATION_ERROR,A=({itemData:e})=>0===e.time_finished,U=(e,s,t)=>e.post(`${i.A.BUNDLES_URL}/${s.id}/share`,{skip_validation:t}),x={id:"sources",displayName:"Manage sources...",icon:n.A.USER,filter:e=>e.itemData.sources.total>0&&A(e),handler:({itemData:e,navigate:s})=>{s(`sources/${e.id}`)}},v={id:"content",displayName:"Manage files...",icon:n.A.FILE,filter:({itemData:e})=>"directory"===e.type.id,handler:({itemData:e,navigate:s})=>{s(`content/${e.id}`)}},y={id:"search",displayName:"Search (foreground)",icon:n.A.SEARCH,handler:({itemData:e,location:s,navigate:t})=>(0,p.e)(e,s,t)},D={id:"searchAlternates",displayName:"Search for alternates",icon:n.A.SEARCH_ALTERNATES,filter:A,handler:({itemData:e,socket:s})=>s.post(`${i.A.BUNDLES_URL}/${e.id}/search`),notifications:{onSuccess:"The bundle {{item.name}} was searched for alternates"}},j={id:"remove",displayName:"Remove",access:o.US.QUEUE_EDIT,icon:n.A.REMOVE,confirmation:{content:"Are you sure that you want to remove the bundle {{item.name}}?",approveCaption:"Remove bundle",rejectCaption:"Don't remove",checkboxCaption:"Remove finished files"},handler:({itemData:e,socket:s},t)=>s.post(`${i.A.BUNDLES_URL}/${e.id}/remove`,{remove_finished:t})},S={id:"rescan",displayName:"Rescan for errors",access:o.US.QUEUE_EDIT,icon:n.A.REFRESH_COLORED,filter:E,handler:({itemData:e,socket:s})=>U(s,e,!1)},f={id:"forceShare",displayName:"Force in share",access:o.US.QUEUE_EDIT,icon:n.A.ERROR,filter:E,handler:({itemData:e,socket:s})=>U(s,e,!0)},w={sources:x,content:v,divider:null,search:y,searchAlternates:D,divider2:null,remove:j,divider3:null,rescan:S,forceShare:f},N={moduleId:r.KV.QUEUE,subId:"bundle"},_={moduleData:N,actions:w};t(32563);var R=t(89478);t(34395)},32563:(e,s,t)=>{t.d(s,{mM:()=>d});var i=t(58059),n=t(4425),o=t(86038),r=t(67749);const a={remove:{id:"remove",displayName:"Remove source",access:o.US.QUEUE_EDIT,icon:n.A.REMOVE,handler:({itemData:e,entity:s,socket:t})=>t.delete(`${i.A.BUNDLES_URL}/${s.id}/sources/${e.user.cid}`)}},d={moduleData:{moduleId:r.KV.QUEUE,subId:"bundleSource"},actions:a}},32814:(e,s,t)=>{t.r(s),t.d(s,{default:()=>ve});var i=t(74848),n=t(96540),o=t(68465),r=t(3570),a=t(2404),d=t.n(a),c=t(86038);const l={[c.Fm.PAUSED_FORCED]:{str:"Paused (forced)",id:0},[c.Fm.PAUSED]:{str:"Paused",id:1},[c.Fm.LOWEST]:{str:"Lowest",id:2},[c.Fm.LOW]:{str:"Low",id:3},[c.Fm.NORMAL]:{str:"Normal",id:4},[c.Fm.HIGH]:{str:"High",id:5},[c.Fm.HIGHEST]:{str:"Highest",id:6}};var u=t(2690),m=t(67749),h=t(42695),p=t(36076),E=t(43045),A=t(6897),U=t(39364),x=t(70756),v=t(48249);const y=(0,n.memo)(({item:e,itemPrio:s,prioAction:t,t:n})=>{const o=(0,U.wV)(),r=(0,v.F)(),a=s=>(0,p.bd)(()=>t(e,s,r),n);let d=(0,h.Tl)(l[s.id].str,n,m.KV.QUEUE);return s.auto&&(d+=` (${(0,h.Tl)("Auto",n,m.KV.QUEUE).toLocaleLowerCase()})`),(0,x.z)(o,c.US.QUEUE_EDIT)?(0,i.jsx)(u.A,{caption:d,className:"priority-menu",children:t=>{const i=Object.keys(l).map(Number).map(s=>((s,t)=>{const i=e.priority.id;return{id:s.id.toString(),item:{active:i===s.id,onClick:()=>{a(s.id)},caption:(0,h.Tl)(s.str,t,m.KV.QUEUE)}}})(l[s],n));return i.push({id:"divider"}),i.push({id:"auto",item:{active:s.auto,onClick:()=>{a(c.Fm.DEFAULT)},caption:(0,h.Tl)("Auto",n,m.KV.QUEUE)}}),(0,A.y)(i,t)}}):(0,i.jsx)(E.b,{caption:d})},(e,s)=>d()(s.item.priority,e.item.priority));var D=t(46942),j=t.n(D),S=t(25364);const f=(e,s)=>{if(e.completed)return"success";const t=e.id;return j()({grey:(!t||t===c.$E.QUEUED)&&0===s.speed},{blue:(!t||t===c.$E.QUEUED)&&s.speed>0})},w=({cellData:e,rowDataGetter:s})=>{if(e.failed)return(0,i.jsx)("span",{className:"error",children:e.str});const t=s();return(0,i.jsx)(S.A,{className:f(e,t),caption:e.str,percent:100*t.downloaded_bytes/t.size})};var N=t(22005),_=t.n(N),R=t(58059),b=t(52267);const C=_().createStore({_viewName:`${R.A.BUNDLE_VIEW_ID}_view`,_apiUrl:R.A.MODULE_URL,mixins:[(0,b.A)("name")]});var I=t(99671),L=t(65385),T=t(5945);const V=_().createStore({_viewName:`${R.A.FILE_VIEW_ID}_view`,_apiUrl:R.A.MODULE_URL,mixins:[(0,b.A)("name")]});var g=t(44247),F=t(56896),k=t(39115),P=t(27415),Q=t(85072),$=t.n(Q),K=t(97825),O=t.n(K),H=t(77659),B=t.n(H),q=t(55056),M=t.n(q),G=t(10540),W=t.n(G),z=t(41113),Z=t.n(z),J=t(61987),X={};X.styleTagTransform=Z(),X.setAttributes=M(),X.insert=B().bind(null,"head"),X.domAPI=O(),X.insertStyleElement=W(),$()(J.A,X),J.A&&J.A.locals&&J.A.locals;const Y=({cellData:e,rowDataGetter:s,t})=>(0,i.jsx)(y,{itemPrio:e,item:s(),prioAction:F.nX,t});class ee extends n.Component{constructor(){super(...arguments),this.isActive=(e,s)=>!s.status.downloaded,this.isRunning=(e,s)=>s.speed>0}render(){return(0,i.jsxs)(r.A,{store:V,sourceFilter:{pattern:this.props.bundle.id,method:c.Od.EXACT,property:"bundle"},moduleId:m.KV.QUEUE,textFilterProps:{autoFocus:!0},children:[(0,i.jsx)(o.VP,{name:"Name",width:200,flexGrow:20,columnKey:"name",cell:(0,i.jsx)(g.tC,{actions:P.Hi,remoteMenuId:k.Ay.QUEUE_FILE})}),(0,i.jsx)(o.VP,{name:"Size",width:70,columnKey:"size",cell:(0,i.jsx)(g.us,{}),flexGrow:1}),(0,i.jsx)(o.VP,{name:"Status",width:120,columnKey:"status",cell:(0,i.jsx)(w,{})}),(0,i.jsx)(o.VP,{name:"Sources",width:65,columnKey:"sources",renderCondition:this.isActive}),(0,i.jsx)(o.VP,{name:"Time left",width:50,columnKey:"seconds_left",renderCondition:this.isRunning,cell:(0,i.jsx)(g.WQ,{})}),(0,i.jsx)(o.VP,{name:"Speed",width:55,columnKey:"speed",cell:(0,i.jsx)(g.kF,{}),renderCondition:this.isRunning}),(0,i.jsx)(o.VP,{name:"Priority",width:80,columnKey:"priority",renderCondition:this.isActive,cell:(0,i.jsx)(Y,{}),flexGrow:1})]})}}const se=ee;var te=t(56484);class ie extends n.Component{render(){const{bundle:e}=this.props;return(0,i.jsx)(I.A,{className:"source",title:e.name,subHeader:e.target,closable:!0,icon:(0,i.jsx)(T.A,{typeInfo:e.type}),fullHeight:!0,children:(0,i.jsx)(se,{bundle:e})})}}ie.displayName="BundleFileDialog";const ne=(0,L.A)((0,te.A)(ie,{urls:{bundle:({params:e},s)=>s.get(`${R.A.BUNDLES_URL}/${e.bundleId}`)}}),"content/:bundleId");var oe=t(32563),re=t(74416),ae=t(71352),de=t(86668);const ce=({source:e,bundle:s,t})=>{const{formatSize:n,formatSpeed:o}=(0,re.k)();return(0,i.jsxs)("tr",{children:[(0,i.jsx)("td",{className:"user dropdown",children:(0,i.jsx)(ae.Bg,{userIcon:!0,user:e.user,ids:de.F9,contextElement:".source.modal",remoteMenuId:k.Ay.HINTED_USER,children:(0,i.jsx)(ae.Wy,{actions:oe.mM,itemData:e,entity:s})})}),(0,i.jsx)("td",{className:"hubs",children:e.user.hub_names}),(0,i.jsx)("td",{className:"speed",children:e.last_speed>0&&o(e.last_speed)}),(0,i.jsx)("td",{className:"files",children:e.files}),(0,i.jsx)("td",{className:"size",children:n(e.size)})]})},le=(e,s)=>e.user.nicks.localeCompare(s.user.nicks),ue=(0,te.A)(({sources:e,bundle:s,queueT:t})=>{const{translate:n}=t;return(0,i.jsxs)("div",{className:"sources",children:[(0,i.jsx)("h2",{children:n("Sources")}),(0,i.jsxs)("table",{className:"ui striped table",children:[(0,i.jsx)("thead",{children:(0,i.jsxs)("tr",{children:[(0,i.jsx)("th",{children:n("User")}),(0,i.jsx)("th",{children:n("Hubs")}),(0,i.jsx)("th",{children:n("Last known speed")}),(0,i.jsx)("th",{children:n("Files")}),(0,i.jsx)("th",{children:n("Size")})]})}),(0,i.jsx)("tbody",{children:e.slice().sort(le).map(e=>(0,i.jsx)(ce,{source:e,bundle:s,t:t.plainT},e.user.cid))})]})]})},{urls:{sources:({bundle:e},s)=>s.get(`${R.A.BUNDLES_URL}/${e.id}/sources`)},onSocketConnected:(e,{refetchData:s,props:t})=>{e(R.A.MODULE_URL,R.A.BUNDLE_SOURCES,e=>{e.id===t.bundle.id&&s()})}});class me extends n.Component{render(){const{bundle:e,queueT:s}=this.props;return(0,i.jsx)(I.A,Object.assign({className:"source",title:e.name,subHeader:e.target,closable:!0,icon:(0,i.jsx)(T.A,{typeInfo:e.type}),fullHeight:!0},this.props,{children:(0,i.jsx)(ue,{bundle:e,queueT:s})}))}}me.displayName="SourceDialog";const he=(0,L.A)((0,te.A)(me,{urls:{bundle:({params:e},s)=>s.get(`${R.A.BUNDLES_URL}/${e.bundleId}`)}}),"sources/:bundleId");var pe=t(32728),Ee=t(32389),Ae=t(4425);const Ue=({cellData:e,rowDataGetter:s,t})=>(0,i.jsx)(y,{itemPrio:e,item:s(),prioAction:F.hh,t});class xe extends n.Component{constructor(){super(...arguments),this.isActive=(e,s)=>!s.status.downloaded,this.isDownloaded=(e,s)=>s.status.downloaded,this.isRunning=(e,s)=>s.speed>0,this.emptyRowsNodeGetter=()=>{const{t:e}=this.queueT;return(0,i.jsx)(pe.A,{title:e("queueEmpty","The queue is empty"),icon:Ae.A.FILE,description:e("queueEmptyDesc","New items can be queued from search or filelists")})},this.queueT=(0,h.lw)(this.props.t,m.KV.QUEUE)}render(){const{translate:e}=this.queueT;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(r.A,{emptyRowsNodeGetter:this.emptyRowsNodeGetter,store:C,footerData:(0,i.jsx)(ae.Wy,{className:"top left pointing",caption:e("Actions..."),actions:P.f$,header:e("Queue actions"),triggerIcon:"chevron up",button:!0,remoteMenuId:k.Ay.QUEUE}),moduleId:m.KV.QUEUE,children:[(0,i.jsx)(o.VP,{name:"Name",width:200,flexGrow:4,columnKey:"name",cell:(0,i.jsx)(g.tC,{actions:P.vl,remoteMenuId:k.Ay.QUEUE_BUNDLE,ids:["content","sources","divider","search","searchAlternates","divider","remove","divider","rescan","forceShare"]})}),(0,i.jsx)(o.VP,{name:"Size",width:60,columnKey:"size",cell:(0,i.jsx)(g.us,{}),flexGrow:1}),(0,i.jsx)(o.VP,{name:"Type/content",width:150,columnKey:"type",hideWidth:1e3,cell:(0,i.jsx)(g.V9,{action:P._q,moduleData:P.qZ})}),(0,i.jsx)(o.VP,{name:"Status",width:120,flexGrow:3,columnKey:"status",cell:(0,i.jsx)(w,{})}),(0,i.jsx)(o.VP,{name:"Sources",width:60,columnKey:"sources",renderCondition:this.isActive,flexGrow:1,cell:(0,i.jsx)(g.V9,{action:P.De,moduleData:P.qZ})}),(0,i.jsx)(o.VP,{name:"Time left",width:50,columnKey:"seconds_left",renderCondition:this.isRunning,cell:(0,i.jsx)(g.WQ,{})}),(0,i.jsx)(o.VP,{name:"Speed",width:50,columnKey:"speed",cell:(0,i.jsx)(g.kF,{}),renderCondition:this.isRunning,flexGrow:1}),(0,i.jsx)(o.VP,{name:"Priority",width:80,columnKey:"priority",renderCondition:this.isActive,cell:(0,i.jsx)(Ue,{}),flexGrow:1}),(0,i.jsx)(o.VP,{name:"Added",width:100,columnKey:"time_added",cell:(0,i.jsx)(g.Jo,{}),hideWidth:1400}),(0,i.jsx)(o.VP,{name:"Finished",width:100,columnKey:"time_finished",cell:(0,i.jsx)(g.Jo,{}),renderCondition:this.isDownloaded,hideWidth:1200})]}),(0,i.jsx)(he,{queueT:this.queueT}),(0,i.jsx)(ne,{})]})}}xe.displayName="Queue";const ve=(0,Ee.CI)()(xe)},34395:(e,s,t)=>{t.d(s,{JN:()=>a});var i=t(58059),n=t(4425),o=t(86038),r=t(67749);const a={id:"removeSource",displayName:"Remove user from queue",access:o.US.QUEUE_EDIT,icon:n.A.REMOVE,handler:({itemData:e,socket:s})=>s.delete(`${i.A.SOURCES_URL}/${e.cid}`),notifications:{onSuccess:"The user {{user.nicks}} was removed from {{result.count}} files"}};r.KV.QUEUE},61987:(e,s,t)=>{t.d(s,{A:()=>a});var i=t(71354),n=t.n(i),o=t(76314),r=t.n(o)()(n());r.push([e.id,".status .error {\n color: red;\n}\n\n@media only screen and (min-width: 767px) {\n .source.modal td {\n max-width: 250px;\n }\n\n /* Can't be applied to dropdown cells */\n .source.modal td:not(.user) {\n overflow-x: hidden;\n }\n}\n","",{version:3,sources:["webpack://./src/routes/Queue/style.css"],names:[],mappings:"AAAA;EACE,UAAU;AACZ;;AAEA;EACE;IACE,gBAAgB;EAClB;;EAEA,uCAAuC;EACvC;IACE,kBAAkB;EACpB;AACF",sourcesContent:[".status .error {\n color: red;\n}\n\n@media only screen and (min-width: 767px) {\n .source.modal td {\n max-width: 250px;\n }\n\n /* Can't be applied to dropdown cells */\n .source.modal td:not(.user) {\n overflow-x: hidden;\n }\n}\n"],sourceRoot:""}]);const a=r},89478:(e,s,t)=>{t.d(s,{Hi:()=>m,ew:()=>l});var i=t(58059),n=t(4425),o=t(86038),r=t(67749),a=t(44054);const d={id:"search",displayName:"Search (foreground)",access:o.US.SEARCH,icon:n.A.SEARCH,handler:({itemData:e,location:s,navigate:t})=>(0,a.e)(e,s,t)},c={id:"searchAlternates",displayName:"Search for alternates",access:o.US.QUEUE_EDIT,icon:n.A.SEARCH_ALTERNATES,filter:({itemData:e})=>0===e.time_finished,handler:({itemData:e,socket:s})=>s.post(`${i.A.FILES_URL}/${e.id}/search`)},l={id:"remove",displayName:"Remove",access:o.US.QUEUE_EDIT,icon:n.A.REMOVE,confirmation:{content:"Are you sure that you want to remove the file {{item.name}}?",approveCaption:"Remove file",rejectCaption:"Don't remove",checkboxCaption:"Remove on disk"},handler:({itemData:e,socket:s},t)=>s.post(`${i.A.FILES_URL}/${e.id}/remove`,{remove_finished:t}),notifications:{onSuccess:"File {{item.name}} was removed from queue"}},u={search:d,searchAlternates:c,remove:l},m={moduleData:{moduleId:r.KV.QUEUE,subId:"file"},actions:u}}}]); //# sourceMappingURL=queue.2e2c51447eed5f81354d.chunk.js.map