diff --git a/backend/app_sdk/app_base.py b/backend/app_sdk/app_base.py index dd8bf2e2..d77315f6 100644 --- a/backend/app_sdk/app_base.py +++ b/backend/app_sdk/app_base.py @@ -1433,7 +1433,7 @@ class AppBase: "execution_id": self.current_execution_id } - self.logger.info("[DEBUG] Before FULLEXEC stream result") + self.logger.info("[ERROR] Before FULLEXEC stream result") ret = requests.post( "%s/api/v1/streams/results" % (self.base_url), headers=headers, @@ -1444,8 +1444,7 @@ class AppBase: fullexecution = ret.json() else: try: - self.logger.info("[DEBUG] Error: Data: ", ret.json()) - self.logger.info("[DEBUG] Error with status code for results. Crashing because ACTION_RESULTS or WORKFLOW_VARIABLE can't be handled. Status: %d" % ret.status_code) + self.logger.info("[ERROR] Error in app with status code for results. Crashing because results can't be handled. Status: %d" % ret.status_code) except json.decoder.JSONDecodeError: pass @@ -1457,7 +1456,7 @@ class AppBase: self.send_result(self.action_result, headers, stream_path) return except requests.exceptions.ConnectionError as e: - self.logger.info("[DEBUG] FullExec Connectionerror: %s" % e) + self.logger.info("[ERROR] FullExec Connectionerror: %s" % e) self.action_result["result"] = json.dumps({ "success": False, "reason": f"Connection error during startup: {e}" @@ -1470,7 +1469,7 @@ class AppBase: try: fullexecution = json.loads(self.full_execution) except json.decoder.JSONDecodeError as e: - self.logger.info("[WARNING] Json decode execution error: %s" % e) + self.logger.info("[ERROR] Json decode execution error: %s" % e) self.action_result["result"] = "Json error during startup: %s" % e self.send_result(self.action_result, headers, stream_path) return diff --git a/backend/go-app/go.mod b/backend/go-app/go.mod index 9125a3e9..9b4f011a 100644 --- a/backend/go-app/go.mod +++ b/backend/go-app/go.mod @@ -2,8 +2,7 @@ module main go 1.16 -replace github.com/shuffle/shuffle-shared => ../../../shuffle-shared - +//replace github.com/shuffle/shuffle-shared => ../../../shuffle-shared //replace github.com/frikky/kin-openapi => ../../../../git/kin-openapi //replace github.com/frikky/go-elasticsearch => ../../../../git/go-elasticsearch @@ -15,7 +14,7 @@ require ( github.com/basgys/goxml2json v1.1.0 github.com/carlescere/scheduler v0.0.0-20170109141437-ee74d2f83d82 github.com/docker/docker v20.10.12+incompatible - github.com/frikky/kin-openapi v0.41.0 + github.com/frikky/kin-openapi v0.42.0 github.com/fsouza/go-dockerclient v1.7.7 github.com/ghodss/yaml v1.0.0 github.com/go-git/go-billy/v5 v5.3.1 @@ -24,7 +23,7 @@ require ( github.com/h2non/filetype v1.1.3 github.com/nirasan/go-oauth-pkce-code-verifier v0.0.0-20170819232839-0fbfe93532da // indirect github.com/satori/go.uuid v1.2.0 - github.com/shuffle/shuffle-shared v0.2.87 + github.com/shuffle/shuffle-shared v0.3.5 go4.org v0.0.0-20201209231011-d4a079459e60 // indirect golang.org/x/crypto v0.0.0-20220112180741-5e0467b6c7ce google.golang.org/api v0.65.0 diff --git a/frontend/src/views/AppCreator.jsx b/frontend/src/views/AppCreator.jsx index 954dace9..05a57944 100644 --- a/frontend/src/views/AppCreator.jsx +++ b/frontend/src/views/AppCreator.jsx @@ -34,8 +34,17 @@ import { AttachFile as AttachFileIcon, Apps as AppsIcon, ErrorOutline as ErrorOutlineIcon, + AddAPhoto as AddAPhotoIcon, + AddAPhotoOutlined as AddAPhotoOutlinedIcon, + ZoomInOutlined as ZoomInOutlinedIcon, + ZoomOutOutlined as ZoomOutOutlinedIcon, + Loop as LoopIcon, } from "@material-ui/icons"; +import { + AddPhotoAlternate as AddPhotoAlternateIcon, +} from '@mui/icons-material'; + import { v4 as uuidv4 } from "uuid"; import { Link, useParams } from "react-router-dom"; import YAML from "yaml"; @@ -44,12 +53,6 @@ import { useAlert } from "react-alert"; import words from "shellwords"; import AvatarEditor from "react-avatar-editor"; -import AddAPhotoIcon from "@material-ui/icons/AddAPhoto"; -import AddAPhotoOutlinedIcon from "@material-ui/icons/AddAPhotoOutlined"; -import ZoomInOutlinedIcon from "@material-ui/icons/ZoomInOutlined"; -import ZoomOutOutlinedIcon from "@material-ui/icons/ZoomOutOutlined"; -import LoopIcon from "@material-ui/icons/Loop"; -import AddPhotoAlternateIcon from "@material-ui/icons/AddPhotoAlternate"; const surfaceColor = "#27292D"; const inputColor = "#383B40"; @@ -344,14 +347,14 @@ const AppCreator = (defaultprops) => { useEffect(() => { if (window.location.pathname.includes("apps/edit")) { setIsEditing(true); - handleEditApp(); + handleEditApp(props.match.params.appid); } else { checkQuery(); } }, []); - const handleEditApp = () => { - fetch(globalUrl + "/api/v1/apps/" + props.match.params.appid + "/config", { + const handleEditApp = (appid) => { + fetch(globalUrl + "/api/v1/apps/" + appid + "/config", { method: "GET", headers: { "Content-Type": "application/json", @@ -389,34 +392,36 @@ const AppCreator = (defaultprops) => { setIsAppLoaded(true); return; } + + handleEditApp(urlParams.get("id")) - fetch(globalUrl + "/api/v1/get_openapi/" + urlParams.get("id"), { - method: "GET", - headers: { - "Content-Type": "application/json", - Accept: "application/json", - }, - credentials: "include", - }) - .then((response) => { - if (response.status !== 200) { - throw new Error("NOT 200 :O"); - } + //fetch(globalUrl + "/api/v1/get_openapi/" + urlParams.get("id"), { + // method: "GET", + // headers: { + // "Content-Type": "application/json", + // Accept: "application/json", + // }, + // credentials: "include", + //}) + // .then((response) => { + // if (response.status !== 200) { + // throw new Error("NOT 200 :O"); + // } - return response.json(); - }) - .then((responseJson) => { - setIsAppLoaded(true); - if (!responseJson.success) { - alert.error("Failed to verify"); - } else { - parseIncomingOpenapiData(responseJson); - } - }) - .catch((error) => { - console.log("Error: ", error.toString()); - alert.error(error.toString()); - }); + // return response.json(); + // }) + // .then((responseJson) => { + // setIsAppLoaded(true); + // if (!responseJson.success) { + // alert.error("Failed to verify"); + // } else { + // parseIncomingOpenapiData(responseJson); + // } + // }) + // .catch((error) => { + // console.log("Error: ", error.toString()); + // alert.error(error.toString()); + // }); }; const setFileFromb64 = () => { diff --git a/frontend/src/views/Apps.jsx b/frontend/src/views/Apps.jsx index cf1922a4..e6ff7cd5 100644 --- a/frontend/src/views/Apps.jsx +++ b/frontend/src/views/Apps.jsx @@ -39,6 +39,10 @@ import { Delete as DeleteIcon, } from "@material-ui/icons"; +import { + ForkRight as ForkRightIcon, +} from '@mui/icons-material'; + import { useTheme } from "@material-ui/core/styles"; import YAML from "yaml"; @@ -807,9 +811,11 @@ const Apps = (props) => { ) : null; - // FIXME: Add /apps/new?id= to allow for changes of the original // Should always reference the original ID. - var editButton = + //if (selectedApp.name !== undefined && selectedApp.name !== null && selectedApp.name.includes("New")) { + //} + + var editButton = selectedApp.activated && selectedApp.private_id !== undefined && selectedApp.private_id.length > 0 && @@ -829,21 +835,19 @@ const Apps = (props) => { ) : null; //var editNewButton = editButton === null ? - var editNewButton = selectedApp.generated && selectedApp.activated && props.userdata.id !== selectedApp.owner ? - isCloud ? + var editNewButton = selectedApp.generated && selectedApp.activated && props.userdata.id !== selectedApp.owner && isCloud ? - + - : null : null const activateButton = @@ -879,8 +883,7 @@ const Apps = (props) => { ((selectedApp.private_id !== undefined && selectedApp.private_id.length > 0 && selectedApp.generated) || - (selectedApp.downloaded !== undefined && - selectedApp.downloaded == true) || + (selectedApp.downloaded !== undefined && selectedApp.downloaded == true) || !selectedApp.generated) && activateButton === null ? ( @@ -982,6 +985,10 @@ const Apps = (props) => { const userRoles = ["you", isCloud ? "public" : "everyone"]; + // Admin in org or creator of app + // FIXME: Missing check for if same creator account + const canEditApp = userdata !== undefined && (userdata.admin === "true" || userdata.id === selectedApp.owner || selectedApp.owner === "" || (userdata.admin === "true" && userdata.active_org.id === selectedApp.reference_org)) || !selectedApp.generated + //fetch(globalUrl+"/api/v1/get_openapi/"+urlParams.get("id"), var baseInfo = newAppname.length > 0 ? ( @@ -1086,14 +1093,20 @@ const Apps = (props) => { ) : null} {activateButton} - {editNewButton} - {(editNewButton === null && userdata !== undefined && (userdata.admin === "true" || userdata.id === selectedApp.owner || selectedApp.owner === "" )) || !selectedApp.generated ? ( + + { /* editNewButton === null && */ } + + {canEditApp ? (
{editButton} {downloadButton} {deleteButton}
- ) : null} + ) : +
+ {editNewButton} +
+ } {selectedApp.tags !== undefined && selectedApp.tags !== null ? (
{ })}
) : null} - {props.userdata !== undefined && - props.userdata.id === selectedApp.owner ? ( + {canEditApp + ? (
{/*

ID: {selectedApp.id}

*/} Sharing @@ -1877,7 +1890,7 @@ const Apps = (props) => { getApps(); }, 1000); } else { - alert.error("Failed deleting app"); + alert.error("Failed deleting app. Does it still exist?"); } }) .catch((error) => {