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

Handle processing items #9561

Merged
merged 24 commits into from
Aug 16, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions changelog/unreleased/enhancement-indicate-processig-state
Original file line number Diff line number Diff line change
@@ -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
5 changes: 3 additions & 2 deletions packages/design-system/src/components/OcTable/OcTable.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<table v-bind="extractTableProps()">
<table v-bind="extractTableProps()" class="has-item-context-menu">
AlexAndBear marked this conversation as resolved.
Show resolved Hide resolved
<oc-thead v-if="hasHeader">
<oc-tr class="oc-table-header-row">
<oc-th
Expand Down Expand Up @@ -596,7 +596,8 @@ export default defineComponent({

&-disabled {
background-color: var(--oc-color-background-muted);
opacity: 0.8;
opacity: 0.7;
filter: grayscale(0.6);
pointer-events: none;
}

Expand Down
8 changes: 8 additions & 0 deletions packages/design-system/src/components/OcTile/OcTile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
:data-item-id="resource.id"
:class="{
'oc-tile-card-selected': isResourceSelected,
'oc-tile-card-disabled': resource.processing,
'state-trashed': resource.disabled
}"
@contextmenu="$emit('contextmenu', $event)"
Expand Down Expand Up @@ -125,6 +126,13 @@ export default defineComponent({
flex-flow: column;
outline: 1px solid var(--oc-color-border);

&-disabled {
pointer-events: none;
background-color: var(--oc-color-background-muted) !important;
opacity: 0.7;
filter: grayscale(0.6);
}

&.state-trashed {
cursor: pointer;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ exports[`SpacesList should render all spaces in a table 1`] = `
</div>
<!--v-if-->
</div>
<table class="oc-table oc-table-hover oc-table-sticky spaces-table">
<table class="oc-table oc-table-hover oc-table-sticky has-item-context-menu spaces-table">
<thead class="oc-thead">
<tr class="oc-table-header-row" tabindex="-1">
<th class="oc-table-cell oc-table-cell-align-left oc-table-cell-align-middle oc-table-cell-width-shrink oc-text-nowrap oc-th oc-table-header-cell oc-table-header-cell-select oc-pl-s" style="top: 0px;">
Expand Down
38 changes: 30 additions & 8 deletions packages/web-app-files/src/components/FilesList/ResourceTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
:data="resources"
:fields="fields"
:highlighted="selectedIds"
:disabled="disabled"
:disabled="disabledResources"
:sticky="true"
:header-position="headerPosition"
:drag-drop="dragDrop"
Expand Down Expand Up @@ -209,7 +209,7 @@
</template>

<script lang="ts">
import { defineComponent, PropType, computed, unref, ref } from 'vue'
import { defineComponent, PropType, computed, unref, ref, ComputedRef } from 'vue'
import { mapGetters, mapActions, mapState } from 'vuex'
import { basename, dirname } from 'path'
import { useWindowSize } from '@vueuse/core'
Expand Down Expand Up @@ -351,7 +351,7 @@ export default defineComponent({
* The ids of disabled resources. Null or an empty string/array for no disabled resources.
*/
disabled: {
type: [String, Array],
type: [String, Array] as PropType<Array<Resource['id']>>,
required: false,
default: null
},
Expand Down Expand Up @@ -458,12 +458,31 @@ export default defineComponent({

const getTagToolTip = (text: string) => (text.length > 7 ? text : '')

const disabledResources: ComputedRef<Array<Resource['id']>> = computed(() => {
let disabled = props.disabled

if (disabled) {
if (!Array.isArray(disabled)) {
disabled = [disabled]
}

return disabled
}
Comment on lines +464 to +470
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

coerce into array structure


return (
props.resources
?.filter((resource) => resource.processing === true)
?.map((resource) => resource.id) || []
)
})

return {
getTagToolTip,
renameActions,
renameHandler,
ViewModeConstants,
hasTags,
disabledResources,
hasShareJail: useCapabilityShareJailEnabled(),
hasProjectSpaces: useCapabilityProjectSpacesEnabled(),
isUserContext: useUserContext({ store }),
Expand Down Expand Up @@ -683,7 +702,7 @@ export default defineComponent({
return this.configuration?.options?.displayResourcesLazy
},
areAllResourcesSelected() {
return this.selectedResources.length === this.resources.length
return this.selectedResources.length === this.resources.length - this.disabledResources.length
},
selectedResources() {
return this.resources.filter((resource) => this.selectedIds.includes(resource.id))
Expand Down Expand Up @@ -883,7 +902,11 @@ export default defineComponent({
if (this.areAllResourcesSelected) {
return this.emitSelect([])
}
this.emitSelect(this.resources.map((resource) => resource.id))
this.emitSelect(
this.resources
.filter((resource) => !this.disabledResources.includes(resource.id))
.map((resource) => resource.id)
)
},
emitFileClick(resource) {
const space = this.getMatchingSpace(resource)
Expand All @@ -898,9 +921,8 @@ export default defineComponent({
if (!this.areResourcesClickable) {
return false
}
return Array.isArray(this.disabled)
? !this.disabled.includes(resourceId)
: this.disabled !== resourceId

return !this.disabledResources.includes(resourceId)
},
getResourceCheckboxLabel(resource) {
if (resource.type === 'folder') {
Expand Down
11 changes: 9 additions & 2 deletions packages/web-app-files/src/components/Search/Preview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
:type="resource.isFolder ? 'router-link' : 'button'"
justify-content="left"
class="files-search-preview oc-flex oc-width-1-1"
:class="{ 'files-search-preview-disabled': resource.processing }"
appearance="raw"
v-bind="attrs"
v-on="listeners"
Expand Down Expand Up @@ -205,8 +206,14 @@ export default defineComponent({
}
})
</script>
<style lang="scss">

<style lang="scss" scoped>
.files-search-preview {
font-size: inherit;
&-disabled {
pointer-events: none;
background-color: var(--oc-color-background-muted);
opacity: 0.7;
filter: grayscale(0.6);
}
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -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 })
Expand All @@ -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 })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 })

Expand Down
3 changes: 2 additions & 1 deletion packages/web-app-files/src/helpers/resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@ export function buildSharedResource(
indicators: [],
tags: [],
path: undefined,
webDavPath: undefined
webDavPath: undefined,
processing: share.processing || false
}

if (incomingShares) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ exports[`TrashOverview view states should render spaces list 1`] = `
</div>
<!--v-if-->
</div>
<table class="oc-table oc-table-hover oc-table-sticky spaces-table">
<table class="oc-table oc-table-hover oc-table-sticky has-item-context-menu spaces-table">
<thead class="oc-thead">
<tr class="oc-table-header-row" tabindex="-1">
<th class="oc-table-cell oc-table-cell-align-left oc-table-cell-align-middle oc-table-cell-width-shrink oc-text-nowrap oc-th oc-table-header-cell oc-table-header-cell-icon oc-pl-s" style="top: 0px;">
Expand Down
11 changes: 7 additions & 4 deletions packages/web-app-search/src/portals/SearchBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -570,21 +570,24 @@ 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);

&.provider-details {
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 {
Expand Down
1 change: 0 additions & 1 deletion packages/web-client/src/helpers/resource/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ export function buildResource(resource): Resource {
if (!resourcePath.startsWith('/')) {
resourcePath = `/${resourcePath}`
}

const id = resource.fileInfo[DavProperty.FileId]
const r = {
id,
Expand Down