WIP: Update quick share select option

`SharingEntryQuickSelect` should respond to changes and reflect the new state of shares
when updates are done in the `SharingDetailsTab`

Signed-off-by: fenn-cs <fenn25.fn@gmail.com>
This commit is contained in:
fenn-cs 2024-07-05 21:25:54 +01:00
parent 656e109d2f
commit 7e208977dc
3 changed files with 46 additions and 0 deletions

View file

@ -63,6 +63,20 @@ export default {
},
mixins: [SharesMixin, ShareDetails],
props: {
share: {
type: Object,
required: true,
},
fileInfo: {
type: Object,
required: true,
},
isUnique: {
type: Boolean,
required: true,
},
},
computed: {
title() {
@ -119,6 +133,11 @@ export default {
this.onNoteSubmit()
},
},
watch: {
share(newShare) {
console.log('Shareeeeee prop changed:', newShare)
}
},
}
</script>

View file

@ -53,5 +53,10 @@ export default {
}
},
},
watch: {
shares(old, newShares) {
console.log('Shares prop changed:', old, newShares)
}
}
}
</script>

View file

@ -77,6 +77,7 @@
:share="shareDetailsData.share"
@close-sharing-details="toggleShareDetailsView"
@add:share="addShare"
@update:share="handleShareUpdated"
@remove:share="removeShare" />
</div>
</template>
@ -400,6 +401,27 @@ export default {
})
}
},
handleShareUpdated(updatedShare) {
// Check if the updated share is in the `shares` list
let index = this.shares.findIndex(share => share.id === updatedShare.id)
if (index !== -1) {
console.log("Let us see", this.shares[index].permissions, updatedShare.permissions)
// Update the share in the `shares` list
this.$set(this.shares, index, updatedShare)
console.log('Updated???', updatedShare)
console.log("Let us see (AFTER)", this.shares[index].permissions, updatedShare.permissions)
} else {
// Check if the updated share is in the `linkShares` list
index = this.linkShares.findIndex(share => share.id === updatedShare.id)
if (index !== -1) {
// Update the share in the `linkShares` list
this.$set(this.linkShares, index, updatedShare)
this.linkShares[index] = updatedShare
console.log('Updated link???', updatedShare)
}
}
},
},
}
</script>