Skip to content

Commit

Permalink
Merge pull request #38655 from nextcloud/fix/loading-system-tags
Browse files Browse the repository at this point in the history
  • Loading branch information
Pytal committed Jun 6, 2023
2 parents 3ef53a2 + 5acbe6f commit 5a6fb35
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 22 deletions.
1 change: 1 addition & 0 deletions apps/files/src/views/Sidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,7 @@ export default {
*/
close() {
this.Sidebar.file = ''
this.showTags = false
this.resetData()
},
Expand Down
48 changes: 29 additions & 19 deletions apps/systemtags/src/components/SystemTags.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,32 +22,38 @@

<template>
<div class="system-tags">
<label for="system-tags-input">{{ t('systemtags', 'Search or create collaborative tags') }}</label>
<NcSelectTags class="system-tags__select"
input-id="system-tags-input"
:placeholder="t('systemtags', 'Collaborative tags …')"
:options="sortedTags"
:value="selectedTags"
:create-option="createOption"
:taggable="true"
:passthru="true"
:fetch-tags="false"
:loading="loading"
@input="handleInput"
@option:selected="handleSelect"
@option:created="handleCreate"
@option:deselected="handleDeselect">
<template #no-options>
{{ t('systemtags', 'No tags to select, type to create a new tag') }}
</template>
</NcSelectTags>
<NcLoadingIcon v-if="loadingTags"
:name="t('systemtags', 'Loading collaborative tags …')"
:size="32" />
<template v-else>
<label for="system-tags-input">{{ t('systemtags', 'Search or create collaborative tags') }}</label>
<NcSelectTags class="system-tags__select"
input-id="system-tags-input"
:placeholder="t('systemtags', 'Collaborative tags …')"
:options="sortedTags"
:value="selectedTags"
:create-option="createOption"
:taggable="true"
:passthru="true"
:fetch-tags="false"
:loading="loading"
@input="handleInput"
@option:selected="handleSelect"
@option:created="handleCreate"
@option:deselected="handleDeselect">
<template #no-options>
{{ t('systemtags', 'No tags to select, type to create a new tag') }}
</template>
</NcSelectTags>
</template>
</div>
</template>

<script lang="ts">
// FIXME Vue TypeScript ESLint errors
/* eslint-disable */
import Vue from 'vue'
import NcLoadingIcon from '@nextcloud/vue/dist/Components/NcLoadingIcon.js'
import NcSelectTags from '@nextcloud/vue/dist/Components/NcSelectTags.js'
import { translate as t } from '@nextcloud/l10n'
Expand All @@ -74,6 +80,7 @@ export default Vue.extend({
name: 'SystemTags',
components: {
NcLoadingIcon,
NcSelectTags,
},
Expand All @@ -88,6 +95,7 @@ export default Vue.extend({
return {
sortedTags: [] as TagWithId[],
selectedTags: [] as TagWithId[],
loadingTags: false,
loading: false,
}
},
Expand Down Expand Up @@ -123,12 +131,14 @@ export default Vue.extend({
fileId: {
immediate: true,
async handler() {
this.loadingTags = true
try {
this.selectedTags = await fetchSelectedTags(this.fileId)
this.$emit('has-tags', this.selectedTags.length > 0)
} catch (error) {
showError(t('systemtags', 'Failed to load selected tags'))
}
this.loadingTags = false
},
},
},
Expand Down
4 changes: 2 additions & 2 deletions dist/files-sidebar.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/files-sidebar.js.map

Large diffs are not rendered by default.

0 comments on commit 5a6fb35

Please sign in to comment.