Skip to content

armgit / dashy

Public Imported from GitHub
0

πŸš€ A self-hostable personal dashboard built for you. Includes status-checking, widgets, themes, icon packs, a UI editor and tons more!

πŸ› Fixes iframe widget refresh (#1571)

Alicia Sykes07dbcccc8371
diff --git a/src/components/Widgets/IframeWidget.vue b/src/components/Widgets/IframeWidget.vue
index 5c5f7b71..656b893e 100644
--- a/src/components/Widgets/IframeWidget.vue
+++ b/src/components/Widgets/IframeWidget.vue
@@ -45,8 +45,17 @@ export default {
/* Refreshes iframe contents, called by parent */
update() {
this.startLoading();
- this.updateCount += 1;
- (document.getElementById(this.frameId) || {}).src = this.frameUrl;
+ const iframe = document.getElementById(this.frameId);
+ if (iframe.contentWindow) {
+ try {
+ iframe.contentWindow.location.href = this.frameUrl;
+ iframe.contentWindow.location.reload(true);
+ } catch (e) {
+ this.error('Failed to refresh iframe', e, true);
+ }
+ } else {
+ this.error('Couldn\'t find iframe', null, true);
+ }
this.finishLoading();
},
},
diff --git a/src/mixins/WidgetMixin.js b/src/mixins/WidgetMixin.js
index 53019adf..a497dafb 100644
--- a/src/mixins/WidgetMixin.js
+++ b/src/mixins/WidgetMixin.js
@@ -72,9 +72,9 @@ const WidgetMixin = {
this.updater = setInterval(() => { this.update(); }, this.updateInterval);
},
/* Called when an error occurs. Logs to handler, and passes to parent component */
- error(msg, stackTrace) {
+ error(msg, stackTrace, quite = false) {
ErrorHandler(msg, stackTrace);
- if (!this.options.ignoreErrors) {
+ if (!this.options.ignoreErrors && !quite) {
this.$emit('error', msg);
}
},