Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions js/ActivityTab-89HemtnE.chunk.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".download-summary[data-v-81e4514f]{display:flex;align-items:flex-start;padding:8px 0;margin-bottom:calc(var(--default-grid-baseline) * 2);color:var(--color-text-maxcontrast)}.download-summary__icon[data-v-81e4514f]{flex-shrink:0;display:flex;align-items:center;justify-content:center;width:20px;height:20px;margin-top:2px;opacity:.5}.download-summary__text[data-v-81e4514f]{padding:0 5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.activity[data-v-242e244d]{display:flex;flex-direction:column;overflow:hidden;height:100%}.activity__actions[data-v-242e244d]{display:flex;flex-direction:column;width:100%}.activity__list[data-v-242e244d]{flex-grow:1;overflow:scroll}.activity__load-more[data-v-242e244d]{display:flex;justify-content:center;padding-block:calc(var(--default-grid-baseline) * 2)}.activity__empty-content[data-v-242e244d]{height:100%}[data-v-242e244d] .empty-content__icon span{background-size:64px;width:64px;height:64px}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
import{l as R}from"./lightning-bolt-CVnodBao.chunk.mjs";import{b as M,m as S,h as P,o as D,N as V}from"./NcCheckboxRadioSwitch-BVTMQSAg-BT9wuQMx.chunk.mjs";import{d as C,x as q,B,y as T,a,c as o,j as H,W as p,J as f,m as n,e as k,f as c,t as I,E as y,l as W,b as d,g as u,F as g,K as G,a1 as F,h as O,n as U}from"./translation-DoG5ZELJ-eekoBSws.chunk.mjs";import{a as N}from"./index-BrNGPgve.chunk.mjs";import{j as z,f as J,A as K}from"./ActivityComponent.vue_vue_type_script_setup_true_lang-DX_K5EUD.chunk.mjs";import{l as w}from"./logger-CXg3FpL2.chunk.mjs";import{g as Z,a as $,b as Q}from"./api-fwrRGLr6.chunk.mjs";var b;(function(t){t[t.User=0]="User",t[t.Group=1]="Group",t[t.Link=3]="Link",t[t.Email=4]="Email",t[t.Remote=6]="Remote",t[t.Team=7]="Team",t[t.Guest=8]="Guest",t[t.RemoteGroup=9]="RemoteGroup",t[t.Room=10]="Room",t[t.Deck=12]="Deck",t[t.FederatedGroup=14]="FederatedGroup",t[t.ScienceMesh=15]="ScienceMesh"})(b||(b={}));const X=C({__name:"ActivitySidebarPlugin",props:{plugin:{},node:{}},emits:["reloadActivities"],setup(t,{emit:e}){const i=t,s=e,r=H();return q(()=>i.plugin.mount(r.value,{node:i.node,context:B()?.proxy??void 0,reload:()=>s("reloadActivities")})),T(()=>i.plugin.unmount()),(m,l)=>(a(),o("div",{ref_key:"attachTarget",ref:r},null,512))}}),Y='<svg xmlns="http://www.w3.org/2000/svg" id="mdi-download-circle" viewBox="0 0 24 24"><path d="M12 2C17.5 2 22 6.5 22 12C22 17.5 17.5 22 12 22C6.5 22 2 17.5 2 12C2 6.5 6.5 2 12 2M8 17H16V15H8V17M16 10H13.5V6H10.5V10H8L12 14L16 10Z" /></svg>',tt=C({name:"DownloadSummary",components:{NcIconSvgWrapper:M},props:{fileId:{type:Number,required:!0}},data(){return{totalCount:0,monthlyCount:0,downloadSVG:Y}},computed:{summaryText(){return this.monthlyCount>0&&this.monthlyCount<this.totalCount?p("activity","Downloaded %n time (%s in the last 30 days)","Downloaded %n times (%s in the last 30 days)",this.totalCount,[String(this.monthlyCount)]):p("activity","Downloaded %n time","Downloaded %n times",this.totalCount)}},watch:{fileId:{immediate:!0,handler(){this.fetchCounts()}}},methods:{async fetchCounts(){if(this.fileId){this.totalCount=0,this.monthlyCount=0;try{const t=await S.get(N("apps/activity/api/v2/activity/downloads/count"),{params:{format:"json",object_type:"files",object_id:this.fileId}});this.totalCount=t.data.ocs.data.total,this.monthlyCount=t.data.ocs.data.last30d}catch(t){w.error("Failed to fetch download counts",{error:t})}}},t:f,n:p}}),it={key:0,class:"download-summary"},et={class:"download-summary__icon"},at={class:"download-summary__text"};function st(t,e,i,s,r,m){const l=n("NcIconSvgWrapper");return t.totalCount>0?(a(),o("div",it,[k("span",et,[c(l,{svg:t.downloadSVG,size:20},null,8,["svg"])]),k("span",at,I(t.summaryText),1)])):y("",!0)}const ot=P(tt,[["render",st],["__scopeId","data-v-81e4514f"]]),nt=50,rt=C({name:"ActivityTab",components:{ActivityComponent:J,DownloadSummary:ot,NcButton:V,NcEmptyContent:z,NcIconSvgWrapper:M,NcLoadingIcon:D,ActivitySidebarPlugin:X},props:{node:{type:Object,required:!0},folder:{type:Object,required:!1,default:void 0},view:{type:Object,required:!1,default:void 0}},expose:["update"],data(){return{error:"",loading:!0,loadingMore:!1,activities:[],lightningBoltSVG:R,sidebarPlugins:[],requestController:null,realActivities:[],otherEntries:[],lastGiven:void 0,hasMore:!1}},computed:{hasPublicLink(){return Object.values(this.node?.attributes?.["share-types"]??{}).flat().includes(b.Link)}},watch:{node:{immediate:!0,async handler(){await this.update()}}},beforeUnmount(){this.requestController?.abort()},methods:{async update(){this.sidebarPlugins=[];const t=Q();t.length>0&&W(()=>{this.sidebarPlugins=t}),this.resetState(),await this.getActivities()},async getActivities(){await this.fetchPage(!0)},async loadMoreActivities(){await this.fetchPage(!1)},async fetchPage(t){this.requestController?.abort();const e=new AbortController;this.requestController=e;const{signal:i}=e;try{t?this.loading=!0:this.loadingMore=!0;const s=await this.loadRealActivities(i,t?void 0:this.lastGiven),r=this.processActivities(s.activities),m=t?await $({node:this.node}):this.otherEntries;if(i.aborted)return;this.realActivities=t?r:[...this.realActivities,...r],this.otherEntries=m,(t||s.lastGiven!==void 0)&&(this.lastGiven=s.lastGiven),this.hasMore=s.hasMore,this.activities=[...this.realActivities,...this.otherEntries].sort((l,h)=>h.timestamp-l.timestamp)}catch(s){if(i.aborted)return;this.error=f("activity","Unable to load the activity list"),w.error("Error loading the activity list",{error:s})}finally{i.aborted||(this.loading=!1,this.loadingMore=!1)}},resetState(){this.loading=!0,this.loadingMore=!1,this.error="",this.activities=[],this.realActivities=[],this.otherEntries=[],this.lastGiven=void 0,this.hasMore=!1},async loadRealActivities(t,e){try{const i=await S.get(N("apps/activity/api/v2/activity/filter"),{signal:t,params:{format:"json",object_type:"files",object_id:this.node.fileid,limit:nt,...e===void 0?{}:{since:e}}});return{activities:i.data.ocs.data,lastGiven:i.headers["x-activity-last-given"],hasMore:String(i.headers.link??"").includes('rel="next"')}}catch(i){if(i.response!==void 0&&i.response.status===304)return{activities:[],lastGiven:void 0,hasMore:!1};throw i}},processActivities(t){t=t.map(i=>new K(i)),w.debug(`Processed ${t.length} activity(ies)`,{activities:t,node:this.node});const e=Z();return t.filter(i=>!e||e.every(s=>s(i)))},t:f}}),lt={key:0,class:"activity__actions"},dt={key:4,class:"activity__list"},ct={key:0,class:"activity__load-more"};function ht(t,e,i,s,r,m){const l=n("NcIconSvgWrapper"),h=n("NcEmptyContent"),j=n("ActivitySidebarPlugin"),x=n("DownloadSummary"),_=n("NcLoadingIcon"),L=n("ActivityComponent"),E=n("NcButton");return a(),o("div",{class:U([{"icon-loading":t.loading},"activity"])},[t.error||!t.node?(a(),d(h,{key:0,name:t.error},{icon:u(()=>[c(l,{svg:t.lightningBoltSVG},null,8,["svg"])]),_:1},8,["name"])):(a(),o(g,{key:1},[t.sidebarPlugins.length>0?(a(),o("div",lt,[(a(!0),o(g,null,G(t.sidebarPlugins,(v,A)=>(a(),d(j,{key:A,plugin:v,node:t.node,onReloadActivities:e[0]||(e[0]=vt=>t.getActivities())},null,8,["plugin","node"]))),128))])):y("",!0),t.hasPublicLink&&t.node.fileid?(a(),d(x,{key:1,fileId:t.node.fileid},null,8,["fileId"])):y("",!0),t.loading?(a(),d(h,{key:2,class:"activity__empty-content",name:t.t("activity","Loading activities")},{icon:u(()=>[c(_)]),_:1},8,["name"])):t.activities.length===0?(a(),d(h,{key:3,class:"activity__empty-content",name:t.t("activity","No activity yet")},{icon:u(()=>[c(l,{svg:t.lightningBoltSVG},null,8,["svg"])]),_:1},8,["name"])):(a(),o("ul",dt,[(a(!0),o(g,null,G(t.activities,v=>(a(),d(L,{key:v.id,activity:v,showPreviews:!1,onReload:e[1]||(e[1]=A=>t.getActivities())},null,8,["activity"]))),128)),t.hasMore?(a(),o("li",ct,[c(E,{variant:"tertiary",wide:"",disabled:t.loadingMore,onClick:e[2]||(e[2]=v=>t.loadMoreActivities())},F({default:u(()=>[O(" "+I(t.loadingMore?t.t("activity","Loading older activities…"):t.t("activity","Load older activities")),1)]),_:2},[t.loadingMore?{name:"icon",fn:u(()=>[c(_,{size:20})]),key:"0"}:void 0]),1032,["disabled"])])):y("",!0)]))],64))],2)}const bt=P(rt,[["render",ht],["__scopeId","data-v-242e244d"]]);export{bt as default};
//# sourceMappingURL=ActivityTab-89HemtnE.chunk.mjs.map

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions js/ActivityTab-Cj5ERLj2.chunk.mjs

This file was deleted.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Loading
Loading