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

Fix multi-select in spaces view #8404

Merged
merged 1 commit into from
Feb 9, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/unreleased/enhancement-resources-tiles-view
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Tiles can be dynamically resized on screens bigger than mobile, using the "displ
https://github.com/owncloud/web/pull/7991
https://github.com/owncloud/web/pull/8372
https://github.com/owncloud/web/pull/8392
https://github.com/owncloud/web/pull/8404
https://github.com/owncloud/web/issues/6378
https://github.com/owncloud/web/issues/6379
https://github.com/owncloud/web/issues/6380
Expand Down
9 changes: 1 addition & 8 deletions packages/web-app-files/src/components/AppBar/CreateSpace.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,7 @@ export default defineComponent({
methods: {
...mapActions(['showMessage', 'createModal', 'hideModal', 'setModalInputErrorMessage']),
...mapMutations('runtime/spaces', ['UPSERT_SPACE']),
...mapMutations('Files', [
'SET_CURRENT_FOLDER',
'LOAD_FILES',
'CLEAR_CURRENT_FILES_LIST',
'SET_FILE_SELECTION',
'UPSERT_RESOURCE',
'UPDATE_RESOURCE_FIELD'
]),
...mapMutations('Files', ['UPSERT_RESOURCE', 'UPDATE_RESOURCE_FIELD']),

showCreateSpaceModal() {
const modal = {
Expand Down
3 changes: 2 additions & 1 deletion packages/web-app-files/src/components/SideBar/SideBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ export default defineComponent({
const panel = panelGenerator({
capabilities: store.getters.capabilities,
resource: unref(loadedResource),
selectedFiles: unref(selectedFiles),
router,
multipleSelection: unref(areMultipleSelected),
rootFolder: unref(isRootFolder),
Expand All @@ -206,7 +207,7 @@ export default defineComponent({
})

const getSelectedResource = () => {
if (unref(highlightedFileIsSpace) && unref(selectedFiles).length) {
if (unref(highlightedFileIsSpace) && unref(selectedFiles).length === 1) {
return unref(highlightedSpace)
}
if (unref(selectedFiles).length === 1) {
Expand Down
25 changes: 20 additions & 5 deletions packages/web-app-files/src/fileSideBars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { Panel } from '../../web-pkg/src/components/sideBar'

import { Resource, User } from 'web-client'
import { Router } from 'vue-router'
import SpaceDetailsMultiple from 'web-pkg/src/components/sideBar/Spaces/Details/SpaceDetailsMultiple.vue'

function $gettext(msg: string): string {
return msg
Expand All @@ -28,13 +29,15 @@ function $gettext(msg: string): string {
const panelGenerators: (({
rootFolder,
resource,
selectedFiles,
router,
multipleSelection,
user,
capabilities
}: {
rootFolder: boolean
resource: Resource
selectedFiles: Resource[]
router: Router
multipleSelection: boolean
user: User
Expand All @@ -56,16 +59,15 @@ const panelGenerators: (({
)
}
}),
({ router, rootFolder, resource }): Panel => ({
({ router, resource, multipleSelection }): Panel => ({
app: 'no-selection',
icon: 'questionnaire-line',
title: $gettext('Details'),
component: SpaceNoSelection,
default: () => true,
get enabled() {
return (
isLocationSpacesActive(router, 'files-spaces-projects') &&
(!resource || (rootFolder && resource?.type !== 'space'))
isLocationSpacesActive(router, 'files-spaces-projects') && !multipleSelection && !resource
)
}
}),
Expand All @@ -85,7 +87,7 @@ const panelGenerators: (({
)
}
}),
({ multipleSelection, rootFolder, resource, router }) => ({
({ multipleSelection, router }) => ({
app: 'details-multiple',
icon: 'questionnaire-line',
title: $gettext('Details'),
Expand All @@ -101,7 +103,20 @@ const panelGenerators: (({
},
default: () => true,
get enabled() {
return multipleSelection && (!rootFolder || resource?.type === 'space')
return multipleSelection && !isLocationSpacesActive(router, 'files-spaces-projects')
}
}),
({ multipleSelection, selectedFiles, router }) => ({
app: 'details-space-multiple',
icon: 'questionnaire-line',
title: $gettext('Details'),
component: SpaceDetailsMultiple,
componentAttrs: {
selectedSpaces: selectedFiles
},
default: () => true,
get enabled() {
return multipleSelection && isLocationSpacesActive(router, 'files-spaces-projects')
}
}),
({ multipleSelection, resource }) => ({
Expand Down
3 changes: 3 additions & 0 deletions packages/web-app-files/src/mixins/actions/copy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ export default {
) {
return false
}
if (isLocationSpacesActive(this.$router, 'files-spaces-projects')) {
return false
}
if (resources.length === 0) {
return false
}
Expand Down
3 changes: 3 additions & 0 deletions packages/web-app-files/src/mixins/actions/downloadArchive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ export default {
) {
return false
}
if (isLocationSpacesActive(this.$router, 'files-spaces-projects')) {
return false
}
if (resources.length === 0) {
return false
}
Expand Down
1 change: 1 addition & 0 deletions packages/web-app-files/src/views/spaces/Projects.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
:has-view-options="false"
:has-sidebar-toggle="true"
:show-actions-on-selection="true"
:has-bulk-actions="true"
:side-bar-open="sideBarOpen"
>
<template #actions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ exports[`Projects view different files view states lists all available project s
<div class="oc-flex">
<div class="files-view-wrapper oc-width-expand">
<div id="files-view">
<app-bar-stub breadcrumbs="[object Object]" breadcrumbscontextactionsitems="" displayviewmodeswitch="false" hasbulkactions="false" hassharesnavigation="false" hassidebartoggle="true" hasviewoptions="false" showactionsonselection="true" sidebaropen="false"></app-bar-stub>
<app-bar-stub breadcrumbs="[object Object]" breadcrumbscontextactionsitems="" displayviewmodeswitch="false" hasbulkactions="true" hassharesnavigation="false" hassidebartoggle="true" hasviewoptions="false" showactionsonselection="true" sidebaropen="false"></app-bar-stub>
<div class="spaces-list oc-px-m oc-mt-l">
<div>
<ul class="oc-list oc-my-rm oc-mx-rm oc-tiles oc-flex">
Expand Down