diff --git a/frontend/src/components/NewHeader.jsx b/frontend/src/components/NewHeader.jsx index bd28e2de..e9891240 100644 --- a/frontend/src/components/NewHeader.jsx +++ b/frontend/src/components/NewHeader.jsx @@ -454,12 +454,9 @@ const Header = (props) => { return response.json(); }) .then(function (responseJson) { + console.log("In here?") if (responseJson.success === true) { - if ( - responseJson.region_url !== undefined && - responseJson.region_url !== null && - responseJson.region_url.length > 0 - ) { + if (responseJson.region_url !== undefined && responseJson.region_url !== null && responseJson.region_url.length > 0) { console.log("Region Change: ", responseJson.region_url); localStorage.setItem("globalUrl", responseJson.region_url); //globalUrl = responseJson.region_url @@ -468,9 +465,14 @@ const Header = (props) => { setTimeout(() => { window.location.reload(); }, 2000); + toast("Successfully changed active organization - refreshing!"); } else { - toast("Failed changing org: ", responseJson.reason); + if (responseJson.reason !== undefined && responseJson.reason !== null && responseJson.reason.length > 0) { + toast(responseJson.reason); + } else { + toast("Failed changing org. Try again or contact support@shuffler.io if this persists."); + } } }) .catch((error) => { diff --git a/frontend/src/components/ParsedAction.jsx b/frontend/src/components/ParsedAction.jsx index e0abbe42..66c159a0 100755 --- a/frontend/src/components/ParsedAction.jsx +++ b/frontend/src/components/ParsedAction.jsx @@ -11,6 +11,7 @@ import { NestedMenuItem } from "mui-nested-menu"; //import { useAlert import { + Chip, ButtonGroup, Popper, TextField, @@ -3298,14 +3299,12 @@ const ParsedAction = (props) => { Authentication
{ ); })} + + {isCloud && (selectedApp.sharing === true || selectedApp.public === true || creatorProfile.github_avatar !== undefined) && !internalIds.includes(selectedApp.name.toLowerCase()) ? + + : null}
) : null} + +
+ {isCloud && Object.getOwnPropertyNames(creatorProfile).length !== 0 && creatorProfile.github_avatar !== undefined && creatorProfile.github_avatar !== null ? +
+ { + //setAnchorElAvatar(event.currentTarget); + }} + > + + + + + + Shared by{" "} + + {creatorProfile.github_username} + + +
+ : null} + {selectedApp.tags !== undefined && selectedApp.tags !== null ? ( +
+ {selectedApp.tags.map((tag, index) => { + if (index >= 3) { + return null; + } + + return ( + + ); + })} +
+ ) : null} +
{/*

Owner: {selectedApp.owner}

*/} {selectedApp.privateId !== undefined && selectedApp.privateId.length > 0 ? ( @@ -1666,37 +1804,45 @@ const Apps = (props) => { ) } - const activateApp = (appid, refresh) => { - fetch(globalUrl + "/api/v1/apps/" + appid + "/activate", { - method: 'GET', - headers: { - 'Content-Type': 'application/json', - 'Accept': 'application/json', - }, - credentials: "include", + const activateApp = (appid, refresh) => { + const appExists = userdata.active_apps !== undefined && userdata.active_apps !== null && userdata.active_apps.includes(appid) + const url = appExists ? `${globalUrl}/api/v1/apps/${appid}/deactivate` : `${globalUrl}/api/v1/apps/${appid}/activate` + + fetch(url, { + method: 'GET', + headers: { + 'Content-Type': 'application/json', + 'Accept': 'application/json', + }, + credentials: "include", + }) + .then((response) => { + if (response.status !== 200) { + console.log("Failed to deactivate") + } + + return response.json() }) - .then((response) => { - if (response.status !== 200) { - console.log("Failed to activate") - } + .then((responseJson) => { + if (responseJson.success === false) { + toast("Failed to activate the app") + } else { + //toast("App activated for your organization! Refresh the page to use the app.") + if (appExists) { + toast("App deactivated for your organization! Existing workflows with the app will continue to work.") + } else { + toast("App activated for your organization!") + } - return response.json() - }) - .then((responseJson) => { - if (responseJson.success === false) { - toast("Failed to activate the app") - } else { - toast("App activated for your organization! Refresh the page to use the app.") - - if (refresh === true) { - getApps() - } + if (refresh === true) { + getApps() } - }) - .catch(error => { - //toast(error.toString()) - console.log("Activate app error: ", error.toString()) - }); + } + }) + .catch(error => { + //toast(error.toString()) + console.log("Deactivate app error: ", error.toString()) + }); } diff --git a/functions/onprem/orborus/orborus.go b/functions/onprem/orborus/orborus.go index b81b4597..ed141a1d 100755 --- a/functions/onprem/orborus/orborus.go +++ b/functions/onprem/orborus/orborus.go @@ -675,11 +675,13 @@ func deployWorker(image string, identifier string, env []string, executionReques createdPod, err := clientset.CoreV1().Pods("shuffle").Create(context.Background(), pod, metav1.CreateOptions{}) if err != nil { - fmt.Fprintf(os.Stderr, "Error creating pod: %v\n", err) + log.Printf("[ERROR] Failed creating pod: %v", err) + return err } log.Printf("[INFO] Created pod %q in namespace %q\n", createdPod.Name, createdPod.Namespace) - } else { + return nil + } // Binds is the actual "-v" volume. // Max 20% CPU every second @@ -839,9 +841,6 @@ func deployWorker(image string, identifier string, env []string, executionReques log.Printf("[INFO][%s] New Worker created. Environment %s: docker logs %s", executionRequest.ExecutionId, environment, cont.ID) } - return nil - } - return nil } @@ -1039,11 +1038,16 @@ func getOrborusStats(ctx context.Context) shuffle.OrborusStats { Timestamp: time.Now().Unix(), } + // FIXME: Returning for now due to this causing network congestion + // and database fillup. The backend api also has it disabled. + return newStats + // Disable orborus stats if os.Getenv("SHUFFLE_STATS_DISABLED") == "true" { return newStats } + if swarmConfig == "run" || swarmConfig == "swarm" { newStats.Swarm = true }