-
+
{{ formDateFromNow(item.deleteTimestamp) }}
@@ -58,6 +60,7 @@
import { mapGetters, mapActions } from 'vuex'
import Mixins from '../mixins'
import FileList from './FileList.vue'
+import FileItem from './FileItem.vue'
import NoContentMessage from './NoContentMessage.vue'
import OcDialogPrompt from './ocDialogPrompt.vue'
import SortableColumnHeader from './FilesLists/SortableColumnHeader.vue'
@@ -69,6 +72,7 @@ export default {
components: {
OcDialogPrompt,
FileList,
+ FileItem,
NoContentMessage,
SortableColumnHeader
},
diff --git a/apps/files/src/mixins.js b/apps/files/src/mixins.js
index 76892e795c6..0dcf9fc0e03 100644
--- a/apps/files/src/mixins.js
+++ b/apps/files/src/mixins.js
@@ -46,6 +46,21 @@ export default {
_sidebarOpen () {
return this.highlightedFile !== null
+ },
+
+ requestHeaders () {
+ if (!this.publicPage()) {
+ return null
+ }
+
+ const headers = new Headers()
+ headers.append('X-Requested-With', 'XMLHttpRequest')
+
+ const password = this.publicLinkPassword
+ if (password) {
+ headers.append('Authorization', 'Basic ' + Buffer.from('public:' + password).toString('base64'))
+ }
+ return headers
}
},
methods: {
diff --git a/apps/files/src/store/mutations.js b/apps/files/src/store/mutations.js
index 1cfd0895569..18e04be5571 100644
--- a/apps/files/src/store/mutations.js
+++ b/apps/files/src/store/mutations.js
@@ -265,6 +265,12 @@ export default {
CLEAR_CURRENT_FILES_LIST (state) {
state.currentFolder = null
+ // release blob urls
+ state.files.forEach(item => {
+ if (item.previewUrl && item.previewUrl.startsWith('blob:')) {
+ window.URL.revokeObjectURL(item.previewUrl)
+ }
+ })
state.files = []
}
}
diff --git a/changelog/unreleased/276 b/changelog/unreleased/276
new file mode 100644
index 00000000000..87cb3cb87fd
--- /dev/null
+++ b/changelog/unreleased/276
@@ -0,0 +1,7 @@
+Enhancement: Added thumbnails in file list
+
+Thumbnails are now displayed in the file list for known file types.
+When no thumbnail was returned, fall back to the file type icon.
+
+https://github.com/owncloud/phoenix/issues/276
+https://github.com/owncloud/phoenix/pull/3187
diff --git a/tests/acceptance/features/webUIFiles/fileList.feature b/tests/acceptance/features/webUIFiles/fileList.feature
index 7169415c9da..79037f14035 100644
--- a/tests/acceptance/features/webUIFiles/fileList.feature
+++ b/tests/acceptance/features/webUIFiles/fileList.feature
@@ -18,3 +18,13 @@ Feature: User can view files inside a folder
And the user opens folder "empty-thing" directly on the webUI
Then there should be no resources listed on the webUI
+ @issue-276
+ Scenario: Thumbnails are loaded for known file types
+ When the user uploads file "new-lorem.txt" using the webUI
+ Then the resource "new-lorem.txt" should have a thumbnail displayed on the webUI
+
+ @issue-276
+ Scenario: Thumbnails are not loaded for known file types
+ When the user uploads file "new-data.zip" using the webUI
+ Then the resource "new-data.zip" should have a file type icon displayed on the webUI
+
diff --git a/tests/acceptance/features/webUISharingPublic/shareByPublicLink.feature b/tests/acceptance/features/webUISharingPublic/shareByPublicLink.feature
index c5e839f55db..76fc8471e39 100644
--- a/tests/acceptance/features/webUISharingPublic/shareByPublicLink.feature
+++ b/tests/acceptance/features/webUISharingPublic/shareByPublicLink.feature
@@ -39,6 +39,20 @@ Feature: Share by public link
| simple-folder | Public |
But file "data.zip" should not be listed on the webUI
+ @issue-276
+ Scenario: Thumbnails are loaded for known file types in public link file list
+ Given user "user1" has shared folder "simple-folder" with link with "read,create" permissions
+ When the public uses the webUI to access the last public link created by user "user1"
+ And the user uploads file "new-lorem.txt" using the webUI
+ Then the resource "new-lorem.txt" should have a thumbnail displayed on the webUI
+
+ @issue-276
+ Scenario: Thumbnails are not loaded for known file types in public link file list
+ Given user "user1" has shared folder "simple-folder" with link with "read,create" permissions
+ When the public uses the webUI to access the last public link created by user "user1"
+ And the user uploads file "new-data.zip" using the webUI
+ Then the resource "new-data.zip" should have a file type icon displayed on the webUI
+
Scenario: opening public-link page of the files-drop link protected with password should redirect to files-drop page
Given user "user1" has shared folder "simple-folder" with link with "create" permissions and password "pass123"
When the public tries to open the public link page of the last public link created by user "user1" with password "pass123"
diff --git a/tests/acceptance/pageObjects/FilesPageElement/filesList.js b/tests/acceptance/pageObjects/FilesPageElement/filesList.js
index 0f724a7afd0..fbb15c0b8c6 100644
--- a/tests/acceptance/pageObjects/FilesPageElement/filesList.js
+++ b/tests/acceptance/pageObjects/FilesPageElement/filesList.js
@@ -368,6 +368,37 @@ module.exports = {
.useCss()
return this
},
+ getResourceThumbnail: async function (resourceName) {
+ const fileRowPreviewSelector = this.getFileRowSelectorByFileName(resourceName) + this.elements.filePreviewInFileRow.selector
+ const fileRowIconSelector = this.getFileRowSelectorByFileName(resourceName) + this.elements.fileIconInFileRow.selector
+ let iconUrl = null
+ await this.waitForFileVisible(resourceName)
+ // while the preview is loading, it will first display the file type icon,
+ // so we might misdetect if we don't wait long enough
+ await this.useXpath()
+ .getAttribute(
+ {
+ selector: fileRowPreviewSelector,
+ timeout: 5000,
+ suppressNotFoundErrors: true
+ },
+ 'src',
+ (result) => {
+ // somehow when element was not found the result.value is an empty array...
+ if (result.status !== -1 && typeof result.value === 'string') {
+ iconUrl = result.value
+ }
+ }
+ )
+ .useCss()
+ if (!iconUrl) {
+ // check that at least the file type icon svg is displayed
+ await this.useXpath()
+ .waitForElementVisible(fileRowIconSelector)
+ .useCss()
+ }
+ return iconUrl
+ },
/**
* Wait for A filerow with given path to be visible
* This only works in the favorites page as it uses the whole path of a file rather than just the name
@@ -719,6 +750,12 @@ module.exports = {
fileLinkInFileRow: {
selector: '//span[contains(@class, "file-row-name")]'
},
+ fileIconInFileRow: {
+ selector: '//span[contains(@class, "file-row-name")]//*[local-name() = "svg"]'
+ },
+ filePreviewInFileRow: {
+ selector: '//span[contains(@class, "file-row-name")]//img'
+ },
notMarkedFavoriteInFileRow: {
selector: '//span[contains(@class, "oc-star-dimm")]',
locateStrategy: 'xpath'
diff --git a/tests/acceptance/stepDefinitions/filesContext.js b/tests/acceptance/stepDefinitions/filesContext.js
index 71fecd4bc17..ae626b03034 100644
--- a/tests/acceptance/stepDefinitions/filesContext.js
+++ b/tests/acceptance/stepDefinitions/filesContext.js
@@ -926,3 +926,17 @@ When('the user has set the sort order of the {string} column to descending order
When('the user has set the sort order of the {string} column to ascending order', async function (column) {
await _setFilesTableSort(column, false)
})
+Then('the file/folder/resource {string} should have a thumbnail displayed on the webUI', async function (resource) {
+ const iconUrl = await client
+ .page
+ .FilesPageElement.filesList()
+ .getResourceThumbnail(resource)
+ assert.ok(iconUrl && iconUrl.startsWith('blob:'), 'Icon URL expected to be set when thumbnail is displayed')
+})
+Then('the file/folder/resource {string} should have a file type icon displayed on the webUI', async function (resource) {
+ const iconUrl = await client
+ .page
+ .FilesPageElement.filesList()
+ .getResourceThumbnail(resource)
+ assert.strictEqual(null, iconUrl, 'No icon URL expected when file type icon is displayed')
+})