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 // PARAM FIX - Gonna use the ID field, even though it's a hack
const paramcheck = selectedAction.parameters.find(param => param.name === "body") 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 !== undefined && paramcheck !== null) {
if (paramcheck.id === "TOGGLED"){ if (paramcheck.id === "TOGGLED"){
setHideBody(false) setHideBody(false)
+2 -2
View File
@@ -673,7 +673,7 @@ const AngularWorkflow = (defaultprops) => {
return response.json(); return response.json();
}) })
.then((responseJson) => { .then((responseJson) => {
console.log("RESPONSE: ", responseJson) //console.log("RESPONSE: ", responseJson)
handleUpdateResults(responseJson, executionRequest); handleUpdateResults(responseJson, executionRequest);
}) })
.catch((error) => { .catch((error) => {
@@ -7066,7 +7066,7 @@ const AngularWorkflow = (defaultprops) => {
return response.json(); return response.json();
}) })
.then((responseJson) => { .then((responseJson) => {
console.log("RESPONSE: "); //console.log("RESPONSE: ");
setTriggerAuthentication(responseJson); setTriggerAuthentication(responseJson);
clearInterval(id); clearInterval(id);
newwin.close(); newwin.close();
+20 -13
View File
@@ -618,6 +618,7 @@ const AppCreator = (defaultprops) => {
continue; continue;
} }
//console.log("METHOD: ", methodvalue)
var tmpname = methodvalue.summary; var tmpname = methodvalue.summary;
if ( if (
methodvalue.operationId !== undefined && methodvalue.operationId !== undefined &&
@@ -628,7 +629,13 @@ const AppCreator = (defaultprops) => {
tmpname = methodvalue.operationId; 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 = { var newaction = {
name: tmpname, name: tmpname,
@@ -739,9 +746,9 @@ const AppCreator = (defaultprops) => {
var newbody = {}; var newbody = {};
// Can handle default, required, description and type // Can handle default, required, description and type
for (var propkey in retRef.properties) { for (var propkey in retRef.properties) {
const parsedkey = propkey console.log("replace: ", propkey)
.replaceAll(" ", "_")
.toLowerCase(); const parsedkey = propkey.replaceAll(" ", "_").toLowerCase();
newbody[parsedkey] = "${" + parsedkey + "}"; newbody[parsedkey] = "${" + parsedkey + "}";
} }
@@ -885,9 +892,8 @@ const AppCreator = (defaultprops) => {
) { ) {
var newbody = {}; var newbody = {};
for (var propkey in parameter.properties) { for (var propkey in parameter.properties) {
const parsedkey = propkey console.log("propkey2: ", propkey)
.replaceAll(" ", "_") const parsedkey = propkey.replaceAll(" ", "_").toLowerCase();
.toLowerCase();
if (parameter.properties[propkey].type === undefined) { if (parameter.properties[propkey].type === undefined) {
console.log( console.log(
"Skipping (4): ", "Skipping (4): ",
@@ -1022,9 +1028,8 @@ const AppCreator = (defaultprops) => {
) { ) {
var newbody = {}; var newbody = {};
for (var propkey in parameter.properties) { for (var propkey in parameter.properties) {
const parsedkey = propkey console.log("propkey3: ", propkey)
.replaceAll(" ", "_") const parsedkey = propkey.replaceAll(" ", "_").toLowerCase();
.toLowerCase();
if ( if (
parameter.properties[propkey].type === undefined parameter.properties[propkey].type === undefined
) { ) {
@@ -1112,9 +1117,8 @@ const AppCreator = (defaultprops) => {
) { ) {
var newbody = {}; var newbody = {};
for (var propkey in parameter.properties) { for (var propkey in parameter.properties) {
const parsedkey = propkey console.log("propkey4: ", propkey)
.replaceAll(" ", "_") const parsedkey = propkey.replaceAll(" ", "_").toLowerCase();
.toLowerCase();
if ( if (
parameter.properties[propkey].type === parameter.properties[propkey].type ===
undefined undefined
@@ -1197,6 +1201,7 @@ const AppCreator = (defaultprops) => {
) { ) {
var newbody = {}; var newbody = {};
for (var propkey in parameter.properties) { for (var propkey in parameter.properties) {
console.log("propkey5: ", propkey)
const parsedkey = propkey const parsedkey = propkey
.replaceAll(" ", "_") .replaceAll(" ", "_")
.toLowerCase(); .toLowerCase();
@@ -2068,6 +2073,7 @@ const AppCreator = (defaultprops) => {
return; return;
} }
console.log("Paramname: ", parameterName)
var newparamName = parameterName.replaceAll('"', ""); var newparamName = parameterName.replaceAll('"', "");
newparamName = newparamName.replaceAll("'", ""); newparamName = newparamName.replaceAll("'", "");
@@ -2098,6 +2104,7 @@ const AppCreator = (defaultprops) => {
scheme: "basic", scheme: "basic",
}; };
} else if (authenticationOption === "Oauth2") { } else if (authenticationOption === "Oauth2") {
console.log("oauth2: ", parameterName)
var newparamName = parameterName.replaceAll('"', ""); var newparamName = parameterName.replaceAll('"', "");
newparamName = newparamName.replaceAll("'", ""); newparamName = newparamName.replaceAll("'", "");
+10 -6
View File
@@ -257,6 +257,7 @@ const Settings = (props) => {
console.log("Status not 200 for WORKFLOW EXECUTION :O!"); console.log("Status not 200 for WORKFLOW EXECUTION :O!");
} }
return response.json(); return response.json();
}) })
.then((responseJson) => { .then((responseJson) => {
@@ -402,11 +403,14 @@ const Settings = (props) => {
userdata.eth_info.account.length > 0 && userdata.eth_info.parsed_balance !== undefined userdata.eth_info.account.length > 0 && userdata.eth_info.parsed_balance !== undefined
// Random names for type & autoComplete. Didn't research :^) // Random names for type & autoComplete. Didn't research :^)
var imageData = file.length > 0 ? file : fileBase64; //var imageData = file.length > 0 ? file : fileBase64;
imageData = //imageData = imageData === undefined || imageData.length === 0
imageData === undefined || imageData.length === 0 // ? theme.palette.defaultImage
? theme.palette.defaultImage // : imageData;
: 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 = ( const imageInfo = (
<img <img
src={imageData} src={imageData}
@@ -934,7 +938,7 @@ const Settings = (props) => {
const client_id = "3d272b1b782b100b1e61" const client_id = "3d272b1b782b100b1e61"
const username = userdata.id; 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` 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`