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!

✨ Adds update support to image widget (#992)

Alicia Sykes71291c1ce9de
diff --git a/src/components/Widgets/ImageWidget.vue b/src/components/Widgets/ImageWidget.vue
index a556810f..2634b1d2 100644
--- a/src/components/Widgets/ImageWidget.vue
+++ b/src/components/Widgets/ImageWidget.vue
@@ -9,10 +9,24 @@ import WidgetMixin from '@/mixins/WidgetMixin';
export default {
mixins: [WidgetMixin],
+ data: () => ({
+ updateCount: 0,
+ }),
computed: {
+ /* The path to image to render */
imagePath() {
if (!this.options.imagePath) this.error('You must specify an imagePath');
- return this.options.imagePath;
+ return `${this.options.imagePath}${this.updatePathParam}`;
+ },
+ /* Generate a URL param, to be updated in order to re-fetch image */
+ updatePathParam() {
+ return this.updateCount ? `#dashy-update-${this.updateCount}` : '';
+ },
+ },
+ methods: {
+ /* In order to re-fetch the image, we much update the URL with an arbitrary hash */
+ update() {
+ this.updateCount += 1;
},
},
};