Added possibility of hiding/showing body for full control in in HTTP requests
This commit is contained in:
@@ -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("'")
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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 =
|
||||
<div style={{marginTop: 25, border:"1px solid rgba(255,255,255,0.7)",borderTop: "1px solid rgba(255,255,255,0.7)", borderRadius: theme.palette.borderRadius, alignItems: "center", textAlign: "center",}}>
|
||||
<Tooltip color="secondary" title={"Automatically change body"} placement="top">
|
||||
<FormControlLabel
|
||||
control={
|
||||
<Checkbox
|
||||
tabIndex="-1"
|
||||
checked={hideBody}
|
||||
style={{
|
||||
color: theme.palette.primary.secondary,
|
||||
}}
|
||||
onChange={(event) => {
|
||||
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"}
|
||||
/>
|
||||
</Tooltip>
|
||||
</div>
|
||||
|
||||
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 <Divider key={Math.random()} />
|
||||
return hideBodyButton
|
||||
}
|
||||
}
|
||||
|
||||
if (activateHidingBody === true) {
|
||||
hideBodyButton = ""
|
||||
}
|
||||
|
||||
const clickedFieldId = "rightside_field_"+count
|
||||
//<TextareaAutosize
|
||||
// <CodeMirror
|
||||
@@ -1000,7 +1049,8 @@ const ParsedAction = (props) => {
|
||||
}
|
||||
*/
|
||||
} 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 =
|
||||
<Select
|
||||
@@ -1046,6 +1096,10 @@ const ParsedAction = (props) => {
|
||||
staticcolor = "#f85a3e"
|
||||
}
|
||||
|
||||
if (data.field_active === false) {
|
||||
return null
|
||||
}
|
||||
|
||||
// Shows nested list of nodes > their JSON lists
|
||||
const ActionlistWrapper = (props) => {
|
||||
|
||||
@@ -1296,6 +1350,7 @@ const ParsedAction = (props) => {
|
||||
{/*<div style={{width: 17, height: 17, borderRadius: 17 / 2, backgroundColor: itemColor, marginRight: 10, marginTop: 2, marginTop: "auto", marginBottom: "auto",}}/>*/}
|
||||
return (
|
||||
<div key={data.name}>
|
||||
{hideBodyButton}
|
||||
<div style={{marginTop: 20, marginBottom: 0, display: "flex"}}>
|
||||
{data.configuration === true ?
|
||||
<Tooltip color="primary" title={`Authenticate ${selectedApp.name}`} placement="top">
|
||||
@@ -1306,10 +1361,11 @@ const ParsedAction = (props) => {
|
||||
:
|
||||
null
|
||||
}
|
||||
|
||||
<div style={{flex: "10", marginTop: "auto", marginBottom: "auto",}}>
|
||||
<Tooltip title={tooltipDescription} placement="top">
|
||||
<b>{tmpitem} </b>
|
||||
</Tooltip>
|
||||
</Tooltip>
|
||||
</div>
|
||||
|
||||
{/*selectedActionParameters[count].options !== undefined && selectedActionParameters[count].options !== null && selectedActionParameters[count].options.length > 0 ? null :
|
||||
@@ -1355,7 +1411,7 @@ const ParsedAction = (props) => {
|
||||
onChange={(event) => {
|
||||
//console.log("CHECKED!: ", selectedActionParameters[count])
|
||||
selectedActionParameters[count].unique_toggled = !selectedActionParameters[count].unique_toggled
|
||||
selectedAction.parameters[count].unique_toggled = selectedActionParameters[count].unique_toggled
|
||||
selectedAction.parameters[count].unique_toggled = selectedActionParameters[count].unique_toggled
|
||||
setSelectedActionParameters(selectedActionParameters)
|
||||
setSelectedAction(selectedAction)
|
||||
setUpdate(Math.random())
|
||||
@@ -1610,7 +1666,9 @@ const ParsedAction = (props) => {
|
||||
: null}
|
||||
{selectedAction.authentication !== undefined && selectedAction.authentication !== null && selectedAction.authentication.length > 0 ?
|
||||
<div style={{marginTop: 15, }}>
|
||||
Authentication
|
||||
<Typography>
|
||||
Authentication
|
||||
</Typography>
|
||||
<div style={{display: "flex"}}>
|
||||
<Select
|
||||
labelId="select-app-auth"
|
||||
|
||||
@@ -36,7 +36,7 @@ const data = [{
|
||||
{
|
||||
selector: `node[type="ACTION"]`,
|
||||
css: {
|
||||
'shape': 'square',
|
||||
'shape': 'roundrectangle',
|
||||
'background-color': '#213243',
|
||||
'border-color': '#81c784',
|
||||
'background-width': '100%',
|
||||
|
||||
@@ -4944,7 +4944,7 @@ const AngularWorkflow = (props) => {
|
||||
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,
|
||||
},
|
||||
}}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user