Skip to content

Commit

Permalink
Merge pull request #532 from Progress1/fix_refresh
Browse files Browse the repository at this point in the history
Fixed lost data refresh in Analyze screen
  • Loading branch information
Progress1 authored Feb 19, 2025
2 parents 5753a5d + e12b7c2 commit b91d203
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 24 deletions.
17 changes: 12 additions & 5 deletions src/gui/src/components/analyze/ContentDataAnalyze.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,17 @@
export default {
name: "ContentDataAnalyze",
components: {
CardAnalyze,
},
props: {
publish_selector: Boolean,
selection: Array,
cardItem: String
},
data: () => ({
collections: [],
data_loaded: false,
Expand All @@ -35,16 +38,20 @@
sort: "DATE_DESC"
}
}),
methods: {
showReportItemDetail(report_item){
this.$emit('show-report-item-detail', report_item)
},
showRemoteReportItemDetail(report_item){
showRemoteReportItemDetail(report_item) {
this.$emit('show-remote-report-item-detail', report_item)
},
removeReportItemFromSelector(report_item){
removeReportItemFromSelector(report_item) {
this.$emit('remove-report-item-from-selector', report_item)
},
preselected(item_id) {
if (this.selection != null) {
Expand All @@ -70,7 +77,6 @@
},
updateData(append, reload_all) {
this.data_loaded = false;
if (append === false) {
Expand Down Expand Up @@ -127,6 +133,7 @@
this.updateData(false, false);
},
},
computed: {
multiSelectActive() {
return this.$store.getters.getMultiSelect;
Expand All @@ -139,10 +146,10 @@
this.$root.$on('report-item-updated', this.report_item_updated);
this.$root.$on('report-items-updated', this.report_item_updated);
},
created() {},
beforeDestroy() {
this.$root.$off('report-item-updated', this.report_item_updated);
this.$root.$off('report-items-updated', this.report_item_updated);
}
}
</script>
</script>
3 changes: 1 addition & 2 deletions src/gui/src/components/assess/ContentDataAssess.vue
Original file line number Diff line number Diff line change
Expand Up @@ -228,11 +228,10 @@
mounted() {
this.$root.$on('news-items-updated', this.news_items_updated);
this.$root.$on('force-reindex', this.forceReindex);
},
beforeDestroy() {
this.$root.$off('news-items-updated', this.news_items_updated);
}
}
</script>
</script>
13 changes: 13 additions & 0 deletions src/gui/src/components/assets/ContentDataAssets.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,19 @@
export default {
name: "ContentData",
components: {
CardAsset,
CardCompact
},
props: {
name: String,
action: String,
getter: String,
cardItem: String
},
data: () => ({
collections: [],
filter: {
Expand All @@ -30,6 +33,7 @@
sort: "ALPHABETICAL"
},
}),
methods: {
updateData() {
Expand All @@ -45,16 +49,19 @@
});
}
},
cardLayout: function () {
return this.cardItem;
}
},
watch: {
$route() {
this.updateData();
}
},
mounted() {
this.updateData();
this.$root.$on('notification', () => {
Expand All @@ -67,6 +74,12 @@
this.filter = filter;
this.updateData()
});
},
beforeDestroy() {
this.$root.$off('notification')
this.$root.$off('update-data')
this.$root.$off('update-assets-filter')
}
}
</script>
6 changes: 3 additions & 3 deletions src/gui/src/components/assets/ToolbarFilterAssets.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@
},
filterSearch() {
clearTimeout(this.timeout);
let self = this;
this.timeout = setTimeout(function () {
this.$root.$emit('update-assets-filter', this.filter);
self.$root.$emit('update-assets-filter', self.filter);
}, 300);
},
changeTheme() {
Expand All @@ -101,4 +101,4 @@
},
}
}
</script>
</script>
13 changes: 9 additions & 4 deletions src/gui/src/components/publish/ContentDataPublish.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@
export default {
name: "ContentDataPublish",
components: {
CardProduct,
},
data: () => ({
collections: [],
data_loaded: false,
Expand All @@ -24,6 +26,7 @@
sort: "DATE_DESC"
}
}),
methods: {
infiniteScrolling(entries, observer, isIntersecting) {
Expand All @@ -33,7 +36,6 @@
},
updateData(append, reload_all) {
this.data_loaded = false;
if (append === false) {
Expand Down Expand Up @@ -67,11 +69,13 @@
});
}
},
watch: {
$route() {
this.updateData(false, false);
}
},
mounted() {
this.updateData();
this.$root.$on('notification', () => {
Expand All @@ -82,9 +86,10 @@
this.updateData(false, false)
});
},
created() {
},
beforeDestroy() {
this.$root.$off('notification');
this.$root.$off('update-products-filter');
}
}
</script>
</script>
20 changes: 10 additions & 10 deletions src/gui/src/services/api_service.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,28 @@ const ApiService = {
},

get(resource, data = {}) {
//window.console.debug("GET:", resource);
// console.debug("GET:", resource);
return axios.get(resource, data)
},

getWithCancel(resType, resource) {
// resType: cancel key that abort request (support for multiple cancels)
if (resType in abortControllers) {
// window.console.debug("CANCEL", resType);
// console.debug("CANCEL", resType);
abortControllers[resType].abort();
}

abortControllers[resType] = new AbortController();
let promise = axios.get(resource, {
signal: abortControllers[resType].signal
}).catch(function (e) {
if (axios.isCancel(e)) {
window.console.debug("request canceled:", resource);
} else {
throw e;
}
});
// window.console.debug("GET CANCEL:", resource, promise);
if (axios.isCancel(e)) {
console.debug("request canceled:", resource);
} else {
throw e;
}
});
// console.debug("GET CANCEL:", resource, promise);
return promise;
},

Expand Down Expand Up @@ -81,4 +81,4 @@ const ApiService = {
},
};

export default ApiService
export default ApiService

0 comments on commit b91d203

Please sign in to comment.