mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-30 12:19:13 -04:00
Add button in admin backend to cleanup revisions of a specific pad
This commit is contained in:
parent
491d4af19e
commit
593d1021b6
6 changed files with 64 additions and 4 deletions
|
@ -6,7 +6,7 @@ import {useDebounce} from "../utils/useDebounce.ts";
|
|||
import {determineSorting} from "../utils/sorting.ts";
|
||||
import * as Dialog from "@radix-ui/react-dialog";
|
||||
import {IconButton} from "../components/IconButton.tsx";
|
||||
import {ChevronLeft, ChevronRight, Eye, Trash2} from "lucide-react";
|
||||
import {ChevronLeft, ChevronRight, Eye, Trash2, FileStack} from "lucide-react";
|
||||
import {SearchField} from "../components/SearchField.tsx";
|
||||
|
||||
export const PadPage = ()=>{
|
||||
|
@ -68,12 +68,30 @@ export const PadPage = ()=>{
|
|||
results: newPads
|
||||
})
|
||||
})
|
||||
|
||||
settingsSocket.on('results:cleanupPadRevisions', (data)=>{
|
||||
let newPads = useStore.getState().pads?.results ?? []
|
||||
|
||||
newPads.forEach((pad)=>{
|
||||
if (pad.padName === data.padId) {
|
||||
pad.revisionNumber = data.keepRevisions
|
||||
}
|
||||
})
|
||||
|
||||
useStore.getState().setPads({
|
||||
results: newPads,
|
||||
total: useStore.getState().pads!.total
|
||||
})
|
||||
})
|
||||
}, [settingsSocket, pads]);
|
||||
|
||||
const deletePad = (padID: string)=>{
|
||||
settingsSocket?.emit('deletePad', padID)
|
||||
}
|
||||
|
||||
const cleanupPad = (padID: string)=>{
|
||||
settingsSocket?.emit('cleanupPadRevisions', padID)
|
||||
}
|
||||
|
||||
|
||||
return <div>
|
||||
|
@ -150,6 +168,9 @@ export const PadPage = ()=>{
|
|||
setPadToDelete(pad.padName)
|
||||
setDeleteDialog(true)
|
||||
}}/>
|
||||
<IconButton icon={<FileStack/>} title={<Trans i18nKey="ep_admin_pads:ep_adminpads2_cleanup"/>} onClick={()=>{
|
||||
cleanupPad(pad.padName)
|
||||
}}/>
|
||||
<IconButton icon={<Eye/>} title="view" onClick={()=>window.open(`/p/${pad.padName}`, '_blank')}/>
|
||||
</div>
|
||||
</td>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue