Skip to content

Commit

Permalink
Add tags to ResourceTable (#7388)
Browse files Browse the repository at this point in the history
* Add tags to resourcetable

* Use file tags instead of tags

* Add changelog, remove border for + item

* Replace OcFileTag

* Dump ODS
  • Loading branch information
lookacat authored and fschade committed Dec 22, 2022
1 parent b870786 commit 7a591be
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
5 changes: 5 additions & 0 deletions changelog/unreleased/enhancement-add-tags-to-resource-table
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Enhancement: Add Tags to ResourceTable

We've added a new column in ResourceTable to display tags

https://github.com/owncloud/web/pull/7388
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,21 @@
<template #size="{ item }">
<oc-resource-size :size="item.size || Number.NaN" />
</template>
<template #tags="{ item }">
<router-link v-for="tag in item.tags.slice(0, 2)" :key="tag" :to="getTagLink(tag)">
<oc-tag :rounded="true" size="small" class="oc-ml-xs">
{{ tag }}
</oc-tag>
</router-link>
<oc-tag
v-if="item.tags.length > 2"
size="small"
class="resource-table-tag-more"
@click="openTagsSidebar"
>
+ {{ item.tags.length - 2 }}
</oc-tag>
</template>
<template #mdate="{ item }">
<span
v-oc-tooltip="formatDate(item.mdate)"
Expand Down Expand Up @@ -192,7 +207,7 @@ import { Resource } from 'web-client'
import { ClipboardActions } from '../../helpers/clipboardActions'
import { isResourceTxtFileAlmostEmpty } from '../../helpers/resources'
import { ShareTypes } from 'web-client/src/helpers/share'
import { createLocationSpaces, createLocationShares } from '../../router'
import { createLocationSpaces, createLocationShares, createLocationCommon } from '../../router'
import { formatDateFromJSDate, formatRelativeDateFromJSDate } from 'web-pkg/src/helpers'
import { SideBarEventTopics } from '../../composables/sideBar'
import { buildShareSpaceResource, extractDomSelector, SpaceResource } from 'web-client/src/helpers'
Expand Down Expand Up @@ -462,6 +477,13 @@ export default defineComponent({
alignH: 'right',
wrap: 'nowrap'
},
{
name: 'tags',
title: this.$gettext('Tags'),
type: 'slot',
alignH: 'right',
wrap: 'nowrap'
},
{
name: 'owner',
title: this.$gettext('Shared by'),
Expand Down Expand Up @@ -567,6 +589,11 @@ export default defineComponent({
shouldDisplayThumbnails(item) {
return this.areThumbnailsDisplayed && !isResourceTxtFileAlmostEmpty(item)
},
getTagLink(tag) {
return createLocationCommon('files-common-search', {
query: { term: `tag:${tag}`, provider: 'files.sdk' }
})
},
isLatestSelectedItem(item) {
return item.id === this.latestSelectedId
},
Expand All @@ -577,6 +604,9 @@ export default defineComponent({
openRenameDialog(item) {
this.$_rename_trigger({ resources: [item] }, this.getMatchingSpace(item))
},
openTagsSidebar() {
this.openWithPanel('tags-item')
},
openSharingSidebar(file) {
let panelToOpen
if (file.type === 'space') {
Expand Down Expand Up @@ -868,6 +898,10 @@ export default defineComponent({
}
}
}
&-tag-more {
cursor: pointer;
border: 0px !important;
}
&-edit-name {
display: inline-flex;
margin-left: var(--oc-space-xsmall);
Expand Down
1 change: 1 addition & 0 deletions packages/web-client/src/helpers/resource/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export interface Resource {
storageId?: string
readonly nodeId?: string
name?: string
tags?: string[]
path: string
webDavPath?: string
downloadURL?: string
Expand Down

0 comments on commit 7a591be

Please sign in to comment.