Minor fixes EVERYWHERE
This commit is contained in:
@@ -2,7 +2,7 @@ module shuffle
|
||||
|
||||
go 1.22.2
|
||||
|
||||
//replace github.com/shuffle/shuffle-shared => ../../../shuffle-shared
|
||||
replace github.com/shuffle/shuffle-shared => ../../../shuffle-shared
|
||||
|
||||
require (
|
||||
cloud.google.com/go/datastore v1.15.0
|
||||
|
||||
+41
-1
@@ -34,7 +34,7 @@ import RunWorkflow from "./views/RunWorkflow.jsx";
|
||||
import Admin2 from "./views/Admin2.jsx";
|
||||
|
||||
import LoginPage from "./views/LoginPage.jsx";
|
||||
//import LoginPage from "./views/LoginPage.jsx";
|
||||
import LoginPageOld from "./views/LoginPageOld.jsx";
|
||||
|
||||
import SettingsPage from "./views/SettingsPage.jsx";
|
||||
import KeepAlive from "./views/KeepAlive.jsx";
|
||||
@@ -257,6 +257,44 @@ const App = (message, props) => {
|
||||
}
|
||||
/>
|
||||
|
||||
<Route
|
||||
exact
|
||||
path="/login2"
|
||||
element={
|
||||
<LoginPageOld
|
||||
isLoggedIn={isLoggedIn}
|
||||
setIsLoggedIn={setIsLoggedIn}
|
||||
register={false}
|
||||
inregister={false}
|
||||
isLoaded={isLoaded}
|
||||
globalUrl={globalUrl}
|
||||
setCookie={setCookie}
|
||||
cookies={cookies}
|
||||
checkLogin={checkLogin}
|
||||
{...props}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
|
||||
<Route
|
||||
exact
|
||||
path="/loginsetup"
|
||||
element={
|
||||
<LoginPageOld
|
||||
isLoggedIn={isLoggedIn}
|
||||
setIsLoggedIn={setIsLoggedIn}
|
||||
register={false}
|
||||
inregister={false}
|
||||
isLoaded={isLoaded}
|
||||
globalUrl={globalUrl}
|
||||
setCookie={setCookie}
|
||||
cookies={cookies}
|
||||
checkLogin={checkLogin}
|
||||
{...props}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
|
||||
<Route
|
||||
exact
|
||||
path="/register"
|
||||
@@ -376,6 +414,7 @@ const App = (message, props) => {
|
||||
}
|
||||
/>
|
||||
) : null}
|
||||
|
||||
<Route
|
||||
exact
|
||||
path="/AdminSetup"
|
||||
@@ -388,6 +427,7 @@ const App = (message, props) => {
|
||||
/>
|
||||
}
|
||||
/>
|
||||
|
||||
<Route
|
||||
exact
|
||||
path="/detectionframework"
|
||||
|
||||
@@ -87,21 +87,21 @@ const LeftSideBar = ({ userdata, serverside, globalUrl, notifications, }) => {
|
||||
return orgOptions.find((option) => option.name === selectedOrg);
|
||||
}, [selectedOrg, orgOptions]);
|
||||
|
||||
//With this code it is opening search bar on google chrome search bar as well which is not required
|
||||
useEffect(() => {
|
||||
const handleKeyDown = (event) => {
|
||||
if ((event.ctrlKey || event.metaKey) && event.key === "k") {
|
||||
event.preventDefault();
|
||||
setSearchBarModalOpen((prev)=> !prev);
|
||||
}
|
||||
};
|
||||
//With this code it is opening search bar on google chrome search bar as well which is not required
|
||||
useEffect(() => {
|
||||
const handleKeyDown = (event) => {
|
||||
if ((event.ctrlKey || event.metaKey) && event.key === "k") {
|
||||
event.preventDefault();
|
||||
setSearchBarModalOpen((prev)=> !prev);
|
||||
}
|
||||
};
|
||||
|
||||
window.addEventListener("keydown", handleKeyDown);
|
||||
window.addEventListener("keydown", handleKeyDown);
|
||||
|
||||
return () => {
|
||||
window.removeEventListener("keydown", handleKeyDown);
|
||||
};
|
||||
}, [setSearchBarModalOpen]);
|
||||
return () => {
|
||||
window.removeEventListener("keydown", handleKeyDown);
|
||||
};
|
||||
}, [setSearchBarModalOpen]);
|
||||
|
||||
const CustomPopper = (props) => {
|
||||
return (
|
||||
@@ -155,6 +155,7 @@ useEffect(() => {
|
||||
>
|
||||
{props.children}
|
||||
</Box>
|
||||
|
||||
<Link to="/admin?tab=tenants" style={hrefStyle}>
|
||||
<Box
|
||||
sx={{
|
||||
@@ -1605,6 +1606,18 @@ useEffect(() => {
|
||||
marginLeft: 5,
|
||||
}}
|
||||
>
|
||||
|
||||
{expandLeftNav &&
|
||||
<Button
|
||||
variant="outlined"
|
||||
style={{marginBottom: 15, borderWidth: 2, }}
|
||||
onClick={() => {
|
||||
window.open("https://shuffler.io/contact?category=book_a_demo", "_blank")
|
||||
}}
|
||||
>
|
||||
Book a Demo
|
||||
</Button>
|
||||
}
|
||||
<Box ref={autocompleteRef}>
|
||||
<Autocomplete
|
||||
disablePortal
|
||||
@@ -1898,8 +1911,6 @@ useEffect(() => {
|
||||
};
|
||||
|
||||
export default LeftSideBar;
|
||||
|
||||
|
||||
const ModalView = memo(({searchBarModalOpen, setSearchBarModalOpen, globalUrl, serverside, userdata}) => {
|
||||
return (
|
||||
(
|
||||
|
||||
@@ -785,7 +785,7 @@ const TenantsTab = memo((props) => {
|
||||
<div style={{ marginBottom: 20 }}>
|
||||
<h2 style={{ marginBottom: 8, marginTop: 0, color: "#ffffff" }}>Tenants</h2>
|
||||
<span style={{ color: textColor }}>
|
||||
Control sub organizations (tenants)! {" "}
|
||||
Create, manage and change to sub-organizations (tenants)! {" "}
|
||||
{isCloud
|
||||
? "You can only make a sub organization if you are a customer of shuffle or running a POC of the platform. Please contact support@shuffler.io to try it out."
|
||||
: ''}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
/* eslint-disable react/no-multi-comp */
|
||||
import React, { useState } from "react";
|
||||
import { makeStyles } from "@mui/styles";
|
||||
import theme from '../theme.jsx';
|
||||
import { useNavigate } from "react-router-dom";
|
||||
|
||||
import {
|
||||
CircularProgress,
|
||||
@@ -20,11 +22,8 @@ const surfaceColor = "#27292D";
|
||||
const inputColor = "#383B40";
|
||||
|
||||
const boxStyle = {
|
||||
paddingLeft: "30px",
|
||||
paddingRight: "30px",
|
||||
paddingBottom: "30px",
|
||||
paddingTop: "30px",
|
||||
backgroundColor: surfaceColor,
|
||||
padding: 40,
|
||||
backgroundColor: theme.palette.backgroundColor,
|
||||
};
|
||||
|
||||
const useStyles = makeStyles({
|
||||
@@ -41,8 +40,10 @@ const AdminAccount = (props) => {
|
||||
const [firstRequest, setFirstRequest] = useState(true);
|
||||
const [loginLoading, setLoginLoading] = useState(false);
|
||||
|
||||
|
||||
// Used to swap from login to register. True = login, false = register
|
||||
const register = true;
|
||||
let navigate = useNavigate();
|
||||
|
||||
const classes = useStyles();
|
||||
// Error messages etc
|
||||
@@ -70,13 +71,16 @@ const AdminAccount = (props) => {
|
||||
setLoginInfo(responseJson["reason"]);
|
||||
} else {
|
||||
if (responseJson.reason === "redirect") {
|
||||
window.location.pathname = "/login";
|
||||
setTimeout(() => {
|
||||
window.location.pathname = "/login";
|
||||
}, 2500)
|
||||
}
|
||||
}
|
||||
})
|
||||
)
|
||||
.catch((error) => {
|
||||
setLoginInfo("Error in userdata: ", error);
|
||||
setLoginInfo("Error in userdata (1): ", error);
|
||||
navigate("/loginsetup")
|
||||
});
|
||||
};
|
||||
|
||||
@@ -108,13 +112,17 @@ const AdminAccount = (props) => {
|
||||
setLoginInfo(responseJson["reason"]);
|
||||
} else {
|
||||
setLoginInfo("Successful register :)");
|
||||
window.location.pathname = "/login";
|
||||
|
||||
setTimeout(() => {
|
||||
window.location.pathname = "/login";
|
||||
}, 2500)
|
||||
}
|
||||
})
|
||||
)
|
||||
.catch((error) => {
|
||||
setLoginLoading(false);
|
||||
setLoginInfo("Error in userdata: ", error);
|
||||
setLoginInfo("Error in userdata (2): ", error);
|
||||
setLoginLoading(false)
|
||||
navigate("/loginsetup")
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -2540,18 +2540,21 @@ const AngularWorkflow = (defaultprops) => {
|
||||
}
|
||||
*/
|
||||
|
||||
// FIXME: What is this?
|
||||
if (cy !== undefined && cy !== null) {
|
||||
// scale: 0.3,
|
||||
// bg: "#27292d",
|
||||
const cyImageData = cy.png({
|
||||
output: "base64uri",
|
||||
maxWidth: 480,
|
||||
maxHeight: 270,
|
||||
})
|
||||
if (cy.png !== undefined && cy.png !== null) {
|
||||
const cyImageData = cy.png({
|
||||
output: "base64uri",
|
||||
maxWidth: 480,
|
||||
maxHeight: 270,
|
||||
})
|
||||
|
||||
if (cyImageData !== undefined && cyImageData !== null && cyImageData.length > 0) {
|
||||
useworkflow.image = cyImageData
|
||||
}
|
||||
if (cyImageData !== undefined && cyImageData !== null && cyImageData.length > 0) {
|
||||
useworkflow.image = cyImageData
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (useworkflow.id === undefined || useworkflow.id === null || useworkflow.id.length === 0) {
|
||||
@@ -9785,9 +9788,14 @@ const AngularWorkflow = (defaultprops) => {
|
||||
toast("Successfully stopped schedule");
|
||||
}
|
||||
|
||||
workflow.triggers[triggerindex].status = "stopped";
|
||||
trigger.status = "stopped";
|
||||
setSelectedTrigger(trigger);
|
||||
if (triggerindex !== undefined && triggerindex !== null && triggerindex >= 0) {
|
||||
workflow.triggers[triggerindex].status = "stopped";
|
||||
}
|
||||
|
||||
//trigger.status = "stopped";
|
||||
//console.log("TRIGGER: ", trigger)
|
||||
//setSelectedTrigger(trigger);
|
||||
|
||||
setWorkflow(workflow);
|
||||
saveWorkflow(workflow)
|
||||
|
||||
@@ -14637,20 +14645,19 @@ const AngularWorkflow = (defaultprops) => {
|
||||
cy.add(cybranch);
|
||||
}
|
||||
|
||||
console.log("Value to be set: ", e.target.value);
|
||||
try {
|
||||
workflow.triggers[
|
||||
selectedTriggerIndex
|
||||
].parameters[3].value = e.target.value.id;
|
||||
} catch {
|
||||
workflow.triggers[selectedTriggerIndex].parameters[3] =
|
||||
{
|
||||
name: "startnode",
|
||||
value: e.target.value.id,
|
||||
};
|
||||
workflow.triggers[selectedTriggerIndex].parameters[3].value = e.target.value.id
|
||||
} catch(e) {
|
||||
console.log("Error: ", e)
|
||||
workflow.triggers[selectedTriggerIndex].parameters[3] =
|
||||
{
|
||||
name: "startnode",
|
||||
value: e.target.value.id,
|
||||
};
|
||||
}
|
||||
|
||||
setWorkflow(workflow);
|
||||
setWorkflow(workflow)
|
||||
setUpdate(Math.random())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15035,7 +15042,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
<Tooltip arrow placement="left" title={
|
||||
<span style={{}}>
|
||||
{data.image !== undefined && data.image !== null && data.image.length > 0 ?
|
||||
<img src={data.image} alt={data.name} style={{ backgroundColor: theme.palette.surfaceColor, maxHeight: 200, minHeigth: 200, borderRadius: theme.palette?.borderRadius, }} />
|
||||
<img src={data.image} alt={data.name} style={{ backgroundColor: theme.palette.surfaceColor, maxHeight: 200, minHeigth: 200, maxWidth: 285, borderRadius: theme.palette?.borderRadius, }} />
|
||||
: null}
|
||||
<Typography>
|
||||
Choose Subflow '{data.name}'
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
/* eslint-disable react/no-multi-comp */
|
||||
import React, { useState } from 'react';
|
||||
import React, { useState, useEffect, } from 'react';
|
||||
import { makeStyles } from '@mui/styles';
|
||||
import { useNavigate, Link, useParams } from "react-router-dom";
|
||||
import { isMobile } from "react-device-detect";
|
||||
import { toast } from 'react-toastify';
|
||||
import { useInterval } from "react-powerhooks";
|
||||
|
||||
|
||||
import {
|
||||
@@ -259,7 +260,7 @@ const MarketplaceCard = ({ classes }) => {
|
||||
target="_blank"
|
||||
style={{ color: "rgba(255, 132, 68, 1)", textDecoration: "underline" }}
|
||||
>
|
||||
Read more about self hosting
|
||||
Learn more about self hosting
|
||||
</a>
|
||||
</div >
|
||||
|
||||
@@ -269,7 +270,7 @@ const MarketplaceCard = ({ classes }) => {
|
||||
|
||||
|
||||
const LoginPage = props => {
|
||||
const { globalUrl, isLoaded, isLoggedIn, setIsLoggedIn, setCookie, inregister, serverside } = props;
|
||||
const { globalUrl, isLoaded, isLoggedIn, setIsLoggedIn, setCookie, inregister, serverside, checkLogin, } = props;
|
||||
let navigate = useNavigate();
|
||||
const [username, setUsername] = useState("");
|
||||
const [password, setPassword] = useState("");
|
||||
@@ -284,6 +285,21 @@ const LoginPage = props => {
|
||||
|
||||
const isCloud = window.location.host === "localhost:3002" || window.location.host === "shuffler.io" || window.location.host === "migration.shuffler.io";
|
||||
const parsedsearch = serverside === true ? "" : window.location.search
|
||||
|
||||
useEffect(() => {
|
||||
if (!isCloud) {
|
||||
checkAdmin()
|
||||
}
|
||||
}, [])
|
||||
|
||||
const { start, stop } = useInterval({
|
||||
duration: 3000,
|
||||
startImmediate: false,
|
||||
callback: () => {
|
||||
checkAdmin()
|
||||
},
|
||||
})
|
||||
|
||||
if (serverside !== true) {
|
||||
const tmpMessage = new URLSearchParams(window.location.search).get("message")
|
||||
if (tmpMessage !== undefined && tmpMessage !== null && message !== tmpMessage) {
|
||||
@@ -409,6 +425,38 @@ const LoginPage = props => {
|
||||
window.location.pathname = "/workflows"
|
||||
}
|
||||
|
||||
const checkAdmin = () => {
|
||||
const url = globalUrl + "/api/v1/checkusers";
|
||||
fetch(url, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
})
|
||||
.then((response) =>
|
||||
response.json().then((responseJson) => {
|
||||
if (responseJson["success"] === false) {
|
||||
setLoginInfo(responseJson["reason"]);
|
||||
} else {
|
||||
|
||||
// Stay = 0 users
|
||||
// Redirect = >1 user
|
||||
if (responseJson.reason === "stay") {
|
||||
setTimeout(() => {
|
||||
navigate("/adminsetup")
|
||||
}, 2500)
|
||||
}
|
||||
}
|
||||
})
|
||||
)
|
||||
.catch((error) => {
|
||||
setTimeout(() => {
|
||||
navigate("/adminsetup")
|
||||
}, 2500)
|
||||
})
|
||||
};
|
||||
|
||||
|
||||
const onSubmit = (e) => {
|
||||
//toast("Testing from login page")
|
||||
|
||||
@@ -629,12 +677,13 @@ const LoginPage = props => {
|
||||
width: "max-content",
|
||||
}}
|
||||
>
|
||||
<form onSubmit={onSubmit} style={{ margin: 15, width: isMobile ? "100%" : "360px", width: "max-content", overflow: "hidden" }}>
|
||||
<form onSubmit={onSubmit} style={{ margin: 15, width: isMobile ? "100%" : "360px", width: "max-content", overflow: "hidden", textAlign: "center", }}>
|
||||
<img
|
||||
style={{
|
||||
height: 44,
|
||||
width: isMobile ? "100%" : 44,
|
||||
paddingBottom: isMobile ? null : 40
|
||||
minHeight: 40,
|
||||
minWidth: isMobile ? "100%" : 40,
|
||||
paddingBottom: isMobile ? null : 35,
|
||||
|
||||
}}
|
||||
src="images/logos/orange_logo.svg"
|
||||
alt="Shuffle Logo"
|
||||
@@ -667,12 +716,12 @@ const LoginPage = props => {
|
||||
variant="body2"
|
||||
>
|
||||
{register
|
||||
? "Find new ways to automate by discovering usecases made by Shufflers"
|
||||
? "Find new ways to automate by discovering usecases Shufflers"
|
||||
: "Please fill in the information to continue to discover the power of Shuffle"
|
||||
}
|
||||
</Typography>
|
||||
|
||||
<div style={{ marginBottom: 20 }}>
|
||||
<div style={{ marginBottom: 20, textAlign: "left", }}>
|
||||
<div style={{ marginBottom: 5 }}>{isCloud ? "Email" : "Username"}</div>
|
||||
<TextField
|
||||
color="primary"
|
||||
@@ -704,7 +753,7 @@ const LoginPage = props => {
|
||||
</div>
|
||||
|
||||
{!loginWithSSO && (
|
||||
<div style={{ marginBottom: 20 }}>
|
||||
<div style={{ marginBottom: 20, textAlign: "left", }}>
|
||||
<div style={{ marginBottom: 5 }}>Password</div>
|
||||
<TextField
|
||||
color="primary"
|
||||
@@ -781,14 +830,9 @@ const LoginPage = props => {
|
||||
flexDirection: "column",
|
||||
marginTop: "0px"
|
||||
}}>
|
||||
{register && !loginWithSSO && (
|
||||
{isCloud && register && !loginWithSSO && (
|
||||
<Link
|
||||
to={`/passwordreset${parsedsearch}`}
|
||||
onChange={() => {
|
||||
if (!isCloud) {
|
||||
toast.warn("Talk to your administrator")
|
||||
}
|
||||
}}
|
||||
style={{
|
||||
...hrefStyle,
|
||||
alignSelf: isMobile ? "center" : "flex-end"
|
||||
|
||||
@@ -58,9 +58,9 @@ const LoginDialog = (props) => {
|
||||
|
||||
// Used to swap from login to register. True = login, false = register
|
||||
|
||||
useEffect(() => {
|
||||
checkAdmin()
|
||||
}, [loginViewLoading])
|
||||
useEffect(() => {
|
||||
checkAdmin()
|
||||
}, [loginViewLoading])
|
||||
|
||||
// Error messages etc
|
||||
const [loginInfo, setLoginInfo] = useState("");
|
||||
@@ -91,6 +91,8 @@ const LoginDialog = (props) => {
|
||||
if (responseJson.sso_url !== undefined && responseJson.sso_url !== null) {
|
||||
setSSOUrl(responseJson.sso_url);
|
||||
}
|
||||
|
||||
navigate("/login")
|
||||
|
||||
if (loginViewLoading) {
|
||||
setLoginViewLoading(false);
|
||||
@@ -125,7 +127,7 @@ const LoginDialog = (props) => {
|
||||
callback: () => {
|
||||
checkAdmin();
|
||||
},
|
||||
});
|
||||
})
|
||||
|
||||
if (firstRequest) {
|
||||
setFirstRequest(false);
|
||||
@@ -294,7 +296,7 @@ const LoginDialog = (props) => {
|
||||
style={{ marginBottom: 20, color: "white" }}
|
||||
>
|
||||
Waiting for the Shuffle database to become available. This may
|
||||
take up to a minute.
|
||||
take up to two minutes.
|
||||
</Typography>
|
||||
|
||||
{loginInfo === undefined ||
|
||||
|
||||
Reference in New Issue
Block a user