summaryrefslogtreecommitdiffstats
path: root/apps/files_trashbin
diff options
context:
space:
mode:
authorJohn Molakvoæ <skjnldsv@protonmail.com>2023-03-22 11:45:59 +0100
committerJohn Molakvoæ <skjnldsv@protonmail.com>2023-04-06 14:49:31 +0200
commitf330813ff01e321a9e39822b183c49805bff16a5 (patch)
tree2f0349af40c82be1e0132dc3040047e90e63dfba /apps/files_trashbin
parent10010fc532a02958804667e1cb3acee8e9556394 (diff)
downloadnextcloud-server-f330813ff01e321a9e39822b183c49805bff16a5.tar.gz
nextcloud-server-f330813ff01e321a9e39822b183c49805bff16a5.zip
feat(files): custom columns
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
Diffstat (limited to 'apps/files_trashbin')
-rw-r--r--apps/files_trashbin/src/css/trashbin.css2
-rw-r--r--apps/files_trashbin/src/main.ts23
2 files changed, 24 insertions, 1 deletions
diff --git a/apps/files_trashbin/src/css/trashbin.css b/apps/files_trashbin/src/css/trashbin.css
new file mode 100644
index 00000000000..dd6cd8af591
--- /dev/null
+++ b/apps/files_trashbin/src/css/trashbin.css
@@ -0,0 +1,2 @@
+.files-list__row-trashbin-deleted {
+} \ No newline at end of file
diff --git a/apps/files_trashbin/src/main.ts b/apps/files_trashbin/src/main.ts
index 626b9ef813d..d9cd2841b23 100644
--- a/apps/files_trashbin/src/main.ts
+++ b/apps/files_trashbin/src/main.ts
@@ -21,8 +21,9 @@
*/
import type NavigationService from '../../files/src/services/Navigation'
-import { translate as t } from '@nextcloud/l10n'
+import { translate as t, translate } from '@nextcloud/l10n'
import DeleteSvg from '@mdi/svg/svg/delete.svg?raw'
+import moment from '@nextcloud/moment'
import getContents from './services/trashbin'
@@ -35,5 +36,25 @@ Navigation.register({
order: 50,
sticky: true,
+ columns: [
+ {
+ id: 'deleted',
+ title: t('files_trashbin', 'Deleted'),
+ render(mount, node) {
+ const deletionTime = node.attributes?.['trashbin-deletion-time']
+ if (deletionTime) {
+ mount.innerText = moment.unix(deletionTime).fromNow()
+ return
+ }
+ mount.innerText = translate('files_trashbin', 'Deleted a long time ago')
+ },
+ sort(nodeA, nodeB) {
+ const deletionTimeA = nodeA.attributes?.['trashbin-deletion-time'] || nodeA?.mtime || 0
+ const deletionTimeB = nodeB.attributes?.['trashbin-deletion-time'] || nodeB?.mtime || 0
+ return deletionTimeA - deletionTimeB
+ },
+ },
+ ],
+
getContents,
})