Skip to content

Commit

Permalink
use ocis storageId whenever possible
Browse files Browse the repository at this point in the history
use roles storageId whenever possible
refactor share loading out of link and share panel component into parent component and load the data only once
  • Loading branch information
fschade committed Jun 2, 2022
1 parent ae65ef2 commit 339c6cf
Show file tree
Hide file tree
Showing 14 changed files with 181 additions and 182 deletions.
4 changes: 2 additions & 2 deletions .drone.env
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=09ff21ace56566127e3e328dd1a179936f918734
OCIS_BRANCH=master
OCIS_COMMITID=4206509dbedc1b1c8d5a1ef459e424706c5155e9
OCIS_BRANCH=Resharing
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ export default defineComponent({
client: this.$client,
path: this.file.path,
$gettext: this.$gettext,
storageId: this.$route.params.storageId
storageId: this.file.fileId
})
this.shareIndicators = getIndicators(this.file, this.sharesTree)
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,13 +323,6 @@ export default {
this.selectedRole.permissions(this.hasResharing || this.resourceIsSpace)
)
let storageId
if (this.resourceIsSpace) {
storageId = this.highlightedFile.id
} else if (this.$route.params.storageId) {
storageId = this.$route.params.storageId
}
this.addShare({
client: this.$client,
graphClient: this.graphClient,
Expand All @@ -339,8 +332,9 @@ export default {
displayName: collaborator.label,
shareType: collaborator.value.shareType,
permissions: bitmask,
role: this.selectedRole,
expirationDate: this.expirationDate,
storageId
storageId: this.highlightedFile.fileId
})
})
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ export default {
client: this.$client,
graphClient: this.graphClient,
share: this.share,
role,
permissions: bitmask,
expirationDate: expirationDate || ''
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ import CreateQuickLink from './Links/CreateQuickLink.vue'
import { ShareTypes, LinkShareRoles } from '../../../helpers/share'
import { useStore, useCapabilitySpacesEnabled } from 'web-pkg/src/composables'
import { clientService } from 'web-pkg/src/services'
import { dirname } from 'path'
import { defineComponent } from '@vue/composition-api'
import { shareViaLinkHelp } from '../../../helpers/contextualHelpers'
Expand Down Expand Up @@ -315,48 +314,14 @@ export default defineComponent({
return this.$route.params.storageId || null
}
},
watch: {
highlightedFile(newItem, oldItem) {
if (oldItem !== newItem) {
this.reloadLinks()
}
}
},
mounted() {
this.reloadLinks()
},
methods: {
...mapActions('Files', [
'addLink',
'updateLink',
'removeLink',
'loadSharesTree',
'loadCurrentFileOutgoingShares'
]),
...mapActions('Files', ['addLink', 'updateLink', 'removeLink']),
...mapActions(['showMessage', 'createModal', 'hideModal']),
toggleLinkListCollapsed() {
this.linkListCollapsed = !this.linkListCollapsed
},
reloadLinks() {
this.loadCurrentFileOutgoingShares({
client: this.$client,
graphClient: this.graphClient,
path: this.highlightedFile.path,
$gettext: this.$gettext,
storageId: this.currentStorageId,
resource: this.highlightedFile
})
this.loadSharesTree({
client: this.$client,
path: this.highlightedFile.path === '' ? '/' : dirname(this.highlightedFile.path),
$gettext: this.$gettext,
storageId: this.currentStorageId
})
},
linksComparator(l1, l2) {
// sorting priority 1: display name (lower case, ascending), 2: creation time (descending)
const name1 = l1.name.toLowerCase().trim()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
</template>

<script lang="ts">
import { dirname } from 'path'
import { useTask } from 'vue-concurrency'
import { mapGetters, mapActions, mapState } from 'vuex'
import { watch, computed } from '@vue/composition-api'
Expand Down Expand Up @@ -289,16 +288,6 @@ export default {
)
}
},
watch: {
highlightedFile: {
handler: function (newItem, oldItem) {
if (oldItem !== newItem) {
this.$_reloadShares()
}
},
immediate: true
}
},
async mounted() {
if (this.$route.params.storageId) {
await this.loadSpaceTask.perform(this, this.$route.params.storageId)
Expand All @@ -309,12 +298,7 @@ export default {
}
},
methods: {
...mapActions('Files', [
'loadCurrentFileOutgoingShares',
'loadSharesTree',
'deleteShare',
'loadIncomingShares'
]),
...mapActions('Files', ['deleteShare']),
...mapActions(['createModal', 'hideModal', 'showMessage']),
toggleShareesListCollapsed() {
this.sharesListCollapsed = !this.sharesListCollapsed
Expand Down Expand Up @@ -385,26 +369,6 @@ export default {
})
})
},
$_reloadShares() {
this.loadCurrentFileOutgoingShares({
client: this.$client,
path: this.highlightedFile.path,
$gettext: this.$gettext,
storageId: this.$route.params.storageId
})
this.loadIncomingShares({
client: this.$client,
path: this.highlightedFile.path,
$gettext: this.$gettext,
storageId: this.$route.params.storageId
})
this.loadSharesTree({
client: this.$client,
path: dirname(this.highlightedFile.path),
$gettext: this.$gettext,
storageId: this.$route.params.storageId
})
},
getSharedParentRoute(parentShare) {
if (!parentShare.indirect) {
return null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ 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 { clientService } from 'web-pkg/src/services'
import { useStore } from 'web-pkg/src/composables'
export default defineComponent({
name: 'SharesPanel',
Expand All @@ -26,6 +30,57 @@ export default defineComponent({
props: {
showSpaceMembers: { type: Boolean, default: false },
showLinks: { type: Boolean, default: false }
},
setup() {
const store = useStore()
const graphClient = clientService.graphAuthenticated(
store.getters.configuration.server,
store.getters.getToken
)
return { graphClient }
},
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>
Loading

0 comments on commit 339c6cf

Please sign in to comment.