Merge remote-tracking branch 'origin/dev' into integration

This commit is contained in:
djeinstine 2024-11-24 18:35:57 +00:00
commit faee7761e6
14 changed files with 189 additions and 0 deletions

View File

@ -107,6 +107,8 @@ If you are using multiple instances of homepage, an `instance` annotation can be
If you have a single service that needs to be shown on multiple specific instances of homepage (but not on all of them), the service can be annotated by multiple `instance.name` annotations, where `name` can be the names of your specific multiple homepage instances. For example, a service that is annotated with `gethomepage.dev/instance.public: ""` and `gethomepage.dev/instance.internal: ""` will be shown on `public` and `internal` homepage instances.
Use the `gethomepage.dev/pod-selector` selector to specify the pod used for the health check. For example, a service that is annotated with `gethomepage.dev/pod-selector: app.kubernetes.io/name=deployment` would link to a pod with the label `app.kubernetes.io/name: deployment`.
### Traefik IngressRoute support
Homepage can also read ingresses defined using the Traefik IngressRoute custom resource definition. Due to the complex nature of Traefik routing rules, it is required for the `gethomepage.dev/href` annotation to be set:

View File

@ -0,0 +1,20 @@
---
title: Gitlab
description: Gitlab Widget Configuration
---
Learn more about [Gitlab](https://gitlab.com).
API requires a personal access token with either `read_api` or `api` permission. See the [gitlab documentation](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html#create-a-personal-access-token) for details on generating one.
Your Gitlab user ID can be found on [your profile page](https://support.circleci.com/hc/en-us/articles/20761157174043-How-to-find-your-GitLab-User-ID).
Allowed fields: `["events", "issues", "merges", "projects"]`.
```yaml
widget:
type: gitlab
url: http://gitlab.host.or.ip:port
key: personal-access-token
user_id: 123456
```

View File

@ -41,6 +41,7 @@ You can also find a list of all available service widgets in the sidebar navigat
- [Gatus](gatus.md)
- [Ghostfolio](ghostfolio.md)
- [Gitea](gitea.md)
- [Gitlab](gitlab.md)
- [Glances](glances.md)
- [Gluetun](gluetun.md)
- [Gotify](gotify.md)

View File

@ -0,0 +1,15 @@
---
title: Spoolman
description: Spoolman Widget Configuration
---
Learn more about [Spoolman](https://github.com/Donkie/Spoolman).
4 spools are displayed by default. If more than 4 spools are configured in spoolman you can use the spoolIds configuration option to control which are displayed.
```yaml
widget:
type: spoolman
url: http://spoolman.host.or.ip
spoolIds: [1, 2, 3, 4] # optional
```

View File

@ -64,6 +64,7 @@ nav:
- widgets/services/gatus.md
- widgets/services/ghostfolio.md
- widgets/services/gitea.md
- widgets/services/gitlab.md
- widgets/services/glances.md
- widgets/services/gluetun.md
- widgets/services/gotify.md
@ -138,6 +139,7 @@ nav:
- widgets/services/scrutiny.md
- widgets/services/sonarr.md
- widgets/services/speedtest-tracker.md
- widgets/services/spoolman.md
- widgets/services/stash.md
- widgets/services/stocks.md
- widgets/services/swagdashboard.md

View File

@ -998,5 +998,14 @@
"progressing": "Progressing",
"missing": "Missing",
"suspended": "Suspended"
},
"spoolman": {
"loading": "Loading"
},
"gitlab": {
"groups": "Groups",
"issues": "Issues",
"merges": "Merge Requests",
"projects": "Projects"
}
}

View File

@ -406,6 +406,9 @@ export function cleanServiceGroups(groups) {
// technitium
range,
// spoolman
spoolIds,
} = cleanedService.widget;
let fieldsList = fields;
@ -567,6 +570,9 @@ export function cleanServiceGroups(groups) {
if (metrics) cleanedService.widget.metrics = metrics;
if (refreshInterval) cleanedService.widget.refreshInterval = refreshInterval;
}
if (type === "spoolman") {
if (spoolIds !== undefined) cleanedService.widget.spoolIds = spoolIds;
}
}
return cleanedService;

View File

@ -94,6 +94,8 @@ export default async function credentialedProxyHandler(req, res, map) {
}
} else if (widget.type === "wgeasy") {
headers.Authorization = widget.password;
} else if (widget.type === "gitlab") {
headers["PRIVATE-TOKEN"] = widget.key;
} else {
headers["X-API-Key"] = `${widget.key}`;
}

View File

