Merge pull request #1701 from Nizzan943/feat/add-azure-pipelines
Adding Azure Pipelines
This commit is contained in:
commit
460c67be77
6 changed files with 60 additions and 0 deletions
|
@ -664,5 +664,15 @@
|
||||||
"kavita": {
|
"kavita": {
|
||||||
"seriesCount": "Series",
|
"seriesCount": "Series",
|
||||||
"totalFiles": "Files"
|
"totalFiles": "Files"
|
||||||
|
},
|
||||||
|
"azurePipelines": {
|
||||||
|
"result": "Result",
|
||||||
|
"status": "Status",
|
||||||
|
"buildId": "Build ID",
|
||||||
|
"succeeded": "Succeeded",
|
||||||
|
"notStarted": "Not Started",
|
||||||
|
"failed": "Failed",
|
||||||
|
"canceled": "Canceled",
|
||||||
|
"inProgress": "In Progress"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,6 +61,9 @@ export default async function credentialedProxyHandler(req, res, map) {
|
||||||
} else {
|
} else {
|
||||||
headers.Authorization = `Basic ${Buffer.from(`${widget.username}:${widget.password}`).toString("base64")}`;
|
headers.Authorization = `Basic ${Buffer.from(`${widget.username}:${widget.password}`).toString("base64")}`;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else if (widget.type === "azurePipelines") {
|
||||||
|
headers.Authorization = `Basic ${Buffer.from(`$:${widget.key}`).toString("base64")}`;
|
||||||
} else {
|
} else {
|
||||||
headers["X-API-Key"] = `${widget.key}`;
|
headers["X-API-Key"] = `${widget.key}`;
|
||||||
}
|
}
|
||||||
|
|
36
src/widgets/azurePipelines/component.jsx
Normal file
36
src/widgets/azurePipelines/component.jsx
Normal 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: pipelineData, error: pipelineError } = useWidgetAPI(widget);
|
||||||
|
|
||||||
|
if (pipelineError) {
|
||||||
|
return <Container service={service} error={pipelineError} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!pipelineData || !Array.isArray(pipelineData.value)) {
|
||||||
|
return (
|
||||||
|
<Container service={service}>
|
||||||
|
<Block label="azurePipelines.result" />
|
||||||
|
<Block label="azurePipelines.buildId" />
|
||||||
|
</Container>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Container service={service}>
|
||||||
|
{pipelineData.value[0].result ?
|
||||||
|
<Block label="azurePipelines.result" value={t(`azurePipelines.${pipelineData.value[0].result.toString()}`)} /> :
|
||||||
|
<Block label="azurePipelines.status" value={t(`azurePipelines.${pipelineData.value[0].status.toString()}`)} />
|
||||||
|
}
|
||||||
|
<Block label="azurePipelines.buildId" value= { pipelineData.value[0].id } />
|
||||||
|
</Container>
|
||||||
|
);
|
||||||
|
}
|
8
src/widgets/azurePipelines/widget.js
Normal file
8
src/widgets/azurePipelines/widget.js
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
import credentialedProxyHandler from "utils/proxy/handlers/credentialed";
|
||||||
|
|
||||||
|
const widget = {
|
||||||
|
api: "https://dev.azure.com/{organization}/{project}/_apis/build/Builds?branchName={branchName}&definitions={definitionId}",
|
||||||
|
proxyHandler: credentialedProxyHandler,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default widget;
|
|
@ -5,6 +5,7 @@ const components = {
|
||||||
audiobookshelf: dynamic(() => import("./audiobookshelf/component")),
|
audiobookshelf: dynamic(() => import("./audiobookshelf/component")),
|
||||||
authentik: dynamic(() => import("./authentik/component")),
|
authentik: dynamic(() => import("./authentik/component")),
|
||||||
autobrr: dynamic(() => import("./autobrr/component")),
|
autobrr: dynamic(() => import("./autobrr/component")),
|
||||||
|
azurePipelines: dynamic(() => import("./azurePipelines/component")),
|
||||||
bazarr: dynamic(() => import("./bazarr/component")),
|
bazarr: dynamic(() => import("./bazarr/component")),
|
||||||
caddy: dynamic(() => import("./caddy/component")),
|
caddy: dynamic(() => import("./caddy/component")),
|
||||||
changedetectionio: dynamic(() => import("./changedetectionio/component")),
|
changedetectionio: dynamic(() => import("./changedetectionio/component")),
|
||||||
|
|
|
@ -2,6 +2,7 @@ import adguard from "./adguard/widget";
|
||||||
import audiobookshelf from "./audiobookshelf/widget";
|
import audiobookshelf from "./audiobookshelf/widget";
|
||||||
import authentik from "./authentik/widget";
|
import authentik from "./authentik/widget";
|
||||||
import autobrr from "./autobrr/widget";
|
import autobrr from "./autobrr/widget";
|
||||||
|
import azurePipelines from "./azurePipelines/widget";
|
||||||
import bazarr from "./bazarr/widget";
|
import bazarr from "./bazarr/widget";
|
||||||
import caddy from "./caddy/widget";
|
import caddy from "./caddy/widget";
|
||||||
import changedetectionio from "./changedetectionio/widget";
|
import changedetectionio from "./changedetectionio/widget";
|
||||||
|
@ -91,6 +92,7 @@ const widgets = {
|
||||||
audiobookshelf,
|
audiobookshelf,
|
||||||
authentik,
|
authentik,
|
||||||
autobrr,
|
autobrr,
|
||||||
|
azurePipelines,
|
||||||
bazarr,
|
bazarr,
|
||||||
caddy,
|
caddy,
|
||||||
changedetectionio,
|
changedetectionio,
|
||||||
|
|
Loading…
Add table
Reference in a new issue