diff --git a/docs/widgets.md b/docs/widgets.md index fd11ae13c8..22795b4890 100644 --- a/docs/widgets.md +++ b/docs/widgets.md @@ -16,6 +16,7 @@ Dashy has support for displaying dynamic content in the form of widgets. There a - [Stock Price History](#stock-price-history) - [Joke of the Day](#joke) - [Flight Data](#flight-data) + - [Example Widget](#example-widget) - [Self-Hosted Services Widgets](#dynamic-widgets) - [Dynamic Widgets](#dynamic-widgets) - [Iframe Widget](#iframe-widget) @@ -366,6 +367,30 @@ Displays airport departure and arrival flights, using data from [AeroDataBox](ht --- +### Example Widget + +A simple example widget, to use as a template. Fetches and displays a list of images, from [Dummy APIs](https://dummyapis.com/). + +

+ +##### Options + +**Field** | **Type** | **Required** | **Description** +--- | --- | --- | --- +**`text`** | `string` | _Optional_ | Text to display in the images. Defaults to `Dashy` +**`count`** | `number` | _Optional_ | The number of images to be rendered. Defaults to `5` + +##### Example + +```yaml +- type: example + options: + text: Hello + count: 3 +``` + +--- + ## Dynamic Widgets ### Iframe Widget diff --git a/src/components/Widgets/ExampleWidget.vue b/src/components/Widgets/ExampleWidget.vue new file mode 100644 index 0000000000..e4ffbcc77b --- /dev/null +++ b/src/components/Widgets/ExampleWidget.vue @@ -0,0 +1,117 @@ + + + + + diff --git a/src/components/Widgets/WidgetBase.vue b/src/components/Widgets/WidgetBase.vue index abc81472fc..402a0ac173 100644 --- a/src/components/Widgets/WidgetBase.vue +++ b/src/components/Widgets/WidgetBase.vue @@ -116,6 +116,13 @@ @error="handleError" :ref="widgetRef" /> +
{{ handleError('No widget type was specified') }}
@@ -145,6 +152,7 @@ import Jokes from '@/components/Widgets/Jokes.vue'; import Flights from '@/components/Widgets/Flights.vue'; import IframeWidget from '@/components/Widgets/IframeWidget.vue'; import EmbedWidget from '@/components/Widgets/EmbedWidget.vue'; +import ExampleWidget from '@/components/Widgets/ExampleWidget.vue'; export default { name: 'Widget', @@ -167,6 +175,7 @@ export default { Flights, IframeWidget, EmbedWidget, + ExampleWidget, }, props: { widget: Object, diff --git a/src/utils/defaults.js b/src/utils/defaults.js index 7434290b88..9886c08bac 100644 --- a/src/utils/defaults.js +++ b/src/utils/defaults.js @@ -216,6 +216,7 @@ module.exports = { jokes: 'https://v2.jokeapi.dev/joke/', flights: 'https://aerodatabox.p.rapidapi.com/flights/airports/icao/', rssToJson: 'https://api.rss2json.com/v1/api.json', + exampleEndpoint: 'https://hub.dummyapis.com/ImagesList', }, /* URLs for web search engines */ searchEngineUrls: {