From 84ac435d18818b65ce26990269c294f5707b88b6 Mon Sep 17 00:00:00 2001 From: Jan Date: Wed, 16 Aug 2023 13:39:42 +0200 Subject: [PATCH] Handle processing items (#9561) --- .../enhancement-indicate-processig-state | 8 ++++ .../src/components/OcTable/OcTable.vue | 5 ++- .../src/components/OcTile/OcTile.vue | 8 ++++ .../__snapshots__/SpacesList.spec.ts.snap | 2 +- .../components/FilesList/ResourceTable.vue | 38 +++++++++++++++---- .../src/components/Search/Preview.vue | 11 +++++- .../useKeyboardTableMouseActions.ts | 7 +++- .../useKeyboardTableNavigation.ts | 17 ++++++++- .../src/composables/scrollTo/useScrollTo.ts | 2 +- .../web-app-files/src/helpers/resources.ts | 3 +- .../trash/__snapshots__/Overview.spec.ts.snap | 2 +- .../web-app-search/src/portals/SearchBar.vue | 11 ++++-- .../src/helpers/resource/functions.ts | 1 - 13 files changed, 90 insertions(+), 25 deletions(-) create mode 100644 changelog/unreleased/enhancement-indicate-processig-state diff --git a/changelog/unreleased/enhancement-indicate-processig-state b/changelog/unreleased/enhancement-indicate-processig-state new file mode 100644 index 00000000000..e2ac6cddd23 --- /dev/null +++ b/changelog/unreleased/enhancement-indicate-processig-state @@ -0,0 +1,8 @@ +Enhancement: Indicate processing state + +If a file has been just recently uploaded, it might go trough a processing state (e.G virus scan). +If so, no actions on this resource is possible, therefore we show now the processing state and make +the temporary restrictions clear to the user. + +https://github.com/owncloud/web/pull/9561 +https://github.com/owncloud/web/issues/9558 diff --git a/packages/design-system/src/components/OcTable/OcTable.vue b/packages/design-system/src/components/OcTable/OcTable.vue index 8a9246c9a90..a731c4e98d2 100644 --- a/packages/design-system/src/components/OcTable/OcTable.vue +++ b/packages/design-system/src/components/OcTable/OcTable.vue @@ -1,5 +1,5 @@ - diff --git a/packages/web-app-files/src/composables/keyboardActions/useKeyboardTableMouseActions.ts b/packages/web-app-files/src/composables/keyboardActions/useKeyboardTableMouseActions.ts index 270e85b99cb..b9d898aa9ff 100644 --- a/packages/web-app-files/src/composables/keyboardActions/useKeyboardTableMouseActions.ts +++ b/packages/web-app-files/src/composables/keyboardActions/useKeyboardTableMouseActions.ts @@ -36,7 +36,8 @@ export const useKeyboardTableMouseActions = ( for (let i = minIndex; i <= maxIndex; i++) { const nodeId = resourceNodes[i].getAttribute('data-item-id') - if (skipTargetSelection && nodeId === resource.id) { + const isDisabled = resourceNodes[i].classList.contains('oc-table-disabled') + if ((skipTargetSelection && nodeId === resource.id) || isDisabled) { continue } store.commit('Files/ADD_FILE_SELECTION', { id: nodeId }) @@ -59,7 +60,9 @@ export const useKeyboardTableMouseActions = ( for (let i = minIndex; i <= maxIndex; i++) { const nodeId = tilesListCard[i].getAttribute('data-item-id') - if (skipTargetSelection && nodeId === resource.id) { + const isDisabled = tilesListCard[i].classList.contains('oc-tile-card-disabled') + + if ((skipTargetSelection && nodeId === resource.id) || isDisabled) { continue } store.commit('Files/ADD_FILE_SELECTION', { id: nodeId }) diff --git a/packages/web-app-files/src/composables/keyboardActions/useKeyboardTableNavigation.ts b/packages/web-app-files/src/composables/keyboardActions/useKeyboardTableNavigation.ts index d0f4d8f6568..c80dcdd2ccd 100644 --- a/packages/web-app-files/src/composables/keyboardActions/useKeyboardTableNavigation.ts +++ b/packages/web-app-files/src/composables/keyboardActions/useKeyboardTableNavigation.ts @@ -131,7 +131,17 @@ export const useKeyboardTableNavigation = ( if (latestSelectedResourceIndex === -1) { return -1 } - const nextResourceIndex = latestSelectedResourceIndex + (previous ? -movedBy : movedBy) + + const step = previous ? -movedBy : movedBy + let nextResourceIndex = latestSelectedResourceIndex + step + + while (nextResourceIndex >= 0 && nextResourceIndex < paginatedResources.value.length) { + if (paginatedResources.value[nextResourceIndex].processing !== true) { + return paginatedResources.value[nextResourceIndex].id + } + nextResourceIndex += step + } + if (nextResourceIndex < 0 || nextResourceIndex >= paginatedResources.value.length) { return -1 } @@ -162,7 +172,10 @@ export const useKeyboardTableNavigation = ( const handleSelectAllAction = () => { keyActions.resetSelectionCursor() - store.commit('Files/SET_FILE_SELECTION', paginatedResources.value) + store.commit( + 'Files/SET_FILE_SELECTION', + unref(paginatedResources).filter((resource) => resource.processing !== true) + ) } const getVerticalProperties = (viewDirection: Direction) => { diff --git a/packages/web-app-files/src/composables/scrollTo/useScrollTo.ts b/packages/web-app-files/src/composables/scrollTo/useScrollTo.ts index 9362c44f462..1a7aaa5044a 100644 --- a/packages/web-app-files/src/composables/scrollTo/useScrollTo.ts +++ b/packages/web-app-files/src/composables/scrollTo/useScrollTo.ts @@ -50,7 +50,7 @@ export const useScrollTo = (): ScrollToResult => { } const resource = unref(resources).find((r) => r.id === unref(scrollTo)) - if (resource) { + if (resource && resource.processing !== true) { store.commit('Files/SET_FILE_SELECTION', [resource]) scrollToResource(resource.id, { forceScroll: true }) diff --git a/packages/web-app-files/src/helpers/resources.ts b/packages/web-app-files/src/helpers/resources.ts index b270d5b115a..900c40ea7a4 100644 --- a/packages/web-app-files/src/helpers/resources.ts +++ b/packages/web-app-files/src/helpers/resources.ts @@ -168,7 +168,8 @@ export function buildSharedResource( indicators: [], tags: [], path: undefined, - webDavPath: undefined + webDavPath: undefined, + processing: share.processing || false } if (incomingShares) { diff --git a/packages/web-app-files/tests/unit/views/trash/__snapshots__/Overview.spec.ts.snap b/packages/web-app-files/tests/unit/views/trash/__snapshots__/Overview.spec.ts.snap index b724ecdcca8..1809d454645 100644 --- a/packages/web-app-files/tests/unit/views/trash/__snapshots__/Overview.spec.ts.snap +++ b/packages/web-app-files/tests/unit/views/trash/__snapshots__/Overview.spec.ts.snap @@ -14,7 +14,7 @@ exports[`TrashOverview view states should render spaces list 1`] = ` - +
diff --git a/packages/web-app-search/src/portals/SearchBar.vue b/packages/web-app-search/src/portals/SearchBar.vue index bb12f9db29b..20b059ff01d 100644 --- a/packages/web-app-search/src/portals/SearchBar.vue +++ b/packages/web-app-search/src/portals/SearchBar.vue @@ -570,12 +570,13 @@ export default defineComponent({ } ul { - li.provider { - padding: 0; + li.provider-details, + li.loading, + li#no-results { + padding: var(--oc-space-xsmall) var(--oc-space-small); } li { - padding: var(--oc-space-xsmall) var(--oc-space-small); position: relative; font-size: var(--oc-font-size-small); @@ -583,8 +584,10 @@ export default defineComponent({ font-size: var(--oc-font-size-xsmall); } - &.preview { + &.preview > * { min-height: 44px; + font-size: inherit; + padding: var(--oc-space-xsmall) var(--oc-space-small); &:hover, &.active { diff --git a/packages/web-client/src/helpers/resource/functions.ts b/packages/web-client/src/helpers/resource/functions.ts index 7346d5ae83d..84bb928a3d5 100644 --- a/packages/web-client/src/helpers/resource/functions.ts +++ b/packages/web-client/src/helpers/resource/functions.ts @@ -85,7 +85,6 @@ export function buildResource(resource): Resource { if (!resourcePath.startsWith('/')) { resourcePath = `/${resourcePath}` } - const id = resource.fileInfo[DavProperty.FileId] const r = { id,