@ -38,6 +38,7 @@ const components = {
gatus: dynamic(() => import("./gatus/component")),
ghostfolio: dynamic(() => import("./ghostfolio/component")),
gitea: dynamic(() => import("./gitea/component")),
gitlab: dynamic(() => import("./gitlab/component")),
glances: dynamic(() => import("./glances/component")),
gluetun: dynamic(() => import("./gluetun/component")),
gotify: dynamic(() => import("./gotify/component")),
@ -111,6 +112,7 @@ const components = {
scrutiny: dynamic(() => import("./scrutiny/component")),
sonarr: dynamic(() => import("./sonarr/component")),
speedtest: dynamic(() => import("./speedtest/component")),
spoolman: dynamic(() => import("./spoolman/component")),
stash: dynamic(() => import("./stash/component")),
stocks: dynamic(() => import("./stocks/component")),
strelaysrv: dynamic(() => import("./strelaysrv/component")),

View File

@ -0,0 +1,36 @@
import { useTranslation } from "next-i18next";
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 { t } = useTranslation();
const { widget } = service;
const { data: gitlabCounts, error: gitlabCountsError } = useWidgetAPI(widget, "counts");
if (gitlabCountsError) {
return <Container service={service} error={gitlabCountsError} />;
}
if (!gitlabCounts) {
return (
<Container service={service}>
<Block label="gitlab.groups" />
<Block label="gitlab.issues" />
<Block label="gitlab.merges" />
<Block label="gitlab.projects" />
</Container>
);
}
return (
<Container service={service}>
<Block label="gitlab.groups" value={t("common.number", { value: gitlabCounts.groups_count })} />
<Block label="gitlab.issues" value={t("common.number", { value: gitlabCounts.issues_count })} />
<Block label="gitlab.merges" value={t("common.number", { value: gitlabCounts.merge_requests_count })} />
<Block label="gitlab.projects" value={t("common.number", { value: gitlabCounts.projects_count })} />
</Container>
);
}

View File

@ -0,0 +1,13 @@
import credentialedProxyHandler from "utils/proxy/handlers/credentialed";
const widget = {
api: "{url}/api/v4/{endpoint}",
proxyHandler: credentialedProxyHandler,
mappings: {
counts: {
endpoint: "users/{user_id}/associations_count",
},
},
};
export default widget;

View File

@ -0,0 +1,63 @@
import { useTranslation } from "next-i18next";
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 { t } = useTranslation();
const { widget } = service;
// eslint-disable-next-line prefer-const
let { data: spoolData, error: spoolError } = useWidgetAPI(widget, "spools");
if (spoolError) {
return <Container service={service} error={spoolError} />;
}
if (!spoolData) {
const nBlocksGuess = widget.spoolIds?.length ?? 4;
return (
<Container service={service}>
{[...Array(nBlocksGuess)].map((_, i) => (
// eslint-disable-next-line react/no-array-index-key
<Block key={i} label="spoolman.loading" />
))}
</Container>
);
}
if (spoolData.error || spoolData.message) {
return <Container service={service} error={spoolData?.error ?? spoolData} />;
}
if (spoolData.length === 0) {
return (
<Container service={service}>
<Block label="spoolman.noSpools" />
</Container>
);
}
if (widget.spoolIds?.length) {
spoolData = spoolData.filter((spool) => widget.spoolIds.includes(spool.id));
}
if (spoolData.length > 4) {
spoolData = spoolData.slice(0, 4);
}
return (
<Container service={service}>
{spoolData.map((spool) => (
<Block
key={spool.id}
label={spool.filament.name}
value={t("common.percent", {
value: (spool.remaining_weight / spool.initial_weight) * 100,
})}
/>
))}
</Container>
);
}

View File

@ -0,0 +1,14 @@
import credentialedProxyHandler from "utils/proxy/handlers/credentialed";
const widget = {
api: "{url}/api/v1/{endpoint}",
proxyHandler: credentialedProxyHandler,
mappings: {
spools: {
endpoint: "spool",
},
},
};
export default widget;

View File

@ -32,6 +32,7 @@ import gamedig from "./gamedig/widget";
import gatus from "./gatus/widget";
import ghostfolio from "./ghostfolio/widget";
import gitea from "./gitea/widget";
import gitlab from "./gitlab/widget";
import glances from "./glances/widget";
import gluetun from "./gluetun/widget";
import gotify from "./gotify/widget";
@ -102,6 +103,7 @@ import sabnzbd from "./sabnzbd/widget";
import scrutiny from "./scrutiny/widget";
import sonarr from "./sonarr/widget";
import speedtest from "./speedtest/widget";
import spoolman from "./spoolman/widget";
import stash from "./stash/widget";
import stocks from "./stocks/widget";
import strelaysrv from "./strelaysrv/widget";
@ -163,6 +165,7 @@ const widgets = {
gatus,
ghostfolio,
gitea,
gitlab,
glances,
gluetun,
gotify,
@ -237,6 +240,7 @@ const widgets = {
scrutiny,
sonarr,
speedtest,
spoolman,
stash,
stocks,
strelaysrv,