-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[full-ci] Merge master into experimental (#7460)
* change ocis to experimental change sdk to experimental * bump ocis commit id * Add tags to ResourceTable (#7388) * Add tags to resourcetable * Use file tags instead of tags * Add changelog, remove border for + item * Replace OcFileTag * Dump ODS * [full-ci] Tags (#7385) Tags init * Truncate tags (#7442) Truncate tags Co-authored-by: Paul Neubauer <paulneubauer@live.de> Co-authored-by: Jan <jackermann@owncloud.com>
- Loading branch information
1 parent
6db777d
commit 83bc21c
Showing
19 changed files
with
397 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
# The version of OCIS to use in pipelines that test against OCIS | ||
OCIS_COMMITID=8bb2ebcf4bcecd0ddfb3ce8f2cb4ba3d51be19b5 | ||
OCIS_BRANCH=master | ||
OCIS_COMMITID=f99a2072d33debc7fda43f9b27ba48c01014a83b | ||
OCIS_BRANCH=experimental |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Enhancement: Add Tag support | ||
|
||
Managing files via tags is now possible in web, the feature is experimental and will be only available through a dedicated experimental web build. | ||
Beside that the web version is experimental, it also needs a special experimental ocis version. | ||
|
||
Creating Tags, tagging resources and search for tags now is possible and can be used as an alternative way of working and organizing resources. | ||
|
||
https://github.com/owncloud/web/pull/7388 | ||
https://github.com/owncloud/web/pull/7385 | ||
https://github.com/owncloud/web/pull/7442 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
146 changes: 146 additions & 0 deletions
146
packages/web-app-files/src/components/SideBar/TagsPanel.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
<template> | ||
<div> | ||
<div class="oc-background-highlight oc-p-m"> | ||
<oc-loader v-if="loadAllTagsTask.isRunning" /> | ||
<oc-select | ||
v-else | ||
ref="tagSelect" | ||
v-model="editAssignedTags" | ||
multiple | ||
:options="allTags" | ||
taggable | ||
push-tags | ||
:label="$gettext('Add or edit tags')" | ||
:create-option="createOption" | ||
:selectable="() => editAssignedTags.length <= tagsMaxCount" | ||
:fix-message-line="true" | ||
> | ||
<template #selected-option="{ label }"> | ||
<span class="oc-flex oc-flex-center"> | ||
<avatar-image | ||
class="oc-flex oc-align-self-center oc-mr-s" | ||
:width="16.8" | ||
:userid="label" | ||
:user-name="label" | ||
/> | ||
<span>{{ label }}</span> | ||
</span> | ||
</template> | ||
<template #option="{ label }"> | ||
<div class="oc-flex"> | ||
<span v-if="showSelectNewLabel(label)" v-translate class="oc-mr-s">New</span> | ||
<span class="oc-flex oc-flex-center"> | ||
<avatar-image | ||
class="oc-flex oc-align-self-center oc-mr-s" | ||
:width="16.8" | ||
:userid="label" | ||
:user-name="label" | ||
/> | ||
<span>{{ label }}</span> | ||
</span> | ||
</div> | ||
</template> | ||
</oc-select> | ||
</div> | ||
<compare-save-dialog | ||
class="edit-compare-save-dialog" | ||
:original-object="{ tags: resource.tags }" | ||
:compare-object="{ tags: editAssignedTags }" | ||
@revert="revertChanges" | ||
@confirm="save" | ||
></compare-save-dialog> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { mapActions, mapMutations } from 'vuex' | ||
import { defineComponent, ref } from '@vue/composition-api' | ||
import CompareSaveDialog from 'web-pkg/src/components/sidebar/CompareSaveDialog.vue' | ||
import { bus } from 'web-pkg/src/instance' | ||
import { useTask } from 'vue-concurrency' | ||
import { useRequest, useStore } from 'web-pkg/src/composables' | ||
const tagsMaxCount = 100 | ||
export default defineComponent({ | ||
name: 'Tags', | ||
components: { | ||
CompareSaveDialog | ||
}, | ||
inject: ['displayedItem'], | ||
setup() { | ||
const store = useStore() | ||
const allTags = ref([]) | ||
const { makeRequest } = useRequest() | ||
const loadAllTagsTask = useTask(function* (signal, ref) { | ||
const { | ||
data: { tags = [] } | ||
} = yield makeRequest('GET', `${store.getters.configuration.server}experimental/tags`, {}) | ||
allTags.value = tags | ||
}) | ||
return { | ||
loadAllTagsTask, | ||
allTags, | ||
tagsMaxCount | ||
} | ||
}, | ||
data: function () { | ||
return { | ||
editAssignedTags: [] | ||
} | ||
}, | ||
computed: { | ||
resource() { | ||
return this.displayedItem.value | ||
} | ||
}, | ||
mounted() { | ||
this.editAssignedTags = [...this.resource.tags] | ||
this.loadAllTagsTask.perform(this) | ||
}, | ||
methods: { | ||
...mapActions(['showMessage']), | ||
...mapMutations('Files', ['UPDATE_RESOURCE_FIELD']), | ||
revertChanges() { | ||
this.editAssignedTags = [...this.resource.tags] | ||
}, | ||
async save() { | ||
try { | ||
const tagsToAdd = this.editAssignedTags.filter((tag) => !this.resource.tags.includes(tag)) | ||
const tagsToRemove = this.resource.tags.filter( | ||
(tag) => !this.editAssignedTags.includes(tag) | ||
) | ||
if (tagsToAdd.length) { | ||
await this.$client.tags.addResourceTag(this.resource.fileId, tagsToAdd) | ||
} | ||
if (tagsToRemove.length) { | ||
await this.$client.tags.removeResourceTag(this.resource.fileId, tagsToRemove) | ||
} | ||
this.UPDATE_RESOURCE_FIELD({ | ||
id: this.resource.id, | ||
field: 'tags', | ||
value: [...this.editAssignedTags] | ||
}) | ||
this.displayedItem.value.tags = [...this.editAssignedTags] | ||
bus.publish('sidebar.entity.saved') | ||
} catch (e) { | ||
console.error(e) | ||
} | ||
}, | ||
createOption(option) { | ||
return option.toLowerCase() | ||
}, | ||
showSelectNewLabel(option) { | ||
return !this.$refs.tagSelect.$refs.select.optionExists(option) | ||
} | ||
} | ||
}) | ||
</script> | ||
|
||
<style lang="scss"></style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.