Feature: SWAG dashboard widget (#3523)
parent
0a75c831a6
commit
c6770d233c
@ -0,0 +1,14 @@
|
||||
---
|
||||
title: SWAG Dashboard
|
||||
description: SWAG Dashboard Widget Configuration
|
||||
---
|
||||
|
||||
Learn more about [SWAG Dashboard](https://github.com/linuxserver/docker-mods/tree/swag-dashboard).
|
||||
|
||||
Allowed fields: `["proxied", "auth", "outdated", "banned"]`.
|
||||
|
||||
```yaml
|
||||
widget:
|
||||
type: swagdashboard
|
||||
url: http://swagdashboard.host.or.ip:adminport # default port is 81
|
||||
```
|
@ -0,0 +1,33 @@
|
||||
import Container from "components/services/widget/container";
|
||||
import Block from "components/services/widget/block";
|
||||
import useWidgetAPI from "utils/proxy/use-widget-api";
|
||||
|
||||
export default function Component({ service }) {
|
||||
const { widget } = service;
|
||||
|
||||
const { data: swagData, error: swagError } = useWidgetAPI(widget, "overview");
|
||||
|
||||
if (swagError) {
|
||||
return <Container service={service} error={swagError} />;
|
||||
}
|
||||
|
||||
if (!swagData) {
|
||||
return (
|
||||
<Container service={service}>
|
||||
<Block label="swagdashboard.proxied" />
|
||||
<Block label="swagdashboard.auth" />
|
||||
<Block label="swagdashboard.outdated" />
|
||||
<Block label="swagdashboard.banned" />
|
||||
</Container>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Container service={service}>
|
||||
<Block label="swagdashboard.proxied" value={swagData.proxied} />
|
||||
<Block label="swagdashboard.auth" value={swagData.auth} />
|
||||
<Block label="swagdashboard.outdated" value={swagData.outdated} />
|
||||
<Block label="swagdashboard.banned" value={swagData.banned} />
|
||||
</Container>
|
||||
);
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
import genericProxyHandler from "utils/proxy/handlers/generic";
|
||||
|
||||
const widget = {
|
||||
api: "{url}/?stats=true",
|
||||
proxyHandler: genericProxyHandler,
|
||||
};
|
||||
|
||||
export default widget;
|
Loading…
Reference in new issue