1(self.__LOADABLE_LOADED_CHUNKS__=self.__LOADABLE_LOADED_CHUNKS__||[]).push([[2924],{24868:(t,e,s)=>{"use strict";s.r(e),s.d(e,{default:()=>H});var n=s(83740),o=s(28144),a=s(87539),i=s(11520),r=s(7012),d=s(70556),l=s(24732),c=s(82976),h=s(43908),u=s(35434),p=s(49284),g=s(39732),T=s(50723),m=s(3896),S=s(25716),f=s(41184),v=s(37568),w=s(900),y=s.n(w),x=s(40144),C=s.n(x),B=s(53304),N=s(34128),U=s.n(N),I=s(15088),b=s.n(I),L=s(94404),M=s.n(L),P=s(30012);var E=s(68208),D=n.createElement;const k=(0,p.defineMessages)({success:{id:"Success",defaultMessage:"Success"},error:{id:"Error",defaultMessage:"Error"},undo:{id:"Undo",defaultMessage:"Undo"},back:{id:"Back",defaultMessage:"Back"},default:{id:"Default",defaultMessage:"Default"},sortBy:{id:"Sort By",defaultMessage:"Sort by"},sorted:{id:"Sorted",defaultMessage:"Sorted"},unsorted:{id:"Unsorted",defaultMessage:"Unsorted"},sortByDescription:{id:"Sort transactions by User-Name, Path or Date",defaultMessage:"Sort transactions by User-Name, Path or Date"},failedToUndoTransactions:{id:"Failed To Undo Transactions",defaultMessage:"Failed to undo transactions"},successfullyUndoneTransactions:{id:"Successfully Undone Transactions",defaultMessage:"Successfully undone transactions"},transactionsHaveBeenSorted:{id:"Transactions Have Been Sorted",defaultMessage:"Transactions have been sorted"},transactionsHaveBeenUnsorted:{id:"Transactions Have Been Unsorted",defaultMessage:"Transactions have been unsorted"},noTransactionsSelected:{id:"No Transactions Selected",defaultMessage:"No transactions selected"},noTransactionsSelectedToDoUndo:{id:"No Transactions Selected To Do Undo",defaultMessage:"No transactions selected to do undo"}});class F extends n.Component{constructor(t){super(t),this.state={isClient:!1,sortType:"no value",lowerIndex:0,upperIndex:20,defaultTransactionsLenInTable:20,isSortingTypeSelected:!1,sortedTransactions:[],isEmptyInputForSorting:!1,isTransactionsNotFound:!1,isClickedOnUndoButton:!1,showPrevButton:!1,showNextButton:!1},this.onCancel=this.onCancel.bind(this),this.onSort=this.onSort.bind(this),this.onSelect=this.onSelect.bind(this),this.onPrev=this.onPrev.bind(this),this.onNext=this.onNext.bind(this),this.onUndo=this.onUndo.bind(this),this.handleTableVisiblity=this.handleTableVisiblity.bind(this),this.handleNotSortedNextPrevButtons=this.handleNotSortedNextPrevButtons.bind(this),this.handleSortedNextPrevButtons=this.handleSortedNextPrevButtons.bind(this),this.checkTransactionsUndoneStatus=this.checkTransactionsUndoneStatus.bind(this)}componentDidMount(){this.setState({isClient:!0}),this.props.getTransactions()}UNSAFE_componentWillReceiveProps(t){this.props.revertRequest.loading&&t.revertRequest.loaded&&this.props.getTransactions()}setSortedTransactions(t){t.length>0?this.setState({lowerIndex:0,upperIndex:this.state.defaultTransactionsLenInTable,sortedTransactions:t,isEmptyInputForSorting:!1,isTransactionsNotFound:!1}):this.setState({isTransactionsNotFound:!0})}onCancel(){this.state.sortedTransactions.length>0&&E.toast.info(D(f.c,{info:!0,title:this.props.intl.formatMessage(k.unsorted),content:this.props.intl.formatMessage(k.transactionsHaveBeenUnsorted)})),this.setState({isSortingTypeSelected:!1,isTransactionsNotFound:!1,isEmptyInputForSorting:!1,sortType:"no value",sortedTransactions:[],lowerIndex:0,upperIndex:this.state.defaultTransactionsLenInTable})}onSelect(t){if(null!==t&&null!==t.sortingTypes&&this.state.sortType.toLowerCase()===t.sortingTypes.toLowerCase())return;let e=null!==t&&t.sortingTypes||"no value";"no value"!==e.toLowerCase()?(this.setState({isSortingTypeSelected:!0}),"user name"===e.toLowerCase()&&this.setState({sortType:"user name"}),"date"===e.toLowerCase()&&this.setState({sortType:"date"}),"path"===e.toLowerCase()&&this.setState({sortType:"path"})):this.onCancel()}onSort(t){let e,s=t.sortingTypes||"no value";if("user name"===s.toLowerCase()&&(e=t.sortByUsername)||"path"===s.toLowerCase()&&(e=t.sortByPath)||"date"===s.toLowerCase()&&(e=t.sortByDate)||(e=void 0),"no value"!==s.toLowerCase()&&void 0!==e){let t=[];if("user name"===s.toLowerCase())this.props.transactions.forEach(s=>{"zope"!==e.trim().toLowerCase()||s.username?s.username.trim().toLowerCase().includes(e.trim().toLowerCase())&&t.pu
1sh(s):t.push(s)}),this.setSortedTransactions(t);else if("path"===s.toLowerCase())this.props.transactions.forEach(s=>{s.id.trim().toLowerCase().includes(e.trim().toLowerCase())&&t.push(s)}),this.setSortedTransactions(t);else{let s=864e5,n=Date.parse(e),o=n-n%s+s-1,a=n-n%s;this.props.transactions.forEach(e=>{o>=Date.parse(e.time)&&Date.parse(e.time)>=a&&t.push(e)}),this.setSortedTransactions(t)}E.toast.info(D(f.c,{info:!0,title:this.props.intl.formatMessage(k.sorted),content:this.props.intl.formatMessage(k.transactionsHaveBeenSorted)}))}else this.setState({isEmptyInputForSorting:!0})}onUndo(){let t=!1,e=C()(this.props.transactions.slice(0,this.props.transactions.length),e=>null!==document.getElementById(e.id)&&document.getElementById(e.id).firstElementChild.firstElementChild.firstElementChild.checked?(t=!0,e.id):"");t?(this.setState({isClickedOnUndoButton:!0}),this.props.revertTransactions(e)):E.toast.error(D(f.c,{error:!0,title:this.props.intl.formatMessage(k.noTransactionsSelected),content:this.props.intl.formatMessage(k.noTransactionsSelectedToDoUndo)})),Array.from(document.getElementsByClassName("transactions-checkboxes")).forEach(t=>{t.firstElementChild.checked=!1})}onPrev(){0<this.state.lowerIndex&&this.setState({upperIndex:this.state.lowerIndex,lowerIndex:this.state.lowerIndex-this.state.defaultTransactionsLenInTable})}onNext(){this.props.transactions.length>this.state.upperIndex&&this.setState({lowerIndex:this.state.upperIndex,upperIndex:this.state.upperIndex+this.state.defaultTransactionsLenInTable})}handleSortedNextPrevButtons(){this.state.upperIndex>=this.state.sortedTransactions.length&&this.state.showNextButton&&this.setState({showNextButton:!1}),this.state.upperIndex<this.state.sortedTransactions.length&&!this.state.showNextButton&&this.setState({showNextButton:!0}),this.state.lowerIndex<=0&&this.state.showPrevButton&&this.setState({showPrevButton:!1}),this.state.lowerIndex>0&&!this.state.showPrevButton&&this.setState({showPrevButton:!0})}handleNotSortedNextPrevButtons(){var t,e;this.state.upperIndex>=(null===(t=this.props.transactions)||void 0===t?void 0:t.length)&&this.state.showNextButton&&this.setState({showNextButton:!1}),this.state.upperIndex<(null===(e=this.props.transactions)||void 0===e?void 0:e.length)&&!this.state.showNextButton&&this.setState({showNextButton:!0}),this.state.lowerIndex<=0&&this.state.showPrevButton&&this.setState({showPrevButton:!1}),this.state.lowerIndex>0&&!this.state.showPrevButton&&this.setState({showPrevButton:!0})}handleTableVisiblity(){if(this.state.sortedTransactions.length>0)this.handleSortedNextPrevButtons();else if(this.state.isSortingTypeSelected)this.handleNotSortedNextPrevButtons();else{var t,e;(null===(t=this.props.transactions)||void 0===t?void 0:t.length)>0&&this.state.isTransactionsNotFound&&this.setState({isTransactionsNotFound:!1}),(null===(e=this.props.transactions)||void 0===e?void 0:e.length)<=0&&!this.state.isTransactionsNotFound&&this.setState({isTransactionsNotFound:!0}),this.handleNotSortedNextPrevButtons()}}checkTransactionsUndoneStatus(){this.props.revertRequest.error&&null!==this.props.revertRequest.error&&this.state.isClickedOnUndoButton?(this.setState({isClickedOnUndoButton:!1}),E.toast.error(D(f.c,{error:!0,title:this.props.intl.formatMessage(k.error),content:this.props.intl.formatMessage(k.failedToUndoTransactions)}))):null===this.props.revertRequest.error&&this.state.isClickedOnUndoButton&&(this.setState({isClickedOnUndoButton:!1}),E.toast.success(D(f.c,{success:!0,title:this.props.intl.formatMessage(k.success),content:this.props.intl.formatMessage(k.successfullyUndoneTransactions)})))}render(){var t,e;const s=this.state.sortedTransactions.length>0&&this.state.sortedTransactions.slice(this.state.lowerIndex,this.state.upperIndex)||(null===(t=this.props.transactions)||void 0===t?void 0:t.slice(this.state.lowerIndex,this.state.upperIndex));return this.handleTableVisiblity(),this.checkTransactionsUndoneStatus(),D(d.c,{id:"page-undo",className:"controlpanel-undo"},D(B.c,{title:"Undo"}),D(l.c.Group,{raised:!0},D(l.c,{className:"primary"},D(g.c,{id:"Undo Controlpanel",defaultMessage:"Undo Controlpanel"})),D(l.c,null,(null===(e=this.props.transactions)||void 0===e?void 0:e.length)>0&&D(v.QF,{schema:{fieldsets:[{id:"default",title:this.props.intl.formatMessage(k.default),fields:this.state.isSortingType
1Selected?["sortingTypes",("user name"===this.state.sortType.toLowerCase()?"sortByUsername":"path"===this.state.sortType.toLowerCase()&&"sortByPath")||"date"===this.state.sortType.toLowerCase()&&"sortByDate"]:["sortingTypes"]}],properties:{sortingTypes:{title:this.props.intl.formatMessage(k.sortBy),description:this.props.intl.formatMessage(k.sortByDescription),type:"string",choices:C()(["User Name","Path","Date"],t=>[t,t])},sortByUsername:{title:"Enter Username",type:"string"},sortByPath:{title:"Enter Path",type:"string"},sortByDate:{title:"Enter Date and Time",type:"date"}},required:[]},error:this.state.isEmptyInputForSorting?{message:"Please enter any input to perform sorting"}:void 0,onChangeFormData:this.onSelect,onSubmit:this.state.isSortingTypeSelected?this.onSort:void 0,onCancel:this.state.isSortingTypeSelected?this.onCancel:void 0,resetOnCancel:!0})),D(l.c.Group,{raised:!0},D(l.c,{className:"primary"},D(g.c,{id:"Transactions",defaultMessage:"Transactions"})),this.state.isTransactionsNotFound?D(l.c,null,D(g.c,{id:"No Transactions Found",defaultMessage:"No transactions found"})):D(c.c,{selectable:!0,fixed:!0,celled:!0,compact:!0,singleLine:!0,attached:!0},D(c.c.Header,null,D(c.c.Row,null,D(c.c.HeaderCell,{width:1},D(g.c,{id:"Transactions Checkbox",defaultMessage:"#"})),D(c.c.HeaderCell,{width:3},D(g.c,{id:"What",defaultMessage:"What"})),D(c.c.HeaderCell,{width:3},D(g.c,{id:"Who",defaultMessage:"Who"})),D(c.c.HeaderCell,{width:3},D(g.c,{id:"When",defaultMessage:"When"})),D(c.c.HeaderCell,{width:3},D(g.c,{id:"Note",defaultMessage:"Note"})),D(c.c.HeaderCell,null))),D(c.c.Body,null,C()(s,t=>D(c.c.Row,{id:t.id,key:t.id},D(c.c.Cell,{width:1},D(h.c,{type:"checkbox",className:"transactions-checkboxes"})),D(c.c.Cell,{width:3,title:[t.description].join(" ")},t.description),D(c.c.Cell,{width:3},t.username?t.username:"Zope"),D(c.c.Cell,{width:3},t.time),D(c.c.Cell,{width:3},t.description.includes("Undo")?"Undone":"")))),D(c.c.Footer,null,D(c.c.Row,null,D(c.c.HeaderCell,{textAlign:"center",colSpan:"6"},D(u.c,{pagination:!0},D(u.c.Item,{as:"a",id:"prev-button",icon:!0},this.state.showPrevButton?D(m.c,{onClick:this.onPrev,name:b(),title:"Prev"}):D("div",{style:{width:"36px"}})),D(u.c.Item,{as:"a",icon:!0},D(m.c,{name:M(),id:"undo-button",className:"circled",size:"30px",title:this.props.intl.formatMessage(k.undo),onClick:this.onUndo})),D(u.c.Item,{as:"a",id:"next-button",icon:!0},this.state.showNextButton?D(m.c,{onClick:this.onNext,name:U(),title:"Next"}):D("div",{style:{width:"36px"}}))))))))),this.state.isClient&&(0,r.createPortal)(D(S.c,{pathname:this.props.pathname,hideDefaultViewButtons:!0,inner:D(n.Fragment,null,D(i.cH,{to:"/controlpanel",className:"item"},D(m.c,{name:y(),"aria-label":this.props.intl.formatMessage(k.back),className:"contents circled",size:"30px",title:this.props.intl.formatMessage(k.back)})))}),document.getElementById("toolbar")))}}const H=(0,a.compose)(T.cp,(0,o.connect)((t,e)=>({pathname:e.location.pathname,transactions:t.transactions.transactions_recieved,revertRequest:t.transactions.revert}),{getTransactions:function(){return{type:P.XQ,request:{op:"get",path:"/@transactions"}}},revertTransactions:function(t){return{type:P.aK,request:{op:"patch",path:"/@transactions",data:{transaction_ids:t}}}}}))(F)},94404:t=>{t.exports={attributes:{xmlns:"http://www.w3.org/2000/svg",width:"36",height:"36",viewBox:"0 0 36 36"},content:'<path fill-rule="evenodd" d="M19,9 L10.527,9 L13.719,5.695 L12.281,4.305 L6.781,10 L12.281,15.695 L13.719,14.305 L10.527,11 L19,11 C23.411,11 27,14.589 27,19 C27,23.411 23.411,27 19,27 L18,27 L18,29 L19,29 C24.514,29 29,24.514 29,19 C29,13.486 24.514,9 19,9"/>'}}}]); 2//# sourceMappingURL=plone-volto-components-manage-Controlpanels-UndoControlpanel.9f626534.chunk.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.