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
|
break
|
||||||
except TypeError as e:
|
except TypeError as e:
|
||||||
newres = ""
|
newres = ""
|
||||||
self.logger.info(f"[DEBUG] Got exec error: {errorstring}")
|
self.logger.info(f"[DEBUG] Got exec error: {e}")
|
||||||
errorstring = f"{e}"
|
errorstring = f"{e}"
|
||||||
if "got an unexpected keyword argument" in errorstring:
|
if "got an unexpected keyword argument" in errorstring:
|
||||||
fieldsplit = errorstring.split("'")
|
fieldsplit = errorstring.split("'")
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
### DEFAULT
|
### DEFAULT
|
||||||
NAME=shuffle-app_sdk
|
NAME=shuffle-app_sdk
|
||||||
VERSION=0.9.25
|
VERSION=0.9.26
|
||||||
|
|
||||||
docker rmi docker.pkg.github.com/frikky/shuffle/$NAME:$VERSION --force
|
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
|
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 {
|
if tmpBody.ForceUpdate {
|
||||||
dockercli, err := dockerclient.NewEnvClient()
|
dockercli, err := dockerclient.NewEnvClient()
|
||||||
if err == nil {
|
if err == nil {
|
||||||
_, err := dockercli.ImagePull(ctx, "frikky/shuffle:app_sdk", types.ImagePullOptions{})
|
|
||||||
if err != nil {
|
appSdk := os.Getenv("SHUFFLE_APP_SDK_VERSION")
|
||||||
log.Printf("[WARNING] Failed to download apps with the new App SDK: %s", err)
|
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 {
|
} else {
|
||||||
log.Printf("[WARNING] Failed to download apps with the new App SDK because of docker cli: %s", err)
|
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 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
|
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 classes = useStyles()
|
||||||
|
|
||||||
const [expansionModalOpen, setExpansionModalOpen] = React.useState(false);
|
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 keywords = ["len(", "lower(", "upper(", "trim(", "split(", "length(", "number(", "parse(", "join("]
|
||||||
const getParents = (action) => {
|
const getParents = (action) => {
|
||||||
@@ -258,7 +261,8 @@ const ParsedAction = (props) => {
|
|||||||
|
|
||||||
if (actionlist.length === 0) {
|
if (actionlist.length === 0) {
|
||||||
// FIXME: Have previous execution values in here
|
// 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) {
|
if (workflow.workflow_variables !== null && workflow.workflow_variables !== undefined && workflow.workflow_variables.length > 0) {
|
||||||
for (var key in workflow.workflow_variables) {
|
for (var key in workflow.workflow_variables) {
|
||||||
const item = workflow.workflow_variables[key]
|
const item = workflow.workflow_variables[key]
|
||||||
@@ -788,12 +792,52 @@ const ParsedAction = (props) => {
|
|||||||
//setSelectedActionParameters(selectedActionParameters)
|
//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") {
|
if (selectedApp.generated && data.name === "body") {
|
||||||
const regex = /\${(\w+)}/g
|
const regex = /\${(\w+)}/g
|
||||||
const found = placeholder.match(regex)
|
const found = placeholder.match(regex)
|
||||||
if (found === null) {
|
|
||||||
|
hideBodyButton = hideBodyButtonValue
|
||||||
|
if (found === null || !hideBody) {
|
||||||
//setExtraBodyFields([])
|
//setExtraBodyFields([])
|
||||||
|
//
|
||||||
|
if (found === null) {
|
||||||
|
setActivateHidingBody(true)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
console.log("SHOW BUTTON")
|
||||||
|
|
||||||
rows = "1"
|
rows = "1"
|
||||||
disabled = true
|
disabled = true
|
||||||
openApiHelperText = "OpenAPI spec: fill the following fields."
|
openApiHelperText = "OpenAPI spec: fill the following fields."
|
||||||
@@ -818,7 +862,7 @@ const ParsedAction = (props) => {
|
|||||||
selectedActionParameters.push({
|
selectedActionParameters.push({
|
||||||
action_field: "",
|
action_field: "",
|
||||||
configuration: false,
|
configuration: false,
|
||||||
description: "Generated by OpenAPI body example",
|
description: openApiFieldDesc,
|
||||||
example: "",
|
example: "",
|
||||||
id: "",
|
id: "",
|
||||||
multiline: false,
|
multiline: false,
|
||||||
@@ -830,6 +874,7 @@ const ParsedAction = (props) => {
|
|||||||
tags: null,
|
tags: null,
|
||||||
value: "",
|
value: "",
|
||||||
variant: "STATIC_VALUE",
|
variant: "STATIC_VALUE",
|
||||||
|
field_active: true,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -837,10 +882,14 @@ const ParsedAction = (props) => {
|
|||||||
setSelectedActionParameters(selectedActionParameters)
|
setSelectedActionParameters(selectedActionParameters)
|
||||||
}
|
}
|
||||||
|
|
||||||
return <Divider key={Math.random()} />
|
return hideBodyButton
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (activateHidingBody === true) {
|
||||||
|
hideBodyButton = ""
|
||||||
|
}
|
||||||
|
|
||||||
const clickedFieldId = "rightside_field_"+count
|
const clickedFieldId = "rightside_field_"+count
|
||||||
//<TextareaAutosize
|
//<TextareaAutosize
|
||||||
// <CodeMirror
|
// <CodeMirror
|
||||||
@@ -1000,7 +1049,8 @@ const ParsedAction = (props) => {
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
} else if (selectedActionParameters[count].options !== undefined && selectedActionParameters[count].options !== null && selectedActionParameters[count].options.length > 0) {
|
} 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 :)
|
// Rofl, dirty workaround :)
|
||||||
const e = {
|
const e = {
|
||||||
target: {
|
target: {
|
||||||
@@ -1009,7 +1059,7 @@ const ParsedAction = (props) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
changeActionParameter(e, count, data)
|
changeActionParameter(e, count, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
datafield =
|
datafield =
|
||||||
<Select
|
<Select
|
||||||
@@ -1046,6 +1096,10 @@ const ParsedAction = (props) => {
|
|||||||
staticcolor = "#f85a3e"
|
staticcolor = "#f85a3e"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (data.field_active === false) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
// Shows nested list of nodes > their JSON lists
|
// Shows nested list of nodes > their JSON lists
|
||||||
const ActionlistWrapper = (props) => {
|
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",}}/>*/}
|
{/*<div style={{width: 17, height: 17, borderRadius: 17 / 2, backgroundColor: itemColor, marginRight: 10, marginTop: 2, marginTop: "auto", marginBottom: "auto",}}/>*/}
|
||||||
return (
|
return (
|
||||||
<div key={data.name}>
|
<div key={data.name}>
|
||||||
|
{hideBodyButton}
|
||||||
<div style={{marginTop: 20, marginBottom: 0, display: "flex"}}>
|
<div style={{marginTop: 20, marginBottom: 0, display: "flex"}}>
|
||||||
{data.configuration === true ?
|
{data.configuration === true ?
|
||||||
<Tooltip color="primary" title={`Authenticate ${selectedApp.name}`} placement="top">
|
<Tooltip color="primary" title={`Authenticate ${selectedApp.name}`} placement="top">
|
||||||
@@ -1306,10 +1361,11 @@ const ParsedAction = (props) => {
|
|||||||
:
|
:
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
|
|
||||||
<div style={{flex: "10", marginTop: "auto", marginBottom: "auto",}}>
|
<div style={{flex: "10", marginTop: "auto", marginBottom: "auto",}}>
|
||||||
<Tooltip title={tooltipDescription} placement="top">
|
<Tooltip title={tooltipDescription} placement="top">
|
||||||
<b>{tmpitem} </b>
|
<b>{tmpitem} </b>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/*selectedActionParameters[count].options !== undefined && selectedActionParameters[count].options !== null && selectedActionParameters[count].options.length > 0 ? null :
|
{/*selectedActionParameters[count].options !== undefined && selectedActionParameters[count].options !== null && selectedActionParameters[count].options.length > 0 ? null :
|
||||||
@@ -1355,7 +1411,7 @@ const ParsedAction = (props) => {
|
|||||||
onChange={(event) => {
|
onChange={(event) => {
|
||||||
//console.log("CHECKED!: ", selectedActionParameters[count])
|
//console.log("CHECKED!: ", selectedActionParameters[count])
|
||||||
selectedActionParameters[count].unique_toggled = !selectedActionParameters[count].unique_toggled
|
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)
|
setSelectedActionParameters(selectedActionParameters)
|
||||||
setSelectedAction(selectedAction)
|
setSelectedAction(selectedAction)
|
||||||
setUpdate(Math.random())
|
setUpdate(Math.random())
|
||||||
@@ -1610,7 +1666,9 @@ const ParsedAction = (props) => {
|
|||||||
: null}
|
: null}
|
||||||
{selectedAction.authentication !== undefined && selectedAction.authentication !== null && selectedAction.authentication.length > 0 ?
|
{selectedAction.authentication !== undefined && selectedAction.authentication !== null && selectedAction.authentication.length > 0 ?
|
||||||
<div style={{marginTop: 15, }}>
|
<div style={{marginTop: 15, }}>
|
||||||
Authentication
|
<Typography>
|
||||||
|
Authentication
|
||||||
|
</Typography>
|
||||||
<div style={{display: "flex"}}>
|
<div style={{display: "flex"}}>
|
||||||
<Select
|
<Select
|
||||||
labelId="select-app-auth"
|
labelId="select-app-auth"
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ const data = [{
|
|||||||
{
|
{
|
||||||
selector: `node[type="ACTION"]`,
|
selector: `node[type="ACTION"]`,
|
||||||
css: {
|
css: {
|
||||||
'shape': 'square',
|
'shape': 'roundrectangle',
|
||||||
'background-color': '#213243',
|
'background-color': '#213243',
|
||||||
'border-color': '#81c784',
|
'border-color': '#81c784',
|
||||||
'background-width': '100%',
|
'background-width': '100%',
|
||||||
|
|||||||
@@ -4944,7 +4944,7 @@ const AngularWorkflow = (props) => {
|
|||||||
top: appBarSize+25,
|
top: appBarSize+25,
|
||||||
right: 25,
|
right: 25,
|
||||||
height: "80vh",
|
height: "80vh",
|
||||||
width: 350,
|
width: 365,
|
||||||
minWidth: 200,
|
minWidth: 200,
|
||||||
maxWidth: 600,
|
maxWidth: 600,
|
||||||
maxHeight: "100vh",
|
maxHeight: "100vh",
|
||||||
@@ -8570,6 +8570,7 @@ const AngularWorkflow = (props) => {
|
|||||||
maxHeight: 700,
|
maxHeight: 700,
|
||||||
overflowY: "auto",
|
overflowY: "auto",
|
||||||
overflowX: "hidden",
|
overflowX: "hidden",
|
||||||
|
zIndex: 10012,
|
||||||
//boxShadow: "none",
|
//boxShadow: "none",
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
@@ -9301,6 +9302,7 @@ const AngularWorkflow = (props) => {
|
|||||||
maxHeight: 700,
|
maxHeight: 700,
|
||||||
padding: 15,
|
padding: 15,
|
||||||
overflow: "hidden",
|
overflow: "hidden",
|
||||||
|
zIndex: 10012,
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|||||||
Reference in New Issue
Block a user