Fixed openapi replacement bug in app creator

This commit is contained in:
frikky
2022-01-21 15:47:22 +01:00
parent ad8618fce3
commit 5525131e7c
4 changed files with 33 additions and 22 deletions
+1 -1
View File
@@ -183,7 +183,7 @@ const ParsedAction = (props) => {
//}
// PARAM FIX - Gonna use the ID field, even though it's a hack
const paramcheck = selectedAction.parameters.find(param => param.name === "body")
console.log("LOADED! Change hideBody based on input? Action: ", selectedAction, paramcheck)
//console.log("LOADED! Change hideBody based on input? Action: ", selectedAction, paramcheck)
if (paramcheck !== undefined && paramcheck !== null) {
if (paramcheck.id === "TOGGLED"){
setHideBody(false)
+2 -2
View File
@@ -673,7 +673,7 @@ const AngularWorkflow = (defaultprops) => {
return response.json();
})
.then((responseJson) => {
console.log("RESPONSE: ", responseJson)
//console.log("RESPONSE: ", responseJson)
handleUpdateResults(responseJson, executionRequest);
})
.catch((error) => {
@@ -7066,7 +7066,7 @@ const AngularWorkflow = (defaultprops) => {
return response.json();
})
.then((responseJson) => {
console.log("RESPONSE: ");
//console.log("RESPONSE: ");
setTriggerAuthentication(responseJson);
clearInterval(id);
newwin.close();
+20 -13
View File
@@ -618,6 +618,7 @@ const AppCreator = (defaultprops) => {
continue;
}
//console.log("METHOD: ", methodvalue)
var tmpname = methodvalue.summary;
if (
methodvalue.operationId !== undefined &&
@@ -628,7 +629,13 @@ const AppCreator = (defaultprops) => {
tmpname = methodvalue.operationId;
}
tmpname = tmpname.replaceAll(".", " ");
if (tmpname !== undefined && tmpname !== null) {
tmpname = tmpname.replaceAll(".", " ");
}
if ((tmpname === undefined || tmpname === null) && methodvalue.description !== undefined && methodvalue.description !== null && methodvalue.description.length > 0) {
tmpname = methodvalue.description.replaceAll(".", " ").replaceAll("_", " ")
}
var newaction = {
name: tmpname,
@@ -739,9 +746,9 @@ const AppCreator = (defaultprops) => {
var newbody = {};
// Can handle default, required, description and type
for (var propkey in retRef.properties) {
const parsedkey = propkey
.replaceAll(" ", "_")
.toLowerCase();
console.log("replace: ", propkey)
const parsedkey = propkey.replaceAll(" ", "_").toLowerCase();
newbody[parsedkey] = "${" + parsedkey + "}";
}
@@ -885,9 +892,8 @@ const AppCreator = (defaultprops) => {
) {
var newbody = {};
for (var propkey in parameter.properties) {
const parsedkey = propkey
.replaceAll(" ", "_")
.toLowerCase();
console.log("propkey2: ", propkey)
const parsedkey = propkey.replaceAll(" ", "_").toLowerCase();
if (parameter.properties[propkey].type === undefined) {
console.log(
"Skipping (4): ",
@@ -1022,9 +1028,8 @@ const AppCreator = (defaultprops) => {
) {
var newbody = {};
for (var propkey in parameter.properties) {
const parsedkey = propkey
.replaceAll(" ", "_")
.toLowerCase();
console.log("propkey3: ", propkey)
const parsedkey = propkey.replaceAll(" ", "_").toLowerCase();
if (
parameter.properties[propkey].type === undefined
) {
@@ -1112,9 +1117,8 @@ const AppCreator = (defaultprops) => {
) {
var newbody = {};
for (var propkey in parameter.properties) {
const parsedkey = propkey
.replaceAll(" ", "_")
.toLowerCase();
console.log("propkey4: ", propkey)
const parsedkey = propkey.replaceAll(" ", "_").toLowerCase();
if (
parameter.properties[propkey].type ===
undefined
@@ -1197,6 +1201,7 @@ const AppCreator = (defaultprops) => {
) {
var newbody = {};
for (var propkey in parameter.properties) {
console.log("propkey5: ", propkey)
const parsedkey = propkey
.replaceAll(" ", "_")
.toLowerCase();
@@ -2068,6 +2073,7 @@ const AppCreator = (defaultprops) => {
return;
}
console.log("Paramname: ", parameterName)
var newparamName = parameterName.replaceAll('"', "");
newparamName = newparamName.replaceAll("'", "");
@@ -2098,6 +2104,7 @@ const AppCreator = (defaultprops) => {
scheme: "basic",
};
} else if (authenticationOption === "Oauth2") {
console.log("oauth2: ", parameterName)
var newparamName = parameterName.replaceAll('"', "");
newparamName = newparamName.replaceAll("'", "");
+10 -6
View File
@@ -257,6 +257,7 @@ const Settings = (props) => {
console.log("Status not 200 for WORKFLOW EXECUTION :O!");
}
return response.json();
})
.then((responseJson) => {
@@ -402,11 +403,14 @@ const Settings = (props) => {
userdata.eth_info.account.length > 0 && userdata.eth_info.parsed_balance !== undefined
// Random names for type & autoComplete. Didn't research :^)
var imageData = file.length > 0 ? file : fileBase64;
imageData =
imageData === undefined || imageData.length === 0
? theme.palette.defaultImage
: imageData;
//var imageData = file.length > 0 ? file : fileBase64;
//imageData = imageData === undefined || imageData.length === 0
// ? theme.palette.defaultImage
// : imageData;
const imageData = userSettings.image === undefined || userSettings.image == null || userSettings.image.length === 0 ? theme.palette.defaultImage : userSettings.image
console.log("settings: ", userSettings)
console.log("Image: ", imageData)
const imageInfo = (
<img
src={imageData}
@@ -934,7 +938,7 @@ const Settings = (props) => {
const client_id = "3d272b1b782b100b1e61"
const username = userdata.id;
const scopes = "user:email";
const scopes = "read:user";
const url = `https://github.com/login/oauth/authorize?access_type=offline&prompt=consent&client_id=${client_id}&redirect_uri=${redirectUri}&response_type=code&scope=${scopes}&state=username%3D${username}%26type%3Dgithub`