mirror of
https://github.com/nextcloud/server.git
synced 2026-06-07 07:43:18 -04:00
Merge pull request #44584 from nextcloud/backport/44512/stable29
This commit is contained in:
commit
088f73763c
4 changed files with 42 additions and 6 deletions
|
|
@ -19,7 +19,10 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
import { translate as t, translate } from '@nextcloud/l10n'
|
||||
|
||||
import './trashbin.scss'
|
||||
|
||||
import { translate as t } from '@nextcloud/l10n'
|
||||
import DeleteSvg from '@mdi/svg/svg/delete.svg?raw'
|
||||
import moment from '@nextcloud/moment'
|
||||
|
||||
|
|
@ -27,7 +30,20 @@ import { getContents } from './services/trashbin'
|
|||
|
||||
// Register restore action
|
||||
import './actions/restoreAction'
|
||||
import { Column, View, getNavigation } from '@nextcloud/files'
|
||||
import { Column, Node, View, getNavigation } from '@nextcloud/files'
|
||||
import { dirname, joinPaths } from '@nextcloud/paths'
|
||||
|
||||
const parseOriginalLocation = (node: Node): string => {
|
||||
const path = node.attributes?.['trashbin-original-location'] !== undefined ? String(node.attributes?.['trashbin-original-location']) : null
|
||||
if (!path) {
|
||||
return t('files_trashbin', 'Unknown')
|
||||
}
|
||||
const dir = dirname(path)
|
||||
if (dir === path) { // Node is in root folder
|
||||
return t('files_trashbin', 'All files')
|
||||
}
|
||||
return joinPaths(t('files_trashbin', 'All files'), dir)
|
||||
}
|
||||
|
||||
const Navigation = getNavigation()
|
||||
Navigation.register(new View({
|
||||
|
|
@ -45,6 +61,23 @@ Navigation.register(new View({
|
|||
defaultSortKey: 'deleted',
|
||||
|
||||
columns: [
|
||||
new Column({
|
||||
id: 'original-location',
|
||||
title: t('files_trashbin', 'Original location'),
|
||||
render(node) {
|
||||
const originalLocation = parseOriginalLocation(node)
|
||||
const span = document.createElement('span')
|
||||
span.title = originalLocation
|
||||
span.textContent = originalLocation
|
||||
return span
|
||||
},
|
||||
sort(nodeA, nodeB) {
|
||||
const locationA = parseOriginalLocation(nodeA)
|
||||
const locationB = parseOriginalLocation(nodeB)
|
||||
return locationA.localeCompare(locationB)
|
||||
},
|
||||
}),
|
||||
|
||||
new Column({
|
||||
id: 'deleted',
|
||||
title: t('files_trashbin', 'Deleted'),
|
||||
|
|
@ -58,7 +91,7 @@ Navigation.register(new View({
|
|||
}
|
||||
|
||||
// Unknown deletion time
|
||||
span.textContent = translate('files_trashbin', 'A long time ago')
|
||||
span.textContent = t('files_trashbin', 'A long time ago')
|
||||
return span
|
||||
},
|
||||
sort(nodeA, nodeB) {
|
||||
|
|
|
|||
3
apps/files_trashbin/src/trashbin.scss
Normal file
3
apps/files_trashbin/src/trashbin.scss
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
.files-list__row-trashbin-original-location {
|
||||
width: 150px !important;
|
||||
}
|
||||
4
dist/files_trashbin-main.js
vendored
4
dist/files_trashbin-main.js
vendored
File diff suppressed because one or more lines are too long
2
dist/files_trashbin-main.js.map
vendored
2
dist/files_trashbin-main.js.map
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue