Fixed issue with loss of data when swapping actions - now copying!

This commit is contained in:
frikky
2022-01-08 03:44:45 +01:00
parent c41b4da5f5
commit 54647e10af
6 changed files with 49 additions and 15 deletions
+16 -4
View File
@@ -681,7 +681,12 @@ class AppBase:
except KeyError:
break
else:
raise e
raise json.dumps({
"success": False,
"reason": "You may be running an old version of this action. Please delete and remake the node.",
"exception": f"TypeError: {e}",
})
except:
e = ""
@@ -2389,7 +2394,11 @@ class AppBase:
for parameter in action["parameters"]:
check, value, is_loop = parse_params(action, fullexecution, parameter, self)
if check:
raise "Value check error: %s" % Exception(check)
raise json.dumps({
"success": False,
"reason": "Parameter {parameter} has an issue",
"exception": f"Value Check Error: {check}",
})
# Custom format for ${name[0,1,2,...]}$
#submatch = "([${]{2}([0-9a-zA-Z_-]+)(\[.*\])[}$]{2})"
@@ -2726,8 +2735,11 @@ class AppBase:
except KeyError:
break
else:
raise e
#break
raise json.dumps({
"success": False,
"reason": "You may be running an old version of this action. Please delete and remake the node.",
"exception": f"TypeError: {e}",
})
# Forcing async wait in case of old apps that use async
try:
+1 -2
View File
@@ -18,7 +18,7 @@ docker push ghcr.io/frikky/$NAME:$VERSION
docker push ghcr.io/frikky/$NAME:nightly
docker push ghcr.io/frikky/$NAME:latest
#### BLACKARCH ###
#### KALI ###
NAME=shuffle-app_sdk_kali
docker build . -f Dockerfile_kali -t frikky/shuffle:app_sdk_kali -t frikky/$NAME:$VERSION -t docker.pkg.github.com/frikky/shuffle/$NAME:$VERSION -t ghcr.io/frikky/$NAME:$VERSION
@@ -33,4 +33,3 @@ docker build . -f Dockerfile_blackarch -t frikky/shuffle:app_sdk_blackarch -t fr
docker push frikky/shuffle:app_sdk_blackarch
docker push ghcr.io/frikky/$NAME:$VERSION
docker push ghcr.io/frikky/$NAME:nightly
+2
View File
@@ -5810,8 +5810,10 @@ func initHandlers() {
// Triggers
r.HandleFunc("/api/v1/hooks/new", shuffle.HandleNewHook).Methods("POST", "OPTIONS")
r.HandleFunc("/api/v1/hooks", shuffle.HandleNewHook).Methods("POST", "OPTIONS")
r.HandleFunc("/api/v1/hooks/{key}", handleWebhookCallback).Methods("POST", "GET", "PATCH", "PUT", "DELETE", "OPTIONS")
r.HandleFunc("/api/v1/hooks/{key}/delete", shuffle.HandleDeleteHook).Methods("DELETE", "OPTIONS")
r.HandleFunc("/api/v1/hooks/{key}", shuffle.HandleDeleteHook).Methods("DELETE", "OPTIONS")
// OpenAPI configuration
r.HandleFunc("/api/v1/verify_swagger", verifySwagger).Methods("POST", "OPTIONS")
+1 -1
View File
@@ -1265,6 +1265,7 @@ const ParsedAction = (props) => {
//<TextareaAutosize
// <CodeMirror
//fullWidth
var datafield = (
<TextField
disabled={disabled}
@@ -1321,7 +1322,6 @@ const ParsedAction = (props) => {
</InputAdornment>
),
}}
fullWidth
multiline={multiline}
helperText={returnHelperText(data.name, data.value)}
onClick={() => {
+28 -7
View File
@@ -2568,6 +2568,7 @@ const AngularWorkflow = (defaultprops) => {
// Takes an action as input, then runs through and updates the relevant fields
// based on previous actions'
// Uses lots of synonyms
// autocomplete
const RunAutocompleter = (dstdata) => {
// **PS: The right action should already be set here**
// 1. Check execution argument
@@ -5292,15 +5293,34 @@ const AngularWorkflow = (defaultprops) => {
}
// Does this one find the wrong one?
var newSelectedAction = selectedAction;
var newSelectedAction = JSON.parse(JSON.stringify(selectedAction))
newSelectedAction.name = newaction.name;
newSelectedAction.parameters = JSON.parse(
JSON.stringify(newaction.parameters)
);
newSelectedAction.parameters = JSON.parse(JSON.stringify(newaction.parameters))
newSelectedAction.errors = [];
newSelectedAction.isValid = true;
newSelectedAction.is_valid = true;
// Simmple action swap autocompleter
if (selectedAction.parameters !== undefined && newSelectedAction.parameters !== undefined && selectedAction.id === newSelectedAction.id) {
//console.log("OLD: ", selectedAction, "NEW: ", newSelectedAction)
for (var paramkey in selectedAction.parameters) {
const param = selectedAction.parameters[paramkey];
if (param.value === null || param.value === undefined || param.value.length === 0) {
continue
}
const newParamIndex = newSelectedAction.parameters.findIndex(paramdata => paramdata.name === param.name)
console.log("INDEX: ", newParamIndex)
if (newParamIndex < 0) {
console.log("NOT FOUND: ", param)
continue
}
console.log("FOUND: ", param)
newSelectedAction.parameters[newParamIndex].value = param.value
}
}
if (newSelectedAction.app_name === "Shuffle Tools") {
const iconInfo = GetIconInfo(newSelectedAction);
console.log("ICONINFO: ", iconInfo);
@@ -5327,6 +5347,7 @@ const AngularWorkflow = (defaultprops) => {
}
}
// Takes an action as input, then runs through and updates the relevant fields
// based on previous actions'
newSelectedAction = RunAutocompleter(newSelectedAction);
@@ -9253,7 +9274,7 @@ const AngularWorkflow = (defaultprops) => {
workflow.triggers[selectedTriggerIndex].parameters = [];
workflow.triggers[selectedTriggerIndex].parameters[0] = {
name: "cron",
value: isCloud ? "*/15 * * * *" : "120",
value: isCloud ? "*/25 * * * *" : "60",
};
workflow.triggers[selectedTriggerIndex].parameters[1] = {
name: "execution_argument",
@@ -9327,12 +9348,12 @@ const AngularWorkflow = (defaultprops) => {
if (e.target.value === "cloud") {
console.log("Set cloud config");
workflow.triggers[selectedTriggerIndex].parameters[0].value =
"*/15 * * * *";
"*/25 * * * *";
} else {
console.log("Set cloud config");
workflow.triggers[selectedTriggerIndex].parameters[0].value =
"120";
"60";
}
setWorkflow(workflow);
+1 -1
View File
@@ -1,5 +1,5 @@
NAME=shuffle-orborus
VERSION=0.9.45
VERSION=0.9.46
echo "Running docker build with $NAME:$VERSION"
#docker rmi frikky/shuffle:$NAME --force