Skip to content

Commit

Permalink
Set loading spinner when collaborator removal is in progress.
Browse files Browse the repository at this point in the history
  • Loading branch information
kulmann committed Feb 6, 2020
1 parent 1bdd8db commit 0688f34
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions apps/files/src/components/Collaborators/Collaborator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@
</oc-table-row>
<oc-table-row class="files-collaborators-collaborator-table-row-info">
<oc-table-cell shrink>
<oc-button v-if="modifiable" :ariaLabel="$gettext('Delete share')" @click="$emit('onDelete', collaborator)" variation="raw" class="files-collaborators-collaborator-delete">
<oc-button v-if="$_deleteButtonVisible" :ariaLabel="$gettext('Delete share')" @click="$_removeShare" variation="raw" class="files-collaborators-collaborator-delete">
<oc-icon name="close" />
</oc-button>
<oc-spinner v-else-if="$_loadingSpinnerVisible" :aria-label="$gettext('Removing collaborator') + '...'" size="small" />
<oc-icon v-else name="lock" class="uk-invisible"></oc-icon>
</oc-table-cell>
<oc-table-cell shrink>
Expand All @@ -36,7 +37,7 @@
</div>
</oc-table-cell>
<oc-table-cell shrink>
<oc-button v-if="modifiable" :aria-label="$gettext('Edit share')" @click="$emit('onEdit', collaborator)" variation="raw" class="files-collaborators-collaborator-edit">
<oc-button v-if="$_editButtonVisible" :aria-label="$gettext('Edit share')" @click="$emit('onEdit', collaborator)" variation="raw" class="files-collaborators-collaborator-edit">
<oc-icon name="edit" />
</oc-button>
</oc-table-cell>
Expand Down Expand Up @@ -79,12 +80,23 @@ export default {
},
data: function () {
return {
shareTypes
shareTypes,
removalInProgress: false
}
},
computed: {
...mapGetters(['user']),
$_loadingSpinnerVisible () {
return this.modifiable && this.removalInProgress
},
$_deleteButtonVisible () {
return this.modifiable && !this.removalInProgress
},
$_editButtonVisible () {
return this.modifiable && !this.removalInProgress
},
$_isIndirectShare () {
// it is assumed that the "incoming" attribute only exists
// on shares coming from this.sharesTree which are all indirect
Expand Down Expand Up @@ -139,6 +151,12 @@ export default {
label: this.$gettext('Unknown Role')
}
}
},
methods: {
$_removeShare () {
this.removalInProgress = true
this.$emit('onDelete', this.collaborator)
}
}
}
</script>
Expand Down

0 comments on commit 0688f34

Please sign in to comment.