mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-20 02:48:51 +00:00
1 line
8.8 KiB
JavaScript
1 line
8.8 KiB
JavaScript
![]() |
"use strict";(self.webpackChunkseahub_frontend=self.webpackChunkseahub_frontend||[]).push([[5583],{65396:function(e,t,n){var r=n(23029),s=n(92901),o=n(39874),a=n(85501),i=n(9950),l=n(17119),c=n(13690),d=n(65604),h=n(40326),u=n(97011),m=n(81446),p=n(40866),f=n(4086),x=n(27288),j=n(58195),g=n(14113),A=n(99308),b=n(85907),v=n(18849),P=n(44414),k=function(e){function t(e){var n;return(0,r.A)(this,t),(n=(0,o.A)(this,t,[e])).action=function(){n.setState({btnDisabled:!0}),n.props.restoreRepo()},n.state={btnDisabled:!1},n}return(0,a.A)(t,e),(0,s.A)(t,[{key:"render",value:function(){var e=this.props.toggle;return(0,P.jsxs)(j.A,{centered:!0,isOpen:!0,toggle:e,children:[(0,P.jsx)(g.A,{toggle:e,children:(0,h.AP)("Restore Library")}),(0,P.jsx)(A.A,{children:(0,P.jsx)("p",{children:(0,h.AP)("Are you sure you want to restore this library?")})}),(0,P.jsxs)(b.A,{children:[(0,P.jsx)(v.A,{color:"secondary",onClick:e,children:(0,h.AP)("Cancel")}),(0,P.jsx)(v.A,{color:"primary",onClick:this.action,disabled:this.state.btnDisabled,children:(0,h.AP)("Restore")})]})]})}}])}(i.Component),N=(n(18291),n(81848),window.app.pageOptions),w=N.repoID,C=N.repoName,y=N.canRestoreRepo,F=N.commitID,D=N.commitTime,I=N.commitDesc,M=N.commitRelativeTime,S=N.showAuthor,O=N.authorAvatarURL,R=N.authorName,_=N.authorNickName,q=function(e){function t(e){var n;return(0,r.A)(this,t),(n=(0,o.A)(this,t,[e])).toggleDialog=function(){n.setState({isConfirmDialogOpen:!n.state.isConfirmDialogOpen})},n.onSearchedClick=function(e){if(!0===e.is_dir){var t=h.Yc+"library/"+e.repo_id+"/"+e.repo_name+e.path;(0,c.oo)(t,{repalce:!0})}else{var n=h.Yc+"lib/"+e.repo_id+"/file"+d.Aq.encodePath(e.path);window.open("about:blank").location.href=n}},n.goBack=function(e){e.preventDefault(),window.history.back()},n.renderFolder=function(e){n.setState({folderPath:e,folderItems:[],isLoading:!0}),u.e.listCommitDir(w,F,e).then((function(e){n.setState({isLoading:!1,folderItems:e.data.dirent_list})})).catch((function(e){n.setState({isLoading:!1,errorMsg:d.Aq.getErrorMsg(e,!0)})}))},n.clickFolderPath=function(e,t){t.preventDefault(),n.renderFolder(e)},n.renderPath=function(){var e=n.state.folderPath,t=e.split("/");return"/"==e?(0,P.jsx)("span",{className:"text-truncate",title:C,children:C}):(0,P.jsxs)(i.Fragment,{children:[(0,P.jsx)("a",{href:"#",onClick:n.clickFolderPath.bind(n,"/"),className:"text-truncate",title:C,children:C}),(0,P.jsx)("span",{className:"mx-1",children:"/"}),t.map((function(e,r){return r>0&&r!=t.length-1?(0,P.jsxs)(i.Fragment,{children:[(0,P.jsx)("a",{href:"#",onClick:n.clickFolderPath.bind(n,t.slice(0,r+1).join("/")),className:"text-truncate",title:t[r],children:t[r]}),(0,P.jsx)("span",{className:"mx-1",children:"/"})]},r):null})),(0,P.jsx)("span",{className:"text-truncate",title:t[t.length-1],children:t[t.length-1]})]})},n.restoreRepo=function(){u.e.revertRepo(w,F).then((function(e){n.toggleDialog(),f.A.success((0,h.AP)("Successfully restored the library."))})).catch((function(e){var t=d.Aq.getErrorMsg(e);n.toggleDialog(),f.A.danger(t)}))},n.state={isLoading:!0,errorMsg:"",folderPath:"/",folderItems:[],isConfirmDialogOpen:!1},n}return(0,a.A)(t,e),(0,s.A)(t,[{key:"componentDidMount",value:function(){this.renderFolder(this.state.folderPath)}},{key:"render",value:function(){var e=this.state,t=e.isConfirmDialogOpen,n=e.folderPath,r=(0,h.AP)("{placeholder} Snapshot");return r=r.replace("{placeholder}",'<span class="op-target text-truncate mx-1">'+d.Aq.HTMLescape(C)+"</span>"),(0,P.jsxs)(i.Fragment,{children:[(0,P.jsxs)("div",{className:"h-100 d-flex flex-column",children:[(0,P.jsxs)("div",{className:"top-header d-flex justify-content-between",children:[(0,P.jsx)("a",{href:h.Yc,children:(0,P.jsx)("img",{src:h.SG+h.VI,height:h.hM,width:h.gA,title:h.q0,alt:"logo"})}),(0,P.jsx)(x.A,{onSearchedClick:this.onSearchedClick})]}),(0,P.jsx)("div",{className:"flex-auto container-fluid pt-4 pb-6 o-auto",children:(0,P.jsx)("div",{className:"row",children:(0,P.jsxs)("div",{className:"col-md-10 offset-md-1",children:[(0,P.jsxs)("h2",{children:[(0,P.jsx)("span",{dangerouslySetInnerHTML:{__html:r},c
|