-
Notifications
You must be signed in to change notification settings - Fork 159
/
SharesPanel.vue
81 lines (79 loc) · 2.05 KB
/
SharesPanel.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<template>
<div>
<div class="oc-background-highlight oc-p-m oc-mb-m">
<space-members v-if="showSpaceMembers" />
<file-shares v-else />
</div>
<div v-if="showLinks" class="oc-background-highlight oc-p-m">
<file-links />
</div>
</div>
</template>
<script lang="ts">
import { defineComponent } from '@vue/composition-api'
import FileLinks from './FileLinks.vue'
import FileShares from './FileShares.vue'
import SpaceMembers from './SpaceMembers.vue'
import { mapActions, mapGetters } from 'vuex'
import { dirname } from 'path'
import { useGraphClient } from 'web-client/src/composables'
export default defineComponent({
name: 'SharesPanel',
components: {
FileLinks,
FileShares,
SpaceMembers
},
props: {
showSpaceMembers: { type: Boolean, default: false },
showLinks: { type: Boolean, default: false }
},
setup() {
return {
...useGraphClient()
}
},
watch: {
highlightedFile: {
handler: function (newItem, oldItem) {
if (oldItem !== newItem) {
this.$_reloadShares()
}
},
immediate: true
}
},
computed: {
...mapGetters('Files', ['highlightedFile'])
},
methods: {
...mapActions('Files', [
'loadCurrentFileOutgoingShares',
'loadSharesTree',
'loadIncomingShares'
]),
$_reloadShares() {
this.loadCurrentFileOutgoingShares({
client: this.$client,
graphClient: this.graphClient,
path: this.highlightedFile.path,
$gettext: this.$gettext,
storageId: this.highlightedFile.fileId,
resource: this.highlightedFile
})
this.loadIncomingShares({
client: this.$client,
path: this.highlightedFile.path,
$gettext: this.$gettext,
storageId: this.highlightedFile.fileId
})
this.loadSharesTree({
client: this.$client,
path: this.highlightedFile.path === '' ? '/' : dirname(this.highlightedFile.path),
$gettext: this.$gettext,
storageId: this.highlightedFile.fileId
})
}
}
})
</script>