diff --git a/backend/app_sdk/app_base.py b/backend/app_sdk/app_base.py index 73ed57e8..d8e04d6e 100644 --- a/backend/app_sdk/app_base.py +++ b/backend/app_sdk/app_base.py @@ -2555,7 +2555,7 @@ class AppBase: break except TypeError as e: newres = "" - self.logger.info(f"[DEBUG] Got exec error: {errorstring}") + self.logger.info(f"[DEBUG] Got exec error: {e}") errorstring = f"{e}" if "got an unexpected keyword argument" in errorstring: fieldsplit = errorstring.split("'") diff --git a/backend/app_sdk/build.sh b/backend/app_sdk/build.sh index ae5e1f56..847c0185 100644 --- a/backend/app_sdk/build.sh +++ b/backend/app_sdk/build.sh @@ -3,7 +3,7 @@ ### DEFAULT NAME=shuffle-app_sdk -VERSION=0.9.25 +VERSION=0.9.26 docker rmi docker.pkg.github.com/frikky/shuffle/$NAME:$VERSION --force docker build . -f Dockerfile -t frikky/shuffle:app_sdk -t frikky/$NAME:$VERSION -t docker.pkg.github.com/frikky/shuffle/$NAME:$VERSION -t ghcr.io/frikky/$NAME:$VERSION -t ghcr.io/frikky/$NAME:nightly diff --git a/backend/go-app/walkoff.go b/backend/go-app/walkoff.go index 7078110e..22b90cd1 100644 --- a/backend/go-app/walkoff.go +++ b/backend/go-app/walkoff.go @@ -4050,9 +4050,19 @@ func LoadSpecificApps(resp http.ResponseWriter, request *http.Request) { if tmpBody.ForceUpdate { dockercli, err := dockerclient.NewEnvClient() if err == nil { - _, err := dockercli.ImagePull(ctx, "frikky/shuffle:app_sdk", types.ImagePullOptions{}) - if err != nil { - log.Printf("[WARNING] Failed to download apps with the new App SDK: %s", err) + + appSdk := os.Getenv("SHUFFLE_APP_SDK_VERSION") + if len(appSdk) == 0 { + _, err := dockercli.ImagePull(ctx, "frikky/shuffle:app_sdk", types.ImagePullOptions{}) + if err != nil { + log.Printf("[WARNING] Failed to download new App SDK: %s", err) + } + } else { + _, err := dockercli.ImagePull(ctx, fmt.Sprintf("%s/%s/shuffle-app_sdk:%s", "ghcr.io", "frikky", appSdk), types.ImagePullOptions{}) + if err != nil { + log.Printf("[WARNING] Failed to download new App SDK %s: %s", err) + } + } } else { log.Printf("[WARNING] Failed to download apps with the new App SDK because of docker cli: %s", err) diff --git a/frontend/src/components/ParsedAction.jsx b/frontend/src/components/ParsedAction.jsx index ef635b6f..b6bcbd46 100644 --- a/frontend/src/components/ParsedAction.jsx +++ b/frontend/src/components/ParsedAction.jsx @@ -49,6 +49,7 @@ const useStyles = makeStyles({ // }, //) +const openApiFieldDesc = "Generated by OpenAPI body example" const ParsedAction = (props) => { const {workflow, setWorkflow, setAction, setSelectedAction, setUpdate, appActionArguments, selectedApp, workflowExecutions, setSelectedResult, selectedAction, setSelectedApp, setSelectedTrigger, setSelectedEdge, setCurrentView, cy, setAuthenticationModalOpen,setVariablesModalOpen, setCodeModalOpen, selectedNameChange, rightsidebarStyle, showEnvironment, selectedActionEnvironment, environments, setNewSelectedAction, appApiViewStyle, globalUrl, setSelectedActionEnvironment, requiresAuthentication, hideExtraTypes, scrollConfig, setScrollConfig, authenticationType, appAuthentication, getAppAuthentication } = props @@ -56,6 +57,8 @@ const ParsedAction = (props) => { const classes = useStyles() const [expansionModalOpen, setExpansionModalOpen] = React.useState(false); + const [hideBody, setHideBody] = React.useState(false) + const [activateHidingBody, setActivateHidingBody] = React.useState(false) const keywords = ["len(", "lower(", "upper(", "trim(", "split(", "length(", "number(", "parse(", "join("] const getParents = (action) => { @@ -258,7 +261,8 @@ const ParsedAction = (props) => { if (actionlist.length === 0) { // FIXME: Have previous execution values in here - actionlist.push({"type": "Execution Argument", "name": "Execution Argument", "value": "$exec", "highlight": "exec", "autocomplete": "exec", "example": "hello"}) + actionlist.push({"type": "Execution Argument", "name": "Execution Argument", "value": "$exec", "highlight": "exec", "autocomplete": "exec", "example": ""}) + actionlist.push({"type": "Shuffle DB", "name": "Shuffle DB", "value": "$shuffle_cache", "highlight": "shuffle", "autocomplete": "shuffle", "example": ""}) if (workflow.workflow_variables !== null && workflow.workflow_variables !== undefined && workflow.workflow_variables.length > 0) { for (var key in workflow.workflow_variables) { const item = workflow.workflow_variables[key] @@ -788,12 +792,52 @@ const ParsedAction = (props) => { //setSelectedActionParameters(selectedActionParameters) } + var hideBodyButton = "" + const hideBodyButtonValue = +
+ + { + setHideBody(!hideBody) + + for (var key in selectedActionParameters) { + var currentItem = selectedActionParameters[key] + + if (currentItem.description === openApiFieldDesc) { + currentItem.field_active = !hideBody + console.log("Changing", currentItem) + } + } + }} + name="requires_unique" + /> + } + label={"Automatically fix body"} + /> + +
+ if (selectedApp.generated && data.name === "body") { const regex = /\${(\w+)}/g const found = placeholder.match(regex) - if (found === null) { + + hideBodyButton = hideBodyButtonValue + if (found === null || !hideBody) { //setExtraBodyFields([]) + // + if (found === null) { + setActivateHidingBody(true) + } } else { + console.log("SHOW BUTTON") + rows = "1" disabled = true openApiHelperText = "OpenAPI spec: fill the following fields." @@ -818,7 +862,7 @@ const ParsedAction = (props) => { selectedActionParameters.push({ action_field: "", configuration: false, - description: "Generated by OpenAPI body example", + description: openApiFieldDesc, example: "", id: "", multiline: false, @@ -830,6 +874,7 @@ const ParsedAction = (props) => { tags: null, value: "", variant: "STATIC_VALUE", + field_active: true, }) } @@ -837,10 +882,14 @@ const ParsedAction = (props) => { setSelectedActionParameters(selectedActionParameters) } - return + return hideBodyButton } } + if (activateHidingBody === true) { + hideBodyButton = "" + } + const clickedFieldId = "rightside_field_"+count // { } */ } else if (selectedActionParameters[count].options !== undefined && selectedActionParameters[count].options !== null && selectedActionParameters[count].options.length > 0) { - if (selectedActionParameters[count].value === "" && selectedActionParameters[count].required) { + if (selectedActionParameters[count].value === "") { + // && selectedActionParameters[count].required) { // Rofl, dirty workaround :) const e = { target: { @@ -1009,7 +1059,7 @@ const ParsedAction = (props) => { } changeActionParameter(e, count, data) - } + } datafield = { top: appBarSize+25, right: 25, height: "80vh", - width: 350, + width: 365, minWidth: 200, maxWidth: 600, maxHeight: "100vh", @@ -8570,6 +8570,7 @@ const AngularWorkflow = (props) => { maxHeight: 700, overflowY: "auto", overflowX: "hidden", + zIndex: 10012, //boxShadow: "none", }, }} @@ -9301,6 +9302,7 @@ const AngularWorkflow = (props) => { maxHeight: 700, padding: 15, overflow: "hidden", + zIndex: 10012, }, }} >