Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show hidden files and folders count in file info #10907

Merged
merged 4 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Enhancement: Display hidden resources information in files list

We've added the ability for the user to see how many files and folders are hidden in the files list footer.

https://github.com/owncloud/web/pull/10907
https://github.com/owncloud/web/issues/9036
44 changes: 42 additions & 2 deletions packages/web-app-files/src/components/FilesList/ListInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,20 @@ export default defineComponent({
type: Number,
required: true
},
hiddenFiles: {
type: Number,
required: false,
default: 0
},
folders: {
type: Number,
required: true
},
hiddenFolders: {
type: Number,
required: false,
default: 0
},
spaces: {
type: Number,
default: 0,
Expand All @@ -45,25 +55,55 @@ export default defineComponent({
type: [String, Number],
required: false,
default: null
},
showHiddenItems: {
type: Boolean,
required: false,
default: false
}
},
computed: {
items() {
return this.files + this.folders + (this.showSpaces ? this.spaces : 0)
},
text() {
const filesStr = this.$ngettext('%{ filesCount } file', '%{ filesCount } files', this.files, {
let filesStr = this.$ngettext('%{ filesCount } file', '%{ filesCount } files', this.files, {
filesCount: this.files.toString()
})

const foldersStr = this.$ngettext(
if (this.showHiddenItems && this.hiddenFiles) {
filesStr = this.$ngettext(
'%{ filesCount } file including %{ filesHiddenCount } hidden',
'%{ filesCount } files including %{ filesHiddenCount } hidden',
this.files,
{
filesCount: this.files.toString(),
filesHiddenCount: this.hiddenFiles.toString()
}
)
}

let foldersStr = this.$ngettext(
'%{ foldersCount } folder',
'%{ foldersCount } folders',
this.folders,
{
foldersCount: this.folders.toString()
}
)

if (this.showHiddenItems && this.hiddenFolders) {
foldersStr = this.$ngettext(
'%{ foldersCount } folder including %{ foldersHiddenCount } hidden',
'%{ foldersCount } folders including %{ foldersHiddenCount } hidden',
this.folders,
{
foldersCount: this.folders.toString(),
foldersHiddenCount: this.hiddenFolders.toString()
}
)
}

const spacesStr = this.$ngettext(
'%{ spacesCount } space',
'%{ spacesCount } spaces',
Expand Down
9 changes: 7 additions & 2 deletions packages/web-app-files/src/views/spaces/GenericSpace.vue
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,11 @@
v-if="paginatedResources.length > 0"
class="oc-width-1-1 oc-my-s"
:files="totalResourcesCount.files"
:hidden-files="totalResourcesCount.hiddenFiles"
:folders="totalResourcesCount.folders"
:hidden-folders="totalResourcesCount.hiddenFolders"
:size="totalResourcesSize"
:show-hidden-items="!areHiddenFilesShown"
/>
</template>
<template #quickActions="{ resource }">
Expand Down Expand Up @@ -257,7 +260,8 @@ export default defineComponent({

const resourcesStore = useResourcesStore()
const { removeResources, resetSelection, updateResourceField } = resourcesStore
const { currentFolder, totalResourcesCount, totalResourcesSize } = storeToRefs(resourcesStore)
const { currentFolder, totalResourcesCount, totalResourcesSize, areHiddenFilesShown } =
storeToRefs(resourcesStore)

let loadResourcesEventToken: string

Expand Down Expand Up @@ -544,7 +548,8 @@ export default defineComponent({
totalResourcesSize,
removeResources,
resetSelection,
updateResourceField
updateResourceField,
areHiddenFilesShown
}
},

Expand Down
8 changes: 8 additions & 0 deletions packages/web-pkg/src/composables/piniaStores/resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,20 @@ export const useResourcesStore = defineStore('resources', () => {

const totalResourcesCount = computed(() => {
const fileCount = unref(resources).filter(({ type }) => type === 'file').length
const hiddenFileCount = unref(resources).filter(
({ type, name }) => type === 'file' && name.startsWith('.')
).length
const folderCount = unref(resources).filter(({ type }) => type === 'folder').length
const hiddenFolderCount = unref(resources).filter(
({ type, name }) => type === 'folder' && name.startsWith('.')
).length
const spaceCount = unref(resources).filter(isProjectSpaceResource).length

return {
files: fileCount,
hiddenFiles: hiddenFileCount,
folders: folderCount,
hiddenFolders: hiddenFolderCount,
spaces: spaceCount
}
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Feature: check files pagination in personal space
| .hidden-testFile.txt | This is a hidden file. |
And "Alice" opens the "files" app
When "Alice" navigates to page "2" of the personal space files view
Then "Alice" should see the text "111 items with 1 kB in total (56 files, 55 folders)" at the footer of the page
Then "Alice" should see the text "111 items with 1 kB in total (56 files including 1 hidden, 55 folders)" at the footer of the page
And "Alice" should see 10 resources in the personal space files view
When "Alice" enables the option to display the hidden file
Then "Alice" should see 11 resources in the personal space files view
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/cucumber/features/spaces/pagination.feature
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Feature: check files pagination in project space
| .hidden-testFile.txt | This is a hidden file. |
And "Alice" navigates to the project space "dev.1"
When "Alice" navigates to page "2" of the project space files view
Then "Alice" should see the text "112 items with 1 kB in total (56 files, 56 folders)" at the footer of the page
Then "Alice" should see the text "112 items with 1 kB in total (56 files including 1 hidden, 56 folders including 1 hidden)" at the footer of the page
And "Alice" should see 10 resources in the project space files view
When "Alice" enables the option to display the hidden file
Then "Alice" should see 12 resources in the project space files view
Expand Down