From 281f173d14aca95bf0257dcddc270175835c2ef9 Mon Sep 17 00:00:00 2001 From: Matthias Bilger Date: Tue, 14 Feb 2023 19:05:24 +0100 Subject: [PATCH] Added documentation --- docs/widgets.md | 39 +++++++++++++++++++++++++++-- src/components/Widgets/Linkding.vue | 15 ++++++++++- 2 files changed, 51 insertions(+), 3 deletions(-) diff --git a/docs/widgets.md b/docs/widgets.md index ade021d7..550dd6fd 100644 --- a/docs/widgets.md +++ b/docs/widgets.md @@ -61,6 +61,7 @@ Dashy has support for displaying dynamic content in the form of widgets. There a - [Sabnzbd](#sabnzbd) - [Gluetun VPN Info](#gluetun-vpn-info) - [Drone CI Build](#drone-ci-builds) + - [Linkding](#linkding) - **[System Resource Monitoring](#system-resource-monitoring)** - [CPU Usage Current](#current-cpu-usage) - [CPU Usage Per Core](#cpu-usage-per-core) @@ -2046,7 +2047,7 @@ Display the last builds from a [Drone CI](https://www.drone.ci) instance. A self **Field** | **Type** | **Required** | **Description** --- | --- | --- | --- -**`host`** | `string` | Required | The histname of the Drone CI instance. +**`host`** | `string` | Required | The hostname of the Drone CI instance. **`apiKey`** | `string` | Required | The API key (https:///account). **`limit`** | `integer` | _Optional_ | Limit the amounts of listed builds. **`repo`** | `string` | _Optional_ | Show only builds of the specified repo @@ -2072,10 +2073,44 @@ Display the last builds from a [Drone CI](https://www.drone.ci) instance. A self --- +### Linkding + +Linkding is a self-hosted bookmarking service, which has a clean interface and is simple to set up. This lists the links, filterable by tags. + +#### Options + +**Field** | **Type** | **Required** | **Description** +--- | --- | --- | --- +**`host`** | `string` | Required | The hostname of the Drone CI instance. +**`apiKey`** | `string` | Required | The API key (https:///settings/integrations). +**`tags`** | `list of string` | _Optional_ | Filter the links by tag. + +#### Example + +```yaml +- type: linkding + updateInterval: 30 + options: + host: https://lingding.somedomain.com + apiKey: my-very-secret-api-key + tags: + - rpg + - markdown +``` + +#### Info + +- **CORS**: 🟢 Enabled +- **Auth**: 🟢 Required +- **Price**: 🟢 Free +- **Host**: Self-Hosted (see [Linkding](https://github.com/sissbruecker/linkding)) +- **Privacy**: _See [Linkding](https://github.com/sissbruecker/linkding)_ + +--- + ## System Resource Monitoring ### Glances - The easiest method for displaying system info and resource usage in Dashy is with [Glances](https://nicolargo.github.io/glances/). Glances is a cross-platform monitoring tool developed by [@nicolargo](https://github.com/nicolargo). It's similar to top/htop but with a [Rest API](https://glances.readthedocs.io/en/latest/api.html) and many [data exporters](https://glances.readthedocs.io/en/latest/gw/index.html) available. Under the hood, it uses [psutil](https://github.com/giampaolo/psutil) for retrieving system info. diff --git a/src/components/Widgets/Linkding.vue b/src/components/Widgets/Linkding.vue index c5c60ef4..8f8c47c4 100644 --- a/src/components/Widgets/Linkding.vue +++ b/src/components/Widgets/Linkding.vue @@ -36,6 +36,9 @@ export default { if (!this.options.apiKey) this.error('linkgding apiKey is required'); return this.options.apiKey; }, + filtertags() { + return this.options.tags; + }, }, methods: { update() { @@ -50,7 +53,17 @@ export default { ); }, processData(data) { - this.links = data.results; + const self = this; + const fltr = function (entry) { + if (self.filtertags === null) return true; + for (let i = 0; i < self.filtertags.length; i += 1) { + if (entry.tag_names.includes(self.filtertags[i])) return true; + } + return false; + }; + this.links = data.results.filter( + entry => fltr(entry), + ); }, }, };