diff --git a/frontend/src/components/AppFramework.jsx b/frontend/src/components/AppFramework.jsx index b5ab004e..aca62d61 100644 --- a/frontend/src/components/AppFramework.jsx +++ b/frontend/src/components/AppFramework.jsx @@ -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,`), @@ -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) }) } diff --git a/frontend/src/components/AppGrid.jsx b/frontend/src/components/AppGrid.jsx index 1e6ab296..57369deb 100644 --- a/frontend/src/components/AppGrid.jsx +++ b/frontend/src/components/AppGrid.jsx @@ -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) } diff --git a/frontend/src/components/Appsearch.jsx b/frontend/src/components/Appsearch.jsx index 8beb1014..5f88e99a 100644 --- a/frontend/src/components/Appsearch.jsx +++ b/frontend/src/components/Appsearch.jsx @@ -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) => { diff --git a/frontend/src/components/AuthenticationItem.jsx b/frontend/src/components/AuthenticationItem.jsx index 06329a35..593eacb4 100644 --- a/frontend/src/components/AuthenticationItem.jsx +++ b/frontend/src/components/AuthenticationItem.jsx @@ -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()); }); }; diff --git a/frontend/src/components/AuthenticationNormal.jsx b/frontend/src/components/AuthenticationNormal.jsx index a0d6acab..1140de10 100644 --- a/frontend/src/components/AuthenticationNormal.jsx +++ b/frontend/src/components/AuthenticationNormal.jsx @@ -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" diff --git a/frontend/src/components/AuthenticationWindow.jsx b/frontend/src/components/AuthenticationWindow.jsx index 47dd9b4e..d7bcc55a 100755 --- a/frontend/src/components/AuthenticationWindow.jsx +++ b/frontend/src/components/AuthenticationWindow.jsx @@ -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" diff --git a/frontend/src/components/Branding.jsx b/frontend/src/components/Branding.jsx index 4b44f5c1..e565a013 100644 --- a/frontend/src/components/Branding.jsx +++ b/frontend/src/components/Branding.jsx @@ -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 diff --git a/frontend/src/components/CacheView.jsx b/frontend/src/components/CacheView.jsx index 62394423..6546885c 100644 --- a/frontend/src/components/CacheView.jsx +++ b/frontend/src/components/CacheView.jsx @@ -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()); }); }; diff --git a/frontend/src/components/ConfigureWorkflow.jsx b/frontend/src/components/ConfigureWorkflow.jsx index c24703fe..6c734c8e 100755 --- a/frontend/src/components/ConfigureWorkflow.jsx +++ b/frontend/src/components/ConfigureWorkflow.jsx @@ -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"); } }}> {webhook.description} diff --git a/frontend/src/components/CreatorGrid.jsx b/frontend/src/components/CreatorGrid.jsx index 9d23b439..712a2197 100644 --- a/frontend/src/components/CreatorGrid.jsx +++ b/frontend/src/components/CreatorGrid.jsx @@ -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) } diff --git a/frontend/src/components/DocsGrid.jsx b/frontend/src/components/DocsGrid.jsx index fa194a25..947a2d76 100644 --- a/frontend/src/components/DocsGrid.jsx +++ b/frontend/src/components/DocsGrid.jsx @@ -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) } diff --git a/frontend/src/components/EditWorkflow.jsx b/frontend/src/components/EditWorkflow.jsx index 38ddbcf5..9971ff3d 100644 --- a/frontend/src/components/EditWorkflow.jsx +++ b/frontend/src/components/EditWorkflow.jsx @@ -127,7 +127,7 @@ const EditWorkflow = (props) => { } }) .catch((error) => { - //alert.error(error.toString()); + //toast(error.toString()); console.log("Get workflow error: ", error.toString()); }) } diff --git a/frontend/src/components/Files.jsx b/frontend/src/components/Files.jsx index 9f013ee3..2d5b68d2 100644 --- a/frontend/src/components/Files.jsx +++ b/frontend/src/components/Files.jsx @@ -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"); } }} > diff --git a/frontend/src/components/Header.jsx b/frontend/src/components/Header.jsx index 892334e3..e54877b2 100644 --- a/frontend/src/components/Header.jsx +++ b/frontend/src/components/Header.jsx @@ -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 => { diff --git a/frontend/src/components/Oauth2Auth.jsx b/frontend/src/components/Oauth2Auth.jsx index 8bccfb5a..4c37a251 100755 --- a/frontend/src/components/Oauth2Auth.jsx +++ b/frontend/src/components/Oauth2Auth.jsx @@ -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" ); diff --git a/frontend/src/components/OrgHeader.jsx b/frontend/src/components/OrgHeader.jsx index 3b5a091a..b29ed7a9 100644 --- a/frontend/src/components/OrgHeader.jsx +++ b/frontend/src/components/OrgHeader.jsx @@ -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; } diff --git a/frontend/src/components/ParsedAction.jsx b/frontend/src/components/ParsedAction.jsx index 10353f2f..3751dfa7 100755 --- a/frontend/src/components/ParsedAction.jsx +++ b/frontend/src/components/ParsedAction.jsx @@ -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()); }); }; diff --git a/frontend/src/components/Priorities.jsx b/frontend/src/components/Priorities.jsx index 86215b6f..f003540c 100644 --- a/frontend/src/components/Priorities.jsx +++ b/frontend/src/components/Priorities.jsx @@ -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; diff --git a/frontend/src/components/Priority.jsx b/frontend/src/components/Priority.jsx index a4f93729..3a23f15f 100644 --- a/frontend/src/components/Priority.jsx +++ b/frontend/src/components/Priority.jsx @@ -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."); }); } diff --git a/frontend/src/components/ShuffleCodeEditor.jsx b/frontend/src/components/ShuffleCodeEditor.jsx index 21293d7c..4b9dd48a 100644 --- a/frontend/src/components/ShuffleCodeEditor.jsx +++ b/frontend/src/components/ShuffleCodeEditor.jsx @@ -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) }) diff --git a/frontend/src/components/UsecaseSearch.jsx b/frontend/src/components/UsecaseSearch.jsx index ba8a98a1..6d0f2eef 100644 --- a/frontend/src/components/UsecaseSearch.jsx +++ b/frontend/src/components/UsecaseSearch.jsx @@ -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 (
{ if (subdata.disabled === true) { - //alert.info("Usecase not available yet.") + //toast("Usecase not available yet.") return } diff --git a/frontend/src/components/WelcomeForm2.jsx b/frontend/src/components/WelcomeForm2.jsx index 5d887851..83d43e2b 100644 --- a/frontend/src/components/WelcomeForm2.jsx +++ b/frontend/src/components/WelcomeForm2.jsx @@ -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()); }); } diff --git a/frontend/src/components/WorkflowGrid.jsx b/frontend/src/components/WorkflowGrid.jsx index fb19e806..e721dc3f 100644 --- a/frontend/src/components/WorkflowGrid.jsx +++ b/frontend/src/components/WorkflowGrid.jsx @@ -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()); }); }; diff --git a/frontend/src/components/Workflowsearch.jsx b/frontend/src/components/Workflowsearch.jsx index 267face5..b8f4c022 100644 --- a/frontend/src/components/Workflowsearch.jsx +++ b/frontend/src/components/Workflowsearch.jsx @@ -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) } diff --git a/frontend/src/views/Admin.jsx b/frontend/src/views/Admin.jsx index 0befde05..95a4f042 100755 --- a/frontend/src/views/Admin.jsx +++ b/frontend/src/views/Admin.jsx @@ -75,7 +75,8 @@ import { FmdGood as FmdGoodIcon, } from "@mui/icons-material"; -import { useAlert } from "react-alert"; +//import { useAlert +import { ToastContainer, toast } from "react-toastify" import Dropzone from "../components/Dropzone.jsx"; import HandlePaymentNew from "../views/HandlePaymentNew.jsx"; import OrgHeader from "../components/OrgHeader.jsx"; @@ -216,13 +217,13 @@ const Admin = (props) => { .then((responseJson) => { //console.log("RESPONSE: ", responseJson) if (responseJson.success === true) { - //alert.info(responseJson.reason) + //toast(responseJson.reason) setImage2FA(responseJson.reason); setSecret2FA(responseJson.extra); } }) .catch((error) => { - alert.error(error.toString()); + toast(error.toString()); }); }; @@ -256,7 +257,7 @@ const Admin = (props) => { //} }) .catch((error) => { - alert.error(error.toString()); + toast(error.toString()); }); }; @@ -287,7 +288,7 @@ const Admin = (props) => { ] */ - const alert = useAlert(); + //const alert = useAlert(); const handleStatusChange = (event) => { const { value } = event.target; console.log("value: ", value) @@ -465,7 +466,7 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user } 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; @@ -480,13 +481,13 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user .then((response) => response.json().then((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!") } }) ) @@ -518,12 +519,12 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user response.json().then((responseJson) => { console.log("RESP: ", responseJson); if (responseJson["success"] === false) { - alert.error("Failed stopping schedule"); + toast("Failed stopping schedule"); } else { setTimeout(() => { getSchedules(); }, 1500); - //alert.success("Successfully stopped schedule!") + //toast("Successfully stopped schedule!") } }) ) @@ -534,7 +535,7 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user if (userdata.support === true && selectedOrganization.id !== "" && selectedOrganization.id !== undefined && selectedOrganization.id !== null && selectedOrganization.id !== userdata.active_org.id) { - alert.info("Refreshing window to fix org support access") + toast("Refreshing window to fix org support access") window.location.reload() return null } @@ -559,15 +560,15 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user .then((response) => { if (response.status === 200) { } else { - //alert.info("Wrong code sent.") - //alert.info("Wrong code sent. Please try again.") + //toast("Wrong code sent.") + //toast("Wrong code sent. Please try again.") } return response.json(); }) .then((responseJson) => { if (responseJson.success === true) { - alert.info("Successfully enabled 2fa"); + toast("Successfully enabled 2fa"); setTimeout(() => { getUsers(); @@ -579,19 +580,19 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user setSelectedUserModalOpen(false); }, 1000); } else { - alert.info("Wrong code sent. Please try again."); - //alert.error("Failed setting 2fa: ", responseJson.reason) + toast("Wrong code sent. Please try again."); + //toast("Failed setting 2fa: ", responseJson.reason) } }) .catch((error) => { - alert.info("Wrong code sent. Please try again."); - //alert.error("Err: " + error.toString()) + toast("Wrong code sent. Please try again."); + //toast("Err: " + error.toString()) }); }; const handleStopOrgSync = (org_id) => { if (org_id === undefined || org_id === null) { - alert.error("Couldn't get org " + org_id); + toast("Couldn't get org " + org_id); return; } @@ -612,10 +613,10 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user .then((response) => { if (response.status === 200) { console.log("Cloud sync success?"); - alert.success("Successfully stopped cloud sync"); + toast("Successfully stopped cloud sync"); } else { console.log("Cloud sync fail?"); - alert.error( + toast( "Failed stopping sync. Try again, and contact support if this persists." ); } @@ -628,7 +629,7 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user }, 1000); }) .catch((error) => { - alert.error("Err: " + error.toString()); + toast("Err: " + error.toString()); }); }; @@ -672,16 +673,16 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user responseJson.reason !== undefined ) { setOrgSyncResponse(responseJson.reason); - alert.error("Failed to handle sync: " + responseJson.reason); + toast("Failed to handle sync: " + responseJson.reason); } else if (!responseJson.success) { - alert.error("Failed to handle sync."); + toast("Failed to handle sync."); } else { getOrgs(); if (disableSync) { - alert.success("Successfully disabled sync!"); + toast("Successfully disabled sync!"); setOrgSyncResponse("Successfully disabled syncronization"); } else { - alert.success("Cloud Syncronization successfully set up!"); + toast("Cloud Syncronization successfully set up!"); setOrgSyncResponse( "Successfully started syncronization. Cloud features you now have access to can be seen below." ); @@ -696,7 +697,7 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user }) .catch((error) => { setLoading(false); - alert.error("Err: " + error.toString()); + toast("Err: " + error.toString()); }); }; @@ -718,16 +719,16 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user .then((response) => response.json().then((responseJson) => { if (responseJson["success"] === false) { - alert.error("Failed changing authentication"); + toast("Failed changing authentication"); } else { - //alert.success("Successfully password!") + //toast("Successfully password!") setSelectedUserModalOpen(false); getAppAuthentication(); } }) ) .catch((error) => { - alert.error("Err: " + error.toString()); + toast("Err: " + error.toString()); }); }; @@ -766,16 +767,16 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user .then((response) => response.json().then((responseJson) => { if (responseJson["success"] === false) { - alert.error("Failed updating org: ", responseJson.reason); + toast("Failed updating org: ", responseJson.reason); } else { if (lead_info === undefined || lead_info === null || lead_info === []) { - alert.success("Successfully edited org!"); + toast("Successfully edited org!"); } } }) ) .catch((error) => { - alert.error("Err: " + error.toString()); + toast("Err: " + error.toString()); }); }; @@ -800,9 +801,9 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user .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(); @@ -811,7 +812,7 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user }) ) .catch((error) => { - alert.error("Err: " + error.toString()); + toast("Err: " + error.toString()); }); }; @@ -835,12 +836,12 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user response.json().then((responseJson) => { if (responseJson["success"] === false) { if (responseJson.reason !== undefined) { - alert.error(responseJson.reason); + toast(responseJson.reason); } else { - alert.error("Failed creating suborg. Please try again"); + toast("Failed creating suborg. Please try again"); } } else { - alert.success( + toast( "Successfully created suborg. Reloading in 3 seconds!" ); setSelectedUserModalOpen(false); @@ -855,7 +856,7 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user }) ) .catch((error) => { - alert.error("Err: " + error.toString()); + toast("Err: " + error.toString()); }); }; @@ -878,18 +879,18 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user response.json().then((responseJson) => { if (responseJson["success"] === false) { if (responseJson.reason !== undefined) { - alert.error(responseJson.reason); + toast(responseJson.reason); } else { - alert.error("Failed setting new password"); + toast("Failed setting new password"); } } else { - alert.success("Successfully updated password!"); + toast("Successfully updated password!"); setSelectedUserModalOpen(false); } }) ) .catch((error) => { - alert.error("Err: " + error.toString()); + toast("Err: " + error.toString()); }); }; @@ -914,9 +915,9 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user }) .then((responseJson) => { if (!responseJson.success && responseJson.reason !== undefined) { - alert.error("Failed to deactivate user: " + responseJson.reason); + toast("Failed to deactivate user: " + responseJson.reason); } else { - alert.success("Changed activation for user " + data.id); + toast("Changed activation for user " + data.id); } }) @@ -939,7 +940,7 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user } if (orgId.length === 0) { - alert.error("Organization ID not defined. Please contact us on https://shuffler.io if this persists logout."); + toast("Organization ID not defined. Please contact us on https://shuffler.io if this persists logout."); return; } @@ -960,7 +961,7 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user }) .then((responseJson) => { if (responseJson["success"] === false) { - alert.error("Failed getting your org. If this persists, please contact support."); + toast("Failed getting your org. If this persists, please contact support."); } else { if ( responseJson.sync_features === undefined || @@ -1032,7 +1033,7 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user }) .catch((error) => { console.log("Error getting org: ", error); - alert.error("Error getting current organization"); + toast("Error getting current organization"); }); }; @@ -1061,7 +1062,7 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user response.json().then((responseJson) => { if (responseJson["success"] === false) { setLoginInfo("Error: " + responseJson.reason); - alert.error("Failed to send email (2). Please try again and contact support if this persists.") + toast("Failed to send email (2). Please try again and contact support if this persists.") } else { setLoginInfo(""); setModalOpen(false); @@ -1069,13 +1070,13 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user getUsers(); }, 1000); - alert.info("Invite sent! They will show up in the list when they have accepted the invite.") + toast("Invite sent! They will show up in the list when they have accepted the invite.") } }) ) .catch((error) => { console.log("Error in userdata: ", error); - alert.error("Failed to send email. Please try again and contact support if this persists.") + toast("Failed to send email. Please try again and contact support if this persists.") }); }; @@ -1117,12 +1118,12 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user // Horrible frontend fix for environments const setDefaultEnvironment = (environment) => { // FIXME - add more checks to this - alert.info("Setting default env to " + environment.name); + toast("Setting default env to " + environment.name); var newEnv = []; for (var key in environments) { if (environments[key].id == environment.id) { if (environments[key].archived) { - alert.error("Can't set archived to default"); + toast("Can't set archived to default"); return; } @@ -1150,7 +1151,7 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user .then((response) => response.json().then((responseJson) => { if (responseJson["success"] === false) { - alert.error(responseJson.reason); + toast(responseJson.reason); setTimeout(() => { getEnvironments(); }, 1500); @@ -1181,7 +1182,7 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user .then((response) => response.json().then((responseJson) => { if (responseJson["success"] === false) { - alert.error(responseJson.reason); + toast(responseJson.reason); getEnvironments(); } else { setLoginInfo(""); @@ -1196,7 +1197,7 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user }; const rerunCloudWorkflows = (environment) => { - alert.info("Starting execution reruns. This can run in the background.") + toast("Starting execution reruns. This can run in the background.") fetch( `${globalUrl}/api/v1/environments/${environment.id}/rerun`, { @@ -1209,8 +1210,8 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user console.log("Status not 200 for apps :O!"); return; } else { - alert.error(response.reason); - //alert.info("Aborted all dangling workflows"); + toast(response.reason); + //toast("Aborted all dangling workflows"); } return response.json(); @@ -1221,7 +1222,7 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user //setFiles(responseJson) }) .catch((error) => { - //alert.error(error.toString()) + //toast(error.toString()) }); }; @@ -1238,10 +1239,10 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user .then((response) => { if (response.status !== 200) { console.log("Status not 200 for apps :O!"); - alert.error("Failed aborting dangling workflows"); + toast("Failed aborting dangling workflows"); return; } else { - alert.info("Aborted all dangling workflows"); + toast("Aborted all dangling workflows"); } return response.json(); @@ -1252,7 +1253,7 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user //setFiles(responseJson) }) .catch((error) => { - //alert.error(error.toString()) + //toast(error.toString()) }); }; @@ -1260,17 +1261,17 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user // FIXME - add some check here ROFL //const name = environment.name - //alert.info("Modifying environment " + name) + //toast("Modifying environment " + name) //var newEnv = [] //for (var key in environments) { // if (environments[key].Name == name) { // if (environments[key].default) { - // alert.error("Can't modify the default environment") + // toast("Can't modify the default environment") // return // } // if (environments[key].type === "cloud" && !environments[key].archived) { - // alert.error("Can't modify cloud environments") + // toast("Can't modify cloud environments") // return // } @@ -1281,17 +1282,17 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user //} const id = environment.id; - //alert.info("Modifying environment " + environment.Name) + //toast("Modifying environment " + environment.Name) var newEnv = []; for (var key in environments) { if (environments[key].id == id) { if (environments[key].default) { - alert.error("Can't modify the default environment"); + toast("Can't modify the default environment"); return; } if (environments[key].type === "cloud" && !environments[key].archived) { - alert.error("Can't modify cloud environments"); + toast("Can't modify cloud environments"); return; } @@ -1314,7 +1315,7 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user .then((response) => response.json().then((responseJson) => { if (responseJson["success"] === false) { - alert.error(responseJson.reason); + toast(responseJson.reason); getEnvironments(); } else { setLoginInfo(""); @@ -1387,7 +1388,7 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user setSchedules(responseJson); }) .catch((error) => { - alert.error(error.toString()); + toast(error.toString()); }); }; @@ -1414,11 +1415,11 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user //console.log(responseJson) setAuthentication(responseJson.data); } else { - alert.error("Failed getting authentications"); + toast("Failed getting authentications"); } }) .catch((error) => { - alert.error(error.toString()); + toast(error.toString()); }); }; @@ -1443,7 +1444,7 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user setEnvironments(responseJson); }) .catch((error) => { - alert.error(error.toString()); + toast(error.toString()); }); }; @@ -1471,7 +1472,7 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user setOrganizations(responseJson); }) .catch((error) => { - alert.error(error.toString()); + toast(error.toString()); }); }; @@ -1497,7 +1498,7 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user setUsers(responseJson); }) .catch((error) => { - alert.error(error.toString()); + toast(error.toString()); }); }; @@ -1672,10 +1673,10 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user }) .then((responseJson) => { if (!responseJson.success && responseJson.reason !== undefined) { - alert.error("Failed setting user: " + responseJson.reason); + toast("Failed setting user: " + responseJson.reason); } else { - //alert.success("Set the user field " + field + " to " + value); - alert.success("Successfully updated user field " + field) + //toast("Set the user field " + field + " to " + value); + toast("Successfully updated user field " + field) if (field !== "suborgs") { setSelectedUserModalOpen(false); @@ -1712,9 +1713,9 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user .then((responseJson) => { console.log("RESP: ", responseJson); if (!responseJson.success && responseJson.reason !== undefined) { - alert.error("Failed getting new: " + responseJson.reason); + toast("Failed getting new: " + responseJson.reason); } else { - alert.success("Got new API key"); + toast("Got new API key"); } }) .catch((error) => { @@ -1808,9 +1809,9 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user } if (error) { - alert.error("All fields must have a new value"); + toast("All fields must have a new value"); } else { - alert.success("Saving new version of this authentication"); + toast("Saving new version of this authentication"); selectedAuthentication.fields = authenticationFields; saveAuthentication(selectedAuthentication); setSelectedAuthentication({}); @@ -1827,7 +1828,7 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user const handleOrgEditChange = (event) => { if (userdata.id === selectedUser.id) { - alert.info("Can't remove orgs from yourself"); + toast("Can't remove orgs from yourself"); return; } @@ -2424,7 +2425,7 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user if (copyText !== null && copyText !== undefined) { 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; } @@ -2438,7 +2439,7 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user /* Copy the text inside the text field */ document.execCommand("copy"); - alert.info(org_id + " copied to clipboard"); + toast(org_id + " copied to clipboard"); } }} > @@ -3115,7 +3116,7 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user ) { const clipboard = navigator.clipboard; if (clipboard === undefined) { - alert.error( + toast( "Can only copy over HTTPS (port 3443)" ); return; @@ -3131,7 +3132,7 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user /* Copy the text inside the text field */ document.execCommand("copy"); - alert.info("Apikey copied to clipboard"); + toast("Apikey copied to clipboard"); } }} > @@ -3786,14 +3787,14 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user } } 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."); }); } @@ -3953,7 +3954,7 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user disabled={environment.Type === "cloud"} onClick={() => { if (environment.Type === "cloud") { - alert.info("No Orborus necessary for environment cloud. Create and use a different environment to run executions on-premises.") + toast("No Orborus necessary for environment cloud. Create and use a different environment to run executions on-premises.") return } @@ -3964,7 +3965,7 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user if (copyText !== null && copyText !== undefined) { 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; } @@ -3978,7 +3979,7 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user /* Copy the text inside the text field */ document.execCommand("copy"); - alert.info("Orborus command copied to clipboard"); + toast("Orborus command copied to clipboard"); } }} > diff --git a/frontend/src/views/AngularWorkflow.jsx b/frontend/src/views/AngularWorkflow.jsx index 5378d297..bc2191aa 100755 --- a/frontend/src/views/AngularWorkflow.jsx +++ b/frontend/src/views/AngularWorkflow.jsx @@ -12,7 +12,8 @@ import { useBeforeunload } from "react-beforeunload"; import ReactJson from "react-json-view"; import { NestedMenuItem } from 'mui-nested-menu'; import ReactMarkdown from "react-markdown"; -import { useAlert } from "react-alert"; +//import { useAlert +import { ToastContainer, toast } from "react-toastify" import { isMobile } from "react-device-detect" import aa from 'search-insights' import Drift from "react-driftjs"; @@ -384,7 +385,7 @@ const searchClient = algoliasearch("JNSS5CFDZZ", "db08e40265e2941b9a7d8f644b6e52 const AngularWorkflow = (defaultprops) => { const { globalUrl, isLoggedIn, isLoaded, userdata, data_id } = defaultprops; const referenceUrl = globalUrl + "/api/v1/hooks/"; - const alert = useAlert() + //const alert = useAlert() let navigate = useNavigate(); const params = useParams(); var props = JSON.parse(JSON.stringify(defaultprops)) @@ -584,9 +585,9 @@ const AngularWorkflow = (defaultprops) => { }) .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(); @@ -604,7 +605,7 @@ const AngularWorkflow = (defaultprops) => { }) .catch((error) => { - alert.error(error.toString()); + toast(error.toString()); }); }; @@ -644,7 +645,7 @@ const AngularWorkflow = (defaultprops) => { setListCache(responseJson); }) .catch((error) => { - alert.error(error.toString()); + toast(error.toString()); }); }; @@ -746,7 +747,7 @@ const AngularWorkflow = (defaultprops) => { } }) .catch((error) => { - //alert.error(error.toString()); + //toast(error.toString()); console.log("Workflow error: ", error.toString()) }); }; @@ -893,17 +894,17 @@ const AngularWorkflow = (defaultprops) => { }) .then((responseJson) => { if (!responseJson.success) { - alert.error("Failed to set app auth: " + responseJson.reason); + toast("Failed to set app auth: " + responseJson.reason); } else { getAppAuthentication(true, false); setAuthenticationModalOpen(false); // 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()); }); }; @@ -992,7 +993,7 @@ const AngularWorkflow = (defaultprops) => { } }) .catch((error) => { - //alert.error(error.toString()); + //toast(error.toString()); console.log("Get execution error: ", error.toString()); }); }; @@ -1046,7 +1047,7 @@ const AngularWorkflow = (defaultprops) => { return response.json(); }) .catch((error) => { - //alert.error(error.toString()); + //toast(error.toString()); console.log("Abort error: ", error.toString()); }); }; @@ -1159,7 +1160,7 @@ const AngularWorkflow = (defaultprops) => { if (!visited.includes(label)) { //if (item.action.result !== undefined && item.action.result !== null && !item.action.result.includes("failed condition")) { - // alert.error("Error for " + item.action.label + " with result " + item.result); + // toast("Error for " + item.action.label + " with result " + item.result); //} visited.push(label); setVisited(visited); @@ -1287,7 +1288,7 @@ const AngularWorkflow = (defaultprops) => { }) .catch((error) => { console.log("Stream send error: ", error.toString()) - //alert.error(error.toString()); + //toast(error.toString()); }) } @@ -1458,7 +1459,7 @@ const AngularWorkflow = (defaultprops) => { newComments.push(curworkflowComment); } else { - alert.info("No handler for type: " + type); + toast("No handler for type: " + type); } } } @@ -1519,9 +1520,9 @@ const AngularWorkflow = (defaultprops) => { if (!responseJson.success) { console.log(responseJson); if (responseJson.reason !== undefined && responseJson.reason !== null) { - alert.error("Failed to save: " + responseJson.reason); + toast("Failed to save: " + responseJson.reason); } else { - alert.error("Failed to save. Please contact your support@shuffler.io or your local admin if this is unexpected.") + toast("Failed to save. Please contact your support@shuffler.io or your local admin if this is unexpected.") } } else { @@ -1570,7 +1571,7 @@ const AngularWorkflow = (defaultprops) => { }) .catch((error) => { setSavingState(0); - //alert.error(error.toString()); + //toast(error.toString()); console.log("Save workflow error: ", error.toString()); }); @@ -1615,12 +1616,12 @@ const AngularWorkflow = (defaultprops) => { } if (workflow.public) { - alert.info("Save it to get a new version"); + toast("Save it to get a new version"); } var returncheck = monitorUpdates(); if (!returncheck) { - alert.error("No startnode set."); + toast("No startnode set."); return; } @@ -1656,7 +1657,7 @@ const AngularWorkflow = (defaultprops) => { }) .then((responseJson) => { if (!responseJson.success) { - alert.error("Failed to start: " + responseJson.reason); + toast("Failed to start: " + responseJson.reason); setExecutionRunning(false); setExecutionRequestStarted(false); stop(); @@ -1676,7 +1677,7 @@ const AngularWorkflow = (defaultprops) => { responseJson.authorization === "" || responseJson.authorization === undefined ) { - alert.error("Something went wrong during execution startup"); + toast("Something went wrong during execution startup"); console.log("BAD RESPONSE FOR EXECUTION: ", responseJson); setExecutionRunning(false); setExecutionRequestStarted(false); @@ -1698,7 +1699,7 @@ const AngularWorkflow = (defaultprops) => { start(); }) .catch((error) => { - //alert.error(error.toString()); + //toast(error.toString()); setExecutionRequestStarted(false) console.log("Execute workflow err: ", error.toString()); }); @@ -1809,16 +1810,16 @@ const AngularWorkflow = (defaultprops) => { setSelectedAction(selectedAction); setWorkflow(workflow); saveWorkflow(workflow); - alert.info("Added and updated authentication!"); + toast("Added and updated authentication!"); shouldClose = true } else { console.log("Closing auth modal? FAIL") - alert.error("Failed to find new authentication. See details in Oauth2 popup window where auth was attempted."); + toast("Failed to find new authentication. See details in Oauth2 popup window where auth was attempted."); shouldClose = false } } else { - alert.info("No authentication to update"); + toast("No authentication to update"); } } else { shouldClose = true @@ -1835,7 +1836,7 @@ const AngularWorkflow = (defaultprops) => { }) .catch((error) => { setAppAuthentication([]); - //alert.error("Auth loading error: " + error.toString()); + //toast("Auth loading error: " + error.toString()); console.log("AppAuth error: " + error.toString()); }); }; @@ -1867,7 +1868,7 @@ const AngularWorkflow = (defaultprops) => { setFilteredApps(pretend_apps) setPrioritizedApps(pretend_apps); - alert.error("Something went wrong while loading apps. Please refresh the window to try again.") + toast("Something went wrong while loading apps. Please refresh the window to try again.") return } @@ -1930,7 +1931,7 @@ const AngularWorkflow = (defaultprops) => { .catch((error) => { console.log("App loading error: " + error.toString()); setAppsLoaded(true) - //alert.error("App loading error: "+error.toString()); + //toast("App loading error: "+error.toString()); }); }; @@ -2008,7 +2009,7 @@ const AngularWorkflow = (defaultprops) => { } }) .catch((error) => { - //alert.error(error.toString()); + //toast(error.toString()); console.log("Error loading files: ", error) }); }; @@ -2027,9 +2028,9 @@ const AngularWorkflow = (defaultprops) => { console.log("Status not 200 for workflows :O!"); if (response.status >= 500) { - alert.info("Something went wrong while loading the workflow. Please reload.") + toast("Something went wrong while loading the workflow. Please reload.") } else { - alert.info("You don't access to this workflow or loading failed.") + toast("You don't access to this workflow or loading failed.") window.location.pathname = "/workflows"; } } @@ -2064,7 +2065,7 @@ const AngularWorkflow = (defaultprops) => { fetchRecommendations(responseJson) if (responseJson.public) { - //alert.info("This workflow is public. Save the workflow to use it in your organization."); + //toast("This workflow is public. Save the workflow to use it in your organization."); setAppAuthentication([]) console.log("RESP: ", responseJson) @@ -2280,7 +2281,7 @@ const AngularWorkflow = (defaultprops) => { } }) .catch((error) => { - //alert.error(error.toString()); + //toast(error.toString()); console.log("Get workflows error: ", error.toString()); }); }; @@ -2411,7 +2412,7 @@ const AngularWorkflow = (defaultprops) => { event.target.data("type") !== "COMMENT" && event.target.data().decorator ) { - alert.info("This edge can't be edited."); + toast("This edge can't be edited."); } else { //console.log("DATA: ", event.target.data()) const destinationId = event.target.data("target"); @@ -2423,7 +2424,7 @@ const AngularWorkflow = (defaultprops) => { curaction.app_name === "Shuffle Tools" && curaction.name === "router" ) { - alert.info("Router action can't have incoming conditions"); + toast("Router action can't have incoming conditions"); event.target.unselect(); return; } @@ -2455,7 +2456,7 @@ const AngularWorkflow = (defaultprops) => { if (nodedata.type === "TRIGGER" && (nodedata.app_name === "Shuffle Workflow" || nodedata.app_name === "User Input")) { if (nodedata.parameters === null) { - alert.error("Set a workflow first"); + toast("Set a workflow first"); return; } @@ -3045,7 +3046,7 @@ const AngularWorkflow = (defaultprops) => { curaction = data } else { if (workflow.public !== true) { - alert.error("Action not found. Please remake it."); + toast("Action not found. Please remake it."); } event.target.remove(); @@ -3103,7 +3104,7 @@ const AngularWorkflow = (defaultprops) => { if (!curapp || curapp === undefined) { console.log("APPS - couldn't find it: ", newapps) - //alert.error(`App ${curaction.app_name}:${curaction.app_version} not found. Is it activated?`); + //toast(`App ${curaction.app_name}:${curaction.app_version} not found. Is it activated?`); const tmpapp = { name: curaction.app_name, @@ -3295,7 +3296,7 @@ const AngularWorkflow = (defaultprops) => { // workflow.actions.push(data) // curaction = data //} else { - // alert.error("Action not found. Please remake it."); + // toast("Action not found. Please remake it."); // event.target.remove(); // return; //} @@ -3329,7 +3330,7 @@ const AngularWorkflow = (defaultprops) => { } else if (data.type === "COMMENT") { setSelectedComment(data); } else { - alert.error("Can't handle node type " + data.type); + toast("Can't handle node type " + data.type); return; } @@ -3383,16 +3384,16 @@ const AngularWorkflow = (defaultprops) => { }) .then((responseJson) => { if (responseJson.success === false) { - alert.error("Failed to auto-activate the app. Go to /apps and activate it.") + toast("Failed to auto-activate the app. Go to /apps and activate it.") } else { if (refresh === true) { - //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.") getApps() } } }) .catch(error => { - //alert.error(error.toString()) + //toast(error.toString()) console.log("Activate app error: ", error.toString()) }); } @@ -3707,7 +3708,7 @@ const AngularWorkflow = (defaultprops) => { event.target.remove() //console.log("Found branch already!") - alert.info("Triggers can have exactly one target node") + toast("Triggers can have exactly one target node") return @@ -3740,7 +3741,7 @@ const AngularWorkflow = (defaultprops) => { workflow.triggers[targetnode].app_name === "Shuffle Workflow" ) { } else { - alert.error("Can't have triggers as target of branch"); + toast("Can't have triggers as target of branch"); event.target.remove(); } } @@ -3793,7 +3794,7 @@ const AngularWorkflow = (defaultprops) => { workflow.branches[branchkey].destination_id === edge.source && workflow.branches[branchkey].source_id === edge.target ) { - alert.error("A branch in the opposite direction already exists"); + toast("A branch in the opposite direction already exists"); event.target.remove(); found = true; break; @@ -3803,7 +3804,7 @@ const AngularWorkflow = (defaultprops) => { ) { console.log(edge.source); - //alert.error("That branch already exists"); + //toast("That branch already exists"); event.target.remove(); found = true; @@ -3814,7 +3815,7 @@ const AngularWorkflow = (defaultprops) => { ); if (targetnode === -1) { if (targetnode.type !== "TRIGGER") { - alert.error("Can't make arrow to starting node"); + toast("Can't make arrow to starting node"); event.target.remove(); break; } @@ -3829,7 +3830,7 @@ const AngularWorkflow = (defaultprops) => { // console.log("Destination: ", edge.target) // console.log("CHECK SOURCE IF ITS A TRIGGER: ", targetnode) // if (targetnode !== -1) { - // alert.error("Triggers can only target one target (startnode)") + // toast("Triggers can only target one target (startnode)") // event.target.remove() // found = true // break @@ -3844,7 +3845,7 @@ const AngularWorkflow = (defaultprops) => { console.log("TARGETNODE: ", targetnode) if (workflow.triggers[targetnode].app_name === "User Input" || workflow.triggers[targetnode].app_name === "Shuffle Workflow") { } else { - alert.error("Can't have triggers as target of branch") + toast("Can't have triggers as target of branch") event.target.remove() found = true break @@ -3937,7 +3938,7 @@ const AngularWorkflow = (defaultprops) => { /* var curaction = workflow.actions.find((a) => a.id === nodedata.id); if (curaction === null || curaction === undefined) { - alert.error("Node not found. Please remake it.") + toast("Node not found. Please remake it.") event.target.remove(); } */ @@ -4016,7 +4017,7 @@ const AngularWorkflow = (defaultprops) => { setWorkflow(workflow); } else if (nodedata.type === "TRIGGER") { if (nodedata.is_valid === false) { - alert.info("This trigger is not available to you"); + toast("This trigger is not available to you"); node.remove(); return; } @@ -4101,7 +4102,7 @@ const AngularWorkflow = (defaultprops) => { data: newdata, }) - alert.error("You must STOP the trigger before deleting its branches") + toast("You must STOP the trigger before deleting its branches") } catch (e) { console.log("Failed re-adding edge: ", e) } @@ -4258,7 +4259,7 @@ const AngularWorkflow = (defaultprops) => { if (copyText !== null && copyText !== undefined) { 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; } @@ -4266,7 +4267,7 @@ const AngularWorkflow = (defaultprops) => { copyText.select(); copyText.setSelectionRange(0, 99999); /* For mobile devices */ document.execCommand("copy"); - alert.success(`Copied ${cydata.length} element(s)`); + toast(`Copied ${cydata.length} element(s)`); } } } @@ -4279,7 +4280,7 @@ const AngularWorkflow = (defaultprops) => { /* const clipboard = navigator.clipboard if (clipboard === undefined || window === undefined || window === null) { - alert.error("Can only use cliboard over HTTPS (port 3443)") + toast("Can only use cliboard over HTTPS (port 3443)") return } @@ -4387,7 +4388,7 @@ const AngularWorkflow = (defaultprops) => { } } catch (e) { console.log("Error pasting: ", e); - //alert.info("Failed parsing clipboard: ", e) + //toast("Failed parsing clipboard: ", e) } }; @@ -4458,7 +4459,7 @@ const AngularWorkflow = (defaultprops) => { } }) .catch((error) => { - //alert.error(error.toString()); + //toast(error.toString()); console.log("Get environments error: ", error.toString()); }); }; @@ -5478,7 +5479,7 @@ const AngularWorkflow = (defaultprops) => { //} const parsedSelection = cy.$(":selected"); if (selectedNode.data().decorator === true && selectedNode.data("type") !== "COMMENT") { - alert.info("This node can't be deleted."); + toast("This node can't be deleted."); } else { console.log("Deleted.") selectedNode.remove(); @@ -5545,7 +5546,7 @@ const AngularWorkflow = (defaultprops) => { } }) .catch((error) => { - //alert.error("ERROR: " + error.toString()); + //toast("ERROR: " + error.toString()); console.log("ERROR getting usecases: " + error.toString()); }) } @@ -5574,7 +5575,7 @@ const AngularWorkflow = (defaultprops) => { } }) .catch((error) => { - //alert.error("ERROR: " + error.toString()); + //toast("ERROR: " + error.toString()); console.log("ERROR getting usecases: " + error.toString()); }) } @@ -5749,7 +5750,7 @@ const AngularWorkflow = (defaultprops) => { console.log("END: ", cy) var cydata = cy.$(":selected").jsons(); if (cydata !== undefined && cydata !== null && cydata.length > 0) { - alert.success(`Selected ${cydata.length} element(s). CTRL+C to copy them.`); + toast(`Selected ${cydata.length} element(s). CTRL+C to copy them.`); } }); @@ -5804,10 +5805,10 @@ const AngularWorkflow = (defaultprops) => { // No matter what, it's being stopped. if (!responseJson.success) { if (responseJson.reason !== undefined) { - alert.error("Failed to stop schedule: " + responseJson.reason); + toast("Failed to stop schedule: " + responseJson.reason); } } else { - alert.success("Successfully stopped schedule"); + toast("Successfully stopped schedule"); } workflow.triggers[triggerindex].status = "stopped"; @@ -5817,14 +5818,14 @@ const AngularWorkflow = (defaultprops) => { saveWorkflow(workflow); }) .catch((error) => { - //alert.error(error.toString()); + //toast(error.toString()); console.log("Stop schedule error: ", error.toString()); }); }; const submitSchedule = (trigger, triggerindex) => { if (trigger.name.length <= 0) { - alert.error("Error: name can't be empty"); + toast("Error: name can't be empty"); return; } @@ -5841,7 +5842,7 @@ const AngularWorkflow = (defaultprops) => { } } - alert.info("Creating schedule") + toast("Creating schedule") const data = { name: trigger.name, frequency: workflow.triggers[triggerindex].parameters[0].value, @@ -5872,9 +5873,9 @@ const AngularWorkflow = (defaultprops) => { }) .then((responseJson) => { if (!responseJson.success) { - alert.error("Failed to set schedule: " + responseJson.reason); + toast("Failed to set schedule: " + responseJson.reason); } else { - alert.success("Successfully created schedule"); + toast("Successfully created schedule"); workflow.triggers[triggerindex].status = "running"; trigger.status = "running"; setSelectedTrigger(trigger); @@ -5884,7 +5885,7 @@ const AngularWorkflow = (defaultprops) => { } }) .catch((error) => { - //alert.error(error.toString()); + //toast(error.toString()); console.log("Get schedule error: ", error.toString()); }); }; @@ -6397,7 +6398,7 @@ const AngularWorkflow = (defaultprops) => { currentnode[0].renderedPosition("y", e.pageY - cycontainer.offsetTop); } else { if (workflow.start === "" || workflow.start === undefined) { - alert.error("Define a starting action first."); + toast("Define a starting action first."); return; } @@ -6602,7 +6603,7 @@ const AngularWorkflow = (defaultprops) => { app.actions === null || app.actions.length === 0 ) { - alert.error( + toast( "App " + app.name + " currently has no actions to perform. Please go to https://shuffler.io/apps to edit it." @@ -7131,13 +7132,13 @@ const AngularWorkflow = (defaultprops) => { return (
{ //if (!isCloud) { - // alert.info("Since this is an on-prem instance. You will need to activate the app yourself. Opening link to download it in a new window.") + // toast("Since this is an on-prem instance. You will need to activate the app yourself. Opening link to download it in a new window.") // setTimeout(() => { // event.preventDefault() // window.open(parsedUrl, '_blank') // }, 2000) //} else { - alert.info(`Activating ${name}`) + toast(`Activating ${name}`) //} console.log("CLICK: ", hit) @@ -7346,7 +7347,7 @@ const AngularWorkflow = (defaultprops) => { ); if (newaction === undefined || newaction === null) { - alert.error("Failed to find the action"); + toast("Failed to find the action"); return; } @@ -7696,7 +7697,7 @@ const AngularWorkflow = (defaultprops) => { // Max 1 folder for office for some reason. MailFolders('MAILBOX_ID') in resource // Can't parse URL with multiple folders. if (selectedTrigger.name === "Office365" & value !== undefined && value !== null && value.length > 1) { - alert.info("Max 1 folder at a time allowed for Office365") + toast("Max 1 folder at a time allowed for Office365") console.log("VALUE: ", value) value = [value[0]] } @@ -8900,7 +8901,7 @@ const AngularWorkflow = (defaultprops) => { (branch) => branch.source_id === selectedTrigger.id ); if (branch === undefined || branch === null) { - alert.error( + toast( "No startnode connected to node. Connect it to an action." ); return; @@ -8996,7 +8997,7 @@ const AngularWorkflow = (defaultprops) => { (branch) => branch.source_id === selectedTrigger.id ); if (branch === undefined || branch === null) { - alert.error( + toast( "No startnode connected to node. Connect it to an action." ); return; @@ -10982,7 +10983,7 @@ const AngularWorkflow = (defaultprops) => { 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; } @@ -10995,7 +10996,7 @@ const AngularWorkflow = (defaultprops) => { /* Copy the text inside the text field */ document.execCommand("copy"); - alert.success("Copied Webhook URL"); + toast("Copied Webhook URL"); } else { console.log("Couldn't find webhook URI field: ", copyText); } @@ -11207,7 +11208,7 @@ const AngularWorkflow = (defaultprops) => { return; } - alert.info("Stopping mail trigger"); + toast("Stopping mail trigger"); const requesttype = triggerAuthentication.type; fetch( `${globalUrl}/api/v1/workflows/${props.match.params.key}/${requesttype}/${trigger.id}`, @@ -11229,7 +11230,7 @@ const AngularWorkflow = (defaultprops) => { }) .then((responseJson) => { if (responseJson.success) { - alert.success("Successfully stopped trigger"); + toast("Successfully stopped trigger"); // Set the status workflow.triggers[triggerindex].status = "stopped"; trigger.status = "stopped"; @@ -11237,11 +11238,11 @@ const AngularWorkflow = (defaultprops) => { setSelectedTrigger(trigger); saveWorkflow(workflow); } else { - alert.error("Failed stopping trigger: " + responseJson.reason); + toast("Failed stopping trigger: " + responseJson.reason); } }) .catch((error) => { - //alert.error(error.toString()); + //toast(error.toString()); console.log("Stop mailsub error: ", error.toString()); }); }; @@ -11263,7 +11264,7 @@ const AngularWorkflow = (defaultprops) => { const item = splitItem[splitkey]; const curfolder = triggerFolders.find((a) => a.displayName === item); if (curfolder === undefined) { - alert.error("Something went wrong with folder selection: " + item); + toast("Something went wrong with folder selection: " + item); return; } @@ -11277,7 +11278,7 @@ const AngularWorkflow = (defaultprops) => { }; const requesttype = triggerAuthentication.type; - alert.info( + toast( "Creating " + requesttype + " subscription with name " + trigger.name ); @@ -11306,9 +11307,9 @@ const AngularWorkflow = (defaultprops) => { }) .then((responseJson) => { if (!responseJson.success) { - alert.error("Failed to start trigger: " + responseJson.reason); + toast("Failed to start trigger: " + responseJson.reason); } else { - alert.success( + toast( "Successfully started folder subscription trigger. Test it by sending yoursend an email" ); @@ -11320,7 +11321,7 @@ const AngularWorkflow = (defaultprops) => { } }) .catch((error) => { - //alert.error(error.toString()); + //toast(error.toString()); console.log("Start mailsub error: ", error.toString()); }); }; @@ -11328,12 +11329,12 @@ const AngularWorkflow = (defaultprops) => { const newWebhook = (trigger) => { const hookname = trigger.label; if (hookname.length === 0) { - alert.error("Missing name"); + toast("Missing name"); return; } if (trigger.id.length !== 36) { - alert.error("Missing id"); + toast("Missing id"); return; } @@ -11343,10 +11344,10 @@ const AngularWorkflow = (defaultprops) => { (branch) => branch.source_id === trigger.id ); if (branch === undefined && (workflow.start === undefined || workflow.start === null || workflow.start.length === 0)) { - alert.error("No webhook node defined"); + toast("No webhook node defined"); } - alert.info("Starting webhook"); + toast("Starting webhook"); if (branch !== undefined) { startNode = branch.destination_id; } @@ -11398,14 +11399,14 @@ const AngularWorkflow = (defaultprops) => { .then((responseJson) => { if (responseJson.success) { // Set the status - alert.success("Successfully started webhook"); + toast("Successfully started webhook"); trigger.status = "running"; setSelectedTrigger(trigger); workflow.triggers[selectedTriggerIndex].status = "running"; setWorkflow(workflow); saveWorkflow(workflow); } else { - alert.error("Failed starting webhook: " + responseJson.reason); + toast("Failed starting webhook: " + responseJson.reason); } }) .catch((error) => { @@ -11444,7 +11445,7 @@ const AngularWorkflow = (defaultprops) => { saveWorkflow(workflow); } else { if (responseJson.reason !== undefined) { - alert.error("Failed stopping webhook: " + responseJson.reason); + toast("Failed stopping webhook: " + responseJson.reason); } } @@ -11453,8 +11454,8 @@ const AngularWorkflow = (defaultprops) => { setSelectedTrigger(trigger); }) .catch((error) => { - //alert.error(error.toString()); - alert.error("Delete webhook error. Contact support or check logs if this persists.") + //toast(error.toString()); + toast("Delete webhook error. Contact support or check logs if this persists.") }); }; @@ -13406,7 +13407,7 @@ const AngularWorkflow = (defaultprops) => { 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; } @@ -13423,7 +13424,7 @@ const AngularWorkflow = (defaultprops) => { document.execCommand("copy"); console.log("COPYING!"); - alert.info("Copied value to clipboard, NOT json path.") + toast("Copied value to clipboard, NOT json path.") } else { console.log("Failed to copy from " + elementName + ": ", copyText); } @@ -13494,7 +13495,7 @@ const AngularWorkflow = (defaultprops) => { 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; } @@ -13505,7 +13506,7 @@ const AngularWorkflow = (defaultprops) => { /* Copy the text inside the text field */ document.execCommand("copy"); console.log("COPYING!"); - alert.info("Copied JSON path to clipboard.") + toast("Copied JSON path to clipboard.") } else { console.log("Couldn't find element ", elementName); } @@ -14875,7 +14876,7 @@ const AngularWorkflow = (defaultprops) => { 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; } @@ -15480,7 +15481,7 @@ const AngularWorkflow = (defaultprops) => { selectedApp.authentication.parameters[paramkey].name ] = "false"; } else { - alert.info( + toast( "Field " + selectedApp.authentication.parameters[paramkey].name + " can't be empty" diff --git a/frontend/src/views/AppCreator.jsx b/frontend/src/views/AppCreator.jsx index cb77cf0e..9b7646bd 100755 --- a/frontend/src/views/AppCreator.jsx +++ b/frontend/src/views/AppCreator.jsx @@ -46,7 +46,8 @@ import { v4 as uuidv4 } from "uuid"; import { Link, useParams } from "react-router-dom"; import YAML from "yaml"; import { MuiChipsInput } from "mui-chips-input"; -import { useAlert } from "react-alert"; +//import { useAlert +import { ToastContainer, toast } from "react-toastify" import words from "shellwords"; import AvatarEditor from "react-avatar-editor"; @@ -350,7 +351,7 @@ const getJsonObject = (properties) => { const AppCreator = (defaultprops) => { const { globalUrl, isLoaded } = defaultprops; const classes = useStyles(); - const alert = useAlert(); + //const alert = useAlert(); const params = useParams(); var props = JSON.parse(JSON.stringify(defaultprops)) @@ -451,7 +452,7 @@ const AppCreator = (defaultprops) => { }) .then((responseJson) => { if (responseJson.success === false) { - alert.error("Failed to get the app"); + toast("Failed to get the app"); setIsAppLoaded(true); window.location.pathname = "/search"; } else { @@ -459,7 +460,7 @@ const AppCreator = (defaultprops) => { } }) .catch((error) => { - alert.error(error.toString()); + toast(error.toString()); }); }; @@ -494,14 +495,14 @@ const AppCreator = (defaultprops) => { .then((responseJson) => { setIsAppLoaded(true); if (!responseJson.success) { - alert.error("Failed to get app config. Do you have access?"); + toast("Failed to get app config. Do you have access?"); } else { parseIncomingOpenapiData(responseJson); } }) .catch((error) => { console.log("Error: ", error.toString()); - alert.error(error.toString()); + toast(error.toString()); }); }; @@ -568,7 +569,7 @@ const AppCreator = (defaultprops) => { } if (data.openapi === null) { - alert.info("Failed to load OpenAPI for app. Please contact support if this persists.") + toast("Failed to load OpenAPI for app. Please contact support if this persists.") setIsAppLoaded(true); return } @@ -600,7 +601,7 @@ const AppCreator = (defaultprops) => { } if (!jsonvalid) { - alert.info("OpenAPI data is invalid."); + toast("OpenAPI data is invalid."); return; } @@ -726,7 +727,7 @@ const AppCreator = (defaultprops) => { for (let [method, methodvalue] of Object.entries(pathvalue)) { if (methodvalue === null) { - alert.info("Skipped method (null)" + method); + toast("Skipped method (null)" + method); continue; } @@ -734,7 +735,7 @@ const AppCreator = (defaultprops) => { // Typical YAML issue if (method !== "parameters") { console.log("Invalid method: ", method, "data: ", methodvalue); - //alert.info("Skipped method (not allowed): " + method); + //toast("Skipped method (not allowed): " + method); } continue; } @@ -1596,7 +1597,7 @@ const AppCreator = (defaultprops) => { setParameterLocation(value.in); if (!apikeySelection.includes(value.in)) { console.log("APIKEY SELECT: ", apikeySelection); - alert.error("Might be error in setting up API key authentication"); + toast("Might be error in setting up API key authentication"); } console.log("PARAM NAME: ", value.name); @@ -1637,7 +1638,7 @@ const AppCreator = (defaultprops) => { optionset = true } else if (value.type === "oauth2" || key === "Oauth2" || key === "Oauth2c" || (key !== undefined && key !== null && key.toLowerCase().includes("oauth2"))) { - //alert.info("Can't handle Oauth2 auth yet.") + //toast("Can't handle Oauth2 auth yet.") setAuthenticationOption("Oauth2"); setAuthenticationRequired(true); optionset = true @@ -1686,7 +1687,7 @@ const AppCreator = (defaultprops) => { const scopekeysplit = scopekey.split("/"); if (scopekeysplit.length < 5) { console.log("Skipping scope: ", scopekey); - alert.info("Skipping scope: " + scopekey); + toast("Skipping scope: " + scopekey); continue; } @@ -1707,7 +1708,7 @@ const AppCreator = (defaultprops) => { ); } } else { - alert.error("Couldn't handle AUTH type: ", key); + toast("Couldn't handle AUTH type: ", key); //newauth.push({ // "name": key, // "type": value.in, @@ -1716,7 +1717,7 @@ const AppCreator = (defaultprops) => { } } } catch (e) { - alert.error("Failed to handle auth") + toast("Failed to handle auth") console.log("Error: ", e) } @@ -1790,7 +1791,7 @@ const AppCreator = (defaultprops) => { //const isCloud = window.location.host === "localhost:3002" || window.location.host === "shuffler.io" if (newActions.length > 1000 && isCloud) { - alert.error("Cut down actions from " + newActions.length + " to 999 because of limit"); + toast("Cut down actions from " + newActions.length + " to 999 because of limit"); newActions = newActions.slice(0, 999); } @@ -1812,7 +1813,7 @@ const AppCreator = (defaultprops) => { // Saving the app that's been configured. // Save SAVE app const submitApp = () => { - alert.info("Uploading and building app " + name); + toast("Uploading and building app " + name); setAppBuilding(true); setErrorCode(""); @@ -1881,7 +1882,7 @@ const AppCreator = (defaultprops) => { for (let actionkey in actions) { var item = JSON.parse(JSON.stringify(actions[actionkey])) if (item.errors.length > 0) { - alert.error("Saving with error in action " + item.name); + toast("Saving with error in action " + item.name); } if (item.name === undefined && item.description !== undefined) { @@ -2107,7 +2108,7 @@ const AppCreator = (defaultprops) => { // Bad code as it doesn't allow for "anything". if (skipped) { - alert.info( + toast( "Bad configuration of " + item.name + ". Skipping because queries are invalid." @@ -2358,7 +2359,7 @@ const AppCreator = (defaultprops) => { if (authenticationOption === "API key") { if (parameterName.length === 0) { - alert.error("A field name for the APIkey must be defined"); + toast("A field name for the APIkey must be defined"); setAppBuilding(false); return; } @@ -2424,7 +2425,7 @@ const AppCreator = (defaultprops) => { const curauth = extraAuth[authkey]; if (curauth.name.toLowerCase() == "url") { - alert.error("Can't add extra auth with Name URL"); + toast("Can't add extra auth with Name URL"); setAppBuilding(false); return; } @@ -2459,10 +2460,10 @@ const AppCreator = (defaultprops) => { if (!responseJson.success) { if (responseJson.reason !== undefined) { setErrorCode(responseJson.reason); - alert.error("Failed to verify: " + responseJson.reason); + toast("Failed to verify: " + responseJson.reason); } } else { - alert.success("Successfully uploaded openapi"); + toast("Successfully uploaded openapi"); if (window.location.pathname.includes("/new")) { if (responseJson.id !== undefined && responseJson.id !== null) { window.location = `/apps/edit/${responseJson.id}`; @@ -2473,7 +2474,7 @@ const AppCreator = (defaultprops) => { .catch((error) => { setAppBuilding(false); setErrorCode(error.toString()); - alert.error(error.toString()); + toast(error.toString()); }); }; @@ -2805,7 +2806,7 @@ const AppCreator = (defaultprops) => { !tmpstring.startsWith("http") && !tmpstring.startsWith("ftp") ) { - alert.error("Auth URL must start with http(s)://"); + toast("Auth URL must start with http(s)://"); } if (tmpstring.includes("?")) { @@ -2854,7 +2855,7 @@ const AppCreator = (defaultprops) => { !tmpstring.startsWith("http") && !tmpstring.startsWith("ftp") ) { - alert.error("Token URL must start with http(s)://"); + toast("Token URL must start with http(s)://"); } if (tmpstring.includes("?")) { @@ -2900,7 +2901,7 @@ const AppCreator = (defaultprops) => { !tmpstring.startsWith("http") && !tmpstring.startsWith("ftp") ) { - alert.error("Refresh URL must start with http(s)://"); + toast("Refresh URL must start with http(s)://"); } if (tmpstring.includes("?")) { @@ -3791,7 +3792,7 @@ const AppCreator = (defaultprops) => { value = keysplit[1].trim() } else { - alert.error("Removed key: ", key) + toast("Removed key: ", key) continue } } @@ -4626,11 +4627,11 @@ const AppCreator = (defaultprops) => { setSelectedAction(selectedAction); } - //alert.error("Failed getting authentications") + //toast("Failed getting authentications") } }) .catch((error) => { - alert.error("Auth loading error: " + error.toString()); + toast("Auth loading error: " + error.toString()); }); }; @@ -4686,17 +4687,17 @@ const AppCreator = (defaultprops) => { }) .then((responseJson) => { if (!responseJson.success) { - alert.error("Failed to set app auth: " + responseJson.reason); + toast("Failed to set app auth: " + responseJson.reason); } else { getAppAuthentication(true); setAuthenticationModalOpen(false); // 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()); }); }; @@ -4747,7 +4748,7 @@ const AppCreator = (defaultprops) => { 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 } @@ -4757,7 +4758,7 @@ const AppCreator = (defaultprops) => { selectedApp.authentication.parameters[key].name ].length === 0 ) { - alert.info( + toast( "Field " + selectedApp.authentication.parameters[key].name + " can't be empty" @@ -5165,7 +5166,7 @@ const AppCreator = (defaultprops) => { setFileBase64(canvasUrl); } } catch (e) { - alert.error("Failed to parse canvasurl!"); + toast("Failed to parse canvasurl!"); } }; @@ -5253,7 +5254,7 @@ const AppCreator = (defaultprops) => { setOpenImageModal(false); setDisableImageUpload(true); } catch (e) { - alert.error("Failed to set image. Replace it if this persists."); + toast("Failed to set image. Replace it if this persists."); } } }; @@ -5468,7 +5469,7 @@ const AppCreator = (defaultprops) => { 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"); setName(e.target.value.replaceAll(".", "").replaceAll("#", "").replaceAll(":", "").replaceAll(",", "")) return; @@ -5476,7 +5477,7 @@ const AppCreator = (defaultprops) => { } if (e.target.value.length > 29) { - alert.error("Choose a shorter name (max 29)."); + toast("Choose a shorter name (max 29)."); setName(e.target.value.slice(0,28)) return; } @@ -5588,7 +5589,7 @@ const AppCreator = (defaultprops) => { !tmpstring.startsWith("http") && !tmpstring.startsWith("ftp") ) { - alert.error("URL must start with http(s)://"); + toast("URL must start with http(s)://"); } if (tmpstring.includes("?")) { diff --git a/frontend/src/views/Apps.jsx b/frontend/src/views/Apps.jsx index dccc81bc..c9ee901c 100755 --- a/frontend/src/views/Apps.jsx +++ b/frontend/src/views/Apps.jsx @@ -59,7 +59,8 @@ import algoliasearch from 'algoliasearch/lite'; import YAML from "yaml"; import { useNavigate, Link, useParams } from "react-router-dom"; -import { useAlert } from "react-alert"; +//import { useAlert +import { ToastContainer, toast } from "react-toastify" import Dropzone from "../components/Dropzone.jsx"; const surfaceColor = "#27292D"; @@ -272,7 +273,7 @@ const Apps = (props) => { //const [workflows, setWorkflows] = React.useState([]); const baseRepository = "https://github.com/frikky/shuffle-apps"; - const alert = useAlert(); + //const alert = useAlert(); let navigate = useNavigate(); const [selectedApp, setSelectedApp] = React.useState({}); @@ -454,7 +455,7 @@ const Apps = (props) => { //}, 5000) }) .catch((error) => { - alert.error(error.toString()); + toast(error.toString()); setIsLoading(false); }); }; @@ -462,7 +463,7 @@ const Apps = (props) => { const downloadApp = (inputdata) => { const id = inputdata.id; - alert.info("Downloading.."); + toast("Downloading.."); fetch(globalUrl + "/api/v1/apps/" + id + "/config", { method: "GET", headers: { @@ -480,7 +481,7 @@ const Apps = (props) => { }) .then((responseJson) => { if (!responseJson.success) { - alert.error("Failed to download file"); + toast("Failed to download file"); } else { console.log(responseJson); const basedata = atob(responseJson.openapi); @@ -538,7 +539,7 @@ const Apps = (props) => { }) .catch((error) => { console.log(error); - alert.error(error.toString()); + toast(error.toString()); }); }; @@ -1152,7 +1153,7 @@ const Apps = (props) => {