Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a37e101bba |
No files matched your search
+8
-8
@@ -74,7 +74,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td align="center">
|
<td align="center">
|
||||||
<a href="https://homarr.dev/docs/integrations/archiveteam-warrior" target="_blank" rel="noreferrer noopener">
|
<a href="null" target="_blank" rel="noreferrer noopener">
|
||||||
<img src="https://cdn.jsdelivr.net/gh/selfhst/icons/png/archiveteam-warrior.png" alt="ArchiveTeam Warrior" width="90" height="90" />
|
<img src="https://cdn.jsdelivr.net/gh/selfhst/icons/png/archiveteam-warrior.png" alt="ArchiveTeam Warrior" width="90" height="90" />
|
||||||
<br/>
|
<br/>
|
||||||
<p align="center">ArchiveTeam<br/>Warrior</p>
|
<p align="center">ArchiveTeam<br/>Warrior</p>
|
||||||
@@ -88,7 +88,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td align="center">
|
<td align="center">
|
||||||
<a href="https://homarr.dev/docs/integrations/audiobookshelf" target="_blank" rel="noreferrer noopener">
|
<a href="null" target="_blank" rel="noreferrer noopener">
|
||||||
<img src="https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons@master/svg/audiobookshelf.svg" alt="Audiobookshelf" width="90" height="90" />
|
<img src="https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons@master/svg/audiobookshelf.svg" alt="Audiobookshelf" width="90" height="90" />
|
||||||
<br/>
|
<br/>
|
||||||
<p align="center">Audiobookshelf</p>
|
<p align="center">Audiobookshelf</p>
|
||||||
@@ -137,7 +137,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td align="center">
|
<td align="center">
|
||||||
<a href="https://homarr.dev/docs/integrations/glances" target="_blank" rel="noreferrer noopener">
|
<a href="null" target="_blank" rel="noreferrer noopener">
|
||||||
<img src="https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons@master/svg/glances.svg" alt="Glances" width="90" height="90" />
|
<img src="https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons@master/svg/glances.svg" alt="Glances" width="90" height="90" />
|
||||||
<br/>
|
<br/>
|
||||||
<p align="center">Glances</p>
|
<p align="center">Glances</p>
|
||||||
@@ -200,7 +200,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td align="center">
|
<td align="center">
|
||||||
<a href="https://homarr.dev/docs/integrations/navidrome" target="_blank" rel="noreferrer noopener">
|
<a href="null" target="_blank" rel="noreferrer noopener">
|
||||||
<img src="https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons@master/svg/navidrome.svg" alt="Navidrome" width="90" height="90" />
|
<img src="https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons@master/svg/navidrome.svg" alt="Navidrome" width="90" height="90" />
|
||||||
<br/>
|
<br/>
|
||||||
<p align="center">Navidrome</p>
|
<p align="center">Navidrome</p>
|
||||||
@@ -249,7 +249,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td align="center">
|
<td align="center">
|
||||||
<a href="https://homarr.dev/docs/integrations/paperless-ngx" target="_blank" rel="noreferrer noopener">
|
<a href="null" target="_blank" rel="noreferrer noopener">
|
||||||
<img src="https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons@master/svg/paperless-ngx.svg" alt="Paperless-ngx" width="90" height="90" />
|
<img src="https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons@master/svg/paperless-ngx.svg" alt="Paperless-ngx" width="90" height="90" />
|
||||||
<br/>
|
<br/>
|
||||||
<p align="center">Paperless-ngx</p>
|
<p align="center">Paperless-ngx</p>
|
||||||
@@ -263,7 +263,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td align="center">
|
<td align="center">
|
||||||
<a href="https://homarr.dev/docs/integrations/peanut" target="_blank" rel="noreferrer noopener">
|
<a href="null" target="_blank" rel="noreferrer noopener">
|
||||||
<img src="https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons@master/svg/peanut.svg" alt="PeaNUT" width="90" height="90" />
|
<img src="https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons@master/svg/peanut.svg" alt="PeaNUT" width="90" height="90" />
|
||||||
<br/>
|
<br/>
|
||||||
<p align="center">PeaNUT</p>
|
<p align="center">PeaNUT</p>
|
||||||
@@ -313,7 +313,7 @@
|
|||||||
</td>
|
</td>
|
||||||
<td align="center">
|
<td align="center">
|
||||||
<a href="https://homarr.dev/docs/integrations/readarr" target="_blank" rel="noreferrer noopener">
|
<a href="https://homarr.dev/docs/integrations/readarr" target="_blank" rel="noreferrer noopener">
|
||||||
<img src="https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons@main/png/readarr.png" alt="Readarr" width="90" height="90" />
|
<img src="https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons@master/svg/readarr.svg" alt="Readarr" width="90" height="90" />
|
||||||
<br/>
|
<br/>
|
||||||
<p align="center">Readarr</p>
|
<p align="center">Readarr</p>
|
||||||
</a>
|
</a>
|
||||||
@@ -424,7 +424,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td align="center">
|
<td align="center">
|
||||||
<a href="https://homarr.dev/docs/integrations/uptime-kuma" target="_blank" rel="noreferrer noopener">
|
<a href="null" target="_blank" rel="noreferrer noopener">
|
||||||
<img src="https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons@master/svg/uptime-kuma.svg" alt="Uptime Kuma" width="90" height="90" />
|
<img src="https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons@master/svg/uptime-kuma.svg" alt="Uptime Kuma" width="90" height="90" />
|
||||||
<br/>
|
<br/>
|
||||||
<p align="center">Uptime<br/>Kuma</p>
|
<p align="center">Uptime<br/>Kuma</p>
|
||||||
|
|||||||
@@ -481,13 +481,14 @@ export function calculateCpuUsage(stats: ContainerStats): number {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const numberOfCpus = stats.cpu_stats.online_cpus;
|
const cpuDelta = stats.cpu_stats.cpu_usage.total_usage - (stats.precpu_stats?.cpu_usage?.total_usage ?? 0);
|
||||||
const usage = stats.cpu_stats.system_cpu_usage;
|
const systemDelta = (stats.cpu_stats.system_cpu_usage ?? 0) - (stats.precpu_stats?.system_cpu_usage ?? 0);
|
||||||
if (!usage || usage === 0) {
|
|
||||||
|
if (systemDelta <= 0 || cpuDelta < 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (stats.cpu_stats.cpu_usage.total_usage / usage) * numberOfCpus * 100;
|
return (cpuDelta / systemDelta) * 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function calculateMemoryUsage(stats: ContainerStats): number {
|
export function calculateMemoryUsage(stats: ContainerStats): number {
|
||||||
|
|||||||
@@ -72,16 +72,16 @@ describe("calculateCpuUsage", () => {
|
|||||||
const stats = createStats({
|
const stats = createStats({
|
||||||
cpu_stats: { online_cpus: 4, cpu_usage: { total_usage: 2000 }, system_cpu_usage: 10000 },
|
cpu_stats: { online_cpus: 4, cpu_usage: { total_usage: 2000 }, system_cpu_usage: 10000 },
|
||||||
});
|
});
|
||||||
// (2000 / 10000) * 4 * 100 = 80
|
// (2000 / 10000) * 100 = 20
|
||||||
expect(calculateCpuUsage(stats)).toBe(80);
|
expect(calculateCpuUsage(stats)).toBe(20);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("should handle fractional CPU usage", () => {
|
test("should handle fractional CPU usage", () => {
|
||||||
const stats = createStats({
|
const stats = createStats({
|
||||||
cpu_stats: { online_cpus: 2, cpu_usage: { total_usage: 500 }, system_cpu_usage: 100000 },
|
cpu_stats: { online_cpus: 2, cpu_usage: { total_usage: 500 }, system_cpu_usage: 100000 },
|
||||||
});
|
});
|
||||||
// (500 / 100000) * 2 * 100 = 1
|
// (500 / 100000) * 100 = 0.5
|
||||||
expect(calculateCpuUsage(stats)).toBe(1);
|
expect(calculateCpuUsage(stats)).toBe(0.5);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
import { readFile, writeFile } from "fs/promises";
|
import { readFile, writeFile } from "fs/promises";
|
||||||
import {
|
import { integrationDefs } from "../packages/definitions/src/integration";
|
||||||
getIntegrationDocumentationUrl,
|
|
||||||
integrationDefs,
|
|
||||||
integrationKinds,
|
|
||||||
} from "../packages/definitions/src/integration";
|
|
||||||
|
|
||||||
const FILE = "docs/README.md";
|
const FILE = "docs/README.md";
|
||||||
const MAX_COLUMNS_PER_ROW = 7;
|
const MAX_COLUMNS_PER_ROW = 7;
|
||||||
@@ -25,29 +21,19 @@ async function updateIntegrationList() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Generate the new integration list
|
// Generate the new integration list
|
||||||
const integrations = integrationKinds
|
const integrations = Object.values(integrationDefs)
|
||||||
.filter((kind) => kind !== "mock")
|
.filter((def) => def.name !== "Mock")
|
||||||
.map((kind) => ({
|
.sort((a, b) => a.name.localeCompare(b.name));
|
||||||
...integrationDefs[kind],
|
|
||||||
documentationUrl: getIntegrationDocumentationUrl(kind),
|
|
||||||
}))
|
|
||||||
.toSorted((a, b) => a.name.localeCompare(b.name));
|
|
||||||
const tableRows: string[] = [];
|
const tableRows: string[] = [];
|
||||||
let currentRow: string[] = [];
|
let currentRow: string[] = [];
|
||||||
|
|
||||||
integrations.forEach((integration) => {
|
integrations.forEach((integration) => {
|
||||||
const cellBody = `
|
currentRow.push(`<td align="center">
|
||||||
|
<a href="${integration.documentationUrl}" target="_blank" rel="noreferrer noopener">
|
||||||
<img src="${integration.iconUrl}" alt="${integration.name}" width="90" height="90" />
|
<img src="${integration.iconUrl}" alt="${integration.name}" width="90" height="90" />
|
||||||
<br/>
|
<br/>
|
||||||
<p align="center">${integration.name.replaceAll(" ", "<br/>")}</p>
|
<p align="center">${integration.name.replaceAll(" ", "<br/>")}</p>
|
||||||
`;
|
</a>
|
||||||
let cellContent = `<div>${cellBody}</div>`;
|
|
||||||
if (integration.documentationUrl !== null) {
|
|
||||||
cellContent = `<a href="${integration.documentationUrl}" target="_blank" rel="noreferrer noopener">${cellBody}</a>`;
|
|
||||||
}
|
|
||||||
|
|
||||||
currentRow.push(`<td align="center">
|
|
||||||
${cellContent}
|
|
||||||
</td>`);
|
</td>`);
|
||||||
|
|
||||||
if (currentRow.length === MAX_COLUMNS_PER_ROW) {
|
if (currentRow.length === MAX_COLUMNS_PER_ROW) {
|
||||||
@@ -81,7 +67,4 @@ ${endMarker}`;
|
|||||||
await writeFile(FILE, newContent, "utf8");
|
await writeFile(FILE, newContent, "utf8");
|
||||||
}
|
}
|
||||||
|
|
||||||
updateIntegrationList().catch((error: unknown) => {
|
updateIntegrationList().catch(console.error);
|
||||||
console.error(error);
|
|
||||||
process.exitCode = 1;
|
|
||||||
});
|
|
||||||
Reference in new issue
Block a user