Skip to content

Commit

Permalink
apply review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
kelanik8 committed Oct 27, 2023
1 parent 1bf0583 commit 348162f
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 0 deletions.
21 changes: 21 additions & 0 deletions client/web/compose/src/components/PageBlocks/CalendarBase.vue
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,14 @@ export default {
this.refreshBlock(this.refresh)
},
mounted () {
this.$root.$on('module-records-updated', this.refreshOnRelatedRecordsUpdate)
},
beforeDestroy () {
this.setDefaultValues()
this.abortRequests()
this.destroyEvents()
},
methods: {
Expand All @@ -252,6 +257,18 @@ export default {
})
},
refreshOnRelatedRecordsUpdate ({ moduleID, notPageID }) {
this.options.feeds.forEach((feed) => {
const { moduleID: feedModuleID } = feed.options
if (feedModuleID) {
if (feedModuleID === moduleID && this.page.pageID !== notPageID) {
this.refresh()
}
}
})
},
/**
* Helper method to load requested locale.
* See https://github.com/fullcalendar/fullcalendar/tree/master/packages/core/src/locales
Expand Down Expand Up @@ -406,6 +423,10 @@ export default {
abortRequests () {
this.cancelTokenSource.cancel(`cancel-record-list-request-${this.block.blockID}`)
},
destroyEvents () {
this.$root.$off('module-records-updated', this.refreshOnRelatedRecordsUpdate)
},
},
}
</script>
Expand Down
3 changes: 3 additions & 0 deletions client/web/compose/src/components/PageBlocks/CommentBase.vue
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,9 @@ export default {
this.newRecord.title = ''
this.newRecord.content = ''
this.refresh()
const { moduleID } = this.options
this.$root.$emit('module-records-updated', { moduleID })
})
.catch(this.toastErrorHandler(this.$t('notification:record.createFailed')))
}
Expand Down
17 changes: 17 additions & 0 deletions client/web/compose/src/components/PageBlocks/GeometryBase.vue
Original file line number Diff line number Diff line change
Expand Up @@ -154,16 +154,29 @@ export default {
this.refreshBlock(this.refresh)
},
mounted () {
this.$root.$on('module-records-updated', this.refreshOnRelatedRecordsUpdate)
},
beforeDestroy () {
this.setDefaultValues()
this.abortRequests()
this.destroyEvents()
},
methods: {
...mapActions({
findModuleByID: 'module/findByID',
}),
refreshOnRelatedRecordsUpdate ({ moduleID, notPageID }) {
this.options.feeds.forEach((feed) => {
if (feed.options.moduleID === moduleID && this.page.pageID !== notPageID) {
this.refresh()
}
})
},
loadEvents () {
this.geometries = []
Expand Down Expand Up @@ -329,6 +342,10 @@ export default {
abortRequests () {
this.cancelTokenSource.cancel(`abort-request-${this.block.blockID}`)
},
destroyEvents () {
this.$root.$off('module-records-updated', this.refreshOnRelatedRecordsUpdate)
},
},
}
</script>
8 changes: 8 additions & 0 deletions client/web/compose/src/components/PageBlocks/ProgressBase.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export default {
mounted () {
this.$root.$on(`refetch-non-record-blocks:${this.page.pageID}`, this.refresh)
this.$root.$on('module-records-updated', this.refreshOnRelatedRecordsUpdate)
},
beforeDestroy () {
Expand Down Expand Up @@ -132,6 +133,12 @@ export default {
})
},
refreshOnRelatedRecordsUpdate ({ moduleID, notPageID }) {
if (this.options.value.moduleID === moduleID && this.page.pageID !== notPageID) {
this.refresh()
}
},
setDefaultValues () {
this.processing = false
this.value = undefined
Expand All @@ -141,6 +148,7 @@ export default {
destroyEvents () {
this.$root.$off(`refetch-non-record-blocks:${this.page.pageID}`, this.refresh)
this.$root.$off('module-records-updated', this.refreshOnRelatedRecordsUpdate)
},
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,13 +218,24 @@ export default {
beforeDestroy () {
this.setDefaultValues()
this.destroyEvents()
},
created () {
this.refreshBlock(this.refresh)
},
mounted () {
this.$root.$on('module-records-updated', this.refreshOnRelatedRecordsUpdate)
},
methods: {
refreshOnRelatedRecordsUpdate ({ moduleID }) {
if (this.module.moduleID === moduleID) {
this.refresh()
}
},
async loadRevisions () {
if (this.revisionsDisabledOnModule) {
return
Expand Down Expand Up @@ -259,6 +270,10 @@ export default {
this.revisions = []
this.columns = []
},
destroyEvents () {
this.$root.$off('module-records-updated', this.refreshOnRelatedRecordsUpdate)
},
},
}
</script>

0 comments on commit 348162f

Please sign in to comment.