1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-19 01:44:13 +00:00
Files
seahub/media/assets/frontend/static/js/repoFolderTrash.620a0b18.js

1 line
12 KiB
JavaScript
Raw Normal View History

"use strict";(self.webpackChunkseahub_frontend=self.webpackChunkseahub_frontend||[]).push([[9023],{68849:function(e,t,r){var n=r(23029),s=r(92901),o=r(39874),a=r(85501),i=r(9950),l=r(58195),c=r(14113),d=r(99308),h=r(85907),u=r(18849),m=r(20015),p=r(30730),f=r(40326),x=r(97011),g=r(65604),j=r(4086),A=r(44414),b=function(e){function t(e){var r;return(0,n.A)(this,t),(r=(0,o.A)(this,t,[e])).handleInputChange=function(e){r.setState({inputValue:e})},r.formSubmit=function(){var e=r.state.inputValue,t=r.props.repoID;r.setState({submitBtnDisabled:!0}),x.e.deleteRepoTrash(t,e.value).then((function(e){j.A.success((0,f.AP)("Clean succeeded.")),r.props.refreshTrash(),r.props.toggleDialog()})).catch((function(e){var t=g.Aq.getErrorMsg(e);r.setState({formErrorMsg:t,submitBtnDisabled:!1})}))},r.options=[{label:(0,f.AP)("3 days ago"),value:3},{label:(0,f.AP)("1 week ago"),value:7},{label:(0,f.AP)("1 month ago"),value:30},{label:(0,f.AP)("all"),value:0}],r.state={inputValue:r.options[0],submitBtnDisabled:!1},r}return(0,a.A)(t,e),(0,s.A)(t,[{key:"render",value:function(){var e=this.state.formErrorMsg;return(0,A.jsxs)(l.A,{isOpen:!0,toggle:this.props.toggleDialog,children:[(0,A.jsx)(c.A,{toggle:this.props.toggleDialog,children:(0,f.AP)("Clean")}),(0,A.jsx)(d.A,{children:(0,A.jsxs)(i.Fragment,{children:[(0,A.jsx)("p",{children:(0,f.AP)("Clear files in trash and history\uff1a")}),(0,A.jsx)(m.A,{defaultValue:this.options[0],options:this.options,autoFocus:!1,onChange:this.handleInputChange,placeholder:"",styles:p.xD}),e&&(0,A.jsx)("p",{className:"error m-0 mt-2",children:e})]})}),(0,A.jsxs)(h.A,{children:[(0,A.jsx)(u.A,{color:"secondary",onClick:this.props.toggleDialog,children:(0,f.AP)("Cancel")}),(0,A.jsx)(u.A,{color:"primary",disabled:this.state.submitBtnDisabled,onClick:this.formSubmit,children:(0,f.AP)("Submit")})]})]})}}])}(i.Component);t.A=b},12121:function(e,t,r){var n=r(23029),s=r(92901),o=r(39874),a=r(85501),i=r(9950),l=r(17119),c=r(13690),d=r(4159),h=r.n(d),u=r(65604),m=r(40326),p=r(97011),f=r(81446),x=r(40866),g=r(4086),j=r(27288),A=r(68849),b=(r(18291),r(81848),r(44414)),v=window.app.pageOptions,M=v.repoID,D=v.repoFolderName,P=v.path,k=v.enableUserCleanTrash,C=v.isRepoAdmin,F=function(e){function t(e){var r;return(0,n.A)(this,t),(r=(0,o.A)(this,t,[e])).getItems=function(e){p.e.getRepoFolderTrash(M,P,e).then((function(e){var t=e.data,n=t.data,s=t.more,o=t.scan_stat;!n.length&&s?r.getItems(o):r.setState({isLoading:!1,items:r.state.items.concat(n),more:s,scanStat:o})})).catch((function(e){r.setState({isLoading:!1,errorMsg:u.Aq.getErrorMsg(e,!0)})}))},r.getMore=function(){r.setState({isLoading:!0}),r.getItems(r.state.scanStat)},r.onSearchedClick=function(e){if(!0===e.is_dir){var t=m.Yc+"library/"+e.repo_id+"/"+e.repo_name+e.path;(0,c.oo)(t,{repalce:!0})}else{var r=m.Yc+"lib/"+e.repo_id+"/file"+u.Aq.encodePath(e.path);window.open("about:blank").location.href=r}},r.goBack=function(e){e.preventDefault(),window.history.back()},r.cleanTrash=function(){r.toggleCleanTrashDialog()},r.toggleCleanTrashDialog=function(){r.setState({isCleanTrashDialogOpen:!r.state.isCleanTrashDialogOpen})},r.refreshTrash=function(){r.setState({isLoading:!0,errorMsg:"",items:[],scanStat:null,more:!1,showFolder:!1}),r.getItems()},r.renderFolder=function(e,t,n){r.setState({showFolder:!0,commitID:e,baseDir:t,folderPath:n,folderItems:[],isLoading:!0}),p.e.listCommitDir(M,e,"".concat(t.substr(0,t.length-1)).concat(n)).then((function(e){r.setState({isLoading:!1,folderItems:e.data.dirent_list})})).catch((function(e){e.response?403==e.response.status?r.setState({isLoading:!1,errorMsg:(0,m.AP)("Permission denied")}):r.setState({isLoading:!1,errorMsg:(0,m.AP)("Error")}):r.setState({isLoading:!1,errorMsg:(0,m.AP)("Please check the network.")})}))},r.clickRoot=function(e){e.preventDefault(),r.refreshTrash()},r.clickFolderPath=function(e,t){t.preventDefault();var n=r.state,s=n.commitID,o=n.baseDir;r.renderFolder(s,o,e)},r.renderFolderPath=function(){var e=r.state.folderPath.split("/");return(0,b.jsxs)(i.Fragment,{children:[(0,b.jsx)("a",{href:"#",onClick:r.clickRoot,className: