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
9 changes: 8 additions & 1 deletion apps/files_versions/src/views/FilesVersionsSidebarTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,14 @@ function compareVersion(version: Version) {
const _versions = versions.value.map((version) => ({ ...version, previewUrl: undefined }))

window.OCA.Viewer.compare(
{ path: props.node!.path },
{
fileid: props.node!.fileid,
filename: props.node!.path,
basename: props.node!.basename,
source: props.node!.source,
mime: props.node!.mime,
hasPreview: props.node!.attributes?.['has-preview'] ?? false,
},
_versions.find((v) => v.source === version.source),
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ import{d as j,a as Y}from"./index-68GQhqPi.chunk.mjs";import{a as B,q as te,g as
<nc:version-label>${t}</nc:version-label>
</d:prop>
</d:set>
</d:propertyupdate>`})}async function bi(e){await R.deleteFile(e.filename)}const yi={key:0,class:"versions-tab__container"},wi=["aria-label"],ji=P({__name:"FilesVersionsSidebarTab",props:{active:{type:Boolean},node:{},folder:{},view:{}},setup(e){const t=e,i=le(),l=$([]),c=$(!1),n=$(!1),a=$(null),k=g(()=>Math.floor(new Date(t.node?.mtime?.getTime()??0).getTime()/1e3)*1e3),f=g(()=>[...l.value].sort((s,v)=>t.node?s.mtime===t.node.mtime?.getTime()?-1:v.mtime===t.node.mtime?.getTime()?1:v.mtime-s.mtime:0)),w=g(()=>[{key:"versions",rows:f.value.map(s=>({key:s.mtime.toString(),height:68,sectionKey:"versions",items:[{id:s.mtime.toString(),version:s}]})),height:68*f.value.length}]),o=g(()=>l.value.map(s=>s.mtime).reduce((s,v)=>Math.min(s,v))),V=g(()=>t.node?window.OCA.Viewer?.mimetypes?.includes(t.node?.mime):!1),A=g(()=>!i.value&&window.OCA.Viewer?.mimetypesCompare?.includes(t.node?.mime));_e(()=>t.node.id,z,{immediate:!0}),ae(k,z,{debounce:600});async function z(){try{c.value=!0,l.value=await pi(t.node)}finally{c.value=!1}}async function F(s){if(!t.node)return;const v=t.node.clone();v.attributes.etag=s.etag,v.size=s.size,v.mtime=new Date(s.mtime);const b={preventDefault:!1,node:v,version:s};if(N("files_versions:restore:requested",b),!b.preventDefault)try{await fi(s),s.label?j(d("files_versions",`${s.label} restored`)):s.mtime===o.value?j(d("files_versions","Initial version restored")):j(d("files_versions","Version restored")),N("files:node:updated",v),N("files_versions:restore:restored",{node:v,version:s})}catch{Y(d("files_versions","Could not restore version")),N("files_versions:restore:failed",s)}}function T(s){n.value=!0,a.value=s}async function U(s){if(a.value===null)throw new Error("editedVersion should be set at that point");const v=a.value.label;a.value.label=s,n.value=!1;try{await gi(a.value,s),a.value=null}catch(b){a.value.label=v,Y(d("files_versions","Could not set version label")),x.error("Could not set version label",{exception:b})}}async function q(s){const v=l.value.indexOf(s);l.value.splice(v,1);try{await bi(s)}catch{l.value.push(s),Y(d("files_versions","Could not delete version"))}}function K(s){if(t.node!==null){if(s.mtime===t.node?.mtime?.getTime()){window.OCA.Viewer.open({path:t.node.path});return}window.OCA.Viewer.open({fileInfo:{...s,filename:s.filename,previewUrl:void 0},enableSidebar:!1})}}function W(s){const v=l.value.map(b=>({...b,previewUrl:void 0}));window.OCA.Viewer.compare({path:t.node.path},v.find(b=>b.source===s.source))}return(s,v)=>e.node?(r(),m("div",yi,[S(vi,{sections:w.value,headerHeight:0},{default:h(({visibleSections:b})=>[C("ul",{"aria-label":u(d)("files_versions","File versions"),"data-files-versions-versions-list":""},[b.length===1?(r(!0),m(Ce,{key:0},ke(b[0].rows,p=>(r(),H(ni,{key:p.items[0].version.mtime,canView:V.value,canCompare:A.value,loadPreview:e.active,version:p.items[0].version,node:e.node,isCurrent:p.items[0].version.mtime===k.value,isFirstVersion:p.items[0].version.mtime===o.value,onClick:K,onCompare:W,onRestore:F,onLabelUpdateRequest:L=>T(p.items[0].version),onDelete:q},null,8,["canView","canCompare","loadPreview","version","node","isCurrent","isFirstVersion","onLabelUpdateRequest"]))),128)):y("",!0)],8,wi)]),loader:h(()=>[c.value?(r(),H(u(de),{key:0,class:"files-list-viewer__loader"})):y("",!0)]),_:1},8,["sections"]),a.value?(r(),H(li,{key:0,open:n.value,"onUpdate:open":v[0]||(v[0]=b=>n.value=b),label:a.value.label,"onUpdate:label":U},null,8,["open","label"])):y("",!0)])):y("",!0)}});export{ji as default};
//# sourceMappingURL=FilesVersionsSidebarTab-CcPHfWW2.chunk.mjs.map
</d:propertyupdate>`})}async function bi(e){await R.deleteFile(e.filename)}const yi={key:0,class:"versions-tab__container"},wi=["aria-label"],ji=P({__name:"FilesVersionsSidebarTab",props:{active:{type:Boolean},node:{},folder:{},view:{}},setup(e){const t=e,i=le(),l=$([]),c=$(!1),n=$(!1),a=$(null),k=g(()=>Math.floor(new Date(t.node?.mtime?.getTime()??0).getTime()/1e3)*1e3),f=g(()=>[...l.value].sort((s,v)=>t.node?s.mtime===t.node.mtime?.getTime()?-1:v.mtime===t.node.mtime?.getTime()?1:v.mtime-s.mtime:0)),w=g(()=>[{key:"versions",rows:f.value.map(s=>({key:s.mtime.toString(),height:68,sectionKey:"versions",items:[{id:s.mtime.toString(),version:s}]})),height:68*f.value.length}]),o=g(()=>l.value.map(s=>s.mtime).reduce((s,v)=>Math.min(s,v))),V=g(()=>t.node?window.OCA.Viewer?.mimetypes?.includes(t.node?.mime):!1),A=g(()=>!i.value&&window.OCA.Viewer?.mimetypesCompare?.includes(t.node?.mime));_e(()=>t.node.id,z,{immediate:!0}),ae(k,z,{debounce:600});async function z(){try{c.value=!0,l.value=await pi(t.node)}finally{c.value=!1}}async function F(s){if(!t.node)return;const v=t.node.clone();v.attributes.etag=s.etag,v.size=s.size,v.mtime=new Date(s.mtime);const b={preventDefault:!1,node:v,version:s};if(N("files_versions:restore:requested",b),!b.preventDefault)try{await fi(s),s.label?j(d("files_versions",`${s.label} restored`)):s.mtime===o.value?j(d("files_versions","Initial version restored")):j(d("files_versions","Version restored")),N("files:node:updated",v),N("files_versions:restore:restored",{node:v,version:s})}catch{Y(d("files_versions","Could not restore version")),N("files_versions:restore:failed",s)}}function T(s){n.value=!0,a.value=s}async function U(s){if(a.value===null)throw new Error("editedVersion should be set at that point");const v=a.value.label;a.value.label=s,n.value=!1;try{await gi(a.value,s),a.value=null}catch(b){a.value.label=v,Y(d("files_versions","Could not set version label")),x.error("Could not set version label",{exception:b})}}async function q(s){const v=l.value.indexOf(s);l.value.splice(v,1);try{await bi(s)}catch{l.value.push(s),Y(d("files_versions","Could not delete version"))}}function K(s){if(t.node!==null){if(s.mtime===t.node?.mtime?.getTime()){window.OCA.Viewer.open({path:t.node.path});return}window.OCA.Viewer.open({fileInfo:{...s,filename:s.filename,previewUrl:void 0},enableSidebar:!1})}}function W(s){const v=l.value.map(b=>({...b,previewUrl:void 0}));window.OCA.Viewer.compare({fileid:t.node.fileid,filename:t.node.path,basename:t.node.basename,source:t.node.source,mime:t.node.mime,hasPreview:t.node.attributes?.["has-preview"]??!1},v.find(b=>b.source===s.source))}return(s,v)=>e.node?(r(),m("div",yi,[S(vi,{sections:w.value,headerHeight:0},{default:h(({visibleSections:b})=>[C("ul",{"aria-label":u(d)("files_versions","File versions"),"data-files-versions-versions-list":""},[b.length===1?(r(!0),m(Ce,{key:0},ke(b[0].rows,p=>(r(),H(ni,{key:p.items[0].version.mtime,canView:V.value,canCompare:A.value,loadPreview:e.active,version:p.items[0].version,node:e.node,isCurrent:p.items[0].version.mtime===k.value,isFirstVersion:p.items[0].version.mtime===o.value,onClick:K,onCompare:W,onRestore:F,onLabelUpdateRequest:L=>T(p.items[0].version),onDelete:q},null,8,["canView","canCompare","loadPreview","version","node","isCurrent","isFirstVersion","onLabelUpdateRequest"]))),128)):y("",!0)],8,wi)]),loader:h(()=>[c.value?(r(),H(u(de),{key:0,class:"files-list-viewer__loader"})):y("",!0)]),_:1},8,["sections"]),a.value?(r(),H(li,{key:0,open:n.value,"onUpdate:open":v[0]||(v[0]=b=>n.value=b),label:a.value.label,"onUpdate:label":U},null,8,["open","label"])):y("",!0)])):y("",!0)}});export{ji as default};
//# sourceMappingURL=FilesVersionsSidebarTab-x9nSfZ-3.chunk.mjs.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/files_versions-sidebar-tab.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=[window.OC.filePath('', '', 'dist/FilesVersionsSidebarTab-CcPHfWW2.chunk.mjs'),window.OC.filePath('', '', 'dist/index-68GQhqPi.chunk.mjs'),window.OC.filePath('', '', 'dist/Web-Bpn1hT4U.chunk.mjs'),window.OC.filePath('', '', 'dist/public-C1mLBHT3.chunk.mjs'),window.OC.filePath('', '', 'dist/index-DIjZjDEc.chunk.mjs'),window.OC.filePath('', '', 'dist/NcModal-DiDvgcU8-DlAqoAw2.chunk.mjs'),window.OC.filePath('', '', 'dist/logger-D3RVzcfQ-B6R2fmjp.chunk.mjs'),window.OC.filePath('', '', 'dist/createElementId-DhjFt1I9-CzYhhUzc.chunk.mjs'),window.OC.filePath('', '', 'dist/translation-DoG5ZELJ-BmllVdG7.chunk.mjs'),window.OC.filePath('', '', 'dist/index-Cp0kcsps.chunk.mjs'),window.OC.filePath('', '', 'dist/common-createElementId-DhjFt1I9-C_oBIsvc.chunk.css'),window.OC.filePath('', '', 'dist/common-logger-D3RVzcfQ-Ks0gkIDB.chunk.css'),window.OC.filePath('', '', 'dist/common-NcModal-DiDvgcU8-B-yi1OwC.chunk.css'),window.OC.filePath('', '', 'dist/TrashCanOutline-BTIe_2cO.chunk.mjs'),window.OC.filePath('', '', 'dist/common-TrashCanOutline-BYHcrfvW.chunk.css'),window.OC.filePath('', '', 'dist/common-index-DYA_tnKg.chunk.css'),window.OC.filePath('', '', 'dist/mdi-C6sl40Bq.chunk.mjs'),window.OC.filePath('', '', 'dist/common-mdi-BWNFKLbC.chunk.css'),window.OC.filePath('', '', 'dist/index-yD-5b5y_.chunk.mjs'),window.OC.filePath('', '', 'dist/folder-29HuacU_-YFFzfmzN.chunk.mjs'),window.OC.filePath('', '', 'dist/util-DBjHxD9z.chunk.mjs'),window.OC.filePath('', '', 'dist/PencilOutline-BzMMCVP9.chunk.mjs'),window.OC.filePath('', '', 'dist/common-PencilOutline-B3DMd8SU.chunk.css'),window.OC.filePath('', '', 'dist/NcDateTime.vue_vue_type_script_setup_true_lang-BJuPH7S7-DQR03jLO.chunk.mjs'),window.OC.filePath('', '', 'dist/common-NcDateTime-b9UhLDij.chunk.css'),window.OC.filePath('', '', 'dist/NcAvatar-1KxMUN7V-Dr9OrZV_.chunk.mjs'),window.OC.filePath('', '', 'dist/index-D2R3-_i4.chunk.mjs'),window.OC.filePath('', '', 'dist/ArrowRight-BMXv3_tW.chunk.mjs'),window.OC.filePath('', '', 'dist/common-ArrowRight-DfvWJUh_.chunk.css'),window.OC.filePath('', '', 'dist/colors-Cv9F-jWS-3J5iRBdf.chunk.mjs'),window.OC.filePath('', '', 'dist/NcUserStatusIcon-BF5OEQFU-CcJDgcR0.chunk.mjs'),window.OC.filePath('', '', 'dist/common-NcUserStatusIcon-BF5OEQFU-Bq_6hmXG.chunk.css'),window.OC.filePath('', '', 'dist/common-NcAvatar-1KxMUN7V-CIJAK_jb.chunk.css'),window.OC.filePath('', '', 'dist/TrayArrowDown-BXmwzkXp.chunk.mjs'),window.OC.filePath('', '', 'dist/common-TrayArrowDown-BEbvWlY3.chunk.css'),window.OC.filePath('', '', 'dist/NcTextField.vue_vue_type_script_setup_true_lang-Bx2esFU2-LotydYy2.chunk.mjs'),window.OC.filePath('', '', 'dist/NcInputField-5Sg6EUP6-DsazvGgr.chunk.mjs'),window.OC.filePath('', '', 'dist/common-NcInputField-5Sg6EUP6-BYHxARP-.chunk.css'),window.OC.filePath('', '', 'dist/dav-7UJRkJcI.chunk.mjs'),window.OC.filePath('', '', 'dist/index-i0vgf0bu.chunk.mjs'),window.OC.filePath('', '', 'dist/files_versions-FilesVersionsSidebarTab-Cjl2hr1y.chunk.css')])))=>i.map(i=>d[i]);
import{d as i,a as r,_ as e}from"./Web-Bpn1hT4U.chunk.mjs";import{r as t}from"./index-yD-5b5y_.chunk.mjs";import{t as m}from"./translation-DoG5ZELJ-BmllVdG7.chunk.mjs";import{i as n}from"./public-C1mLBHT3.chunk.mjs";import{F as a}from"./folder-29HuacU_-YFFzfmzN.chunk.mjs";import"./index-Cp0kcsps.chunk.mjs";import"./util-DBjHxD9z.chunk.mjs";const d='<svg xmlns="http://www.w3.org/2000/svg" id="mdi-backup-restore" viewBox="0 0 24 24"><path d="M12,3A9,9 0 0,0 3,12H0L4,16L8,12H5A7,7 0 0,1 12,5A7,7 0 0,1 19,12A7,7 0 0,1 12,19C10.5,19 9.09,18.5 7.94,17.7L6.5,19.14C8.04,20.3 9.94,21 12,21A9,9 0 0,0 21,12A9,9 0 0,0 12,3M14,12A2,2 0 0,0 12,10A2,2 0 0,0 10,12A2,2 0 0,0 12,14A2,2 0 0,0 14,12Z" /></svg>',s="files-versions_sidebar-tab";t({id:"files_versions",tagName:s,order:90,displayName:m("files_versions","Versions"),iconSvgInline:d,enabled({node:o}){return!(n()||o.type!==a.File)},async onInit(){const o=r(()=>e(()=>import("./FilesVersionsSidebarTab-CcPHfWW2.chunk.mjs"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40]),import.meta.url));window.customElements.define(s,i(o,{shadowRoot:!1}))}});
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=[window.OC.filePath('', '', 'dist/FilesVersionsSidebarTab-x9nSfZ-3.chunk.mjs'),window.OC.filePath('', '', 'dist/index-68GQhqPi.chunk.mjs'),window.OC.filePath('', '', 'dist/Web-Bpn1hT4U.chunk.mjs'),window.OC.filePath('', '', 'dist/public-C1mLBHT3.chunk.mjs'),window.OC.filePath('', '', 'dist/index-DIjZjDEc.chunk.mjs'),window.OC.filePath('', '', 'dist/NcModal-DiDvgcU8-DlAqoAw2.chunk.mjs'),window.OC.filePath('', '', 'dist/logger-D3RVzcfQ-B6R2fmjp.chunk.mjs'),window.OC.filePath('', '', 'dist/createElementId-DhjFt1I9-CzYhhUzc.chunk.mjs'),window.OC.filePath('', '', 'dist/translation-DoG5ZELJ-BmllVdG7.chunk.mjs'),window.OC.filePath('', '', 'dist/index-Cp0kcsps.chunk.mjs'),window.OC.filePath('', '', 'dist/common-createElementId-DhjFt1I9-C_oBIsvc.chunk.css'),window.OC.filePath('', '', 'dist/common-logger-D3RVzcfQ-Ks0gkIDB.chunk.css'),window.OC.filePath('', '', 'dist/common-NcModal-DiDvgcU8-B-yi1OwC.chunk.css'),window.OC.filePath('', '', 'dist/TrashCanOutline-BTIe_2cO.chunk.mjs'),window.OC.filePath('', '', 'dist/common-TrashCanOutline-BYHcrfvW.chunk.css'),window.OC.filePath('', '', 'dist/common-index-DYA_tnKg.chunk.css'),window.OC.filePath('', '', 'dist/mdi-C6sl40Bq.chunk.mjs'),window.OC.filePath('', '', 'dist/common-mdi-BWNFKLbC.chunk.css'),window.OC.filePath('', '', 'dist/index-yD-5b5y_.chunk.mjs'),window.OC.filePath('', '', 'dist/folder-29HuacU_-YFFzfmzN.chunk.mjs'),window.OC.filePath('', '', 'dist/util-DBjHxD9z.chunk.mjs'),window.OC.filePath('', '', 'dist/PencilOutline-BzMMCVP9.chunk.mjs'),window.OC.filePath('', '', 'dist/common-PencilOutline-B3DMd8SU.chunk.css'),window.OC.filePath('', '', 'dist/NcDateTime.vue_vue_type_script_setup_true_lang-BJuPH7S7-DQR03jLO.chunk.mjs'),window.OC.filePath('', '', 'dist/common-NcDateTime-b9UhLDij.chunk.css'),window.OC.filePath('', '', 'dist/NcAvatar-1KxMUN7V-Dr9OrZV_.chunk.mjs'),window.OC.filePath('', '', 'dist/index-D2R3-_i4.chunk.mjs'),window.OC.filePath('', '', 'dist/ArrowRight-BMXv3_tW.chunk.mjs'),window.OC.filePath('', '', 'dist/common-ArrowRight-DfvWJUh_.chunk.css'),window.OC.filePath('', '', 'dist/colors-Cv9F-jWS-3J5iRBdf.chunk.mjs'),window.OC.filePath('', '', 'dist/NcUserStatusIcon-BF5OEQFU-CcJDgcR0.chunk.mjs'),window.OC.filePath('', '', 'dist/common-NcUserStatusIcon-BF5OEQFU-Bq_6hmXG.chunk.css'),window.OC.filePath('', '', 'dist/common-NcAvatar-1KxMUN7V-CIJAK_jb.chunk.css'),window.OC.filePath('', '', 'dist/TrayArrowDown-BXmwzkXp.chunk.mjs'),window.OC.filePath('', '', 'dist/common-TrayArrowDown-BEbvWlY3.chunk.css'),window.OC.filePath('', '', 'dist/NcTextField.vue_vue_type_script_setup_true_lang-Bx2esFU2-LotydYy2.chunk.mjs'),window.OC.filePath('', '', 'dist/NcInputField-5Sg6EUP6-DsazvGgr.chunk.mjs'),window.OC.filePath('', '', 'dist/common-NcInputField-5Sg6EUP6-BYHxARP-.chunk.css'),window.OC.filePath('', '', 'dist/dav-7UJRkJcI.chunk.mjs'),window.OC.filePath('', '', 'dist/index-i0vgf0bu.chunk.mjs'),window.OC.filePath('', '', 'dist/files_versions-FilesVersionsSidebarTab-Cjl2hr1y.chunk.css')])))=>i.map(i=>d[i]);
import{d as i,a as r,_ as e}from"./Web-Bpn1hT4U.chunk.mjs";import{r as t}from"./index-yD-5b5y_.chunk.mjs";import{t as m}from"./translation-DoG5ZELJ-BmllVdG7.chunk.mjs";import{i as n}from"./public-C1mLBHT3.chunk.mjs";import{F as a}from"./folder-29HuacU_-YFFzfmzN.chunk.mjs";import"./index-Cp0kcsps.chunk.mjs";import"./util-DBjHxD9z.chunk.mjs";const d='<svg xmlns="http://www.w3.org/2000/svg" id="mdi-backup-restore" viewBox="0 0 24 24"><path d="M12,3A9,9 0 0,0 3,12H0L4,16L8,12H5A7,7 0 0,1 12,5A7,7 0 0,1 19,12A7,7 0 0,1 12,19C10.5,19 9.09,18.5 7.94,17.7L6.5,19.14C8.04,20.3 9.94,21 12,21A9,9 0 0,0 21,12A9,9 0 0,0 12,3M14,12A2,2 0 0,0 12,10A2,2 0 0,0 10,12A2,2 0 0,0 12,14A2,2 0 0,0 14,12Z" /></svg>',s="files-versions_sidebar-tab";t({id:"files_versions",tagName:s,order:90,displayName:m("files_versions","Versions"),iconSvgInline:d,enabled({node:o}){return!(n()||o.type!==a.File)},async onInit(){const o=r(()=>e(()=>import("./FilesVersionsSidebarTab-x9nSfZ-3.chunk.mjs"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40]),import.meta.url));window.customElements.define(s,i(o,{shadowRoot:!1}))}});
//# sourceMappingURL=files_versions-sidebar-tab.mjs.map
Loading