Skip to content

Commit

Permalink
Fix: Remove unused dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
Its4Nik committed Jan 10, 2025
1 parent 6b24a25 commit 87a586e
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 25 deletions.
13 changes: 0 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
"dockerode": "^4.0.2",
"express": "^4.21.1",
"express-rate-limit": "^7.4.1",
"hex-rgb": "^5.0.0",
"https": "^1.0.0",
"ipaddr.js": "^2.2.0",
"nodemailer": "^6.9.16",
Expand Down
12 changes: 1 addition & 11 deletions src/handlers/graph.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import cytoscape from "cytoscape";
import logger from "../utils/logger";
import hexRgb from "hex-rgb";
import { AllContainerData, ContainerData } from "./../typings/dockerConfig";
import { atomicWrite } from "../utils/atomicWrite";
import { rateLimitedReadFile } from "../utils/rateLimitFS";
Expand All @@ -24,19 +23,10 @@ async function getPathData(path: string) {
}
}

function hexToRgb(str: string) {
const hexTest = /#[a-f\d]{3,6}/gim;
return str.replace(hexTest, (hexColor) => {
const { red, green, blue } = hexRgb(hexColor);
return `rgb(${red}, ${green}, ${blue})`;
});
}

async function renderGraphToImage(
htmlContent: string,
outputImagePath: string,
): Promise<void> {
const replacedHTML = hexToRgb(htmlContent);
const browser = await puppeteer.launch({
headless: true,
args: [`--window-size=1920,1080`],
Expand All @@ -46,7 +36,7 @@ async function renderGraphToImage(
},
});
const page = await browser.newPage();
await page.setContent(replacedHTML, { waitUntil: "networkidle0" });
await page.setContent(htmlContent, { waitUntil: "networkidle0" });
//await page.waitForNavigation({ waitUntil: "load" });
await page.waitForSelector("#cy", { visible: true });
await page.waitForFunction(
Expand Down

0 comments on commit 87a586e

Please sign in to comment.