Fixed issues with same URL in appcreator - now allowing it with replacements

This commit is contained in:
frikky
2022-01-13 19:04:39 +01:00
parent ff4f4d6722
commit 7ce0559448
3 changed files with 28 additions and 5 deletions
+2 -2
View File
@@ -113,8 +113,8 @@ const AuthenticationOauth2 = (props) => {
var resources = ""; var resources = "";
if (scopes !== undefined && (scopes !== null) & (scopes.length > 0)) { if (scopes !== undefined && (scopes !== null) & (scopes.length > 0)) {
//scopes.push("offline_access") resources = scopes.join(" ");
resources = scopes.join(","); //resources = scopes.join(",");
} }
const authentication_url = authenticationType.token_uri; const authentication_url = authenticationType.token_uri;
+1 -1
View File
@@ -3143,7 +3143,7 @@ const AngularWorkflow = (defaultprops) => {
copyText.select(); copyText.select();
copyText.setSelectionRange(0, 99999); /* For mobile devices */ copyText.setSelectionRange(0, 99999); /* For mobile devices */
document.execCommand("copy"); document.execCommand("copy");
alert.success(`Copied ${cydata.length} elements`); alert.success(`Copied ${cydata.length} element(s)`);
} }
} }
} }
+25 -2
View File
@@ -322,7 +322,7 @@ const AppCreator = (defaultprops) => {
const [currentActionMethod, setCurrentActionMethod] = useState( const [currentActionMethod, setCurrentActionMethod] = useState(
actionNonBodyRequest[0] actionNonBodyRequest[0]
); )
const [currentAction, setCurrentAction] = useState({ const [currentAction, setCurrentAction] = useState({
name: "", name: "",
file_field: "", file_field: "",
@@ -1551,6 +1551,7 @@ const AppCreator = (defaultprops) => {
}; };
// Saving the app that's been configured. // Saving the app that's been configured.
// Save SAVE app
const submitApp = () => { const submitApp = () => {
alert.info("Uploading and building app " + name); alert.info("Uploading and building app " + name);
setAppBuilding(true); setAppBuilding(true);
@@ -1608,8 +1609,9 @@ const AppCreator = (defaultprops) => {
} }
// Handles actions // Handles actions
var handledPaths = []
for (var key in actions) { for (var key in actions) {
var item = actions[key]; var item = JSON.parse(JSON.stringify(actions[key]))
if (item.errors.length > 0) { if (item.errors.length > 0) {
alert.error("Saving with error in action " + item.name); alert.error("Saving with error in action " + item.name);
} }
@@ -1618,6 +1620,27 @@ const AppCreator = (defaultprops) => {
item.name = item.description; item.name = item.description;
} }
// Basic way to allow multiple of the same path
var pathjoin = item.url+"_"+item.method.toLowerCase()
if (handledPaths.includes(pathjoin)) {
console.log("ALREADY INCLUDED: ", pathjoin)
// Max 100 of same lol
for (var i = 0; i < 100; i++) {
item.url = item.url+"_shuffle_replace_"+i
pathjoin = item.url+"_"+item.method.toLowerCase()
if (handledPaths.includes(pathjoin)) {
continue
}
console.log("FOUND NEW: ", item.url)
break
}
}
handledPaths.push(pathjoin)
if (data.paths[item.url] === null || data.paths[item.url] === undefined) { if (data.paths[item.url] === null || data.paths[item.url] === undefined) {
data.paths[item.url] = {}; data.paths[item.url] = {};
} }