Skip to content
Snippets Groups Projects
Commit a139c55f authored by Robin Leber's avatar Robin Leber
Browse files

Scaling Anzeige

parent e24273b2
No related branches found
No related tags found
No related merge requests found
......@@ -222,6 +222,30 @@ const scaleOut = async (id) => {
}
};
const scalingCounter = async () => {
const customCodes = await getCustomCodes();
const idCounts = {};
customCodes.forEach((code) => {
if (code.id !== undefined) {
if (!idCounts[code.id] && code.isScaled === "") {
idCounts[code.id] = 0;
idCounts[code.id]++;
}
if (code.isScaled !== "") {
idCounts[code.isScaled]++;
}
}
});
const result = Object.keys(idCounts).map((id) => {
return { id: id, count: idCounts[id] };
});
return result;
};
module.exports = {
emptyDockerJS,
fillDockerJS,
......@@ -233,4 +257,5 @@ module.exports = {
stopArchitecture,
restartArchitecture,
scaleOut,
scalingCounter,
};
......@@ -5,6 +5,7 @@ const {
restartArchitecture,
clearArchitecture,
scaleOut,
scalingCounter,
} = require("../functions/helperFunctions");
const deployRouter = express.Router();
......@@ -60,4 +61,14 @@ deployRouter.post("/scaleOut", async (req, res) => {
}
});
deployRouter.get("/scaleValues", async (req, res) => {
try {
const result = await scalingCounter();
res.status(200).json({ result, message: "Scale Values erfolgreich" });
} catch (e) {
console.error(e);
res.status(500).json({ message: "Scale Values fehlgeschlagen" });
}
});
module.exports = deployRouter;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment