Feature: Zabbix service widget (#3905)

Co-Authored-By: shamoon <4887959+shamoon@users.noreply.github.com>
This commit is contained in:
Mitchell 2024-08-29 20:45:05 +02:00 committed by shamoon
parent 4c6150a545
commit 44f8e9d4da
10 changed files with 136 additions and 6 deletions

View file

@ -79,7 +79,21 @@ By default the key is passed as an `X-API-Key` header. If you need to pass the k
### `jsonrpcProxyHandler`
A proxy handler that makes authenticated JSON-RPC requests to the specified API endpoint. Where the endpoint is the method to call.
A proxy handler that makes authenticated JSON-RPC requests to the specified API endpoint, either using username + password or an API token.
The endpoint is the method to call and queryParams are used as the parameters.
=== "component.js"
```js
import Container from "components/services/widget/container";
import useWidgetAPI from "utils/proxy/use-widget-api";
export default function Component({ service }) {
const { widget } = service;
const { data, error } = useWidgetAPI(widget, 'trigger', { "triggerids": "14062", "output": "extend", "selectFunctions": "extend" });
}
```
=== "widget.js"
@ -93,6 +107,7 @@ A proxy handler that makes authenticated JSON-RPC requests to the specified API
mappings: {
total: { endpoint: "total" },
average: { endpoint: "average" },
trigger: { endpoint: "trigger.get" },
},
};
```
@ -110,6 +125,16 @@ A proxy handler that makes authenticated JSON-RPC requests to the specified API
password: your-password
```
```yaml
- Your Widget:
icon: yourwidget.svg
href: https://example.com/
widget:
type: yourwidget
url: http://127.0.0.1:1337
key: your-api-token
```
### `synologyProxyHandler`
A proxy handler that makes authenticated requests to the specified Synology API endpoint. This is used exclusively for Synology DSM services.