Changed from Alert to Toast to work well with mui v18

This commit is contained in:
Frikky
2023-08-17 03:16:43 +02:00
parent 1461d6ad6b
commit 99d1a96c63
36 changed files with 553 additions and 542 deletions
+13 -14
View File
@@ -1,10 +1,9 @@
import React, { useState, useEffect } from 'react';
import theme from '../theme.jsx';
import CytoscapeComponent from 'react-cytoscapejs';
import frameworkStyle from '../frameworkStyle.jsx';
import { v4 as uuidv4 } from "uuid";
import theme from '../theme.jsx';
import { useAlert } from "react-alert";
import AppSearch from '../components/Appsearch.jsx';
import PaperComponent from "../components/PaperComponent.jsx"
@@ -34,10 +33,10 @@ import {
import * as edgehandles from "cytoscape-edgehandles";
import * as cytoscape from "cytoscape";
import { toast } from 'react-toastify';
cytoscape.use(edgehandles);
const svgSize = "40px"
const parsedDatatypeImages = {
"SIEM": encodeURI(`data:image/svg+xml;utf-8,<svg fill="rgb(248,90,62)" width="${svgSize}" height="${svgSize}" viewBox="0 0 ${svgSize} ${svgSize}" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M6.93767 0C8.71083 0 10.4114 0.704386 11.6652 1.9582C12.919 3.21202 13.6234 4.91255 13.6234 6.68571C13.6234 8.34171 13.0165 9.864 12.0188 11.0366L12.2965 11.3143H13.1091L18.252 16.4571L16.7091 18L11.5662 12.8571V12.0446L11.2885 11.7669C10.116 12.7646 8.59367 13.3714 6.93767 13.3714C5.16451 13.3714 3.46397 12.667 2.21015 11.4132C0.956339 10.1594 0.251953 8.45888 0.251953 6.68571C0.251953 4.91255 0.956339 3.21202 2.21015 1.9582C3.46397 0.704386 5.16451 0 6.93767 0ZM6.93767 2.05714C4.36624 2.05714 2.3091 4.11429 2.3091 6.68571C2.3091 9.25714 4.36624 11.3143 6.93767 11.3143C9.5091 11.3143 11.5662 9.25714 11.5662 6.68571C11.5662 4.11429 9.5091 2.05714 6.93767 2.05714Z" /></svg>`),
@@ -521,7 +520,7 @@ const AppFramework = (props) => {
const scale = size === undefined ? 1 : size > 5 ? 3 : size
const alert = useAlert()
//const alert = useAlert()
const handleLoadNextSuggestion = (frameworkData) => {
@@ -784,16 +783,16 @@ const AppFramework = (props) => {
.then((responseJson) => {
if (responseJson.success === false) {
if (responseJson.reason !== undefined) {
alert.error("Failed updating: " + responseJson.reason)
toast("Failed updating: " + responseJson.reason)
} else {
alert.error("Failed to update framework for your org.")
toast("Failed to update framework for your org.")
}
} else {
alert.info("Updated usecase.")
toast("Updated usecase.")
}
})
.catch((error) => {
alert.error(error.toString());
toast(error.toString());
//setFrameworkLoaded(true)
})
}
@@ -816,13 +815,13 @@ const AppFramework = (props) => {
})
.then((responseJson) => {
if (responseJson.success === false) {
alert.error("Failed to activate the app")
toast("Failed to activate the app")
} else {
//alert.success("App activated for your organization! Refresh the page to use the app.")
//toast("App activated for your organization! Refresh the page to use the app.")
}
})
.catch(error => {
//alert.error(error.toString())
//toast(error.toString())
console.log("Activate app error: ", error.toString())
});
}
@@ -852,9 +851,9 @@ const AppFramework = (props) => {
.then((responseJson) => {
if (responseJson.success === false) {
if (responseJson.reason !== undefined) {
alert.error("Failed updating: " + responseJson.reason)
toast("Failed updating: " + responseJson.reason)
} else {
alert.error("Failed to update framework for your org.")
toast("Failed to update framework for your org.")
}
}
@@ -863,7 +862,7 @@ const AppFramework = (props) => {
//setFrameworkData(responseJson)
})
.catch((error) => {
alert.error(error.toString());
toast(error.toString());
//setFrameworkLoaded(true)
})
}
+1 -1
View File
@@ -74,7 +74,7 @@ const AppGrid = props => {
.then(response => {
if (response.success === true) {
setFormMessage(response.reason)
//alert.info("Thanks for submitting!")
//toast("Thanks for submitting!")
} else {
setFormMessage(errorMessage)
}
+4 -4
View File
@@ -2,8 +2,8 @@ import React, { useState, useEffect } from 'react';
import ReactGA from 'react-ga4';
import theme from '../theme';
import {Link} from 'react-router-dom';
import { useAlert } from "react-alert";
import { Search as SearchIcon, CloudQueue as CloudQueueIcon, Code as CodeIcon } from '@mui/icons-material';
import { toast } from 'react-toastify';
//import algoliasearch from 'algoliasearch/lite';
import algoliasearch from 'algoliasearch';
@@ -25,7 +25,7 @@ const Appsearch = props => {
const { maxRows, showName, showSuggestion, isMobile, globalUrl, parsedXs, newSelectedApp, setNewSelectedApp, defaultSearch, showSearch, ConfiguredHits, userdata, cy, isCreatorPage, actionImageList, setActionImageList} = props
const isCloud = window.location.host === "localhost:3002" || window.location.host === "shuffler.io";
const alert = useAlert();
//const alert = useAlert();
const rowHandler = maxRows === undefined || maxRows === null ? 50 : maxRows
const xs = parsedXs === undefined || parsedXs === null ? 12 : parsedXs
//const theme = useTheme();
@@ -68,12 +68,12 @@ const Appsearch = props => {
if (response.status !== 200) {
console.log("Status not 200 for set creator :O!");
}
alert.success("Sucessfully updated specialzed app.")
toast("Sucessfully updated specialzed app.")
return response.json();
})
.then((responseJson) => {
if (!responseJson.success && responseJson.reason !== undefined) {
alert.error("Failed updating user: " + responseJson.reason);
toast("Failed updating user: " + responseJson.reason);
}
})
.catch((error) => {
@@ -1,7 +1,8 @@
import React, { useState, useEffect } from "react";
import theme from '../theme.jsx';
import { useAlert } from "react-alert";
import { toast } from 'react-toastify';
import {
Tooltip,
IconButton,
@@ -34,7 +35,7 @@ const AuthenticationItem = (props) => {
const [selectedAuthenticationModalOpen, setSelectedAuthenticationModalOpen] = React.useState(false);
const [authenticationFields, setAuthenticationFields] = React.useState([]);
const alert = useAlert();
//const alert = useAlert();
var bgColor = "#27292d";
if (index % 2 === 0) {
bgColor = "#1f2023";
@@ -63,7 +64,7 @@ const AuthenticationItem = (props) => {
}
const deleteAuthentication = (data) => {
alert.info("Deleting auth " + data.label);
toast("Deleting auth " + data.label);
// Just use this one?
const url = globalUrl + "/api/v1/apps/authentication/" + data.id;
@@ -79,13 +80,13 @@ const AuthenticationItem = (props) => {
response.json().then((responseJson) => {
console.log("RESP: ", responseJson);
if (responseJson["success"] === false) {
alert.error("Failed deleting auth");
toast("Failed deleting auth");
} else {
// Need to wait because query in ES is too fast
setTimeout(() => {
getAppAuthentication();
}, 1000);
//alert.success("Successfully deleted authentication!")
//toast("Successfully deleted authentication!")
}
})
)
@@ -115,9 +116,9 @@ const AuthenticationItem = (props) => {
.then((response) =>
response.json().then((responseJson) => {
if (responseJson["success"] === false) {
alert.error("Failed overwriting appauth in workflows");
toast("Failed overwriting appauth in workflows");
} else {
alert.success("Successfully updated auth everywhere!");
toast("Successfully updated auth everywhere!");
//setSelectedUserModalOpen(false);
setTimeout(() => {
getAppAuthentication();
@@ -126,7 +127,7 @@ const AuthenticationItem = (props) => {
})
)
.catch((error) => {
alert.error("Err: " + error.toString());
toast("Err: " + error.toString());
});
};
@@ -1,7 +1,7 @@
import React, { useState, useEffect } from "react";
import theme from '../theme.jsx';
import { v4 as uuidv4 } from "uuid";
import { toast } from 'react-toastify';
import {
Button,
@@ -54,7 +54,7 @@ const AuthenticationData = (props) => {
})
.then((responseJson) => {
if (!responseJson.success) {
alert.error("Failed to set app auth: " + responseJson.reason);
toast("Failed to set app auth: " + responseJson.reason);
} else {
if (getAppAuthentication !== undefined) {
getAppAuthentication()
@@ -65,11 +65,11 @@ const AuthenticationData = (props) => {
}
// Needs a refresh with the new authentication..
//alert.success("Successfully saved new app auth")
//toast("Successfully saved new app auth")
}
})
.catch((error) => {
//alert.error(error.toString());
//toast(error.toString());
console.log("New auth error: ", error.toString());
});
}
@@ -146,7 +146,7 @@ const AuthenticationData = (props) => {
selectedApp.authentication.parameters[key].name
] = "false";
} else {
alert.info(
toast(
"Field " +
selectedApp.authentication.parameters[key].name +
" can't be empty"
@@ -2,7 +2,7 @@ import React, { useState, useEffect } from "react";
import theme from '../theme.jsx';
import { v4 as uuidv4 } from "uuid";
import { useAlert } from "react-alert";
import { toast } from 'react-toastify';
import {
Divider,
@@ -44,7 +44,7 @@ const AuthenticationData = (props) => {
authFieldsOnly,
} = props
const alert = useAlert()
//const alert = useAlert()
let navigate = useNavigate();
const [submitSuccessful, setSubmitSuccessful] = useState(false)
const [authenticationOption, setAuthenticationOptions] = React.useState({
@@ -99,9 +99,9 @@ const AuthenticationData = (props) => {
.then((responseJson) => {
if (!responseJson.success) {
if (responseJson.reason === undefined) {
alert.error("Failed to set app auth. Are you logged in?")
toast("Failed to set app auth. Are you logged in?")
} else {
alert.error("Failed to set app auth: " + responseJson.reason);
toast("Failed to set app auth: " + responseJson.reason);
}
} else {
setSubmitSuccessful(true)
@@ -115,7 +115,7 @@ const AuthenticationData = (props) => {
}
})
.catch((error) => {
//alert.error(error.toString());
//toast(error.toString());
console.log("New auth error: ", error.toString());
});
};
@@ -175,7 +175,7 @@ const AuthenticationData = (props) => {
selectedApp.authentication.parameters[paramkey].name
] = "false";
} else {
alert.info(
toast(
"Field " +
selectedApp.authentication.parameters[paramkey].name +
" can't be empty"
+2 -2
View File
@@ -11,11 +11,11 @@ import {
Card,
} from "@mui/material";
import { useAlert } from "react-alert";
//import { useAlert
const Branding = (props) => {
const { globalUrl, userdata, serverside, billingInfo, stripeKey, selectedOrganization, handleGetOrg, } = props;
const alert = useAlert();
//const alert = useAlert();
const [publishingInfo, setPublishingInfo] = useState("");
// Should enable / disable org branding
+11 -11
View File
@@ -16,7 +16,7 @@ import {
DialogTitle,
DialogActions,
} from "@mui/material";
import { useAlert } from "react-alert";
//import { useAlert
import {
Edit as EditIcon,
@@ -72,7 +72,7 @@ const CacheView = (props) => {
const [dataValue, setDataValue] = React.useState({});
const [editCache, setEditCache] = React.useState(false);
const [show, setShow] = useState({});
const alert = useAlert();
//const alert = useAlert();
useEffect(() => {
listOrgCache(orgId);
console.log("orgid", orgId);
@@ -105,7 +105,7 @@ const CacheView = (props) => {
}
})
.catch((error) => {
alert.error(error.toString());
toast(error.toString());
});
};
@@ -148,7 +148,7 @@ const CacheView = (props) => {
const deleteCache = (orgId, key) => {
alert.info("Attempting to delete Cache");
toast("Attempting to delete Cache");
fetch(globalUrl + `/api/v1/orgs/${orgId}/cache/${key}`, {
method: "DELETE",
headers: {
@@ -158,16 +158,16 @@ const CacheView = (props) => {
})
.then((response) => {
if (response.status === 200) {
alert.success("Successfully deleted Cache");
toast("Successfully deleted Cache");
setTimeout(() => {
listOrgCache(orgId);
}, 1000);
} else {
alert.error("Failed deleting Cache. Does it still exist?");
toast("Failed deleting Cache. Does it still exist?");
}
})
.catch((error) => {
alert.error(error.toString());
toast(error.toString());
});
};
@@ -197,12 +197,12 @@ const CacheView = (props) => {
})
.then((responseJson) => {
setAddCache(responseJson);
alert.success("Cache Edited Successfully!");
toast("Cache Edited Successfully!");
listOrgCache(orgId);
setModalOpen(false);
})
.catch((error) => {
alert.error(error.toString());
toast(error.toString());
});
};
@@ -231,12 +231,12 @@ const CacheView = (props) => {
})
.then((responseJson) => {
setAddCache(responseJson);
alert.success("New Cache Added Successfully!");
toast("New Cache Added Successfully!");
listOrgCache(orgId);
setModalOpen(false);
})
.catch((error) => {
alert.error(error.toString());
toast(error.toString());
});
};
+11 -11
View File
@@ -112,9 +112,9 @@ const ConfigureWorkflow = (props) => {
})
.then((response) => {
if (response.status === 200) {
//alert.success("Successfully GOT app "+appId)
//toast("Successfully GOT app "+appId)
} else {
alert.error("Failed getting app");
toast("Failed getting app");
}
return response.json();
@@ -128,7 +128,7 @@ const ConfigureWorkflow = (props) => {
}
})
.catch((error) => {
alert.error(error.toString());
toast(error.toString());
});
};
@@ -566,7 +566,7 @@ const ConfigureWorkflow = (props) => {
.then((response) => {
if (response.status !== 200) {
//window.location.pathname = "/search"
//alert.error("Failed to find this app. Is it public?")
//toast("Failed to find this app. Is it public?")
}
return response.json();
@@ -574,16 +574,16 @@ const ConfigureWorkflow = (props) => {
.then((responseJson) => {
if (responseJson.success === false) {
if (responseJson.reason !== undefined) {
alert.error("Failed to activate the app: "+responseJson.reason);
toast("Failed to activate the app: "+responseJson.reason);
} else {
alert.error("Failed to activate the app");
toast("Failed to activate the app");
}
} else {
alert.success("App activated for your organization!");
toast("App activated for your organization!");
}
})
.catch((error) => {
alert.error(error.toString());
toast(error.toString());
});
};
@@ -693,7 +693,7 @@ const ConfigureWorkflow = (props) => {
if (workflow.actions !== null) {
//console.log(workflow.actions)
alert.info("Setting action to version "+action.update_version)
toast("Setting action to version "+action.update_version)
for (let [key,keyval] in Object.entries(workflow.actions)) {
if (workflow.actions[key].app_name === action.app_name && workflow.actions[key].app_version === action.app_version) {
workflow.actions[key].app_version = action.update_version
@@ -851,7 +851,7 @@ const ConfigureWorkflow = (props) => {
console.log("NAVIGATOR: ", navigator);
const clipboard = navigator.clipboard;
if (clipboard === undefined) {
alert.error("Can only copy over HTTPS (port 3443)");
toast("Can only copy over HTTPS (port 3443)");
return;
}
@@ -864,7 +864,7 @@ const ConfigureWorkflow = (props) => {
/* Copy the text inside the text field */
document.execCommand("copy");
alert.success("Copied Webhook URL");
toast("Copied Webhook URL");
}
}}>
<Typography variant="body2" color="textSecondary">{webhook.description}</Typography>
+1 -1
View File
@@ -81,7 +81,7 @@ const CreatorGrid = props => {
.then(response => {
if (response.success === true) {
setFormMessage(response.reason)
//alert.info("Thanks for submitting!")
//toast("Thanks for submitting!")
} else {
setFormMessage(errorMessage)
}
+1 -1
View File
@@ -69,7 +69,7 @@ const DocsGrid = props => {
.then(response => {
if (response.success === true) {
setFormMessage(response.reason)
//alert.info("Thanks for submitting!")
//toast("Thanks for submitting!")
} else {
setFormMessage(errorMessage)
}
+1 -1
View File
@@ -127,7 +127,7 @@ const EditWorkflow = (props) => {
}
})
.catch((error) => {
//alert.error(error.toString());
//toast(error.toString());
console.log("Get workflow error: ", error.toString());
})
}
+17 -17
View File
@@ -29,7 +29,7 @@ import {
Add as AddIcon,
} from "@mui/icons-material";
import { useAlert } from "react-alert";
//import { useAlert
import Dropzone from "../components/Dropzone.jsx";
import CodeEditor from "../components/ShuffleCodeEditor.jsx";
import theme from "../theme.jsx";
@@ -45,7 +45,7 @@ const Files = (props) => {
const [openEditor, setOpenEditor] = React.useState(false);
const [renderTextBox, setRenderTextBox] = React.useState(false);
const alert = useAlert();
//const alert = useAlert();
const allowedFileTypes = ["txt", "py", "yaml", "yml","json", "html", "js", "csv", "log"]
var upload = "";
@@ -113,7 +113,7 @@ const Files = (props) => {
}
})
.catch((error) => {
alert.error(error.toString());
toast(error.toString());
});
};
@@ -139,12 +139,12 @@ const Files = (props) => {
})
.then((responseJson) => {
if (responseJson.success) {
alert.info("Successfully deleted file " + file.name);
toast("Successfully deleted file " + file.name);
} else if (
responseJson.reason !== undefined &&
responseJson.reason !== null
) {
alert.error("Failed to delete file: " + responseJson.reason);
toast("Failed to delete file: " + responseJson.reason);
}
setTimeout(() => {
getFiles();
@@ -153,7 +153,7 @@ const Files = (props) => {
console.log(responseJson);
})
.catch((error) => {
alert.error(error.toString());
toast(error.toString());
});
};
@@ -178,7 +178,7 @@ const Files = (props) => {
// console.log("respdata type ->", typeof(respdata));
if (respdata.length === 0) {
alert.error("Failed getting file. Is it deleted?");
toast("Failed getting file. Is it deleted?");
return;
}
return respdata
@@ -189,7 +189,7 @@ const Files = (props) => {
//console.log("filecontent state ",fileContent);
})
.catch((error) => {
alert.error(error.toString());
toast(error.toString());
});
};
@@ -210,7 +210,7 @@ const Files = (props) => {
})
.then((respdata) => {
if (respdata.length === 0) {
alert.error("Failed getting file. Is it deleted?");
toast("Failed getting file. Is it deleted?");
return;
}
@@ -249,7 +249,7 @@ const Files = (props) => {
//setSchedules(responseJson)
})
.catch((error) => {
alert.error(error.toString());
toast(error.toString());
});
};
@@ -291,11 +291,11 @@ const Files = (props) => {
if (responseJson.success === true) {
handleFileUpload(responseJson.id, file);
} else {
alert.error("Failed to upload file ", filename);
toast("Failed to upload file ", filename);
}
})
.catch((error) => {
alert.error("Failed to upload file ", filename);
toast("Failed to upload file ", filename);
console.log(error.toString());
});
};
@@ -312,7 +312,7 @@ const Files = (props) => {
.then((response) => {
if (response.status !== 200 && response.status !== 201) {
console.log("Status not 200 for apps :O!");
alert.error("File was created, but failed to upload.");
toast("File was created, but failed to upload.");
return;
}
@@ -323,7 +323,7 @@ const Files = (props) => {
//setFiles(responseJson)
})
.catch((error) => {
alert.error(error.toString());
toast(error.toString());
});
};
@@ -364,7 +364,7 @@ const Files = (props) => {
const files = isDropzone ? e.dataTransfer.files : e.target.files;
//const reader = new FileReader();
//alert.info("Starting fileupload")
//toast("Starting fileupload")
uploadFiles(files);
};
@@ -742,7 +742,7 @@ const Files = (props) => {
) {
const clipboard = navigator.clipboard;
if (clipboard === undefined) {
alert.error(
toast(
"Can only copy over HTTPS (port 3443)"
);
return;
@@ -758,7 +758,7 @@ const Files = (props) => {
/* Copy the text inside the text field */
document.execCommand("copy");
alert.info(file.id + " copied to clipboard");
toast(file.id + " copied to clipboard");
}
}}
>
+6 -6
View File
@@ -42,7 +42,7 @@ import {
Lightbulb as LightbulbIcon,
} from "@mui/icons-material";
import { useAlert } from "react-alert";
//import { useAlert
import SearchField from '../components/Searchfield.jsx'
const hoverColor = "#f85a3e"
@@ -51,7 +51,7 @@ const hoverOutColor = "#e8eaf6"
const Header = props => {
const { globalUrl, setNotifications, notifications, isLoggedIn, removeCookie, homePage, userdata, serverside, } = props;
//const theme = useTheme();
const alert = useAlert()
//const alert = useAlert()
const [HomeHoverColor, setHomeHoverColor] = useState(hoverOutColor);
@@ -101,7 +101,7 @@ const { globalUrl, setNotifications, notifications, isLoggedIn, removeCookie, ho
setNotifications([])
handleClose()
} else {
alert.error("Failed dismissing notifications. Please try again later.")
toast("Failed dismissing notifications. Please try again later.")
}
})
.catch(error => {
@@ -131,7 +131,7 @@ const { globalUrl, setNotifications, notifications, isLoggedIn, removeCookie, ho
console.log("NEW NOTIFICATIONS: ", newNotifications)
setNotifications(newNotifications)
} else {
alert.error("Failed dismissing notification. Please try again later.")
toast("Failed dismissing notification. Please try again later.")
}
})
.catch(error => {
@@ -406,9 +406,9 @@ const { globalUrl, setNotifications, notifications, isLoggedIn, removeCookie, ho
setTimeout(() => {
window.location.reload()
}, 2000)
alert.success("Successfully changed active organization - refreshing!")
toast("Successfully changed active organization - refreshing!")
} else {
alert.error("Failed changing org: ", responseJson.reason)
toast("Failed changing org: ", responseJson.reason)
}
})
.catch(error => {
+5 -5
View File
@@ -1,7 +1,7 @@
import React, { useRef, useState, useEffect, useLayoutEffect } from "react";
import { useParams, useNavigate, Link } from "react-router-dom";
import theme from '../theme.jsx';
import { useAlert } from "react-alert";
//import { useAlert
import { v4 as uuidv4 } from "uuid";
import {
@@ -99,7 +99,7 @@ const AuthenticationOauth2 = (props) => {
} = props;
let navigate = useNavigate();
const alert = useAlert()
//const alert = useAlert()
//const [update, setUpdate] = React.useState("|")
const [defaultConfigSet, setDefaultConfigSet] = React.useState(
@@ -422,7 +422,7 @@ const AuthenticationOauth2 = (props) => {
//}
//while(open === true)
} catch (e) {
alert.error(
toast(
"Failed authentication - probably bad credentials. Try again"
);
setButtonClicked(false);
@@ -451,7 +451,7 @@ const AuthenticationOauth2 = (props) => {
console.log("NEW AUTH: ", authenticationOption);
if (authenticationOption.label.length === 0) {
authenticationOption.label = `Auth for ${selectedApp.name}`;
//alert.info("Label can't be empty")
//toast("Label can't be empty")
//return
}
@@ -479,7 +479,7 @@ const AuthenticationOauth2 = (props) => {
selectedApp.authentication.parameters[key].name
] = "false";
} else {
alert.info(
toast(
"Field " + selectedApp.authentication.parameters[key].name.replace("_basic", "", -1).replace("_", " ", -1) + " can't be empty"
);
+4 -4
View File
@@ -17,7 +17,7 @@ import {
Save as SaveIcon,
} from "@mui/icons-material";
import { useAlert } from "react-alert";
//import { useAlert
const useStyles = makeStyles({
notchedOutline: {
@@ -39,7 +39,7 @@ const OrgHeader = (props) => {
handleEditOrg,
} = props;
const alert = useAlert();
//const alert = useAlert();
const classes = useStyles();
var upload = "";
@@ -210,13 +210,13 @@ const OrgHeader = (props) => {
const invalid = ["#", ":", "."];
for (var key in invalid) {
if (e.target.value.includes(invalid[key])) {
alert.error("Can't use " + invalid[key] + " in name");
toast("Can't use " + invalid[key] + " in name");
return;
}
}
if (e.target.value.length > 100) {
alert.error("Choose a shorter name.");
toast("Choose a shorter name.");
return;
}
+6 -6
View File
@@ -7,7 +7,7 @@ import { validateJson, GetIconInfo } from "../views/Workflows.jsx";
import { GetParsedPaths } from "../views/Apps.jsx";
import { sortByKey } from "../views/AngularWorkflow.jsx";
import { NestedMenuItem } from "mui-nested-menu";
import { useAlert } from "react-alert";
//import { useAlert
import {
ButtonGroup,
@@ -172,7 +172,7 @@ const ParsedAction = (props) => {
} = props;
const classes = useStyles();
const alert = useAlert()
//const alert = useAlert()
const [hideBody, setHideBody] = React.useState(true);
const [activateHidingBodyButton, setActivateHidingBodyButton] = React.useState(false);
@@ -227,9 +227,9 @@ const ParsedAction = (props) => {
})
.then((response) => {
if (response.status === 200) {
//alert.success("Successfully GOT app "+appId)
//toast("Successfully GOT app "+appId)
} else {
alert.error("Failed getting app");
toast("Failed getting app");
}
return response.json();
@@ -290,7 +290,7 @@ const ParsedAction = (props) => {
//foundparams.push(param.name)
}
} else {
alert.error("Couldn't find action " + selectedAction.name);
toast("Couldn't find action " + selectedAction.name);
}
selectedAction.errors = [];
@@ -306,7 +306,7 @@ const ParsedAction = (props) => {
}
})
.catch((error) => {
alert.error(error.toString());
toast(error.toString());
});
};
+1 -1
View File
@@ -12,7 +12,7 @@ import {
} from "@mui/material";
import Priority from "../components/Priority.jsx";
import { useAlert } from "react-alert";
//import { useAlert
const Priorities = (props) => {
const { globalUrl, userdata, serverside, billingInfo, stripeKey, checkLogin, setAdminTab, setCurTab, } = props;
+4 -4
View File
@@ -17,7 +17,7 @@ import {
AutoFixHigh as AutoFixHighIcon,
ArrowForward as ArrowForwardIcon,
} from '@mui/icons-material';
import { useAlert } from "react-alert";
//import { useAlert
const Priority = (props) => {
const { globalUrl, userdata, serverside, priority, checkLogin, setAdminTab, setCurTab, } = props;
@@ -56,14 +56,14 @@ const Priority = (props) => {
}
} else {
if (responseJson.success === false && responseJson.reason !== undefined) {
alert.error("Failed change recommendation: ", responseJson.reason)
toast("Failed change recommendation: ", responseJson.reason)
} else {
alert.error("Failed change recommendation");
toast("Failed change recommendation");
}
}
})
.catch((error) => {
alert.info("Failed dismissing alert. Please contact support@shuffler.io if this persists.");
toast("Failed dismissing alert. Please contact support@shuffler.io if this persists.");
});
}
@@ -861,12 +861,12 @@ const CodeEditor = (props) => {
var newResult = {}
if (responseJson.success === true && responseJson.result !== null && responseJson.result !== undefined && responseJson.result.length > 0) {
const result = responseJson.result.slice(0, 50)+"..."
//alert.info("SUCCESS: "+result)
//toast("SUCCESS: "+result)
const validate = validateJson(responseJson.result)
newResult = validate
} else if (responseJson.success === false && responseJson.reason !== undefined && responseJson.reason !== null) {
alert.error(responseJson.reason)
toast(responseJson.reason)
newResult = {"valid": false, "result": responseJson.reason}
} else if (responseJson.success === true) {
newResult = {"valid": false, "result": "Couldn't finish execution. Please fill all the required fields, and retry the execution."}
@@ -882,7 +882,7 @@ const CodeEditor = (props) => {
setExecuting(false)
})
.catch(error => {
//alert.error("Execution error: "+error.toString())
//toast("Execution error: "+error.toString())
console.log("error: ", error)
setExecuting(false)
})
+20 -20
View File
@@ -1,7 +1,7 @@
import React, { useState, useEffect } from "react";
import theme from '../theme.jsx';
import { useNavigate, Link } from "react-router-dom";
import { useAlert } from "react-alert";
//import { useAlert
import ConfigureWorkflow from "../components/ConfigureWorkflow.jsx";
import PaperComponent from "../components/PaperComponent.jsx"
import AuthenticationOauth2 from "../components/Oauth2Auth.jsx";
@@ -349,14 +349,14 @@ const UsecaseSearch = (props) => {
const [firstRequest, setFirstRequest] = React.useState(true);
const isCloud = window.location.host === "localhost:3002" || window.location.host === "shuffler.io";
const alert = useAlert()
//const alert = useAlert()
useEffect(() => {
// if (firstRequest !== true && workflow.id !== undefined && autotry === true && setUsecaseSearch !== undefined && authenticationModalOpen === false && configureWorkflowModalOpen === false) {
//
if (autotry === true && configureWorkflowModalOpen === false && workflow.id !== undefined && setUsecaseSearch !== undefined) {
console.log("Close it?")
alert.info("Workflow successfully added! Add more apps, and we will suggest more workflows")
toast("Workflow successfully added! Add more apps, and we will suggest more workflows")
if (setCloseWindow !== undefined) {
setCloseWindow(true)
@@ -793,7 +793,7 @@ const UsecaseSearch = (props) => {
console.log("Deleted workflow")
})
.catch((error) => {
//alert.error(error.toString());
//toast(error.toString());
console.log("Delete workflow error: ", error.toString());
})
}
@@ -822,7 +822,7 @@ const UsecaseSearch = (props) => {
}
})
.catch((error) => {
//alert.error(error.toString());
//toast(error.toString());
console.log("Get workflows error: ", error.toString());
})
}
@@ -894,9 +894,9 @@ const UsecaseSearch = (props) => {
.then((responseJson) => {
if (responseJson.success === false) {
if (responseJson.reason !== undefined) {
alert.error("Error setting workflow: ", responseJson.reason)
toast("Error setting workflow: ", responseJson.reason)
} else {
alert.error("Error setting workflow.")
toast("Error setting workflow.")
}
return
@@ -905,7 +905,7 @@ const UsecaseSearch = (props) => {
return responseJson;
})
.catch((error) => {
alert.error(error.toString());
toast(error.toString());
});
}
@@ -930,7 +930,7 @@ const UsecaseSearch = (props) => {
if (responseJson.success === false) {
if (responseJson.reason !== null && responseJson.reason !== undefined) {
//alert.error(responseJson.reason)
//toast(responseJson.reason)
}
if (responseJson.source === "") {
@@ -1009,13 +1009,13 @@ const UsecaseSearch = (props) => {
responseJson.status,
).then((response) => {
if (response !== undefined) {
alert.success("Successfully generated " + responseJson.name);
toast("Successfully generated " + responseJson.name);
}
});
}
})
.catch((error) => {
alert.error("Generate error: " + error.toString());
toast("Generate error: " + error.toString());
})
@@ -1057,7 +1057,7 @@ const UsecaseSearch = (props) => {
.catch((error) => {
setIsUploading(false)
console.log("Merge err: ", error.toString())
//alert.error("Err: " + error.toString());
//toast("Err: " + error.toString());
});
}
@@ -1207,7 +1207,7 @@ const UsecaseSearch = (props) => {
}
if (changed) {
//alert.error("Errors were found. Click them to sort sort them out or go to the next usecase.")
//toast("Errors were found. Click them to sort sort them out or go to the next usecase.")
//setUpdate(Math.random())
//setIsUploading(false)
@@ -1268,13 +1268,13 @@ const UsecaseSearch = (props) => {
})
.then((responseJson) => {
if (responseJson.success === false) {
alert.error("Failed to activate the app")
toast("Failed to activate the app")
} else {
//alert.success("App activated for your organization! Refresh the page to use the app.")
//toast("App activated for your organization! Refresh the page to use the app.")
}
})
.catch(error => {
//alert.error(error.toString())
//toast(error.toString())
console.log("Activate app error: ", error.toString())
});
}
@@ -1304,9 +1304,9 @@ const UsecaseSearch = (props) => {
.then((responseJson) => {
if (responseJson.success === false) {
if (responseJson.reason !== undefined) {
alert.error("Failed updating default app: " + responseJson.reason)
toast("Failed updating default app: " + responseJson.reason)
} else {
alert.error("Failed to update framework for your org.")
toast("Failed to update framework for your org.")
}
} else {
@@ -1319,7 +1319,7 @@ const UsecaseSearch = (props) => {
//setFrameworkData(responseJson)
})
.catch((error) => {
alert.error(error.toString());
toast(error.toString());
//setFrameworkLoaded(true)
})
}
@@ -1516,7 +1516,7 @@ const UsecaseSearch = (props) => {
return (
<div key={curindex} style={{display: "flex", maxHeight: 40, minHeight: 40, borderTop: "1px solid rgba(255,255,255,0.3)", }} onClick={() => {
if (subdata.disabled === true) {
//alert.info("Usecase not available yet.")
//toast("Usecase not available yet.")
return
}
+8 -8
View File
@@ -38,7 +38,7 @@ import {
Chip,
ButtonGroup,
} from "@mui/material";
import { useAlert } from "react-alert";
//import { useAlert
import { useNavigate, Link } from "react-router-dom";
import WorkflowSearch from '../components/Workflowsearch.jsx';
@@ -134,7 +134,7 @@ const WelcomeForm = (props) => {
const isCloud = window.location.host === "localhost:3002" || window.location.host === "shuffler.io";
const alert = useAlert();
//const alert = useAlert();
let navigate = useNavigate();
const onNodeSelect = (label) => {
@@ -262,16 +262,16 @@ const WelcomeForm = (props) => {
response.json().then((responseJson) => {
if (responseJson["success"] === false) {
console.log("Update user success")
//alert.error("Failed updating org: ", responseJson.reason);
//toast("Failed updating org: ", responseJson.reason);
} else {
console.log("Update success!")
//alert.success("Successfully edited org!");
//toast("Successfully edited org!");
}
})
)
.catch((error) => {
console.log("Update err: ", error.toString())
//alert.error("Err: " + error.toString());
//toast("Err: " + error.toString());
});
}
@@ -308,15 +308,15 @@ const WelcomeForm = (props) => {
response.json().then((responseJson) => {
if (responseJson["success"] === false) {
console.log("Update of org failed")
//alert.error("Failed updating org: ", responseJson.reason);
//toast("Failed updating org: ", responseJson.reason);
} else {
//alert.success("Successfully edited org!");
//toast("Successfully edited org!");
}
})
)
.catch((error) => {
console.log("Update err: ", error.toString())
//alert.error("Err: " + error.toString());
//toast("Err: " + error.toString());
});
}
+2 -2
View File
@@ -69,7 +69,7 @@ const AppGrid = props => {
.then(response => {
if (response.success === true) {
setFormMessage(response.reason)
//alert.info("Thanks for submitting!")
//toast("Thanks for submitting!")
} else {
setFormMessage(errorMessage)
}
@@ -158,7 +158,7 @@ const AppGrid = props => {
}
})
.catch((error) => {
//alert.error("ERROR: " + error.toString());
//toast("ERROR: " + error.toString());
console.log("ERROR: " + error.toString());
});
};
+1 -1
View File
@@ -53,7 +53,7 @@ const WorkflowSearch = props => {
.then(response => {
if (response.success === true) {
setFormMessage(response.reason)
//alert.info("Thanks for submitting!")
//toast("Thanks for submitting!")
} else {
setFormMessage(errorMessage)
}