From 50f4cc9d7b36763d9718025336a584d82167b309 Mon Sep 17 00:00:00 2001 From: Robin Leber <rleber98@gmail.com> Date: Tue, 11 Jun 2024 15:01:58 +0200 Subject: [PATCH] FEAT: Scaling frontend --- src/functions/api.js | 20 ++++++++++++++++++++ src/functions/codeEditor.js | 1 + src/functions/contextmenu.js | 7 +++++++ 3 files changed, 28 insertions(+) diff --git a/src/functions/api.js b/src/functions/api.js index b766876..a39276f 100644 --- a/src/functions/api.js +++ b/src/functions/api.js @@ -95,3 +95,23 @@ export const clearArchitecture = async () => { console.error(error); }); }; + +export const scaleOut = async (id) => { + const requestBody = { id: id }; + loader(true); + await axios + .post(`${SERVER_URL}/deployment/scaleOut`, requestBody) + .then((response) => { + loader(false); + if (response.status === 200) { + successFeedback(); + } else { + errorFeedback(response); + } + }) + .catch((error) => { + loader(false); + errorFeedback(error); + console.error(error); + }); +}; diff --git a/src/functions/codeEditor.js b/src/functions/codeEditor.js index 85c9b56..46eb5fa 100644 --- a/src/functions/codeEditor.js +++ b/src/functions/codeEditor.js @@ -96,6 +96,7 @@ const handleSubmit = (node, code) => { code: code, isDeployed: false, isPaused: false, + isScaled: false, }; createCustomCode(requestBody); node.style.visibility = "hidden"; diff --git a/src/functions/contextmenu.js b/src/functions/contextmenu.js index 547a831..0f7dd1b 100644 --- a/src/functions/contextmenu.js +++ b/src/functions/contextmenu.js @@ -1,5 +1,6 @@ import { duplicatePipe, duplicateFilter } from "./duplication"; import { codeEditor } from "./codeEditor"; +import { scaleOut } from "./api"; export const initContextmenu = (instance) => { // Kontext Menü zum Löschen von Connections @@ -38,6 +39,9 @@ export const initContextmenu = (instance) => { <button style='border: none; padding: 6px 12px;' class='code-filter'> Code Filter </button> + <button style='background-color: blue; color: white; border: none; padding: 6px 12px;' class='scale-out'> + SCALE OUT + </button> <button style='background-color: red; color: white; border: none; padding: 6px 12px;' class='delete-filter'> Delete Filter </button> @@ -56,6 +60,9 @@ export const initContextmenu = (instance) => { $("body").on("click", ".code-filter", (event) => { codeEditor(instance); }); + $("body").on("click", ".scale-out", (event) => { + scaleOut(window.selectedFilter); + }); // Kontext Menü zum Löschen von Pipes $("body").on("contextmenu", "#Diagram .Pipe", (event) => { -- GitLab