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

[full-ci] Display resources in GenericSpace as tiles #7991

Merged
merged 26 commits into from
Feb 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
aa1ad01
Rebase Proof-of-concept
pascalwengerter Jan 4, 2023
b4e2efd
Rebase after compat-mode-merge, alter approach of using ResourceTiles…
pascalwengerter Jan 9, 2023
16f2e5f
Extract contextMenu from Projects.vue to ResourceTiles, use on Generi…
pascalwengerter Jan 9, 2023
4eeb27f
Make lazy thumbnails work on ResourceTiles
pascalwengerter Jan 10, 2023
ac5a09f
Remove code leftover && make OcTile image top corners rounded
pascalwengerter Jan 10, 2023
d977e4b
Rebase and use 'displayPositionedDropdown' in ResourceTiles
pascalwengerter Jan 12, 2023
0c93dd6
Add initial box-shadow to OcTile
pascalwengerter Jan 12, 2023
924d91e
Make icon/thumbnail optional in OcResource
pascalwengerter Jan 16, 2023
8d604b8
Move tilesView to end of viewMode switcher options
pascalwengerter Jan 16, 2023
93b0df8
Make ImageDimension constant smaller, use it in Spaces-Projects view
pascalwengerter Jan 16, 2023
b603e0d
Hide icon/thumbnail in OcTile, replace box-shadow with outline, more …
pascalwengerter Jan 16, 2023
80bec7a
Add more related issues to tiles changelog item
pascalwengerter Jan 16, 2023
1aa2b64
Make tiles on non-projects views smaller by default
pascalwengerter Jan 16, 2023
851635e
Fix unit tests
pascalwengerter Jan 16, 2023
114a7ff
Rebase & update tile sizing/display
pascalwengerter Jan 17, 2023
3d04cea
Rebase, refactor useResourceRouteResolver composable file structure, …
pascalwengerter Jan 18, 2023
62ef059
Rebase & update snapshot tests
pascalwengerter Jan 25, 2023
13987f6
Rebase, change wording in changelog, update snapshot tests
pascalwengerter Jan 29, 2023
be50811
Reintroduce resourceTargetRouteCallback to make public link navigatio…
pascalwengerter Jan 30, 2023
7191e04
Make ResourceTile thumbnail preview work again after vue3 update
pascalwengerter Jan 30, 2023
9ef257e
Increase Tile ImageDimension
pascalwengerter Jan 31, 2023
9b014e3
Fix resourceRouteResolver usage in ResourceTable
pascalwengerter Jan 31, 2023
8eab9dc
Add basic E2E test for tiles viewMode
pascalwengerter Feb 1, 2023
bdd4dc2
Respect public/private context for loading thumbnails in GenericSpace
pascalwengerter Feb 1, 2023
a883c88
Fix tiles E2E test
pascalwengerter Feb 1, 2023
93e9d76
Fix resourceResolve for fileclick by passing current space to component
pascalwengerter Feb 1, 2023
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
2 changes: 1 addition & 1 deletion changelog/unreleased/enhancement-condensed-files-view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Enhancement: Add switch to enable condensed resource table

We've added a switch to have a more condensed resource table.
The change gets saved to the route and persisted across folder
The change gets saved to the url and persisted across folder
navigation in all files, spaces and favorites views.

https://github.com/owncloud/web/pull/7976
Expand Down
9 changes: 9 additions & 0 deletions changelog/unreleased/enhancement-resources-tiles-view
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Enhancement: Add tiles view for resource display

We've added a switch to change from the known resource table to a tiles view.
The change gets saved to the url and persisted across resource navigation.

https://github.com/owncloud/web/pull/7991
https://github.com/owncloud/web/issues/6378
https://github.com/owncloud/web/issues/6379
https://github.com/owncloud/web/issues/6380
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Enhancement: Add option to hide icon/thumbnail OcResource

We added a property to the OcResource component so it can be displayed without icon/thumbnail.

https://github.com/owncloud/web/pull/7991
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,20 @@ describe('OcResource', () => {

expect(wrapper.html()).toMatchSnapshot()
})

it('can be used without icon/thumbnail', () => {
const wrapper = mount(Resource, {
props: {
resource: fileResourceWithoutParentFoldername,
isIconDisplayed: false,
parentFolderNameDefault: 'Example parent folder name'
},
global: {
stubs
}
})

expect(wrapper.find('oc-resource-thumbnail').exists()).toBeFalsy()
expect(wrapper.find('oc-resource-icon').exists()).toBeFalsy()
})
})
12 changes: 10 additions & 2 deletions packages/design-system/src/components/OcResource/OcResource.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<template>
<div class="oc-resource oc-text-overflow">
<oc-resource-link
v-if="isIconDisplayed"
:resource="resource"
:is-resource-clickable="isResourceClickable"
:folder-link="folderLink"
Expand All @@ -16,7 +17,7 @@
/>
<oc-resource-icon v-else :resource="resource" />
</oc-resource-link>
<div class="oc-resource-details oc-text-overflow">
<div class="oc-resource-details oc-text-overflow" :class="{ 'oc-pl-s': isIconDisplayed }">
<oc-resource-link
v-slot="{ opensInNewWindowDescriptionId }"
:resource="resource"
Expand Down Expand Up @@ -139,6 +140,14 @@ export default defineComponent({
required: false,
default: true
},
/**
* Asserts whether the resource thumbnail should be displayed
*/
isIconDisplayed: {
type: Boolean,
required: false,
default: true
},
/**
* Asserts whether clicking on the resource name triggers any action
*/
Expand Down Expand Up @@ -206,7 +215,6 @@ export default defineComponent({

&-details {
display: block;
padding-left: var(--oc-space-small);

a {
text-decoration: none;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ exports[`OcResource displays parent folder name default if calculated name is em
<!---->
</span>
</button>
<div class="oc-resource-details oc-text-overflow">
<div class="oc-resource-details oc-text-overflow oc-pl-s">
<button class="oc-button oc-rounded oc-button-m oc-button-justify-content-left oc-button-gap-undefined oc-button-passive oc-button-passive-raw oc-text-overflow" draggable="false" type="button">
<!-- @slot Content of the button -->
<!--v-if-->
Expand Down
29 changes: 19 additions & 10 deletions packages/design-system/src/components/OcTile/OcTile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
class="oc-card-media-top oc-border-b oc-flex oc-flex-center oc-flex-middle"
:resource="resource"
:folder-link="resourceRoute"
@click="$emit('click', $event)"
@click="$emit('click')"
>
<oc-tag
v-if="resource.disabled"
Expand All @@ -20,27 +20,34 @@
</oc-tag>
<!-- Slot for resource image, renders resource type icon by default -->
<slot name="imageField" :item="resource">
<oc-img v-if="resource.thumbnail" class="tile-preview" :src="resource.thumbnail" />
<oc-img
v-if="resource.thumbnail"
class="tile-preview oc-rounded-top"
:src="resource.thumbnail"
/>
<oc-resource-icon
v-else
:resource="resource"
size="xxlarge"
class="tile-default-image oc-p-m"
class="tile-default-image oc-pt-s"
/>
</slot>
</oc-resource-link>
<div class="oc-card-body oc-p-s">
<div class="oc-flex oc-flex-between oc-flex-middle">
<div class="oc-flex oc-flex-middle oc-text-truncate">
<div class="oc-flex oc-flex-middle oc-text-truncate resource-name-wrapper">
<oc-resource
:resource="resource"
:is-icon-displayed="false"
:folder-link="resourceRoute"
@click="$emit('click', $event)"
@click="$emit('click')"
/>
</div>
<div class="oc-flex oc-flex-middle">
<!-- Slot for individual actions -->
<slot name="actions" :item="resource" />
<!-- Slot for contextmenu -->
<slot name="contextMenu" :item="resource" />
</div>
</div>
<p
Expand Down Expand Up @@ -93,9 +100,10 @@ export default defineComponent({

<style lang="scss" scoped>
.oc-tile-card {
box-shadow: none !important;
background-color: var(--oc-color-background-highlight) !important;
box-shadow: none !important;
height: 100%;
outline: 1px solid var(--oc-color-border);

&.state-trashed {
cursor: pointer;
Expand All @@ -121,16 +129,17 @@ export default defineComponent({
}

.tile-preview {
min-width: 252px;
height: auto;
aspect-ratio: 16/9;
height: auto;
object-fit: cover;
width: 100%;
}
}

.resource-name {
overflow: hidden;
.resource-name-wrapper {
color: var(--oc-color-text-default);
max-width: 70%;
overflow: hidden;
}
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@ exports[`OcTile component renders default space correctly 1`] = `
<oc-resource-link-stub class="oc-card-media-top oc-border-b oc-flex oc-flex-center oc-flex-middle" isresourceclickable="true" resource="[object Object]">
<!--v-if-->
<!-- Slot for resource image, renders resource type icon by default -->
<oc-resource-icon-stub class="tile-default-image oc-p-m" resource="[object Object]" size="xxlarge"></oc-resource-icon-stub>
<oc-resource-icon-stub class="tile-default-image oc-pt-s" resource="[object Object]" size="xxlarge"></oc-resource-icon-stub>
</oc-resource-link-stub>
<div class="oc-card-body oc-p-s">
<div class="oc-flex oc-flex-between oc-flex-middle">
<div class="oc-flex oc-flex-middle oc-text-truncate">
<oc-resource-stub isextensiondisplayed="true" ispathdisplayed="false" isresourceclickable="true" isthumbnaildisplayed="true" parentfoldernamedefault="" resource="[object Object]"></oc-resource-stub>
<div class="oc-flex oc-flex-middle oc-text-truncate resource-name-wrapper">
<oc-resource-stub isextensiondisplayed="true" isicondisplayed="false" ispathdisplayed="false" isresourceclickable="true" isthumbnaildisplayed="true" parentfoldernamedefault="" resource="[object Object]"></oc-resource-stub>
</div>
<div class="oc-flex oc-flex-middle">
<!-- Slot for individual actions -->
<!-- Slot for contextmenu -->
</div>
</div>
<!--v-if-->
Expand All @@ -27,15 +28,16 @@ exports[`OcTile component renders disabled space correctly 1`] = `
<oc-tag-stub class="resource-disabled-indicator oc-position-absolute" rounded="false" size="medium" type="span">
<span>Disabled</span>
</oc-tag-stub> <!-- Slot for resource image, renders resource type icon by default -->
<oc-resource-icon-stub class="tile-default-image oc-p-m" resource="[object Object]" size="xxlarge"></oc-resource-icon-stub>
<oc-resource-icon-stub class="tile-default-image oc-pt-s" resource="[object Object]" size="xxlarge"></oc-resource-icon-stub>
</oc-resource-link-stub>
<div class="oc-card-body oc-p-s">
<div class="oc-flex oc-flex-between oc-flex-middle">
<div class="oc-flex oc-flex-middle oc-text-truncate">
<oc-resource-stub isextensiondisplayed="true" ispathdisplayed="false" isresourceclickable="true" isthumbnaildisplayed="true" parentfoldernamedefault="" resource="[object Object]"></oc-resource-stub>
<div class="oc-flex oc-flex-middle oc-text-truncate resource-name-wrapper">
<oc-resource-stub isextensiondisplayed="true" isicondisplayed="false" ispathdisplayed="false" isresourceclickable="true" isthumbnaildisplayed="true" parentfoldernamedefault="" resource="[object Object]"></oc-resource-stub>
</div>
<div class="oc-flex oc-flex-middle">
<!-- Slot for individual actions -->
<!-- Slot for contextmenu -->
</div>
</div>
<!--v-if-->
Expand Down
6 changes: 5 additions & 1 deletion packages/web-app-files/src/components/AppBar/AppBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,11 @@ export default defineComponent({
if (!this.displayViewModeSwitch) {
return []
}
return [ViewModeConstants.condensedTable, ViewModeConstants.default]
return [
ViewModeConstants.condensedTable,
ViewModeConstants.default,
ViewModeConstants.tilesView
]
}
},
mounted() {
Expand Down
10 changes: 7 additions & 3 deletions packages/web-app-files/src/components/AppBar/ViewOptions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
<div class="oc-flex oc-flex-middle">
<div
v-if="viewModes.length"
data-testid="viewmode-switch-buttons"
class="oc-button-group oc-visible@s oc-mr-s"
class="viewmode-switch-buttons oc-button-group oc-visible@s oc-mr-s"
>
<oc-button
v-for="viewMode in viewModes"
:key="viewMode.name"
v-oc-tooltip="$gettext(viewMode.label)"
:class="viewMode.name"
:appearance="viewModeCurrent === viewMode.name ? 'filled' : 'outline'"
:label="$gettext(viewMode.label)"
:aria-label="$gettext(viewMode.label)"
@click="setViewMode(viewMode)"
>
<oc-icon :name="viewMode.icon.name" :fill-type="viewMode.icon.fillType" size="small" />
Expand Down Expand Up @@ -148,6 +148,10 @@ export default defineComponent({
</script>

<style lang="scss" scoped>
.viewmode-switch-buttons {
flex-flow: initial;
}

#files-view-options-btn {
vertical-align: middle;
border: 3px solid transparent;
Expand Down
Loading