Revert "Launch"

This commit is contained in:
Frikky
2021-11-14 23:36:13 +01:00
committed by GitHub
parent e7b3480e6c
commit 220f7308b6
63 changed files with 31323 additions and 42417 deletions
-1
View File
@@ -1,5 +1,4 @@
# Certificate: # Certificate:
Creating a localhost certificate: Creating a localhost certificate:
``` ```
-1
View File
@@ -93,7 +93,6 @@
"not op_mini all" "not op_mini all"
], ],
"devDependencies": { "devDependencies": {
"prettier": "2.4.1",
"promise-window": "^1.2.1" "promise-window": "^1.2.1"
} }
} }
+6 -8
View File
@@ -1,15 +1,13 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8">
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" /> <link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
<meta <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
name="viewport" <meta name="theme-color" content="#000000">
content="width=device-width, initial-scale=1, shrink-to-fit=no" <link rel="manifest" href="%PUBLIC_URL%/manifest.json">
/>
<meta name="theme-color" content="#000000" />
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<title>Shuffle</title> <title>Shuffle</title>
</head> </head>
<body> <body>
<div id="root"></div> <div id="root"></div>
+218 -535
View File
@@ -1,9 +1,9 @@
import React, { useState, useEffect } from "react"; import React, { useState, useEffect } from 'react';
import { Route } from "react-router"; import { Route } from 'react-router';
import { BrowserRouter } from "react-router-dom"; import { BrowserRouter } from 'react-router-dom';
import { CookiesProvider } from "react-cookie"; import { CookiesProvider } from 'react-cookie';
import { removeCookies, useCookies } from "react-cookie"; import { removeCookies, useCookies } from 'react-cookie';
import EditSchedule from "./views/EditSchedule"; import EditSchedule from "./views/EditSchedule";
import Schedules from "./views/Schedules"; import Schedules from "./views/Schedules";
@@ -12,10 +12,10 @@ import Workflows from "./views/Workflows";
import EditWebhook from "./views/EditWebhook"; import EditWebhook from "./views/EditWebhook";
import AngularWorkflow from "./views/AngularWorkflow"; import AngularWorkflow from "./views/AngularWorkflow";
import Header from "./components/Header"; import Header from './components/Header';
import theme from "./theme"; import theme from './theme'
import Apps from "./views/Apps"; import Apps from './views/Apps';
import AppCreator from "./views/AppCreator"; import AppCreator from './views/AppCreator';
import Dashboard from "./views/Dashboard"; import Dashboard from "./views/Dashboard";
import AdminSetup from "./views/AdminSetup"; import AdminSetup from "./views/AdminSetup";
@@ -31,559 +31,242 @@ import SettingsPage from "./views/SettingsPage";
import MyView from "./views/MyView"; import MyView from "./views/MyView";
import { createMuiTheme, MuiThemeProvider } from "@material-ui/core/styles"; import { createMuiTheme, MuiThemeProvider } from '@material-ui/core/styles';
import ScrollToTop from "./components/ScrollToTop"; import ScrollToTop from "./components/ScrollToTop";
import AlertTemplate from "./components/AlertTemplate"; import AlertTemplate from "./components/AlertTemplate";
import { positions, Provider } from "react-alert"; import { positions, Provider } from "react-alert";
import { isMobile } from "react-device-detect"; import {isMobile} from "react-device-detect";
import detectEthereumProvider from "@metamask/detect-provider"; import detectEthereumProvider from '@metamask/detect-provider';
// Production - backend proxy forwarding in nginx // Production - backend proxy forwarding in nginx
var globalUrl = window.location.origin; var globalUrl = window.location.origin
// CORS used for testing purposes. Should only happen with specific port and http // CORS used for testing purposes. Should only happen with specific port and http
if (window.location.port === "3000") { if ( window.location.port === "3000") {
globalUrl = "http://localhost:5001"; globalUrl = "http://localhost:5001"
//globalUrl = "http://localhost:5002" //globalUrl = "http://localhost:5002"
} }
const App = (message, props) => { const App = (message, props) => {
const [userdata, setUserData] = useState({}); const [userdata, setUserData] = useState({});
const [notifications, setNotifications] = useState([]); const [notifications, setNotifications] = useState([])
const [cookies, setCookie, removeCookie] = useCookies([]); const [cookies, setCookie, removeCookie] = useCookies([])
const [isLoggedIn, setIsLoggedIn] = useState(false); const [isLoggedIn, setIsLoggedIn] = useState(false);
const [dataset, setDataset] = useState(false); const [dataset, setDataset] = useState(false);
const [isLoaded, setIsLoaded] = useState(false); const [isLoaded, setIsLoaded] = useState(false);
const [curpath, setCurpath] = useState( const [curpath, setCurpath] = useState(typeof window === 'undefined' || window.location === undefined ? "" : window.location.pathname)
typeof window === "undefined" || window.location === undefined
? ""
: window.location.pathname
);
useEffect(() => { useEffect(() => {
if (dataset === false) { if (dataset === false) {
getUserNotifications(); getUserNotifications()
checkLogin(); checkLogin()
setDataset(true); setDataset(true)
} }
}); })
if ( if (isLoaded && !isLoggedIn && (!window.location.pathname.startsWith("/login") && (!window.location.pathname.startsWith("/docs") && (!window.location.pathname.startsWith("/adminsetup"))))) {
isLoaded && window.location = "/login"
!isLoggedIn && }
!window.location.pathname.startsWith("/login") &&
!window.location.pathname.startsWith("/docs") &&
!window.location.pathname.startsWith("/adminsetup")
) {
window.location = "/login";
}
const getUserNotifications = () => { const getUserNotifications = () => {
fetch(`${globalUrl}/api/v1/notifications`, { fetch(`${globalUrl}/api/v1/notifications`, {
credentials: "include", credentials: "include",
headers: { headers: {
"Content-Type": "application/json", 'Content-Type': 'application/json',
}, },
}) })
.then((response) => response.json()) .then(response => response.json())
.then((responseJson) => { .then(responseJson => {
if ( if (responseJson.success === true && responseJson.notifications !== null && responseJson.notifications !== undefined && responseJson.notifications.length > 0) {
responseJson.success === true && //console.log("RESP: ", responseJson)
responseJson.notifications !== null && setNotifications(responseJson.notifications)
responseJson.notifications !== undefined && }
responseJson.notifications.length > 0 })
) { .catch(error => {
//console.log("RESP: ", responseJson) console.log("Failed getting notifications for user: ", error)
setNotifications(responseJson.notifications); });
} }
})
.catch((error) => {
console.log("Failed getting notifications for user: ", error);
});
};
const checkLogin = () => { const checkLogin = () => {
var baseurl = globalUrl; var baseurl = globalUrl
fetch(baseurl + "/api/v1/users/getinfo", { fetch(baseurl + "/api/v1/users/getinfo", {
credentials: "include", credentials: "include",
headers: { headers: {
"Content-Type": "application/json", 'Content-Type': 'application/json',
}, },
}) })
.then((response) => response.json()) .then(response => response.json())
.then((responseJson) => { .then(responseJson => {
var userInfo = {}; var userInfo = {}
if (responseJson.success === true) { if (responseJson.success === true) {
console.log(responseJson); console.log(responseJson)
userInfo = responseJson; userInfo = responseJson
setIsLoggedIn(true); setIsLoggedIn(true)
//console.log("Cookies: ", cookies) //console.log("Cookies: ", cookies)
// Updating cookie every request // Updating cookie every request
for (var key in responseJson["cookies"]) { for (var key in responseJson["cookies"]) {
setCookie( setCookie(responseJson["cookies"][key].key, responseJson["cookies"][key].value, { path: "/" })
responseJson["cookies"][key].key, }
responseJson["cookies"][key].value, }
{ path: "/" }
);
}
}
// Handling Ethereum update // Handling Ethereum update
detectEthereumProvider().then((provider) => { detectEthereumProvider()
if ( .then((provider) => {
provider && if (provider && userInfo.eth_info !== undefined && userInfo.eth_info !== null) {
userInfo.eth_info !== undefined && if (userInfo.eth_info.account !== undefined && userInfo.eth_info.account !== null && userInfo.eth_info.account.length === 0) {
userInfo.eth_info !== null userInfo.eth_info = {}
) { var method = "eth_requestAccounts"
if ( var params = []
userInfo.eth_info.account !== undefined && provider.request({
userInfo.eth_info.account !== null && method: method,
userInfo.eth_info.account.length === 0 params,
) { })
userInfo.eth_info = {}; .then((result) => {
var method = "eth_requestAccounts"; if (result !== undefined && result !== null && result.length > 0) {
var params = []; userInfo.eth_info.account = result[0]
provider
.request({
method: method,
params,
})
.then((result) => {
if (
result !== undefined &&
result !== null &&
result.length > 0
) {
userInfo.eth_info.account = result[0];
// Getting and setting balance for the current user // Getting and setting balance for the current user
method = "eth_getBalance"; method = "eth_getBalance"
params = [userInfo.eth_info.account, "latest"]; params = [
provider userInfo.eth_info.account,
.request({ "latest"
method: method, ]
params, provider.request({
}) method: method,
.then((result) => { params,
if ( })
result !== undefined && .then((result) => {
result !== null && if (result !== undefined && result !== null && result.length > 0) {
result.length > 0 userInfo.parsed_balance = result/1000000000000000000
) { } else {
userInfo.parsed_balance = alert.error("Couldn't find balance: ", result)
result / 1000000000000000000; }
} else { // The result varies by RPC method.
alert.error("Couldn't find balance: ", result); // For example, this method will return a transaction hash hexadecimal string on success.
} })
// The result varies by RPC method. .catch((error) => {
// For example, this method will return a transaction hash hexadecimal string on success. // If the request fails, the Promise will reject with an error.
}) alert.error("Failed getting info from ethereum API: "+error)
.catch((error) => { })
// If the request fails, the Promise will reject with an error. } else {
alert.error( alert.error("Couldn't find any user: ", result)
"Failed getting info from ethereum API: " + error }
); })
}); .catch((error) => {
} else { // If the request fails, the Promise will reject with an error.
alert.error("Couldn't find any user: ", result); alert.error("Failed getting info from ethereum API: "+error)
} })
}) }
.catch((error) => {
// If the request fails, the Promise will reject with an error. // Register hooks here
alert.error( provider.on('message', (event) => {
"Failed getting info from ethereum API: " + error alert.info("Message from MetaMask: ", event)
); })
});
}
// Register hooks here provider.on('chainChanged', (chainId) => {
provider.on("message", (event) => { console.log("Changed chain to: ", chainId)
alert.info("Message from MetaMask: ", event);
}); method = "eth_getBalance"
params = [
userInfo.eth_info.account,
"latest"
]
provider.request({
method: method,
params,
})
.then((result) => {
console.log("Got result: ", result)
if (result !== undefined && result !== null) {
userInfo.eth_info.balance = result
userInfo.eth_info.parsed_balance = result/1000000000000000000
console.log("INFO: ", userInfo)
setUserData(userInfo)
} else {
alert.error("Couldn't find balance: ", result)
}
})
.catch((error) => {
// If the request fails, the Promise will reject with an error.
alert.error("Failed getting info from ethereum API: "+error)
})
})
}
})
provider.on("chainChanged", (chainId) => { if (userInfo.eth_info !== undefined && userInfo.eth_info.balance !== undefined) {
console.log("Changed chain to: ", chainId); //console.log(userInfo.eth_info.balance)
userInfo.eth_info.parsed_balance = userInfo.eth_info.balance/1000000000000000000
}
method = "eth_getBalance"; //console.log("USER: ", userInfo)
params = [userInfo.eth_info.account, "latest"]; setUserData(userInfo)
provider setIsLoaded(true)
.request({
method: method,
params,
})
.then((result) => {
console.log("Got result: ", result);
if (result !== undefined && result !== null) {
userInfo.eth_info.balance = result;
userInfo.eth_info.parsed_balance =
result / 1000000000000000000;
console.log("INFO: ", userInfo);
setUserData(userInfo);
} else {
alert.error("Couldn't find balance: ", result);
}
})
.catch((error) => {
// If the request fails, the Promise will reject with an error.
alert.error(
"Failed getting info from ethereum API: " + error
);
});
});
}
});
if ( })
userInfo.eth_info !== undefined && .catch(error => {
userInfo.eth_info.balance !== undefined setIsLoaded(true)
) { });
//console.log(userInfo.eth_info.balance) }
userInfo.eth_info.parsed_balance =
userInfo.eth_info.balance / 1000000000000000000;
}
//console.log("USER: ", userInfo) // Dumb for content load (per now), but good for making the site not suddenly reload parts (ajax thingies)
setUserData(userInfo);
setIsLoaded(true);
})
.catch((error) => {
setIsLoaded(true);
});
};
// Dumb for content load (per now), but good for making the site not suddenly reload parts (ajax thingies) const options = {
timeout: 9000,
position: positions.BOTTOM_LEFT,
};
const options = { const includedData = window.location.pathname === "/home" || window.location.pathname === "/features" ?
timeout: 9000, <div>
position: positions.BOTTOM_LEFT, <Route exact path="/home" render={props => <LandingPageNew isLoaded={isLoaded} {...props} />} />
}; </div> :
<div style={{ backgroundColor: "#1F2023", color: "rgba(255, 255, 255, 0.65)", minHeight: "100vh" }}>
<ScrollToTop getUserNotifications={getUserNotifications} setCurpath={setCurpath} />
<Header notifications={notifications} setNotifications={setNotifications} checkLogin={checkLogin} cookies={cookies} removeCookie={removeCookie} isLoaded={isLoaded} globalUrl={globalUrl} setIsLoggedIn={setIsLoggedIn} isLoggedIn={isLoggedIn} userdata={userdata} {...props} />
<div style={{height: 60}}/>
<Route exact path="/login" render={props => <LoginPage isLoggedIn={isLoggedIn} setIsLoggedIn={setIsLoggedIn} register={true} isLoaded={isLoaded} globalUrl={globalUrl} setCookie={setCookie} cookies={cookies} checkLogin={checkLogin} {...props} />} />
<Route exact path="/admin" render={props => <Admin userdata={userdata} isLoggedIn={isLoggedIn} setIsLoggedIn={setIsLoggedIn} register={true} isLoaded={isLoaded} globalUrl={globalUrl} setCookie={setCookie} cookies={cookies} {...props} />} />
<Route exact path="/admin/:key" render={props => <Admin isLoggedIn={isLoggedIn} setIsLoggedIn={setIsLoggedIn} register={true} isLoaded={isLoaded} globalUrl={globalUrl} setCookie={setCookie} cookies={cookies} {...props} />} />
{userdata.id !== undefined ?
<Route exact path="/settings" render={props => <SettingsPage isLoaded={isLoaded} setUserData={setUserData} userdata={userdata} globalUrl={globalUrl} {...props} />} />
: null}
<Route exact path="/AdminSetup" render={props => <AdminSetup isLoaded={isLoaded} userdata={userdata} globalUrl={globalUrl} {...props} />} />
<Route exact path="/webhooks" render={props => <Webhooks isLoaded={isLoaded} globalUrl={globalUrl} {...props} />} />
<Route exact path="/webhooks/:key" render={props => <EditWebhook isLoaded={isLoaded} globalUrl={globalUrl} {...props} />} />
<Route exact path="/schedules" render={props => <Schedules globalUrl={globalUrl} {...props} />} />
<Route exact path="/dashboard" render={props => <Dashboard isLoaded={isLoaded} isLoggedIn={isLoggedIn} globalUrl={globalUrl} {...props} />} />
<Route exact path="/apps/new" render={props => <AppCreator isLoaded={isLoaded} isLoggedIn={isLoggedIn} globalUrl={globalUrl} {...props} />} />
<Route exact path="/apps" render={props => <Apps isLoaded={isLoaded} isLoggedIn={isLoggedIn} globalUrl={globalUrl} userdata={userdata} {...props} />} />
<Route exact path="/apps/edit/:appid" render={props => <AppCreator isLoaded={isLoaded} isLoggedIn={isLoggedIn} globalUrl={globalUrl} {...props} />} />
<Route exact path="/schedules/:key" render={props => <EditSchedule globalUrl={globalUrl} {...props} />} />
<Route exact path="/workflows" render={props => <Workflows cookies={cookies} removeCookie={removeCookie} isLoaded={isLoaded} isLoggedIn={isLoggedIn} globalUrl={globalUrl} cookies={cookies} userdata={userdata} {...props} />} />
<Route exact path="/workflows/:key" render={props => <AngularWorkflow userdata={userdata} globalUrl={globalUrl} isLoaded={isLoaded} isLoggedIn={isLoggedIn} {...props} />} />
<Route exact path="/docs/:key" render={props => <Docs isMobile={isMobile} isLoaded={isLoaded} globalUrl={globalUrl} {...props} />} />
<Route exact path="/docs" render={props => { window.location.pathname = "/docs/about" }} />
<Route exact path="/introduction" render={props => <Introduction isLoaded={isLoaded} globalUrl={globalUrl} {...props} />} />
<Route exact path="/introduction/:key" render={props => <Introduction isLoaded={isLoaded} globalUrl={globalUrl} {...props} />} />
<Route exact path="/set_authentication" render={props => <SetAuthentication userdata={userdata} isLoggedIn={isLoggedIn} setIsLoggedIn={setIsLoggedIn} register={true} isLoaded={isLoaded} globalUrl={globalUrl} setCookie={setCookie} cookies={cookies} {...props} />} />
<Route exact path="/login_sso" render={props => <SetAuthenticationSSO userdata={userdata} isLoggedIn={isLoggedIn} setIsLoggedIn={setIsLoggedIn} register={true} isLoaded={isLoaded} globalUrl={globalUrl} setCookie={setCookie} cookies={cookies} {...props} />} />
<Route exact path="/" render={props => <LoginPage isLoggedIn={isLoggedIn} setIsLoggedIn={setIsLoggedIn} register={true} isLoaded={isLoaded} globalUrl={globalUrl} setCookie={setCookie} cookies={cookies} {...props} />} />
</div>
const includedData = // <div style={{backgroundColor: "rgba(21, 32, 43, 1)", color: "#fffff", minHeight: "100vh"}}>
window.location.pathname === "/home" || // backgroundColor: "#213243",
window.location.pathname === "/features" ? ( // This is a mess hahahah
<div> return (
<Route <MuiThemeProvider theme={theme}>
exact <CookiesProvider>
path="/home" <BrowserRouter>
render={(props) => <LandingPageNew isLoaded={isLoaded} {...props} />} <Provider template={AlertTemplate} {...options}>
/> {includedData}
</div> </Provider>
) : ( </BrowserRouter>
<div </CookiesProvider>
style={{ </MuiThemeProvider>
backgroundColor: "#1F2023", );
color: "rgba(255, 255, 255, 0.65)",
minHeight: "100vh",
}}
>
<ScrollToTop
getUserNotifications={getUserNotifications}
setCurpath={setCurpath}
/>
<Header
notifications={notifications}
setNotifications={setNotifications}
checkLogin={checkLogin}
cookies={cookies}
removeCookie={removeCookie}
isLoaded={isLoaded}
globalUrl={globalUrl}
setIsLoggedIn={setIsLoggedIn}
isLoggedIn={isLoggedIn}
userdata={userdata}
{...props}
/>
<div style={{ height: 60 }} />
<Route
exact
path="/login"
render={(props) => (
<LoginPage
isLoggedIn={isLoggedIn}
setIsLoggedIn={setIsLoggedIn}
register={true}
isLoaded={isLoaded}
globalUrl={globalUrl}
setCookie={setCookie}
cookies={cookies}
checkLogin={checkLogin}
{...props}
/>
)}
/>
<Route
exact
path="/admin"
render={(props) => (
<Admin
userdata={userdata}
isLoggedIn={isLoggedIn}
setIsLoggedIn={setIsLoggedIn}
register={true}
isLoaded={isLoaded}
globalUrl={globalUrl}
setCookie={setCookie}
cookies={cookies}
{...props}
/>
)}
/>
<Route
exact
path="/admin/:key"
render={(props) => (
<Admin
isLoggedIn={isLoggedIn}
setIsLoggedIn={setIsLoggedIn}
register={true}
isLoaded={isLoaded}
globalUrl={globalUrl}
setCookie={setCookie}
cookies={cookies}
{...props}
/>
)}
/>
{userdata.id !== undefined ? (
<Route
exact
path="/settings"
render={(props) => (
<SettingsPage
isLoaded={isLoaded}
setUserData={setUserData}
userdata={userdata}
globalUrl={globalUrl}
{...props}
/>
)}
/>
) : null}
<Route
exact
path="/AdminSetup"
render={(props) => (
<AdminSetup
isLoaded={isLoaded}
userdata={userdata}
globalUrl={globalUrl}
{...props}
/>
)}
/>
<Route
exact
path="/webhooks"
render={(props) => (
<Webhooks isLoaded={isLoaded} globalUrl={globalUrl} {...props} />
)}
/>
<Route
exact
path="/webhooks/:key"
render={(props) => (
<EditWebhook isLoaded={isLoaded} globalUrl={globalUrl} {...props} />
)}
/>
<Route
exact
path="/schedules"
render={(props) => <Schedules globalUrl={globalUrl} {...props} />}
/>
<Route
exact
path="/dashboard"
render={(props) => (
<Dashboard
isLoaded={isLoaded}
isLoggedIn={isLoggedIn}
globalUrl={globalUrl}
{...props}
/>
)}
/>
<Route
exact
path="/apps/new"
render={(props) => (
<AppCreator
isLoaded={isLoaded}
isLoggedIn={isLoggedIn}
globalUrl={globalUrl}
{...props}
/>
)}
/>
<Route
exact
path="/apps"
render={(props) => (
<Apps
isLoaded={isLoaded}
isLoggedIn={isLoggedIn}
globalUrl={globalUrl}
userdata={userdata}
{...props}
/>
)}
/>
<Route
exact
path="/apps/edit/:appid"
render={(props) => (
<AppCreator
isLoaded={isLoaded}
isLoggedIn={isLoggedIn}
globalUrl={globalUrl}
{...props}
/>
)}
/>
<Route
exact
path="/schedules/:key"
render={(props) => <EditSchedule globalUrl={globalUrl} {...props} />}
/>
<Route
exact
path="/workflows"
render={(props) => (
<Workflows
cookies={cookies}
removeCookie={removeCookie}
isLoaded={isLoaded}
isLoggedIn={isLoggedIn}
globalUrl={globalUrl}
cookies={cookies}
userdata={userdata}
{...props}
/>
)}
/>
<Route
exact
path="/workflows/:key"
render={(props) => (
<AngularWorkflow
userdata={userdata}
globalUrl={globalUrl}
isLoaded={isLoaded}
isLoggedIn={isLoggedIn}
{...props}
/>
)}
/>
<Route
exact
path="/docs/:key"
render={(props) => (
<Docs
isMobile={isMobile}
isLoaded={isLoaded}
globalUrl={globalUrl}
{...props}
/>
)}
/>
<Route
exact
path="/docs"
render={(props) => {
window.location.pathname = "/docs/about";
}}
/>
<Route
exact
path="/introduction"
render={(props) => (
<Introduction
isLoaded={isLoaded}
globalUrl={globalUrl}
{...props}
/>
)}
/>
<Route
exact
path="/introduction/:key"
render={(props) => (
<Introduction
isLoaded={isLoaded}
globalUrl={globalUrl}
{...props}
/>
)}
/>
<Route
exact
path="/set_authentication"
render={(props) => (
<SetAuthentication
userdata={userdata}
isLoggedIn={isLoggedIn}
setIsLoggedIn={setIsLoggedIn}
register={true}
isLoaded={isLoaded}
globalUrl={globalUrl}
setCookie={setCookie}
cookies={cookies}
{...props}
/>
)}
/>
<Route
exact
path="/login_sso"
render={(props) => (
<SetAuthenticationSSO
userdata={userdata}
isLoggedIn={isLoggedIn}
setIsLoggedIn={setIsLoggedIn}
register={true}
isLoaded={isLoaded}
globalUrl={globalUrl}
setCookie={setCookie}
cookies={cookies}
{...props}
/>
)}
/>
<Route
exact
path="/"
render={(props) => (
<LoginPage
isLoggedIn={isLoggedIn}
setIsLoggedIn={setIsLoggedIn}
register={true}
isLoaded={isLoaded}
globalUrl={globalUrl}
setCookie={setCookie}
cookies={cookies}
{...props}
/>
)}
/>
</div>
);
// <div style={{backgroundColor: "rgba(21, 32, 43, 1)", color: "#fffff", minHeight: "100vh"}}>
// backgroundColor: "#213243",
// This is a mess hahahah
return (
<MuiThemeProvider theme={theme}>
<CookiesProvider>
<BrowserRouter>
<Provider template={AlertTemplate} {...options}>
{includedData}
</Provider>
</BrowserRouter>
</CookiesProvider>
</MuiThemeProvider>
);
}; };
export default App; export default App;
File diff suppressed because one or more lines are too long
+2 -5
View File
@@ -1,6 +1,3 @@
const data = [ const data = [{"name": "cloud", "type": "cloud"}, {"name": "onprem", "type": "onprem"}]
{ name: "cloud", type: "cloud" },
{ name: "onprem", type: "onprem" },
];
export default data; export default data;
+26 -25
View File
@@ -1,29 +1,30 @@
const Data = { const Data = {
src: { "src": {
name: "Get Tickets", "name": "Get Tickets",
description: "Get tickets", "description": "Get tickets",
outputparameters: [ "outputparameters": [{
{ "name": "SymptomDescription",
name: "SymptomDescription", "schema": {"type": "string"}},
schema: { type: "string" }, {"name": "DetailedDescription",
}, "schema": {"type": "string"}},
{ name: "DetailedDescription", schema: { type: "string" } }, {"name": "EventSource",
{ name: "EventSource", schema: { type: "string" } }, "schema": {"type": "string"}
], }]
}, },
dst: { "dst": {
name: "Create alert", "name": "Create alert",
description: "Create alert in TheHive", "description": "Create alert in TheHive",
inputparameters: [ "inputparameters": [{
{ "name": "title",
name: "title", "required": true,
required: true, "schema": {"type": "string"}},
schema: { type: "string" }, {"name": "description",
}, "required": true,
{ name: "description", required: true, schema: { type: "string" } }, "schema": {"type": "string"}},
{ name: "source", required: true, schema: { type: "string" } }, {"name": "source",
], "required": true,
}, "schema": {"type": "string"}
}]}
}; };
export default Data; export default Data;
+12 -12
View File
@@ -1,15 +1,15 @@
const data = { const data = {
id: "8ccf0bec1fde018771ab685d2a40bd52", "id":"8ccf0bec1fde018771ab685d2a40bd52",
info: { "info":{
url: "", "url":"",
name: "testing", "name":"testing",
description: "wut", "description":"wut"
}, },
transforms: {}, "transforms":{},
actions: {}, "actions": {},
type: "webhook", "type":"webhook",
status: "uninitialized", "status":"uninitialized",
running: false, "running":false
}; }
export default data; export default data;
+2 -168
View File
@@ -1,169 +1,3 @@
const data = { const data = {"actions":[{"app_name":"hello_world","app_version":"1.0.0","errors":null,"id":"70574332-da82-cf17-c723-75fa7b8493c2","is_valid":true,"label":"hello_world","environment":"onprem","name":"hello_world","parameters":null,"position":{"x":353.7438792397648,"y":260.6717930890377},"priority":0},{"app_name":"hello_world","app_version":"1.0.0","errors":null,"id":"30522433-56ed-53c3-575d-766e282e1d3e","is_valid":true,"label":"random_number","environment":"cloud","name":"random_number","parameters":null,"position":{"x":458.30040774503794,"y":104.27580103487651},"priority":0},{"app_name":"hello_world","app_version":"1.0.0","errors":null,"id":"5b7ac5b5-9514-02b9-ebe0-998c0843b104","is_valid":false,"label":"hello_world_2","environment":"onprem","name":"hello_world","parameters":null,"position":{"x":414.7256019053981,"y":-140.46450482659628},"priority":0},{"app_name":"hello_world","app_version":"1.0.0","errors":null,"id":"7e6e7a19-4636-cebc-91c4-052a3769a18b","is_valid":true,"label":"hello_world_3","environment":"cloud","name":"hello_world","parameters":null,"position":{"x":83.59752786243806,"y":50.232317715020734},"priority":0},{"app_name":"hello_world","app_version":"1.0.0","errors":null,"id":"edbf927d-5a00-2405-28ed-47982cdf5110","is_valid":true,"label":"hello_world_4","environment":"cloud","name":"hello_world","parameters":null,"position":{"x":-147.30681300186404,"y":89.16690830150289},"priority":0},{"app_name":"hello_world","app_version":"1.0.0","errors":null,"id":"4844a855-1e2b-669d-fc72-5f398321ac5d","is_valid":false,"label":"hello_world_5","environment":"onprem","name":"hello_world","parameters":null,"position":{"x":130.24982593523967,"y":233.8325632286361},"priority":0},{"app_name":"hello_world","app_version":"1.0.0","errors":null,"id":"6d1d3f8a-1ac9-3db4-0e0f-2fe32e9d3c09","is_valid":true,"label":"hello_world_6","environment":"cloud","name":"hello_world","parameters":null,"position":{"x":83.551088005629,"y":-105.15867327274223},"priority":0},{"app_name":"hello_world","app_version":"1.0.0","errors":null,"id":"469d8c2b-52ac-e397-9a29-becccd04aed8","is_valid":true,"label":"hello_world_7","environment":"cloud","name":"hello_world","parameters":null,"position":{"x":314.4987657226086,"y":10.167183586257954},"priority":0}],"branches":[{"destination_id":"30522433-56ed-53c3-575d-766e282e1d3e","id":"4bcb9795-94e6-7d5f-2074-0d5b27784e0b","source_id":"70574332-da82-cf17-c723-75fa7b8493c2"},{"destination_id":"5b7ac5b5-9514-02b9-ebe0-998c0843b104","id":"fe0ab8e4-a535-61cd-3c09-8fd3d8e40769","source_id":"30522433-56ed-53c3-575d-766e282e1d3e"},{"destination_id":"469d8c2b-52ac-e397-9a29-becccd04aed8","id":"8b9ee9bc-b0ab-0bb6-af61-46d4594b2663","source_id":"30522433-56ed-53c3-575d-766e282e1d3e"},{"destination_id":"6d1d3f8a-1ac9-3db4-0e0f-2fe32e9d3c09","id":"c204d5ef-9cc1-d906-9988-86a624c57783","source_id":"469d8c2b-52ac-e397-9a29-becccd04aed8"},{"destination_id":"6d1d3f8a-1ac9-3db4-0e0f-2fe32e9d3c09","id":"1ffb3934-60ec-8f80-5cee-3ddc0a37fdb6","source_id":"5b7ac5b5-9514-02b9-ebe0-998c0843b104"},{"destination_id":"edbf927d-5a00-2405-28ed-47982cdf5110","id":"9c7fb048-9d0d-cb84-9ba0-be729af9b4d1","source_id":"6d1d3f8a-1ac9-3db4-0e0f-2fe32e9d3c09"},{"destination_id":"edbf927d-5a00-2405-28ed-47982cdf5110","id":"e3ab104e-fc8b-3af5-8daa-bfa57bcf9690","source_id":"7e6e7a19-4636-cebc-91c4-052a3769a18b"},{"destination_id":"7e6e7a19-4636-cebc-91c4-052a3769a18b","id":"b6626081-22dd-3af3-b899-480f60d886ca","source_id":"30522433-56ed-53c3-575d-766e282e1d3e"},{"destination_id":"4844a855-1e2b-669d-fc72-5f398321ac5d","id":"4275cf97-0447-bbda-0c80-ab20d389de1a","source_id":"edbf927d-5a00-2405-28ed-47982cdf5110"}],"conditions":[],"triggers":[],"transforms":[],"description":"asd","id":"2f299808-0f1b-4ae0-97fc-ac17483dfcf7","id":"2f299808-0f1b-4ae0-97fc-ac17483dfcf7","is_valid":true,"name":"test2","start":"70574332-da82-cf17-c723-75fa7b8493c2","owner":{"username":"","id":"","orgs":""},"execution_org":{"name":"","org":"","users":null,"id":""},"workflow_variables":null}
actions: [
{
app_name: "hello_world",
app_version: "1.0.0",
errors: null,
id: "70574332-da82-cf17-c723-75fa7b8493c2",
is_valid: true,
label: "hello_world",
environment: "onprem",
name: "hello_world",
parameters: null,
position: { x: 353.7438792397648, y: 260.6717930890377 },
priority: 0,
},
{
app_name: "hello_world",
app_version: "1.0.0",
errors: null,
id: "30522433-56ed-53c3-575d-766e282e1d3e",
is_valid: true,
label: "random_number",
environment: "cloud",
name: "random_number",
parameters: null,
position: { x: 458.30040774503794, y: 104.27580103487651 },
priority: 0,
},
{
app_name: "hello_world",
app_version: "1.0.0",
errors: null,
id: "5b7ac5b5-9514-02b9-ebe0-998c0843b104",
is_valid: false,
label: "hello_world_2",
environment: "onprem",
name: "hello_world",
parameters: null,
position: { x: 414.7256019053981, y: -140.46450482659628 },
priority: 0,
},
{
app_name: "hello_world",
app_version: "1.0.0",
errors: null,
id: "7e6e7a19-4636-cebc-91c4-052a3769a18b",
is_valid: true,
label: "hello_world_3",
environment: "cloud",
name: "hello_world",
parameters: null,
position: { x: 83.59752786243806, y: 50.232317715020734 },
priority: 0,
},
{
app_name: "hello_world",
app_version: "1.0.0",
errors: null,
id: "edbf927d-5a00-2405-28ed-47982cdf5110",
is_valid: true,
label: "hello_world_4",
environment: "cloud",
name: "hello_world",
parameters: null,
position: { x: -147.30681300186404, y: 89.16690830150289 },
priority: 0,
},
{
app_name: "hello_world",
app_version: "1.0.0",
errors: null,
id: "4844a855-1e2b-669d-fc72-5f398321ac5d",
is_valid: false,
label: "hello_world_5",
environment: "onprem",
name: "hello_world",
parameters: null,
position: { x: 130.24982593523967, y: 233.8325632286361 },
priority: 0,
},
{
app_name: "hello_world",
app_version: "1.0.0",
errors: null,
id: "6d1d3f8a-1ac9-3db4-0e0f-2fe32e9d3c09",
is_valid: true,
label: "hello_world_6",
environment: "cloud",
name: "hello_world",
parameters: null,
position: { x: 83.551088005629, y: -105.15867327274223 },
priority: 0,
},
{
app_name: "hello_world",
app_version: "1.0.0",
errors: null,
id: "469d8c2b-52ac-e397-9a29-becccd04aed8",
is_valid: true,
label: "hello_world_7",
environment: "cloud",
name: "hello_world",
parameters: null,
position: { x: 314.4987657226086, y: 10.167183586257954 },
priority: 0,
},
],
branches: [
{
destination_id: "30522433-56ed-53c3-575d-766e282e1d3e",
id: "4bcb9795-94e6-7d5f-2074-0d5b27784e0b",
source_id: "70574332-da82-cf17-c723-75fa7b8493c2",
},
{
destination_id: "5b7ac5b5-9514-02b9-ebe0-998c0843b104",
id: "fe0ab8e4-a535-61cd-3c09-8fd3d8e40769",
source_id: "30522433-56ed-53c3-575d-766e282e1d3e",
},
{
destination_id: "469d8c2b-52ac-e397-9a29-becccd04aed8",
id: "8b9ee9bc-b0ab-0bb6-af61-46d4594b2663",
source_id: "30522433-56ed-53c3-575d-766e282e1d3e",
},
{
destination_id: "6d1d3f8a-1ac9-3db4-0e0f-2fe32e9d3c09",
id: "c204d5ef-9cc1-d906-9988-86a624c57783",
source_id: "469d8c2b-52ac-e397-9a29-becccd04aed8",
},
{
destination_id: "6d1d3f8a-1ac9-3db4-0e0f-2fe32e9d3c09",
id: "1ffb3934-60ec-8f80-5cee-3ddc0a37fdb6",
source_id: "5b7ac5b5-9514-02b9-ebe0-998c0843b104",
},
{
destination_id: "edbf927d-5a00-2405-28ed-47982cdf5110",
id: "9c7fb048-9d0d-cb84-9ba0-be729af9b4d1",
source_id: "6d1d3f8a-1ac9-3db4-0e0f-2fe32e9d3c09",
},
{
destination_id: "edbf927d-5a00-2405-28ed-47982cdf5110",
id: "e3ab104e-fc8b-3af5-8daa-bfa57bcf9690",
source_id: "7e6e7a19-4636-cebc-91c4-052a3769a18b",
},
{
destination_id: "7e6e7a19-4636-cebc-91c4-052a3769a18b",
id: "b6626081-22dd-3af3-b899-480f60d886ca",
source_id: "30522433-56ed-53c3-575d-766e282e1d3e",
},
{
destination_id: "4844a855-1e2b-669d-fc72-5f398321ac5d",
id: "4275cf97-0447-bbda-0c80-ab20d389de1a",
source_id: "edbf927d-5a00-2405-28ed-47982cdf5110",
},
],
conditions: [],
triggers: [],
transforms: [],
description: "asd",
id: "2f299808-0f1b-4ae0-97fc-ac17483dfcf7",
id: "2f299808-0f1b-4ae0-97fc-ac17483dfcf7",
is_valid: true,
name: "test2",
start: "70574332-da82-cf17-c723-75fa7b8493c2",
owner: { username: "", id: "", orgs: "" },
execution_org: { name: "", org: "", users: null, id: "" },
workflow_variables: null,
};
export default data; export default data;
+68 -68
View File
@@ -23,7 +23,7 @@
let chart1_2_options = { let chart1_2_options = {
maintainAspectRatio: false, maintainAspectRatio: false,
legend: { legend: {
display: false, display: false
}, },
tooltips: { tooltips: {
backgroundColor: "#f5f5f5", backgroundColor: "#f5f5f5",
@@ -33,7 +33,7 @@ let chart1_2_options = {
xPadding: 12, xPadding: 12,
mode: "nearest", mode: "nearest",
intersect: 0, intersect: 0,
position: "nearest", position: "nearest"
}, },
responsive: true, responsive: true,
scales: { scales: {
@@ -43,15 +43,15 @@ let chart1_2_options = {
gridLines: { gridLines: {
drawBorder: false, drawBorder: false,
color: "rgba(29,140,248,0.0)", color: "rgba(29,140,248,0.0)",
zeroLineColor: "transparent", zeroLineColor: "transparent"
}, },
ticks: { ticks: {
suggestedMin: 60, suggestedMin: 60,
suggestedMax: 125, suggestedMax: 125,
padding: 20, padding: 20,
fontColor: "#9a9a9a", fontColor: "#9a9a9a"
}, }
}, }
], ],
xAxes: [ xAxes: [
{ {
@@ -59,22 +59,22 @@ let chart1_2_options = {
gridLines: { gridLines: {
drawBorder: false, drawBorder: false,
color: "rgba(29,140,248,0.1)", color: "rgba(29,140,248,0.1)",
zeroLineColor: "transparent", zeroLineColor: "transparent"
}, },
ticks: { ticks: {
padding: 20, padding: 20,
fontColor: "#9a9a9a", fontColor: "#9a9a9a"
}, }
}, }
], ]
}, }
}; };
// ######################################### // #########################################
// // // used inside src/views/Dashboard.js // // // used inside src/views/Dashboard.js
// ######################################### // #########################################
let chartExample1 = { let chartExample1 = {
data1: (canvas) => { data1: canvas => {
let ctx = canvas.getContext("2d"); let ctx = canvas.getContext("2d");
let gradientStroke = ctx.createLinearGradient(0, 230, 0, 50); let gradientStroke = ctx.createLinearGradient(0, 230, 0, 50);
@@ -96,7 +96,7 @@ let chartExample1 = {
"SEP", "SEP",
"OCT", "OCT",
"NOV", "NOV",
"DEC", "DEC"
], ],
datasets: [ datasets: [
{ {
@@ -114,12 +114,12 @@ let chartExample1 = {
pointHoverRadius: 4, pointHoverRadius: 4,
pointHoverBorderWidth: 15, pointHoverBorderWidth: 15,
pointRadius: 4, pointRadius: 4,
data: [100, 70, 90, 70, 85, 60, 75, 60, 90, 80, 110, 100], data: [100, 70, 90, 70, 85, 60, 75, 60, 90, 80, 110, 100]
}, }
], ]
}; };
}, },
data2: (canvas) => { data2: canvas => {
let ctx = canvas.getContext("2d"); let ctx = canvas.getContext("2d");
let gradientStroke = ctx.createLinearGradient(0, 230, 0, 50); let gradientStroke = ctx.createLinearGradient(0, 230, 0, 50);
@@ -141,7 +141,7 @@ let chartExample1 = {
"SEP", "SEP",
"OCT", "OCT",
"NOV", "NOV",
"DEC", "DEC"
], ],
datasets: [ datasets: [
{ {
@@ -159,12 +159,12 @@ let chartExample1 = {
pointHoverRadius: 4, pointHoverRadius: 4,
pointHoverBorderWidth: 15, pointHoverBorderWidth: 15,
pointRadius: 4, pointRadius: 4,
data: [80, 120, 105, 110, 95, 105, 90, 100, 80, 95, 70, 120], data: [80, 120, 105, 110, 95, 105, 90, 100, 80, 95, 70, 120]
}, }
], ]
}; };
}, },
data3: (canvas) => { data3: canvas => {
let ctx = canvas.getContext("2d"); let ctx = canvas.getContext("2d");
let gradientStroke = ctx.createLinearGradient(0, 230, 0, 50); let gradientStroke = ctx.createLinearGradient(0, 230, 0, 50);
@@ -186,7 +186,7 @@ let chartExample1 = {
"SEP", "SEP",
"OCT", "OCT",
"NOV", "NOV",
"DEC", "DEC"
], ],
datasets: [ datasets: [
{ {
@@ -204,19 +204,19 @@ let chartExample1 = {
pointHoverRadius: 4, pointHoverRadius: 4,
pointHoverBorderWidth: 15, pointHoverBorderWidth: 15,
pointRadius: 4, pointRadius: 4,
data: [60, 80, 65, 130, 80, 105, 90, 130, 70, 115, 60, 130], data: [60, 80, 65, 130, 80, 105, 90, 130, 70, 115, 60, 130]
}, }
], ]
}; };
}, },
options: chart1_2_options, options: chart1_2_options
}; };
// ######################################### // #########################################
// // // used inside src/views/Dashboard.js // // // used inside src/views/Dashboard.js
// ######################################### // #########################################
let chartExample2 = { let chartExample2 = {
data: (canvas) => { data: canvas => {
let ctx = canvas.getContext("2d"); let ctx = canvas.getContext("2d");
let gradientStroke = ctx.createLinearGradient(0, 230, 0, 50); let gradientStroke = ctx.createLinearGradient(0, 230, 0, 50);
@@ -243,19 +243,19 @@ let chartExample2 = {
pointHoverRadius: 4, pointHoverRadius: 4,
pointHoverBorderWidth: 15, pointHoverBorderWidth: 15,
pointRadius: 4, pointRadius: 4,
data: [80, 100, 70, 80, 120, 80], data: [80, 100, 70, 80, 120, 80]
}, }
], ]
}; };
}, },
options: chart1_2_options, options: chart1_2_options
}; };
// ######################################### // #########################################
// // // used inside src/views/Dashboard.js // // // used inside src/views/Dashboard.js
// ######################################### // #########################################
let chartExample3 = { let chartExample3 = {
data: (canvas) => { data: canvas => {
let ctx = canvas.getContext("2d"); let ctx = canvas.getContext("2d");
let gradientStroke = ctx.createLinearGradient(0, 230, 0, 50); let gradientStroke = ctx.createLinearGradient(0, 230, 0, 50);
@@ -276,15 +276,15 @@ let chartExample3 = {
borderWidth: 2, borderWidth: 2,
borderDash: [], borderDash: [],
borderDashOffset: 0.0, borderDashOffset: 0.0,
data: [53, 20, 10, 80, 100, 45], data: [53, 20, 10, 80, 100, 45]
}, }
], ]
}; };
}, },
options: { options: {
maintainAspectRatio: false, maintainAspectRatio: false,
legend: { legend: {
display: false, display: false
}, },
tooltips: { tooltips: {
backgroundColor: "#f5f5f5", backgroundColor: "#f5f5f5",
@@ -294,7 +294,7 @@ let chartExample3 = {
xPadding: 12, xPadding: 12,
mode: "nearest", mode: "nearest",
intersect: 0, intersect: 0,
position: "nearest", position: "nearest"
}, },
responsive: true, responsive: true,
scales: { scales: {
@@ -303,38 +303,38 @@ let chartExample3 = {
gridLines: { gridLines: {
drawBorder: false, drawBorder: false,
color: "rgba(225,78,202,0.1)", color: "rgba(225,78,202,0.1)",
zeroLineColor: "transparent", zeroLineColor: "transparent"
}, },
ticks: { ticks: {
suggestedMin: 60, suggestedMin: 60,
suggestedMax: 120, suggestedMax: 120,
padding: 20, padding: 20,
fontColor: "#9e9e9e", fontColor: "#9e9e9e"
}, }
}, }
], ],
xAxes: [ xAxes: [
{ {
gridLines: { gridLines: {
drawBorder: false, drawBorder: false,
color: "rgba(225,78,202,0.1)", color: "rgba(225,78,202,0.1)",
zeroLineColor: "transparent", zeroLineColor: "transparent"
}, },
ticks: { ticks: {
padding: 20, padding: 20,
fontColor: "#9e9e9e", fontColor: "#9e9e9e"
}, }
}, }
], ]
}, }
}, }
}; };
// ######################################### // #########################################
// // // used inside src/views/Dashboard.js // // // used inside src/views/Dashboard.js
// ######################################### // #########################################
const chartExample4 = { const chartExample4 = {
data: (canvas) => { data: canvas => {
let ctx = canvas.getContext("2d"); let ctx = canvas.getContext("2d");
let gradientStroke = ctx.createLinearGradient(0, 230, 0, 50); let gradientStroke = ctx.createLinearGradient(0, 230, 0, 50);
@@ -361,15 +361,15 @@ const chartExample4 = {
pointHoverRadius: 4, pointHoverRadius: 4,
pointHoverBorderWidth: 15, pointHoverBorderWidth: 15,
pointRadius: 4, pointRadius: 4,
data: [90, 27, 60, 12, 80], data: [90, 27, 60, 12, 80]
}, }
], ]
}; };
}, },
options: { options: {
maintainAspectRatio: false, maintainAspectRatio: false,
legend: { legend: {
display: false, display: false
}, },
tooltips: { tooltips: {
@@ -380,7 +380,7 @@ const chartExample4 = {
xPadding: 12, xPadding: 12,
mode: "nearest", mode: "nearest",
intersect: 0, intersect: 0,
position: "nearest", position: "nearest"
}, },
responsive: true, responsive: true,
scales: { scales: {
@@ -390,15 +390,15 @@ const chartExample4 = {
gridLines: { gridLines: {
drawBorder: false, drawBorder: false,
color: "rgba(29,140,248,0.0)", color: "rgba(29,140,248,0.0)",
zeroLineColor: "transparent", zeroLineColor: "transparent"
}, },
ticks: { ticks: {
suggestedMin: 50, suggestedMin: 50,
suggestedMax: 125, suggestedMax: 125,
padding: 20, padding: 20,
fontColor: "#9e9e9e", fontColor: "#9e9e9e"
}, }
}, }
], ],
xAxes: [ xAxes: [
@@ -407,21 +407,21 @@ const chartExample4 = {
gridLines: { gridLines: {
drawBorder: false, drawBorder: false,
color: "rgba(0,242,195,0.1)", color: "rgba(0,242,195,0.1)",
zeroLineColor: "transparent", zeroLineColor: "transparent"
}, },
ticks: { ticks: {
padding: 20, padding: 20,
fontColor: "#9e9e9e", fontColor: "#9e9e9e"
}, }
}, }
], ]
}, }
}, }
}; };
module.exports = { module.exports = {
chartExample1, // in src/views/Dashboard.js chartExample1, // in src/views/Dashboard.js
chartExample2, // in src/views/Dashboard.js chartExample2, // in src/views/Dashboard.js
chartExample3, // in src/views/Dashboard.js chartExample3, // in src/views/Dashboard.js
chartExample4, // in src/views/Dashboard.js chartExample4 // in src/views/Dashboard.js
}; };
+20 -13
View File
@@ -1,19 +1,26 @@
import React, { useEffect } from "react"; import React, { useEffect} from 'react';
const Popup = (props) => { const Popup = (props) => {
const { data } = props; const { data } = props;
const popupStyle = { const popupStyle = {
position: "fixed", position: "fixed",
width: "300px", width: "300px",
height: "50px", height: "50px",
backgroundColor: "black", backgroundColor: "black",
color: "white", color: "white",
}; }
const popupData = <div>HEY</div>; const popupData =
<div>
HEY
</div>
return <div>{popupData}</div>; return (
}; <div>
{popupData}
</div>
)
}
export default Popup; export default Popup
+31 -33
View File
@@ -1,48 +1,46 @@
import React from "react"; import React from 'react'
import InfoIcon from "@material-ui/icons/Info"; import InfoIcon from '@material-ui/icons/Info';
import CheckIcon from "@material-ui/icons/Check"; import CheckIcon from '@material-ui/icons/Check';
import ErrorOutlineIcon from "@material-ui/icons/ErrorOutline"; import ErrorOutlineIcon from '@material-ui/icons/ErrorOutline';
import CloseIcon from "@material-ui/icons/Close"; import CloseIcon from '@material-ui/icons/Close';
import Typography from "@material-ui/core/Typography"; import Typography from '@material-ui/core/Typography';
const alertStyle = { const alertStyle = {
backgroundColor: "rgba(0,0,0,0.9)", backgroundColor: 'rgba(0,0,0,0.9)',
color: "white", color: 'white',
padding: 15, padding: 15,
textTransform: "uppercase", textTransform: 'uppercase',
borderRadius: "3px", borderRadius: '3px',
display: "flex", display: 'flex',
justifyContent: "space-between", justifyContent: 'space-between',
alignItems: "center", alignItems: 'center',
boxShadow: "0px 2px 2px 2px rgba(0, 0, 0, 0.03)", boxShadow: '0px 2px 2px 2px rgba(0, 0, 0, 0.03)',
width: 300, width: 300,
boxSizing: "border-box", boxSizing: 'border-box',
zIndex: 100001, zIndex: 100001,
overflow: "hidden", overflow: "hidden",
}; }
const buttonStyle = { const buttonStyle = {
marginLeft: "20px", marginLeft: '20px',
border: "none", border: 'none',
backgroundColor: "transparent", backgroundColor: 'transparent',
cursor: "pointer", cursor: 'pointer',
color: "#FFFFFF", color: '#FFFFFF'
}; }
const AlertTemplate = ({ message, options, style, close }) => { const AlertTemplate = ({ message, options, style, close }) => {
return ( return (
<div style={{ ...alertStyle, ...style }}> <div style={{ ...alertStyle, ...style }}>
{options.type === "info" && <InfoIcon style={{ color: "white" }} />} {options.type === 'info' && <InfoIcon style={{color: "white"}} />}
{options.type === "success" && <CheckIcon style={{ color: "green" }} />} {options.type === 'success' && <CheckIcon style={{color: "green", }}/>}
{options.type === "error" && ( {options.type === 'error' && <ErrorOutlineIcon style={{color: "red"}} />}
<ErrorOutlineIcon style={{ color: "red" }} /> <Typography style={{marginLeft: 15, flex: 2 }}>{message}</Typography>
)}
<Typography style={{ marginLeft: 15, flex: 2 }}>{message}</Typography>
<button onClick={close} style={buttonStyle}> <button onClick={close} style={buttonStyle}>
<CloseIcon /> <CloseIcon />
</button> </button>
</div> </div>
); )
}; }
export default AlertTemplate; export default AlertTemplate
File diff suppressed because it is too large Load Diff
+22 -22
View File
@@ -1,19 +1,19 @@
import React, { useRef, useState } from "react"; import React, { useRef, useState } from 'react';
import { useEffect } from "react"; import { useEffect } from 'react';
import BackupIcon from "@material-ui/icons/Backup"; import BackupIcon from '@material-ui/icons/Backup';
const dragOverStyle = { const dragOverStyle = {
backgroundColor: "rgba(0,0,0,0.8)", backgroundColor: 'rgba(0,0,0,0.8)',
border: "5px dashed white", border: '5px dashed white',
borderRadius: "8px", borderRadius: '8px',
width: "100%", width: '100%',
height: "100%", height: '100%',
position: "absolute", position: 'absolute',
overflow: "hidden", overflow: 'hidden',
zIndex: 100, zIndex: 100,
display: "flex", display: 'flex',
alignItems: "center", alignItems: 'center',
justifyContent: "center", justifyContent: 'center'
}; };
const Dropzone = ({ children, style, onDrop }) => { const Dropzone = ({ children, style, onDrop }) => {
@@ -56,21 +56,21 @@ const Dropzone = ({ children, style, onDrop }) => {
useEffect(() => { useEffect(() => {
if (!dropzoneRef.current) return; if (!dropzoneRef.current) return;
dropzoneRef.current.addEventListener("dragover", handleDragOver); dropzoneRef.current.addEventListener('dragover', handleDragOver);
dropzoneRef.current.addEventListener("dragenter", handleDragEnter); dropzoneRef.current.addEventListener('dragenter', handleDragEnter);
dropzoneRef.current.addEventListener("dragleave", handleDragLeave); dropzoneRef.current.addEventListener('dragleave', handleDragLeave);
dropzoneRef.current.addEventListener("drop", handleDrop); dropzoneRef.current.addEventListener('drop', handleDrop);
return () => { return () => {
dropzoneRef.current.removeEventListener("dragover", handleDragOver); dropzoneRef.current.removeEventListener('dragover', handleDragOver);
dropzoneRef.current.removeEventListener("dragenter", handleDragEnter); dropzoneRef.current.removeEventListener('dragenter', handleDragEnter);
dropzoneRef.current.removeEventListener("dragleave", handleDragLeave); dropzoneRef.current.removeEventListener('dragleave', handleDragLeave);
dropzoneRef.current.removeEventListener("drop", handleDrop); dropzoneRef.current.removeEventListener('drop', handleDrop);
}; };
}, [dropzoneRef]); }, [dropzoneRef]);
return ( return (
<div ref={dropzoneRef} style={{ position: "relative", ...style }}> <div ref={dropzoneRef} style={{ position: 'relative', ...style }}>
{dragging && ( {dragging && (
<div style={dragOverStyle}> <div style={dragOverStyle}>
<BackupIcon fontSize="large" /> <BackupIcon fontSize="large" />
+37 -37
View File
@@ -1,54 +1,54 @@
import React from "react"; import React from 'react';
//import List from '@material-ui/core/List'; //import List from '@material-ui/core/List';
//import ListItem from '@material-ui/core/ListItem'; //import ListItem from '@material-ui/core/ListItem';
//borderTop: "1px solid #385F71" //borderTop: "1px solid #385F71"
const FooterStyle = { const FooterStyle = {
right: "0", right: "0",
left: "0", left: "0",
bottom: "0", bottom: "0",
height: "130px", height: "130px",
backgroundColor: "rgba(15, 14, 31, 1)", backgroundColor: 'rgba(15, 14, 31, 1)',
}; };
const FooterInfo = { const FooterInfo = {
maxWidth: "1150px", maxWidth: '1150px',
minWidth: "768px", minWidth: '768px',
textAlign: "center", textAlign: 'center',
margin: "auto", margin: 'auto',
}; };
const hrefStyle = { const hrefStyle = {
color: "#bdbdbd", color: "#bdbdbd",
textDecoration: "none", textDecoration: "none"
}
const Footer = props => {
return (
<div style={FooterStyle}>
<div style={FooterInfo}>
<Box />
</div>
</div>
);
}; };
const Footer = (props) => { const Box = props => {
return ( return(
<div style={FooterStyle}> <div style={{display: "flex"}}>
<div style={FooterInfo}> <div style={{flex: "1"}}>
<Box /> <a style={hrefStyle} href="/about">
</div> <h1>About</h1>
</div> </a>
); </div>
}; <div style={{flex: "1"}}>
<a style={hrefStyle} href="/privacy-policy">
const Box = (props) => { <h1>Privacy Policy</h1>
return ( </a>
<div style={{ display: "flex" }}> </div>
<div style={{ flex: "1" }}> </div>
<a style={hrefStyle} href="/about"> );
<h1>About</h1>
</a>
</div>
<div style={{ flex: "1" }}>
<a style={hrefStyle} href="/privacy-policy">
<h1>Privacy Policy</h1>
</a>
</div>
</div>
);
}; };
export default Footer; export default Footer;
File diff suppressed because it is too large Load Diff
+123 -160
View File
@@ -1,176 +1,139 @@
/* eslint-disable react/no-multi-comp */ /* eslint-disable react/no-multi-comp */
import React, { useState } from "react"; import React, {useState} from 'react';
import DialogTitle from "@material-ui/core/DialogTitle"; import DialogTitle from '@material-ui/core/DialogTitle';
import Dialog from "@material-ui/core/Dialog"; import Dialog from '@material-ui/core/Dialog';
import TextField from "@material-ui/core/TextField"; import TextField from '@material-ui/core/TextField';
import Button from "@material-ui/core/Button"; import Button from '@material-ui/core/Button';
const LoginDialog = (props) => { const LoginDialog = props => {
const { const { classes, onClose, open, globalUrl, isLoggedIn, setIsLoggedIn, ...other } = props;
classes,
onClose,
open,
globalUrl,
isLoggedIn,
setIsLoggedIn,
...other
} = props;
const [username, setUsername] = useState(""); const [username, setUsername] = useState("");
const [password, setPassword] = useState(""); const [password, setPassword] = useState("");
//const [selectedValue, setSelectedValue] = useState(false); //const [selectedValue, setSelectedValue] = useState(false);
// Used to swap from login to register. True = login, false = register // Used to swap from login to register. True = login, false = register
const [loginCheck, setLoginCheck] = useState(true); const [loginCheck, setLoginCheck] = useState(true);
// Error messages etc // Error messages etc
const [loginInfo, setLoginInfo] = useState(""); const [loginInfo, setLoginInfo] = useState("");
const handleValidateForm = () => { const handleValidateForm = () => {
return username.length > 1 && password.length > 8; return (username.length > 1 && password.length > 8);
}; }
const onSubmit = (e) => { const onSubmit = (e) => {
e.preventDefault(); e.preventDefault()
// Just use this one? // Just use this one?
var data = var data = '{"username": "' + username + '", "password": "' + password + '"}';
'{"username": "' + username + '", "password": "' + password + '"}'; var baseurl = globalUrl
var baseurl = globalUrl; if (loginCheck) {
if (loginCheck) { var url = baseurl+'/login';
var url = baseurl + "/login"; fetch(url, {
fetch(url, { method: 'POST',
method: "POST", body: data,
body: data, headers: {
headers: { 'Content-Type': 'application/json',
"Content-Type": "application/json", },
}, })
}) .then(response =>
.then((response) => response.json().then(responseJson => {
response.json().then((responseJson) => { console.log(responseJson)
console.log(responseJson); //console.log(e)
//console.log(e) if (responseJson["success"] === false) {
if (responseJson["success"] === false) { setLoginInfo(responseJson["reason"])
setLoginInfo(responseJson["reason"]); } else {
} else { setLoginInfo("Successful login :)")
setLoginInfo("Successful login :)"); onClose()
onClose(); setIsLoggedIn(true)
setIsLoggedIn(true); }
} }),
}) )
) .catch(error => {
.catch((error) => { setLoginInfo("Error in userdata")
setLoginInfo("Error in userdata"); });
}); } else {
} else { url = baseurl+'/register';
url = baseurl + "/register"; fetch(url, {
fetch(url, { method: 'POST',
method: "POST", body: data,
body: data, headers: {
headers: { 'Content-Type': 'application/json',
"Content-Type": "application/json", },
}, })
}) .then(response =>
.then((response) => response.json().then(responseJson => {
response.json().then((responseJson) => { if (responseJson["success"] === false) {
if (responseJson["success"] === false) { setLoginInfo(responseJson["reason"])
setLoginInfo(responseJson["reason"]); } else {
} else { setLoginInfo("Successful register :)")
setLoginInfo("Successful register :)"); onClose()
onClose(); setIsLoggedIn(true)
setIsLoggedIn(true); }
} }),
}) )
) .catch(error => {
.catch((error) => { setLoginInfo("Error in userdata")
setLoginInfo("Error in userdata"); });
}); }
} }
};
const onChangeUser = (e) => { const onChangeUser = (e) => {
setUsername(e.target.value); setUsername(e.target.value)
}; }
const onChangePass = (e) => { const onChangePass = (e) => {
setPassword(e.target.value); setPassword(e.target.value)
}; }
const onClickRegister = () => { const onClickRegister = () => {
setLoginCheck(!loginCheck); setLoginCheck(!loginCheck)
}; }
//var loginChange = loginCheck ? (<div><p onClick={setLoginCheck(false)}>Want to register? Click here.</p></div>) : (<div><p onClick={setLoginCheck(true)}>Go back to login? Click here.</p></div>); //var loginChange = loginCheck ? (<div><p onClick={setLoginCheck(false)}>Want to register? Click here.</p></div>) : (<div><p onClick={setLoginCheck(true)}>Go back to login? Click here.</p></div>);
var formtitle = loginCheck ? <div>Login</div> : <div>Register</div>; var formtitle = loginCheck ? <div>Login</div> : <div>Register</div>
var formButton = loginCheck ? ( var formButton = loginCheck ? <div>Click to Register</div> : <div>Click to Login</div>
<div>Click to Register</div>
) : (
<div>Click to Login</div>
);
return ( return (
<Dialog modal open={open} onClose={onClose} {...other}> <Dialog modal open={open} onClose={onClose} {...other}>
<DialogTitle>{formtitle}</DialogTitle> <DialogTitle>{formtitle}</DialogTitle>
<form onSubmit={onSubmit} style={{ margin: "15px 15px 15px 15px" }}> <form onSubmit={onSubmit} style={{margin: "15px 15px 15px 15px"}}>
Username Username
<div> <div>
<TextField <TextField
required required
id="standard-required" id="standard-required"
autoComplete="username" autoComplete="username"
margin="normal" margin="normal"
variant="outlined" variant="outlined"
onChange={onChangeUser} onChange={onChangeUser}
/> />
</div> </div>
Password Password
<div> <div>
<TextField <TextField
id="outlined-password-input" id="outlined-password-input"
type="password" type="password"
autoComplete="current-password" autoComplete="current-password"
margin="normal" margin="normal"
variant="outlined" variant="outlined"
onChange={onChangePass} onChange={onChangePass}
/> />
</div> </div>
<div style={{ display: "flex", marginTop: "15px" }}> <div style={{display: "flex", marginTop: "15px"}}>
<Button <Button color="secondary" variant="contained" type="submit" style={{flex: "1", marginRight: "5px"}} disabled={!handleValidateForm()}>SUBMIT</Button>
color="secondary"
variant="contained" <Button color="primary" variant="contained" type="button" style={{flex: "1"}} onClick={onClose}>Cancel</Button>
type="submit" </div>
style={{ flex: "1", marginRight: "5px" }} {loginInfo}
disabled={!handleValidateForm()} </form>
> <div style={{display: "flex"}}>
SUBMIT <Button color="secondary" variant="contained" onClick={onClickRegister} type="button" style={{flex: "1"}}>{formButton}</Button>
</Button> </div>
</Dialog>
<Button );
color="primary" }
variant="contained"
type="button"
style={{ flex: "1" }}
onClick={onClose}
>
Cancel
</Button>
</div>
{loginInfo}
</form>
<div style={{ display: "flex" }}>
<Button
color="secondary"
variant="contained"
onClick={onClickRegister}
type="button"
style={{ flex: "1" }}
>
{formButton}
</Button>
</div>
</Dialog>
);
};
export default LoginDialog; export default LoginDialog;
+68 -74
View File
@@ -1,9 +1,9 @@
import React, { useState, useRef, useImperativeHandle } from "react"; import React, {useState, useRef, useImperativeHandle} from 'react'
import { makeStyles } from "@material-ui/core/styles"; import {makeStyles} from '@material-ui/core/styles'
import Menu, { MenuProps } from "@material-ui/core/Menu"; import Menu, {MenuProps} from '@material-ui/core/Menu'
import MenuItem, { MenuItemProps } from "@material-ui/core/MenuItem"; import MenuItem, {MenuItemProps} from '@material-ui/core/MenuItem'
import ArrowRight from "@material-ui/icons/ArrowRight"; import ArrowRight from '@material-ui/icons/ArrowRight'
import clsx from "clsx"; import clsx from 'clsx'
//<MenuItemProps, 'button'> //<MenuItemProps, 'button'>
@@ -39,15 +39,15 @@ import clsx from "clsx";
// /** // /**
// * @see https://material-ui.com/api/list-item/ // * @see https://material-ui.com/api/list-item/
// */ // */
// button: true; // button: true;
//} //}
const TRANSPARENT = "rgba(0,0,0,0)"; const TRANSPARENT = 'rgba(0,0,0,0)'
const useMenuItemStyles = makeStyles((theme) => ({ const useMenuItemStyles = makeStyles((theme) => ({
root: (props: any) => ({ root: (props: any) => ({
backgroundColor: props.open ? theme.palette.action.hover : TRANSPARENT, backgroundColor: props.open ? theme.palette.action.hover : TRANSPARENT
}), })
})); }))
/** /**
* Use as a drop-in replacement for `<MenuItem>` when you need to add cascading * Use as a drop-in replacement for `<MenuItem>` when you need to add cascading
@@ -55,11 +55,11 @@ const useMenuItemStyles = makeStyles((theme) => ({
*/ */
//const NestedMenuItem = React.forwardRef<NestedMenuItemProps>( //const NestedMenuItem = React.forwardRef<NestedMenuItemProps>(
const NestedMenuItem = (props, ref) => { const NestedMenuItem = (props, ref) => {
console.log(props, ref); console.log(props, ref)
//function NestedMenuItem(props, ref) { //function NestedMenuItem(props, ref) {
const { const {
parentMenuOpen, parentMenuOpen,
component = "div", component = 'div',
label, label,
rightIcon = <ArrowRight />, rightIcon = <ArrowRight />,
children, children,
@@ -68,100 +68,94 @@ const NestedMenuItem = (props, ref) => {
MenuProps = {}, MenuProps = {},
ContainerProps: ContainerPropsProp = {}, ContainerProps: ContainerPropsProp = {},
...MenuItemProps ...MenuItemProps
} = props; } = props
const [isSubMenuOpen, setIsSubMenuOpen] = useState(false); const [isSubMenuOpen, setIsSubMenuOpen] = useState(false)
const { ref: containerRefProp, ...ContainerProps } = ContainerPropsProp; const {ref: containerRefProp, ...ContainerProps} = ContainerPropsProp
const menuItemRef = useRef < HTMLLIElement > null;
useImperativeHandle(ref, () => menuItemRef.current);
const containerRef = useRef < HTMLDivElement > null;
useImperativeHandle(containerRefProp, () => containerRef.current);
const menuContainerRef = useRef < HTMLDivElement > null;
console.log( const menuItemRef = useRef<HTMLLIElement>(null)
"PAST THIS: ", useImperativeHandle(ref, () => menuItemRef.current)
containerRefProp, const containerRef = useRef<HTMLDivElement>(null)
menuItemRef, useImperativeHandle(containerRefProp, () => containerRef.current)
containerRef, const menuContainerRef = useRef<HTMLDivElement>(null)
menuContainerRef,
ContainerProps console.log("PAST THIS: ", containerRefProp, menuItemRef, containerRef, menuContainerRef, ContainerProps)
);
const handleMouseEnter = (event: React.MouseEvent<HTMLElement>) => { const handleMouseEnter = (event: React.MouseEvent<HTMLElement>) => {
setIsSubMenuOpen(true); setIsSubMenuOpen(true)
if (ContainerProps?.onMouseEnter) { if (ContainerProps?.onMouseEnter) {
ContainerProps.onMouseEnter(event); ContainerProps.onMouseEnter(event)
} }
}; }
const handleMouseLeave = (event: React.MouseEvent<HTMLElement>) => { const handleMouseLeave = (event: React.MouseEvent<HTMLElement>) => {
setIsSubMenuOpen(false); setIsSubMenuOpen(false)
if (ContainerProps?.onMouseLeave) { if (ContainerProps?.onMouseLeave) {
ContainerProps.onMouseLeave(event); ContainerProps.onMouseLeave(event)
} }
}; }
// Check if any immediate children are active // Check if any immediate children are active
const isSubmenuFocused = () => { const isSubmenuFocused = () => {
const active = containerRef.current?.ownerDocument?.activeElement; const active = containerRef.current?.ownerDocument?.activeElement
for (const child of menuContainerRef.current?.children ?? []) { for (const child of menuContainerRef.current?.children ?? []) {
if (child === active) { if (child === active) {
return true; return true
} }
} }
return false; return false
}; }
const handleFocus = (event: React.FocusEvent<HTMLElement>) => { const handleFocus = (event: React.FocusEvent<HTMLElement>) => {
if (event.target === containerRef.current) { if (event.target === containerRef.current) {
setIsSubMenuOpen(true); setIsSubMenuOpen(true)
} }
if (ContainerProps?.onFocus) { if (ContainerProps?.onFocus) {
ContainerProps.onFocus(event); ContainerProps.onFocus(event)
} }
}; }
const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => { const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {
if (event.key === "Escape") { if (event.key === 'Escape') {
return; return
} }
if (isSubmenuFocused()) { if (isSubmenuFocused()) {
event.stopPropagation(); event.stopPropagation()
} }
const active = containerRef.current?.ownerDocument?.activeElement; const active = containerRef.current?.ownerDocument?.activeElement
if (event.key === "ArrowLeft" && isSubmenuFocused()) { if (event.key === 'ArrowLeft' && isSubmenuFocused()) {
containerRef.current?.focus(); containerRef.current?.focus()
} }
if ( if (
event.key === "ArrowRight" && event.key === 'ArrowRight' &&
event.target === containerRef.current && event.target === containerRef.current &&
event.target === active event.target === active
) { ) {
console.log("MENU: ", menuContainerRef); console.log("MENU: ", menuContainerRef)
const firstChild = menuContainerRef.current.children[0]; const firstChild = menuContainerRef.current.children[0]
console.log("FIRST: ", firstChild); console.log("FIRST: ", firstChild)
firstChild.focus(); firstChild.focus()
} }
};
const open = isSubMenuOpen && parentMenuOpen;
const menuItemClasses = useMenuItemStyles({ open });
// Root element must have a `tabIndex` attribute for keyboard navigation
let tabIndex;
if (!props.disabled) {
tabIndex = tabIndexProp !== undefined ? tabIndexProp : -1;
} }
console.log("PAST 2! ", tabIndex); const open = isSubMenuOpen && parentMenuOpen
const menuItemClasses = useMenuItemStyles({open})
// Root element must have a `tabIndex` attribute for keyboard navigation
let tabIndex
if (!props.disabled) {
tabIndex = tabIndexProp !== undefined ? tabIndexProp : -1
}
console.log("PAST 2! ", tabIndex)
return ( return (
<div <div
@@ -184,30 +178,30 @@ const NestedMenuItem = (props, ref) => {
<Menu <Menu
// Set pointer events to 'none' to prevent the invisible Popover div // Set pointer events to 'none' to prevent the invisible Popover div
// from capturing events for clicks and hovers // from capturing events for clicks and hovers
style={{ pointerEvents: "none" }} style={{pointerEvents: 'none'}}
anchorEl={menuItemRef.current} anchorEl={menuItemRef.current}
anchorOrigin={{ anchorOrigin={{
vertical: "top", vertical: 'top',
horizontal: "right", horizontal: 'right'
}} }}
transformOrigin={{ transformOrigin={{
vertical: "top", vertical: 'top',
horizontal: "left", horizontal: 'left'
}} }}
open={open} open={open}
autoFocus={false} autoFocus={false}
disableAutoFocus disableAutoFocus
disableEnforceFocus disableEnforceFocus
onClose={() => { onClose={() => {
setIsSubMenuOpen(false); setIsSubMenuOpen(false)
}} }}
> >
<div ref={menuContainerRef} style={{ pointerEvents: "auto" }}> <div ref={menuContainerRef} style={{pointerEvents: 'auto'}}>
{children} {children}
</div> </div>
</Menu> </Menu>
</div> </div>
); )
}; }
export default NestedMenuItem; export default NestedMenuItem
+351 -516
View File
@@ -1,332 +1,224 @@
import React, { useRef, useState, useEffect, useLayoutEffect } from "react"; import React, {useRef, useState, useEffect, useLayoutEffect} from 'react';
import { useTheme } from "@material-ui/core/styles"; import { useTheme } from '@material-ui/core/styles';
import { v4 as uuidv4 } from "uuid"; import { v4 as uuidv4 } from 'uuid';
import { import { ListItemText, TextField, Drawer, Button, Paper, Grid, Tabs, InputAdornment, Tab, ButtonBase, Tooltip, Select, MenuItem, Divider, Dialog, Modal, DialogActions, DialogTitle, InputLabel, DialogContent, FormControl, IconButton, Menu, Input, FormGroup, FormControlLabel, Typography, Checkbox, Breadcrumbs, CircularProgress, Switch, Fade } from '@material-ui/core';
ListItemText, import { LockOpen as LockOpenIcon } from '@material-ui/icons';
TextField,
Drawer,
Button,
Paper,
Grid,
Tabs,
InputAdornment,
Tab,
ButtonBase,
Tooltip,
Select,
MenuItem,
Divider,
Dialog,
Modal,
DialogActions,
DialogTitle,
InputLabel,
DialogContent,
FormControl,
IconButton,
Menu,
Input,
FormGroup,
FormControlLabel,
Typography,
Checkbox,
Breadcrumbs,
CircularProgress,
Switch,
Fade,
} from "@material-ui/core";
import { LockOpen as LockOpenIcon } from "@material-ui/icons";
const ITEM_HEIGHT = 55; const ITEM_HEIGHT = 55
const ITEM_PADDING_TOP = 8; const ITEM_PADDING_TOP = 8
const MenuProps = { const MenuProps = {
PaperProps: { PaperProps: {
style: { style: {
maxHeight: ITEM_HEIGHT * 4.5 + ITEM_PADDING_TOP, maxHeight: ITEM_HEIGHT * 4.5 + ITEM_PADDING_TOP,
minWidth: 500, minWidth: 500,
maxWidth: 500, maxWidth: 500,
scrollX: "auto", scrollX: "auto",
}, },
}, },
}; }
const AuthenticationOauth2 = (props) => { const AuthenticationOauth2 = (props) => {
const { const { saveWorkflow, selectedApp, workflow, selectedAction, authenticationType, getAppAuthentication, appAuthentication, setSelectedAction, setNewAppAuth, setAuthenticationModalOpen} = props;
saveWorkflow, const theme = useTheme();
selectedApp,
workflow,
selectedAction,
authenticationType,
getAppAuthentication,
appAuthentication,
setSelectedAction,
setNewAppAuth,
setAuthenticationModalOpen,
} = props;
const theme = useTheme();
//const [update, setUpdate] = React.useState("|") //const [update, setUpdate] = React.useState("|")
const [defaultConfigSet, setDefaultConfigSet] = React.useState( const [defaultConfigSet, setDefaultConfigSet] = React.useState(authenticationType.client_id !== undefined && authenticationType.client_id !== null && authenticationType.client_id.length > 0 && authenticationType.client_secret !== undefined && authenticationType.client_secret !== null && authenticationType.client_secret.length > 0)
authenticationType.client_id !== undefined && const [clientId, setClientId] = React.useState(defaultConfigSet ? authenticationType.client_id : "")
authenticationType.client_id !== null && const [clientSecret, setClientSecret] = React.useState(defaultConfigSet ? authenticationType.client_secret : "")
authenticationType.client_id.length > 0 && const [oauthUrl, setOauthUrl] = React.useState("")
authenticationType.client_secret !== undefined && const [buttonClicked, setButtonClicked] = React.useState(false)
authenticationType.client_secret !== null && const [selectedScopes, setSelectedScopes] = React.useState([])
authenticationType.client_secret.length > 0 const allscopes = authenticationType.scope !== undefined ? authenticationType.scope: []
);
const [clientId, setClientId] = React.useState(
defaultConfigSet ? authenticationType.client_id : ""
);
const [clientSecret, setClientSecret] = React.useState(
defaultConfigSet ? authenticationType.client_secret : ""
);
const [oauthUrl, setOauthUrl] = React.useState("");
const [buttonClicked, setButtonClicked] = React.useState(false);
const [selectedScopes, setSelectedScopes] = React.useState([]);
const allscopes =
authenticationType.scope !== undefined ? authenticationType.scope : [];
const [manuallyConfigure, setManuallyConfigure] = React.useState( const [manuallyConfigure, setManuallyConfigure] = React.useState(defaultConfigSet ? false : true)
defaultConfigSet ? false : true const [authenticationOption, setAuthenticationOptions] = React.useState({
); app: JSON.parse(JSON.stringify(selectedApp)),
const [authenticationOption, setAuthenticationOptions] = React.useState({ fields: {},
app: JSON.parse(JSON.stringify(selectedApp)), label: "",
fields: {}, usage: [{
label: "", workflow_id: workflow.id,
usage: [ }],
{ id: uuidv4(),
workflow_id: workflow.id, active: true,
}, })
],
id: uuidv4(),
active: true,
});
if (selectedApp.authentication === undefined) { if (selectedApp.authentication === undefined) {
return null; return null
} }
const handleOauth2Request = (client_id, client_secret, oauth_url, scopes) => { const handleOauth2Request = (client_id, client_secret, oauth_url, scopes) => {
setButtonClicked(true); setButtonClicked(true)
console.log("SCOPES: ", scopes); console.log("SCOPES: ", scopes)
var resources = ""; var resources = ""
if (scopes !== undefined && (scopes !== null) & (scopes.length > 0)) { if (scopes !== undefined && scopes !== null & scopes.length > 0) {
//scopes.push("offline_access") //scopes.push("offline_access")
resources = scopes.join(","); resources = scopes.join(",")
} }
const authentication_url = authenticationType.token_uri; const authentication_url = authenticationType.token_uri
//console.log("AUTH: ", authenticationType) //console.log("AUTH: ", authenticationType)
//console.log("SCOPES2: ", resources) //console.log("SCOPES2: ", resources)
const redirectUri = `${window.location.protocol}//${window.location.host}/set_authentication`; const redirectUri = `${window.location.protocol}//${window.location.host}/set_authentication`
var state = `workflow_id%3D${workflow.id}%26reference_action_id%3d${selectedAction.app_id}%26app_name%3d${selectedAction.app_name}%26app_id%3d${selectedAction.app_id}%26app_version%3d${selectedAction.app_version}%26authentication_url%3d${authentication_url}%26scope%3d${resources}%26client_id%3d${client_id}%26client_secret%3d${client_secret}`; var state = `workflow_id%3D${workflow.id}%26reference_action_id%3d${selectedAction.app_id}%26app_name%3d${selectedAction.app_name}%26app_id%3d${selectedAction.app_id}%26app_version%3d${selectedAction.app_version}%26authentication_url%3d${authentication_url}%26scope%3d${resources}%26client_id%3d${client_id}%26client_secret%3d${client_secret}`
if (oauth_url !== undefined && oauth_url !== null && oauth_url.length > 0) { if (oauth_url !== undefined && oauth_url !== null && oauth_url.length > 0) {
state += `%26oauth_url%3d${oauth_url}`; state += `%26oauth_url%3d${oauth_url}`
console.log("ADDING OAUTH2 URL: ", state); console.log("ADDING OAUTH2 URL: ", state)
} }
if ( if (authenticationType.refresh_uri !== undefined && authenticationType.refresh_uri !== null && authenticationType.refresh_uri.length > 0) {
authenticationType.refresh_uri !== undefined && state += `%26refresh_uri%3d${authenticationType.refresh_uri}`
authenticationType.refresh_uri !== null && } else {
authenticationType.refresh_uri.length > 0 state += `%26refresh_uri%3d${authentication_url}`
) { }
state += `%26refresh_uri%3d${authenticationType.refresh_uri}`;
} else {
state += `%26refresh_uri%3d${authentication_url}`;
}
const url = `${authenticationType.redirect_uri}?client_id=${client_id}&redirect_uri=${redirectUri}&response_type=code&scope=${resources}&prompt=consent&state=${state}&access_type=offline`; const url = `${authenticationType.redirect_uri}?client_id=${client_id}&redirect_uri=${redirectUri}&response_type=code&scope=${resources}&prompt=consent&state=${state}&access_type=offline`
//const url = `https://accounts.zoho.com/oauth/v2/auth?response_type=code&client_id=${client_id}&scope=AaaServer.profile.Read&redirect_uri=${redirectUri}&prompt=consent` //const url = `https://accounts.zoho.com/oauth/v2/auth?response_type=code&client_id=${client_id}&scope=AaaServer.profile.Read&redirect_uri=${redirectUri}&prompt=consent`
//console.log("Full URI: ", url) //console.log("Full URI: ", url)
//console.log("Redirect Uri: ", redirectUri) //console.log("Redirect Uri: ", redirectUri)
// &resource=https%3A%2F%2Fgraph.microsoft.com& // &resource=https%3A%2F%2Fgraph.microsoft.com&
// FIXME: Awful, but works for prototyping
// How can we get a callback properly realtime?
// How can we properly try-catch without breaks on error?
try {
// FIXME: Awful, but works for prototyping var newwin = window.open(url, "", "width=800,height=600")
// How can we get a callback properly realtime? //console.log(newwin)
// How can we properly try-catch without breaks on error?
try { var open = true
var newwin = window.open(url, "", "width=800,height=600"); const timer = setInterval(() => {
//console.log(newwin) if (newwin.closed) {
setButtonClicked(false)
clearInterval(timer);
//alert('"Secure Payment" window closed!');
var open = true; getAppAuthentication(true, true)
const timer = setInterval(() => { }
if (newwin.closed) { }, 1000);
setButtonClicked(false); //do {
clearInterval(timer); // setTimeout(() => {
//alert('"Secure Payment" window closed!'); // console.log(newwin)
// console.log("CLOSED", newwin.closed)
// if (newwin.closed) {
getAppAuthentication(true, true); // open = false
} // }
}, 1000); // }, 1000)
//do { //}
// setTimeout(() => { //while(open === true)
// console.log(newwin) } catch (e) {
// console.log("CLOSED", newwin.closed) alert.error("Failed authentication - probably bad credentials. Try again")
// if (newwin.closed) { setButtonClicked(false)
}
// open = false return
// } //do {
// }, 1000) //} while (
//} }
//while(open === true)
} catch (e) {
alert.error(
"Failed authentication - probably bad credentials. Try again"
);
setButtonClicked(false);
}
return;
//do {
//} while (
};
authenticationOption.app.actions = []; authenticationOption.app.actions = []
for (var key in selectedApp.authentication.parameters) { for (var key in selectedApp.authentication.parameters) {
if ( if (authenticationOption.fields[selectedApp.authentication.parameters[key].name] === undefined) {
authenticationOption.fields[ authenticationOption.fields[selectedApp.authentication.parameters[key].name] = ""
selectedApp.authentication.parameters[key].name }
] === undefined }
) {
authenticationOption.fields[
selectedApp.authentication.parameters[key].name
] = "";
}
}
const handleSubmitCheck = () => { const handleSubmitCheck = () => {
console.log("NEW AUTH: ", authenticationOption); console.log("NEW AUTH: ", authenticationOption)
if (authenticationOption.label.length === 0) { if (authenticationOption.label.length === 0) {
authenticationOption.label = `Auth for ${selectedApp.name}`; authenticationOption.label = `Auth for ${selectedApp.name}`
//alert.info("Label can't be empty") //alert.info("Label can't be empty")
//return //return
} }
// Automatically mapping fields that already exist (predefined). // Automatically mapping fields that already exist (predefined).
// Warning if fields are NOT filled // Warning if fields are NOT filled
for (var key in selectedApp.authentication.parameters) { for (var key in selectedApp.authentication.parameters) {
if ( if (authenticationOption.fields[selectedApp.authentication.parameters[key].name].length === 0) {
authenticationOption.fields[ if (selectedApp.authentication.parameters[key].value !== undefined && selectedApp.authentication.parameters[key].value !== null && selectedApp.authentication.parameters[key].value.length > 0) {
selectedApp.authentication.parameters[key].name authenticationOption.fields[selectedApp.authentication.parameters[key].name] = selectedApp.authentication.parameters[key].value
].length === 0 } else {
) { if (selectedApp.authentication.parameters[key].schema.type === "bool") {
if ( authenticationOption.fields[selectedApp.authentication.parameters[key].name] = "false"
selectedApp.authentication.parameters[key].value !== undefined && } else {
selectedApp.authentication.parameters[key].value !== null && alert.info("Field "+selectedApp.authentication.parameters[key].name+" can't be empty")
selectedApp.authentication.parameters[key].value.length > 0 return
) { }
authenticationOption.fields[ }
selectedApp.authentication.parameters[key].name }
] = selectedApp.authentication.parameters[key].value; }
} else {
if (
selectedApp.authentication.parameters[key].schema.type === "bool"
) {
authenticationOption.fields[
selectedApp.authentication.parameters[key].name
] = "false";
} else {
alert.info(
"Field " +
selectedApp.authentication.parameters[key].name +
" can't be empty"
);
return;
}
}
}
}
console.log("Action: ", selectedAction); console.log("Action: ", selectedAction)
selectedAction.authentication_id = authenticationOption.id; selectedAction.authentication_id = authenticationOption.id
selectedAction.selectedAuthentication = authenticationOption; selectedAction.selectedAuthentication = authenticationOption
if ( if (selectedAction.authentication === undefined || selectedAction.authentication === null) {
selectedAction.authentication === undefined || selectedAction.authentication = [authenticationOption]
selectedAction.authentication === null } else {
) { selectedAction.authentication.push(authenticationOption)
selectedAction.authentication = [authenticationOption]; }
} else {
selectedAction.authentication.push(authenticationOption);
}
setSelectedAction(selectedAction); setSelectedAction(selectedAction)
var newAuthOption = JSON.parse(JSON.stringify(authenticationOption)); var newAuthOption = JSON.parse(JSON.stringify(authenticationOption))
var newFields = []; var newFields = []
for (const key in newAuthOption.fields) { for (const key in newAuthOption.fields) {
const value = newAuthOption.fields[key]; const value = newAuthOption.fields[key]
newFields.push({ newFields.push({
key: key, key: key,
value: value, value: value,
}); })
} }
console.log("FIELDS: ", newFields); console.log("FIELDS: ", newFields)
newAuthOption.fields = newFields; newAuthOption.fields = newFields
setNewAppAuth(newAuthOption); setNewAppAuth(newAuthOption)
//appAuthentication.push(newAuthOption) //appAuthentication.push(newAuthOption)
//setAppAuthentication(appAuthentication) //setAppAuthentication(appAuthentication)
// //
//if (configureWorkflowModalOpen) {
// setSelectedAction({})
//}
//setUpdate(authenticationOption.id)
//if (configureWorkflowModalOpen) { /*
// setSelectedAction({})
//}
//setUpdate(authenticationOption.id)
/*
{selectedAction.authentication.map(data => ( {selectedAction.authentication.map(data => (
<MenuItem key={data.id} style={{backgroundColor: inputColor, color: "white"}} value={data}> <MenuItem key={data.id} style={{backgroundColor: inputColor, color: "white"}} value={data}>
*/ */
};
}
const handleScopeChange = (event) => { const handleScopeChange = (event) => {
const { const {
target: { value }, target: { value },
} = event; } = event;
console.log("VALUE: ", value); console.log("VALUE: ", value)
// On autofill we get a the stringified value. // On autofill we get a the stringified value.
setSelectedScopes(typeof value === "string" ? value.split(",") : value); setSelectedScopes(typeof value === 'string' ? value.split(',') : value)
};
if (
authenticationOption.label === null ||
authenticationOption.label === undefined
) {
authenticationOption.label = selectedApp.name + " authentication";
} }
//console.log(
return ( if (authenticationOption.label === null || authenticationOption.label === undefined) {
<div> authenticationOption.label = selectedApp.name+" authentication"
<DialogTitle> }
<div style={{ color: "white" }}>
Authentication for {selectedApp.name} //console.log(
</div> return (
</DialogTitle> <div>
<DialogContent> <DialogTitle><div style={{color: "white"}}>Authentication for {selectedApp.name}</div></DialogTitle>
<span style={{}}> <DialogContent>
<b> <span style={{}}>
Oauth2 requires a client ID and secret to authenticate. This is <b>Oauth2 requires a client ID and secret to authenticate. This is usually made in the remote system.</b>
usually made in the remote system. <a target="_blank" rel="norefferer" href="https://shuffler.io/docs/apps#authentication" style={{textDecoration: "none", color: "#f85a3e"}}> Learn more about Oauth2 with Shuffle</a><div/>
</b> </span>
<a {/*<TextField
target="_blank"
rel="norefferer"
href="https://shuffler.io/docs/apps#authentication"
style={{ textDecoration: "none", color: "#f85a3e" }}
>
{" "}
Learn more about Oauth2 with Shuffle
</a>
<div />
</span>
{/*<TextField
style={{backgroundColor: theme.palette.inputColor, borderRadius: theme.palette.borderRadius,}} style={{backgroundColor: theme.palette.inputColor, borderRadius: theme.palette.borderRadius,}}
InputProps={{ InputProps={{
style:{ style:{
@@ -348,243 +240,186 @@ const AuthenticationOauth2 = (props) => {
<Divider style={{marginTop: 15, marginBottom: 15, backgroundColor: "rgb(91, 96, 100)"}}/> <Divider style={{marginTop: 15, marginBottom: 15, backgroundColor: "rgb(91, 96, 100)"}}/>
*/} */}
{!manuallyConfigure ? null : ( {!manuallyConfigure ? null :
<span> <span>
{selectedApp.authentication.parameters.map((data, index) => { {selectedApp.authentication.parameters.map((data, index) => {
//console.log(data, index) //console.log(data, index)
if (data.name === "client_id" || data.name === "client_secret") { if (data.name === "client_id" || data.name === "client_secret") {
return null; return null
} }
if (data.name !== "url") { if (data.name !== "url") {
return null; return null
} }
if (oauthUrl.length === 0) { if (oauthUrl.length === 0) {
setOauthUrl(data.value); setOauthUrl(data.value)
} }
return ( return (
<div key={index} style={{ marginTop: 10 }}> <div key={index} style={{marginTop: 10}}>
<LockOpenIcon style={{ marginRight: 10 }} /> <LockOpenIcon style={{marginRight: 10}}/>
<b>{data.name}</b> <b>{data.name}</b>
{data.schema !== undefined && {data.schema !== undefined && data.schema !== null && data.schema.type === "bool" ?
data.schema !== null && <Select
data.schema.type === "bool" ? ( SelectDisplayProps={{
<Select style: {
SelectDisplayProps={{ marginLeft: 10,
style: { }
marginLeft: 10, }}
}, defaultValue={"false"}
}} fullWidth
defaultValue={"false"} onChange={(e) => {
fullWidth console.log("Value: ", e.target.value)
onChange={(e) => { authenticationOption.fields[data.name] = e.target.value
console.log("Value: ", e.target.value); }}
authenticationOption.fields[data.name] = e.target.value; style={{backgroundColor: theme.palette.surfaceColor, color: "white", height: 50}}
}} >
style={{ <MenuItem key={"false"} style={{backgroundColor: theme.palette.inputColor, color: "white"}} value={"false"}>
backgroundColor: theme.palette.surfaceColor, false
color: "white", </MenuItem>
height: 50, <MenuItem key={"true"} style={{backgroundColor: theme.palette.inputColor, color: "white"}} value={"true"}>
}} true
> </MenuItem>
<MenuItem </Select>
key={"false"} :
style={{ <TextField
backgroundColor: theme.palette.inputColor, style={{backgroundColor: theme.palette.inputColor, borderRadius: theme.palette.borderRadius,}}
color: "white", InputProps={{
}} style:{
value={"false"} color: "white",
> marginLeft: "5px",
false maxWidth: "95%",
</MenuItem> height: 50,
<MenuItem fontSize: "1em",
key={"true"} },
style={{ }}
backgroundColor: theme.palette.inputColor, fullWidth
color: "white", type={data.example !== undefined && data.example.includes("***") ? "password" : "text"}
}} color="primary"
value={"true"} defaultValue={data.value !== undefined && data.value !== null ? data.value : ""}
> placeholder={data.example}
true onChange={(event) => {
</MenuItem> authenticationOption.fields[data.name] = event.target.value
</Select> console.log("Setting oauth url")
) : ( setOauthUrl(event.target.value)
<TextField //const [oauthUrl, setOauthUrl] = React.useState("")
style={{ }}
backgroundColor: theme.palette.inputColor, />
borderRadius: theme.palette.borderRadius, }
}} </div>
InputProps={{ )
style: { })}
color: "white", {allscopes.length === 0 ? null :
marginLeft: "5px", <Select
maxWidth: "95%", multiple
height: 50, value={selectedScopes}
fontSize: "1em", style={{backgroundColor: theme.palette.inputColor, color: "white", }}
}, onChange={(e) => {
}} handleScopeChange(e)
fullWidth }}
type={ fullWidth
data.example !== undefined && input={<Input id="select-multiple-native" />}
data.example.includes("***") renderValue={(selected) => selected.join(', ')}
? "password" MenuProps={MenuProps}
: "text" >
} {allscopes.map((data, index) => {
color="primary" return (
defaultValue={ <MenuItem key={index} value={data}>
data.value !== undefined && data.value !== null <Checkbox checked={selectedScopes.indexOf(data) > -1} />
? data.value <ListItemText primary={data} />
: "" </MenuItem>
} )
placeholder={data.example} })}
onChange={(event) => { </Select>
authenticationOption.fields[data.name] = }
event.target.value; <TextField
console.log("Setting oauth url"); style={{marginTop: 20, backgroundColor: theme.palette.inputColor, borderRadius: theme.palette.borderRadius,}}
setOauthUrl(event.target.value); InputProps={{
//const [oauthUrl, setOauthUrl] = React.useState("") style:{
}} color: "white",
/> marginLeft: "5px",
)} maxWidth: "95%",
</div> height: 50,
); fontSize: "1em",
})} },
{allscopes.length === 0 ? null : ( }}
<Select fullWidth
multiple color="primary"
value={selectedScopes} placeholder={"Client ID"}
style={{ onChange={(event) => {
backgroundColor: theme.palette.inputColor, setClientId(event.target.value)
color: "white", //authenticationOption.label = event.target.value
}} }}
onChange={(e) => { />
handleScopeChange(e); <TextField
}} style={{backgroundColor: theme.palette.inputColor, borderRadius: theme.palette.borderRadius,}}
fullWidth InputProps={{
input={<Input id="select-multiple-native" />} style:{
renderValue={(selected) => selected.join(", ")} color: "white",
MenuProps={MenuProps} marginLeft: "5px",
> maxWidth: "95%",
{allscopes.map((data, index) => { height: 50,
return ( fontSize: "1em",
<MenuItem key={index} value={data}> },
<Checkbox checked={selectedScopes.indexOf(data) > -1} /> }}
<ListItemText primary={data} /> fullWidth
</MenuItem> color="primary"
); placeholder={"Client Secret"}
})} onChange={(event) => {
</Select> setClientSecret(event.target.value)
)} //authenticationOption.label = event.target.value
<TextField }}
style={{ />
marginTop: 20, </span>
backgroundColor: theme.palette.inputColor, }
borderRadius: theme.palette.borderRadius, <Button
}} style={{marginBottom: 40, marginTop: 20, borderRadius: theme.palette.borderRadius}}
InputProps={{ disabled={clientSecret.length === 0 || clientId.length === 0 || buttonClicked}
style: { variant="contained"
color: "white", fullWidth
marginLeft: "5px", onClick={() => {
maxWidth: "95%", handleOauth2Request(clientId, clientSecret, oauthUrl, selectedScopes)
height: 50, }}
fontSize: "1em", color="primary"
}, >
}} {buttonClicked ?
fullWidth <CircularProgress style={{color: "white", }} />
color="primary" :
placeholder={"Client ID"} "Oauth2 request"
onChange={(event) => { }
setClientId(event.target.value); </Button>
//authenticationOption.label = event.target.value
}}
/>
<TextField
style={{
backgroundColor: theme.palette.inputColor,
borderRadius: theme.palette.borderRadius,
}}
InputProps={{
style: {
color: "white",
marginLeft: "5px",
maxWidth: "95%",
height: 50,
fontSize: "1em",
},
}}
fullWidth
color="primary"
placeholder={"Client Secret"}
onChange={(event) => {
setClientSecret(event.target.value);
//authenticationOption.label = event.target.value
}}
/>
</span>
)}
<Button
style={{
marginBottom: 40,
marginTop: 20,
borderRadius: theme.palette.borderRadius,
}}
disabled={
clientSecret.length === 0 || clientId.length === 0 || buttonClicked
}
variant="contained"
fullWidth
onClick={() => {
handleOauth2Request(
clientId,
clientSecret,
oauthUrl,
selectedScopes
);
}}
color="primary"
>
{buttonClicked ? (
<CircularProgress style={{ color: "white" }} />
) : (
"Oauth2 request"
)}
</Button>
{defaultConfigSet ? ( {defaultConfigSet ?
<span style={{}}> <span style={{}}>
... or ... or
<Button <Button
style={{ style={{marginLeft: 10, borderRadius: theme.palette.borderRadius}}
marginLeft: 10, disabled={clientSecret.length === 0 || clientId.length === 0}
borderRadius: theme.palette.borderRadius, variant="text"
}} onClick={() => {
disabled={clientSecret.length === 0 || clientId.length === 0} setManuallyConfigure(!manuallyConfigure)
variant="text"
onClick={() => {
setManuallyConfigure(!manuallyConfigure);
if (manuallyConfigure) { if (manuallyConfigure) {
setClientId(authenticationType.client_id); setClientId(authenticationType.client_id)
setClientSecret(authenticationType.client_secret); setClientSecret(authenticationType.client_secret)
} else { } else {
setClientId(""); setClientId("")
setClientSecret(""); setClientSecret("")
} }
}} }}
color="primary" color="primary"
> >
{manuallyConfigure {manuallyConfigure ? "Use auto-config" : "Manually configure Oauth2"}
? "Use auto-config" </Button>
: "Manually configure Oauth2"} </span>
</Button> :
</span> null
) : null} }
</DialogContent> </DialogContent>
</div> </div>
); )
}; }
export default AuthenticationOauth2; export default AuthenticationOauth2
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
+100 -111
View File
@@ -1,82 +1,79 @@
import React, { useState, useEffect, useLayoutEffect } from "react"; import React, {useState, useEffect, useLayoutEffect} from 'react';
import * as cytoscape from "cytoscape"; import * as cytoscape from 'cytoscape';
import CytoscapeComponent from "react-cytoscapejs"; import CytoscapeComponent from 'react-cytoscapejs';
import cystyle from "../defaultCytoscapeStyle"; import cystyle from '../defaultCytoscapeStyle';
const surfaceColor = "#27292D"; const surfaceColor = "#27292D"
const CytoscapeWrapper = (props) => { const CytoscapeWrapper = (props) => {
const { globalUrl, inworkflow } = props; const { globalUrl, inworkflow } = props;
const [elements, setElements] = useState([]); const [elements, setElements] = useState([])
const [workflow, setWorkflow] = useState(inworkflow); const [workflow, setWorkflow] = useState(inworkflow)
const [cy, setCy] = React.useState(); const [cy, setCy] = React.useState()
const bodyWidth = 200; const bodyWidth = 200
const bodyHeight = 150; const bodyHeight = 150
const setupGraph = () => { const setupGraph = () => {
const actions = workflow.actions.map((action) => { const actions = workflow.actions.map(action => {
const node = {}; const node = {}
node.position = action.position; node.position = action.position
node.data = action; node.data = action
node.data._id = action["id"]; node.data._id = action["id"]
node.data.type = "ACTION"; node.data.type = "ACTION"
node.isStartNode = action["id"] === workflow.start; node.isStartNode = action["id"] === workflow.start
var example = "";
if (
action.example !== undefined &&
action.example !== null &&
action.example.length > 0
) {
example = action.example;
}
node.data.example = example; var example = ""
return node; if (action.example !== undefined && action.example !== null && action.example.length > 0) {
}); example = action.example
}
const triggers = workflow.triggers.map((trigger) => { node.data.example = example
const node = {}; return node;
node.position = trigger.position; })
node.data = trigger;
node.data._id = trigger["id"]; const triggers = workflow.triggers.map(trigger => {
node.data.type = "TRIGGER"; const node = {}
node.position = trigger.position
node.data = trigger
return node; node.data._id = trigger["id"]
}); node.data.type = "TRIGGER"
// FIXME - tmp branch update return node;
var insertedNodes = [].concat(actions, triggers); })
const edges = workflow.branches.map((branch, index) => {
//workflow.branches[index].conditions = [{
const edge = {}; // FIXME - tmp branch update
var conditions = workflow.branches[index].conditions; var insertedNodes = [].concat(actions, triggers)
if (conditions === undefined || conditions === null) { const edges = workflow.branches.map((branch, index) => {
conditions = []; //workflow.branches[index].conditions = [{
}
var label = ""; const edge = { };
if (conditions.length === 1) { var conditions = workflow.branches[index].conditions
label = conditions.length + " condition"; if (conditions === undefined || conditions === null) {
} else if (conditions.length > 1) { conditions = []
label = conditions.length + " conditions"; }
}
edge.data = { var label = ""
id: branch.id, if (conditions.length === 1) {
_id: branch.id, label = conditions.length+" condition"
source: branch.source_id, } else if (conditions.length > 1) {
target: branch.destination_id, label = conditions.length+" conditions"
label: label, }
conditions: conditions,
hasErrors: branch.has_errors,
};
// This is an attempt at prettier edges. The numbers are weird to work with. edge.data = {
/* id: branch.id,
_id: branch.id,
source: branch.source_id,
target: branch.destination_id,
label: label,
conditions: conditions,
hasErrors: branch.has_errors
};
// This is an attempt at prettier edges. The numbers are weird to work with.
/*
//http://manual.graphspace.org/projects/graphspace-python/en/latest/demos/edge-types.html //http://manual.graphspace.org/projects/graphspace-python/en/latest/demos/edge-types.html
const sourcenode = actions.find(node => node.data._id === branch.source_id) const sourcenode = actions.find(node => node.data._id === branch.source_id)
const destinationnode = actions.find(node => node.data._id === branch.destination_id) const destinationnode = actions.find(node => node.data._id === branch.destination_id)
@@ -99,59 +96,51 @@ const CytoscapeWrapper = (props) => {
} }
*/ */
return edge; return edge;
}); })
setWorkflow(workflow); setWorkflow(workflow)
// Verifies if a branch is valid and skips others // Verifies if a branch is valid and skips others
var newedges = []; var newedges = []
for (var key in edges) { for (var key in edges) {
var item = edges[key]; var item = edges[key]
const sourcecheck = insertedNodes.find( const sourcecheck = insertedNodes.find(data => data.data.id === item.data.source)
(data) => data.data.id === item.data.source const destcheck = insertedNodes.find(data => data.data.id === item.data.target)
); if (sourcecheck === undefined || destcheck === undefined) {
const destcheck = insertedNodes.find( continue
(data) => data.data.id === item.data.target }
);
if (sourcecheck === undefined || destcheck === undefined) {
continue;
}
newedges.push(item); newedges.push(item)
} }
insertedNodes = insertedNodes.concat(newedges); insertedNodes = insertedNodes.concat(newedges)
setElements(insertedNodes); setElements(insertedNodes)
}; }
if (elements.length === 0) { if (elements.length === 0) {
setupGraph(); setupGraph()
} }
return ( return (
<CytoscapeComponent <CytoscapeComponent
elements={elements} elements={elements}
minZoom={0.35} minZoom={0.35}
maxZoom={2.0} maxZoom={2.00}
style={{ style={{width: bodyWidth-15, height: bodyHeight-5, backgroundColor: surfaceColor}}
width: bodyWidth - 15, stylesheet={cystyle}
height: bodyHeight - 5, boxSelectionEnabled={true}
backgroundColor: surfaceColor, autounselectify={false}
}} showGrid={true}
stylesheet={cystyle} cy={(incy) => {
boxSelectionEnabled={true} // FIXME: There's something specific loading when
autounselectify={false} // you do the first hover of a node. Why is this different?
showGrid={true} //console.log("CY: ", incy)
cy={(incy) => { setCy(incy)
// FIXME: There's something specific loading when }}
// you do the first hover of a node. Why is this different? />
//console.log("CY: ", incy) )
setCy(incy); }
}}
/>
);
};
export default CytoscapeWrapper; export default CytoscapeWrapper
+11 -11
View File
@@ -1,24 +1,24 @@
import { useEffect } from "react"; import { useEffect } from 'react';
import { withRouter } from "react-router-dom"; import { withRouter } from 'react-router-dom';
function ScrollToTop({ getUserNotifications, setCurpath, history }) { function ScrollToTop({getUserNotifications, setCurpath, history }) {
useEffect(() => { useEffect(() => {
const unlisten = history.listen(() => { const unlisten = history.listen(() => {
window.scroll({ window.scroll({
top: 0, top: 0,
left: 0, left: 0,
behavior: "smooth", behavior: "smooth",
}); });
setCurpath(window.location.pathname); setCurpath(window.location.pathname)
getUserNotifications(); getUserNotifications()
}); });
return () => { return () => {
unlisten(); unlisten();
}; }
}, []); }, []);
return null; return (null);
} }
// https://stackoverflow.com/questions/36904185/react-router-scroll-to-top-on-every-transition // https://stackoverflow.com/questions/36904185/react-router-scroll-to-top-on-every-transition
+125 -161
View File
@@ -1,177 +1,141 @@
import React, { useState } from "react"; import React, {useState} from 'react';
import DialogTitle from "@material-ui/core/DialogTitle"; import DialogTitle from '@material-ui/core/DialogTitle';
import Dialog from "@material-ui/core/Dialog"; import Dialog from '@material-ui/core/Dialog';
import TextField from "@material-ui/core/TextField"; import TextField from '@material-ui/core/TextField';
import Button from "@material-ui/core/Button"; import Button from '@material-ui/core/Button';
import Divider from "@material-ui/core/Divider"; import Divider from '@material-ui/core/Divider';
const SettingsDialog = (props) => {
const {
classes,
onClose,
settingsOpen,
settingsData,
globalUrl,
isLoggedIn,
setIsLoggedIn,
...other
} = props;
const SettingsDialog = props => {
const { classes, onClose, settingsOpen, settingsData, globalUrl, isLoggedIn, setIsLoggedIn, ...other } = props;
const [password1, setPassword1] = useState(""); const [password1, setPassword1] = useState("");
const [password2, setPassword2] = useState(""); const [password2, setPassword2] = useState("");
const [password3, setPassword3] = useState(""); const [password3, setPassword3] = useState("");
const handleValidateForm = () => { const handleValidateForm = () => {
var passlength = 10; var passlength = 10
if ( if (password1 === password2 && password1.length >= passlength && password3.length >= passlength) {
password1 === password2 && return true
password1.length >= passlength && }
password3.length >= passlength
) {
return true;
}
return false; return false
}; }
const onChangePass1 = (e) => { const onChangePass1 = (e) => {
setPassword1(e.target.value); setPassword1(e.target.value)
}; }
const onChangePass2 = (e) => { const onChangePass2 = (e) => {
setPassword2(e.target.value); setPassword2(e.target.value)
}; }
const onChangePass3 = (e) => { const onChangePass3 = (e) => {
setPassword3(e.target.value); setPassword3(e.target.value)
}; }
const onSubmitPassReset = () => { const onSubmitPassReset = () => {
console.log("Should change password"); console.log("Should change password")
// Rofl, this can't possibly be typesafe // Rofl, this can't possibly be typesafe
var data = var data = '{"password1": "'+password1+'", "password2": "'+password2+'", "password3": "'+password3+'"}'
'{"password1": "' +
password1 +
'", "password2": "' +
password2 +
'", "password3": "' +
password3 +
'"}';
fetch(globalUrl + "/passwordreset", { fetch(globalUrl+"/passwordreset", {
body: data, body: data,
method: "POST", method: 'POST',
headers: { headers: {
"Content-Type": "application/json", 'Content-Type': 'application/json',
}, },
}) })
.then((response) => response.json()) .then((response) => response.json())
.then((responseJson) => { .then((responseJson) => {
console.log(responseJson); console.log(responseJson)
if (responseJson.status === true) { if (responseJson.status === true) {
console.log("SUCCESS"); console.log("SUCCESS")
} }
}) })
.catch((error) => { .catch(error => {
console.log(error); console.log(error)
}); });
}; }
//PaperProps={{style: {minWidth: "500px"}} //PaperProps={{style: {minWidth: "500px"}}
return ( return(
<Dialog open={settingsOpen} onClose={() => onClose()} {...other}> <Dialog open={settingsOpen} onClose={() => onClose()} {...other}>
<DialogTitle>Settings</DialogTitle> <DialogTitle>Settings</DialogTitle>
<Divider /> <Divider />
<div style={{ marginLeft: "15px", marginRight: "15px" }}> <div style={{marginLeft: "15px", marginRight: "15px"}}>
<h3>Username</h3> <h3>
{settingsData.username} Username
</div> </h3>
<div {settingsData.username}
style={{ </div>
marginLeft: "15px", <div style={{marginLeft: "15px", marginRight: "15px", marginBottom: "15px"}}>
marginRight: "15px", <h3>
marginBottom: "15px", ApiKey
}} </h3>
> <TextField
<h3>ApiKey</h3> id="outlined-read-only-input"
<TextField defaultValue={settingsData.apikey}
id="outlined-read-only-input" value={settingsData.apikey}
defaultValue={settingsData.apikey} style={{width: 320}}
value={settingsData.apikey} InputProps={{
style={{ width: 320 }} readOnly: true,
InputProps={{ }}
readOnly: true, variant="outlined"
}} />
variant="outlined" </div>
/> <Divider />
</div> <form style={{margin: "15px 15px 15px 15px"}}>
<Divider /> <h3>
<form style={{ margin: "15px 15px 15px 15px" }}> Change password
<h3>Change password</h3> </h3>
<div> <div>
<TextField <TextField
id="standard-password-input" id="standard-password-input"
label="Current password" label="Current password"
type="password" type="password"
name="password" name="password"
style={{ width: 320 }} style={{width: 320}}
placeholder="********************************" placeholder="********************************"
autoComplete="current-password" autoComplete="current-password"
margin="normal" margin="normal"
variant="outlined" variant="outlined"
onChange={onChangePass1} onChange={onChangePass1}
/> />
</div> </div>
<div> <div>
<TextField <TextField
label="Confirm current password" label="Confirm current password"
type="password" type="password"
placeholder="********************************" placeholder="********************************"
name="password" name="password"
style={{ width: 320 }} style={{width: 320}}
autoComplete="current-password" autoComplete="current-password"
margin="normal" margin="normal"
variant="outlined" variant="outlined"
onChange={onChangePass2} onChange={onChangePass2}
/> />
</div> </div>
<div> <div>
<TextField <TextField
label="New password" label="New password"
type="password" type="password"
name="password" name="password"
placeholder="********************************" placeholder="********************************"
style={{ width: 320 }} style={{width: 320}}
margin="normal" margin="normal"
variant="outlined" variant="outlined"
onChange={onChangePass3} onChange={onChangePass3}
/> />
</div> </div>
<div style={{ display: "flex", marginTop: "10px" }}> <div style={{display: "flex", marginTop: "10px"}}>
<Button <Button color="secondary" variant="contained" onClick={onSubmitPassReset} type="button" style={{flex: "1", marginRight: "5px"}} disabled={!handleValidateForm()}>SUBMIT</Button>
color="secondary" <Button color="primary" variant="contained" type="button" style={{flex: "1"}} onClick={onClose}>Cancel</Button>
variant="contained" </div>
onClick={onSubmitPassReset} </form>
type="button" </Dialog>
style={{ flex: "1", marginRight: "5px" }} );
disabled={!handleValidateForm()} }
>
SUBMIT
</Button>
<Button
color="primary"
variant="contained"
type="button"
style={{ flex: "1" }}
onClick={onClose}
>
Cancel
</Button>
</div>
</form>
</Dialog>
);
};
export default SettingsDialog; export default SettingsDialog;
+5 -5
View File
@@ -1,8 +1,8 @@
import { createBrowserHistory } from "history"; import { createBrowserHistory } from 'history';
var localExport; var localExport
if (typeof window !== "undefined") { if (typeof window !== 'undefined') {
localExport = createBrowserHistory({ forceRefresh: true }); localExport = createBrowserHistory({forceRefresh: true});
} }
export default localExport; export default localExport
+14 -19
View File
@@ -1,45 +1,40 @@
/* cyrillic-ext */ /* cyrillic-ext */
@font-face { @font-face {
font-family: "Nunito Sans"; font-family: 'Nunito Sans';
font-style: normal; font-style: normal;
font-weight: 400; font-weight: 400;
src: url("./font1.woff2") format("woff2"); src: url('./font1.woff2') format('woff2');
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
U+FE2E-FE2F;
} }
/* cyrillic */ /* cyrillic */
@font-face { @font-face {
font-family: "Nunito Sans"; font-family: 'Nunito Sans';
font-style: normal; font-style: normal;
font-weight: 400; font-weight: 400;
src: url("./font2.woff2") format("woff2"); src: url('./font2.woff2') format('woff2');
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
} }
/* vietnamese */ /* vietnamese */
@font-face { @font-face {
font-family: "Nunito Sans"; font-family: 'Nunito Sans';
font-style: normal; font-style: normal;
font-weight: 400; font-weight: 400;
src: url("./font3.woff2") format("woff2"); src: url('./font3.woff2') format('woff2');
unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;
U+01AF-01B0, U+1EA0-1EF9, U+20AB;
} }
/* latin-ext */ /* latin-ext */
@font-face { @font-face {
font-family: "Nunito Sans"; font-family: 'Nunito Sans';
font-style: normal; font-style: normal;
font-weight: 400; font-weight: 400;
src: url("./font4.woff2") format("woff2"); src: url('./font4.woff2') format('woff2');
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
} }
/* latin */ /* latin */
@font-face { @font-face {
font-family: "Nunito Sans"; font-family: 'Nunito Sans';
font-style: normal; font-style: normal;
font-weight: 400; font-weight: 400;
src: url("./font5.woff2") format("woff2"); src: url('./font5.woff2') format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
U+FEFF, U+FFFD;
} }
+388 -389
View File
@@ -1,391 +1,389 @@
const data = [ const data = [{
{ selector: 'node',
selector: "node", css: {
css: { 'label': 'data(label)',
label: "data(label)", 'text-valign': 'center',
"text-valign": "center", 'font-family': 'Segoe UI, Tahoma, Geneva, Verdana, sans-serif, sans-serif',
"font-family": 'font-weight': 'lighter',
"Segoe UI, Tahoma, Geneva, Verdana, sans-serif, sans-serif", 'margin-right': '10px',
"font-weight": "lighter", 'font-size': '18px',
"margin-right": "10px", 'width': '80px',
"font-size": "18px", 'height': '80px',
width: "80px", 'color': 'white',
height: "80px", 'padding': '10px',
color: "white", 'margin': '5px',
padding: "10px", 'border-width': '1px',
margin: "5px", 'text-margin-x': '10px',
"border-width": "1px", 'cursor': 'pointer',
"text-margin-x": "10px", "z-index": 5001,
cursor: "pointer", }
"z-index": 5001, },
}, {
}, selector: 'edge',
{ css: {
selector: "edge", 'target-arrow-shape': 'triangle',
css: { 'target-arrow-color': 'grey',
"target-arrow-shape": "triangle", 'curve-style': 'unbundled-bezier',
"target-arrow-color": "grey", 'label': 'data(label)',
"curve-style": "unbundled-bezier", 'text-margin-y': '-15px',
label: "data(label)", 'width': '5px',
"text-margin-y": "-15px", "color": "white",
width: "5px", 'cursor': 'pointer',
color: "white", "line-fill": "linear-gradient",
cursor: "pointer", "line-gradient-stop-positions": ["0.0", "100"],
"line-fill": "linear-gradient", "line-gradient-stop-colors": ["grey", "grey"],
"line-gradient-stop-positions": ["0.0", "100"], "z-index": 5001,
"line-gradient-stop-colors": ["grey", "grey"], },
"z-index": 5001, },
}, {
}, selector: `node[type="ACTION"]`,
{ css: {
selector: `node[type="ACTION"]`, 'shape': 'roundrectangle',
css: { 'background-color': '#213243',
shape: "roundrectangle", 'border-color': '#81c784',
"background-color": "#213243", 'background-width': '100%',
"border-color": "#81c784", 'background-height': '100%',
"background-width": "100%", 'border-radius': '5px',
"background-height": "100%", 'z-index': 5001,
"border-radius": "5px", },
"z-index": 5001, },
}, {
}, selector: `node[type="COMMENT"]`,
{ css: {
selector: `node[type="COMMENT"]`, 'shape': 'roundrectangle',
css: { 'background-color': 'data(backgroundcolor)',
shape: "roundrectangle", 'border-color': '#ffffff',
"background-color": "data(backgroundcolor)", 'color': 'data(color)',
"border-color": "#ffffff", 'width': 'data(width)',
color: "data(color)", 'height': 'data(height)',
width: "data(width)", 'border-radius': '5px',
height: "data(height)", "background-opacity": "0.5",
"border-radius": "5px", 'padding': '0px',
"background-opacity": "0.5", 'margin': '0px',
padding: "0px", 'text-margin-x': '0px',
margin: "0px", 'z-index': 4999,
"text-margin-x": "0px", },
"z-index": 4999, },
}, {
}, selector: `node[app_name="Shuffle Tools"]`,
{ css: {
selector: `node[app_name="Shuffle Tools"]`, 'width': '30px',
css: { 'height': '30px',
width: "30px", 'z-index': 5000,
height: "30px", 'font-size': '0px',
"z-index": 5000, 'background-width': '75%',
"font-size": "0px", 'background-height': '75%',
"background-width": "75%", 'background-color': 'data(iconBackground)',
"background-height": "75%", 'background-fill': 'data(fillstyle)',
"background-color": "data(iconBackground)", 'background-gradient-direction': 'to-right',
"background-fill": "data(fillstyle)", 'background-gradient-stop-colors': 'data(fillGradient)',
"background-gradient-direction": "to-right", }
"background-gradient-stop-colors": "data(fillGradient)", },
}, {
}, selector: `node[app_name="Testing"]`,
{ css: {
selector: `node[app_name="Testing"]`, 'width': '30px',
css: { 'height': '30px',
width: "30px", 'z-index': 5000,
height: "30px", 'font-size': '0px',
"z-index": 5000, },
"font-size": "0px", },
}, {
}, selector: `node[?small_image]`,
{ css: {
selector: `node[?small_image]`, 'background-image': 'data(small_image)',
css: { 'text-halign': 'right',
"background-image": "data(small_image)", },
"text-halign": "right", },
}, {
}, selector: `node[?large_image]`,
{ css: {
selector: `node[?large_image]`, 'background-image': 'data(large_image)',
css: { 'text-halign': 'right',
"background-image": "data(large_image)", },
"text-halign": "right", },
}, {
}, selector: `node[type="CONDITION"]`,
{ css: {
selector: `node[type="CONDITION"]`, 'shape': 'diamond',
css: { 'border-color': '##FFEB3B',
shape: "diamond", 'padding': '30px'
"border-color": "##FFEB3B", },
padding: "30px", },
}, {
}, selector: `node[type="eventAction"]`,
{ css: {
selector: `node[type="eventAction"]`, 'background-color': '#edbd21',
css: { },
"background-color": "#edbd21", },
}, {
}, selector: `node[type="TRIGGER"]`,
{ css: {
selector: `node[type="TRIGGER"]`, 'shape': 'octagon',
css: { 'border-radius': '5px',
shape: "octagon", 'border-color': 'orange',
"border-radius": "5px", 'background-color': '#213243',
"border-color": "orange", 'background-width': '100%',
"background-color": "#213243", 'background-height': '100%',
"background-width": "100%", },
"background-height": "100%", },
}, {
}, selector: `node[status="running"]`,
{ css: {
selector: `node[status="running"]`, 'border-color': '#81c784',
css: { },
"border-color": "#81c784", },
}, {
}, selector: `node[status="stopped"]`,
{ css: {
selector: `node[status="stopped"]`, 'border-color': 'orange',
css: { },
"border-color": "orange", },
}, {
}, selector: 'node[type="mq"]',
{ css: {
selector: 'node[type="mq"]', 'background-color': '#edbd21',
css: { },
"background-color": "#edbd21", },
}, {
}, selector: 'node[?isButton]',
{ css: {
selector: "node[?isButton]", 'shape': 'ellipse',
css: { 'width': '15px',
shape: "ellipse", 'height': '15px',
width: "15px", 'z-index': '5002',
height: "15px", 'font-size': '0px',
"z-index": "5002", 'border': '1px solid rgba(255,255,255,0.9)',
"font-size": "0px", 'background-image': 'data(icon)',
border: "1px solid rgba(255,255,255,0.9)", 'background-color': 'data(iconBackground)',
"background-image": "data(icon)", },
"background-color": "data(iconBackground)", },
}, {
}, selector: 'node[?isDescriptor]',
{ css: {
selector: "node[?isDescriptor]", 'shape': 'ellipse',
css: { 'border-color': '#80deea',
shape: "ellipse", 'width': '5px',
"border-color": "#80deea", 'height': '5px',
width: "5px", 'z-index': '5002',
height: "5px", 'font-size': '10px',
"z-index": "5002", 'text-valign': 'center',
"font-size": "10px", 'text-halign': 'center',
"text-valign": "center", 'border': '1px solid black',
"text-halign": "center", 'margin-right': '0px',
border: "1px solid black", 'text-margin-x': '0px',
"margin-right": "0px", 'background-color': 'data(imageColor)',
"text-margin-x": "0px", 'background-image': 'data(image)',
"background-color": "data(imageColor)", },
"background-image": "data(image)", },
}, {
}, selector: 'node[?isStartNode]',
{ css: {
selector: "node[?isStartNode]", 'shape': 'ellipse',
css: { 'border-color': '#80deea',
shape: "ellipse", 'width': '80px',
"border-color": "#80deea", 'height': '80px',
width: "80px", 'font-size': '18px',
height: "80px", 'background-width': '100%',
"font-size": "18px", 'background-height': '100%',
"background-width": "100%", },
"background-height": "100%", },
}, {
}, selector: "node[!is_valid]",
{ css: {
selector: "node[!is_valid]", 'border-color': 'red',
css: { 'border-width': '10px',
"border-color": "red", },
"border-width": "10px", },
}, {
}, selector: ':selected',
{ css: {
selector: ":selected", 'background-color': '#77b0d0',
css: { 'border-color': '#77b0d0',
"background-color": "#77b0d0", 'border-width': '20px',
"border-color": "#77b0d0", },
"border-width": "20px", },
}, {
}, selector: '.skipped-highlight',
{ css: {
selector: ".skipped-highlight", 'background-color': 'grey',
css: { 'border-color': 'grey',
"background-color": "grey", 'border-width': '8px',
"border-color": "grey", 'transition-property': 'background-color',
"border-width": "8px", 'transition-duration': '0.5s',
"transition-property": "background-color", },
"transition-duration": "0.5s", },
}, {
}, selector: '.success-highlight',
{ css: {
selector: ".success-highlight", 'background-color': '#41dcab',
css: { 'border-color': '#41dcab',
"background-color": "#41dcab", 'border-width': '5px',
"border-color": "#41dcab", 'transition-property': 'background-color',
"border-width": "5px", 'transition-duration': '0.5s',
"transition-property": "background-color", },
"transition-duration": "0.5s", },
}, {
}, selector: '.hover-highlight',
{ css: {
selector: ".hover-highlight", 'background-color': '#5f9265',
css: { 'border-color': '#5f9265',
"background-color": "#5f9265", 'border-width': '5px',
"border-color": "#5f9265", 'transition-property': 'background-color',
"border-width": "5px", 'transition-duration': '0.5s',
"transition-property": "background-color", },
"transition-duration": "0.5s", },
}, {
}, selector: '.failure-highlight',
{ css: {
selector: ".failure-highlight", 'background-color': '#8e3530',
css: { 'border-color': '#8e3530',
"background-color": "#8e3530", 'border-width': '5px',
"border-color": "#8e3530", 'transition-property': 'background-color',
"border-width": "5px", 'transition-duration': '0.5s',
"transition-property": "background-color", },
"transition-duration": "0.5s", },
}, {
}, selector: '.not-executing-highlight',
{ css: {
selector: ".not-executing-highlight", 'background-color': 'grey',
css: { 'border-color': 'grey',
"background-color": "grey", 'border-width': '5px',
"border-color": "grey", 'transition-property': '#ffef47',
"border-width": "5px", 'transition-duration': '0.25s',
"transition-property": "#ffef47", },
"transition-duration": "0.25s", },
}, {
}, selector: '.executing-highlight',
{ css: {
selector: ".executing-highlight", 'background-color': '#ffef47',
css: { 'border-color': '#ffef47',
"background-color": "#ffef47", 'border-width': '8px',
"border-color": "#ffef47", 'transition-property': 'border-width',
"border-width": "8px", 'transition-duration': '0.25s',
"transition-property": "border-width", },
"transition-duration": "0.25s", },
}, {
}, selector: '.awaiting-data-highlight',
{ css: {
selector: ".awaiting-data-highlight", 'background-color': '#f4ad42',
css: { 'border-color': '#f4ad42',
"background-color": "#f4ad42", 'border-width': '5px',
"border-color": "#f4ad42", 'transition-property': 'border-color',
"border-width": "5px", 'transition-duration': '0.5s',
"transition-property": "border-color", },
"transition-duration": "0.5s", },
}, {
}, selector: '.shuffle-hover-highlight',
{ css: {
selector: ".shuffle-hover-highlight", 'background-color': "#f85a3e",
css: { 'border-color': '#f85a3e',
"background-color": "#f85a3e", 'border-width': '12px',
"border-color": "#f85a3e", 'transition-property': 'border-width',
"border-width": "12px", 'transition-duration': '0.25s',
"transition-property": "border-width", 'label': 'data(label)',
"transition-duration": "0.25s", 'font-size': '18px',
label: "data(label)", 'color': 'white',
"font-size": "18px", },
color: "white", },
}, {
}, selector: '$node > node',
{ css: {
selector: "$node > node", 'padding-top': '10px',
css: { 'padding-left': '10px',
"padding-top": "10px", 'padding-bottom': '10px',
"padding-left": "10px", 'padding-right': '10px',
"padding-bottom": "10px", },
"padding-right": "10px", },
}, {
}, selector: 'edge.executing-highlight',
{ css: {
selector: "edge.executing-highlight", 'width': '5px',
css: { 'target-arrow-color': '#ffef47',
width: "5px", 'line-color': '#ffef47',
"target-arrow-color": "#ffef47", 'transition-property': 'line-color, width',
"line-color": "#ffef47", 'transition-duration': '0.25s',
"transition-property": "line-color, width", },
"transition-duration": "0.25s", },
}, {
}, selector: `edge[?decorator]`,
{ css: {
selector: `edge[?decorator]`, 'width': '1px',
css: { 'line-style': 'dashed',
width: "1px", "line-fill": "linear-gradient",
"line-style": "dashed", 'target-arrow-color': '#f34079',
"line-fill": "linear-gradient", "line-gradient-stop-positions": ["0.0", "100"],
"target-arrow-color": "#f34079", "line-gradient-stop-colors": ["#f86a3e", "#f34079"],
"line-gradient-stop-positions": ["0.0", "100"], },
"line-gradient-stop-colors": ["#f86a3e", "#f34079"], },
}, {
}, selector: 'edge.success-highlight',
{ css: {
selector: "edge.success-highlight", 'width': '5px',
css: { 'target-arrow-color': '#41dcab',
width: "5px", 'line-color': '#41dcab',
"target-arrow-color": "#41dcab", 'transition-property': 'line-color, width',
"line-color": "#41dcab", 'transition-duration': '0.5s',
"transition-property": "line-color, width", "line-fill": "linear-gradient",
"transition-duration": "0.5s", "line-gradient-stop-positions": ["0.0", "100"],
"line-fill": "linear-gradient", "line-gradient-stop-colors": ["#41dcab", "#41dcab"],
"line-gradient-stop-positions": ["0.0", "100"], },
"line-gradient-stop-colors": ["#41dcab", "#41dcab"], },
}, {
}, selector: '.eh-handle',
{ style: {
selector: ".eh-handle", 'background-color': '#337ab7',
style: { 'width': '1px',
"background-color": "#337ab7", 'height': '1px',
width: "1px", 'shape': 'circle',
height: "1px", 'border-width': '1px',
shape: "circle", 'border-color': 'black'
"border-width": "1px", }
"border-color": "black", },
}, {
}, selector: '.eh-source',
{ style: {
selector: ".eh-source", 'border-width': '3',
style: { 'border-color': '#337ab7'
"border-width": "3", }
"border-color": "#337ab7", },
}, {
}, selector: '.eh-target',
{ style: {
selector: ".eh-target", 'border-width': '3',
style: { 'border-color': '#337ab7'
"border-width": "3", }
"border-color": "#337ab7", },
}, {
}, selector: '.eh-preview, .eh-ghost-edge',
{ style: {
selector: ".eh-preview, .eh-ghost-edge", 'background-color': '#337ab7',
style: { 'line-color': '#337ab7',
"background-color": "#337ab7", 'target-arrow-color': '#337ab7',
"line-color": "#337ab7", 'source-arrow-color': '#337ab7'
"target-arrow-color": "#337ab7", }
"source-arrow-color": "#337ab7", },
}, {
}, selector: 'edge:selected',
{ css: {
selector: "edge:selected", 'target-arrow-color': '#f85a3e',
css: { },
"target-arrow-color": "#f85a3e", },
}, {
}, selector: `edge[?source_workflow]`,
{ css: {
selector: `edge[?source_workflow]`, "background-opacity": "1",
css: { 'font-size': '0px',
"background-opacity": "1", },
"font-size": "0px", },
}, {
}, selector: `node[?source_workflow]`,
{ css: {
selector: `node[?source_workflow]`, "background-opacity": "0",
css: { 'font-size': '0px',
"background-opacity": "0", },
"font-size": "0px", },
}, ]
},
];
//{ //{
// selector: 'edge[?hasErrors]', // selector: 'edge[?hasErrors]',
@@ -399,4 +397,5 @@ const data = [
// }, // },
//}, //},
export default data;
export default data
+2 -2
View File
@@ -1,9 +1,9 @@
@import url("./css/nunito.css"); @import url('./css/nunito.css');
body { body {
margin: 0; margin: 0;
padding: 0; padding: 0;
font-family: "Nunito Sans", sans-serif; font-family: "Nunito Sans", sans-serif;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
} }
+9 -6
View File
@@ -1,10 +1,13 @@
import React from "react"; import React from 'react';
import ReactDOM from "react-dom"; import ReactDOM from 'react-dom';
import "./index.css"; import './index.css';
import App from "./App"; import App from './App';
import * as serviceWorker from "./serviceWorker"; import * as serviceWorker from './serviceWorker';
ReactDOM.render(<App />, document.getElementById("root"));
ReactDOM.render(
<App />
, document.getElementById('root'));
// If you want your app to work offline and load faster, you can change // If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls. // unregister() to register() below. Note this comes with some pitfalls.
+18 -18
View File
@@ -9,9 +9,9 @@
// This link also includes instructions on opting out of this behavior. // This link also includes instructions on opting out of this behavior.
const isLocalhost = Boolean( const isLocalhost = Boolean(
window.location.hostname === "localhost" || window.location.hostname === 'localhost' ||
// [::1] is the IPv6 localhost address. // [::1] is the IPv6 localhost address.
window.location.hostname === "[::1]" || window.location.hostname === '[::1]' ||
// 127.0.0.1/8 is considered localhost for IPv4. // 127.0.0.1/8 is considered localhost for IPv4.
window.location.hostname.match( window.location.hostname.match(
/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/ /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/
@@ -19,7 +19,7 @@ const isLocalhost = Boolean(
); );
export function register(config) { export function register(config) {
if (process.env.NODE_ENV === "production" && "serviceWorker" in navigator) { if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
// The URL constructor is available in all browsers that support SW. // The URL constructor is available in all browsers that support SW.
const publicUrl = new URL(process.env.PUBLIC_URL, window.location); const publicUrl = new URL(process.env.PUBLIC_URL, window.location);
if (publicUrl.origin !== window.location.origin) { if (publicUrl.origin !== window.location.origin) {
@@ -29,7 +29,7 @@ export function register(config) {
return; return;
} }
window.addEventListener("load", () => { window.addEventListener('load', () => {
const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`; const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;
if (isLocalhost) { if (isLocalhost) {
@@ -40,8 +40,8 @@ export function register(config) {
// service worker/PWA documentation. // service worker/PWA documentation.
navigator.serviceWorker.ready.then(() => { navigator.serviceWorker.ready.then(() => {
console.log( console.log(
"This web app is being served cache-first by a service " + 'This web app is being served cache-first by a service ' +
"worker. To learn more, visit https://goo.gl/SC7cgQ" 'worker. To learn more, visit https://goo.gl/SC7cgQ'
); );
}); });
} else { } else {
@@ -55,17 +55,17 @@ export function register(config) {
function registerValidSW(swUrl, config) { function registerValidSW(swUrl, config) {
navigator.serviceWorker navigator.serviceWorker
.register(swUrl) .register(swUrl)
.then((registration) => { .then(registration => {
registration.onupdatefound = () => { registration.onupdatefound = () => {
const installingWorker = registration.installing; const installingWorker = registration.installing;
installingWorker.onstatechange = () => { installingWorker.onstatechange = () => {
if (installingWorker.state === "installed") { if (installingWorker.state === 'installed') {
if (navigator.serviceWorker.controller) { if (navigator.serviceWorker.controller) {
// At this point, the old content will have been purged and // At this point, the old content will have been purged and
// the fresh content will have been added to the cache. // the fresh content will have been added to the cache.
// It's the perfect time to display a "New content is // It's the perfect time to display a "New content is
// available; please refresh." message in your web app. // available; please refresh." message in your web app.
console.log("New content is available; please refresh."); console.log('New content is available; please refresh.');
// Execute callback // Execute callback
if (config.onUpdate) { if (config.onUpdate) {
@@ -75,7 +75,7 @@ function registerValidSW(swUrl, config) {
// At this point, everything has been precached. // At this point, everything has been precached.
// It's the perfect time to display a // It's the perfect time to display a
// "Content is cached for offline use." message. // "Content is cached for offline use." message.
console.log("Content is cached for offline use."); console.log('Content is cached for offline use.');
// Execute callback // Execute callback
if (config.onSuccess) { if (config.onSuccess) {
@@ -86,22 +86,22 @@ function registerValidSW(swUrl, config) {
}; };
}; };
}) })
.catch((error) => { .catch(error => {
console.error("Error during service worker registration:", error); console.error('Error during service worker registration:', error);
}); });
} }
function checkValidServiceWorker(swUrl, config) { function checkValidServiceWorker(swUrl, config) {
// Check if the service worker can be found. If it can't reload the page. // Check if the service worker can be found. If it can't reload the page.
fetch(swUrl) fetch(swUrl)
.then((response) => { .then(response => {
// Ensure service worker exists, and that we really are getting a JS file. // Ensure service worker exists, and that we really are getting a JS file.
if ( if (
response.status === 404 || response.status === 404 ||
response.headers.get("content-type").indexOf("javascript") === -1 response.headers.get('content-type').indexOf('javascript') === -1
) { ) {
// No service worker found. Probably a different app. Reload the page. // No service worker found. Probably a different app. Reload the page.
navigator.serviceWorker.ready.then((registration) => { navigator.serviceWorker.ready.then(registration => {
registration.unregister().then(() => { registration.unregister().then(() => {
window.location.reload(); window.location.reload();
}); });
@@ -113,14 +113,14 @@ function checkValidServiceWorker(swUrl, config) {
}) })
.catch(() => { .catch(() => {
console.log( console.log(
"No internet connection found. App is running in offline mode." 'No internet connection found. App is running in offline mode.'
); );
}); });
} }
export function unregister() { export function unregister() {
if ("serviceWorker" in navigator) { if ('serviceWorker' in navigator) {
navigator.serviceWorker.ready.then((registration) => { navigator.serviceWorker.ready.then(registration => {
registration.unregister(); registration.unregister();
}); });
} }
+57 -58
View File
File diff suppressed because one or more lines are too long
+37 -62
View File
@@ -1,74 +1,49 @@
import React from "react"; import React from 'react';
const hrefStyle = { const hrefStyle = {
color: "#f85a3e", color: "#f85a3e",
textDecoration: "none", textDecoration: "none"
}; }
const About = () => { const About = () => {
return (
<div>
<h1>About</h1>
<p> return (
Endao was started as a project in late 2018 as a free service to analyze <div>
APK (and soon IPA) files for vulnerabilities. The project was started <h1>About</h1>
after I,
<a href="https://twitter.com/frikkylikeme" style={hrefStyle}>
@frikkylikeme
</a>
, found multiple vulnerabilities in IoT devices based purely on their
apps. As I wanted to learn more about these kind of vulnerabilities, I
looked for solutions that work for my purpose, but didn't find any good,
free and easy to use service - hence this site was born.
</p>
<p> <p>
My personal goal has and will always be to make the internet safer. As Endao was started as a project in late 2018 as a free service to analyze APK (and soon IPA) files for vulnerabilities. The project was started after I,
the IoT sphere grows, I want to be able to add ways of finding possible <a href="https://twitter.com/frikkylikeme" style={hrefStyle}>@frikkylikeme</a>
vulnerabilities fast to this website. This will hopefully include , found multiple vulnerabilities in IoT devices based purely on their apps. As I wanted to learn more about these kind of vulnerabilities, I looked for solutions that work for my purpose, but didn't find any good, free and easy to use service - hence this site was born.
blogposts when I get around to it, as well as actual implementations. </p>
The vulnerability discovery field is in no way new, but I'll try my best
to add whatever I can to it. As a disclaimer, I'm an "Ops" person, and I
had never done frontend before creating this site. This is as much of a
learning project within web development as it is in vulnerability
discovery.
</p>
<p>This site currently uses the following projects</p> <p>
<ul> My personal goal has and will always be to make the internet safer. As the IoT sphere grows, I want to be able to add ways of finding possible vulnerabilities fast to this website. This will hopefully include blogposts when I get around to it, as well as actual implementations. The vulnerability discovery field is in no way new, but I'll try my best to add whatever I can to it. As a disclaimer, I'm an "Ops" person, and I had never done frontend before creating this site. This is as much of a learning project within web development as it is in vulnerability discovery.
<li> </p>
<a style={hrefStyle} href="https://superanalyzer.rocks">
SUPER Android Analyzer
</a>
</li>
<li>
<a style={hrefStyle} href="https://github.com/linkedin/qark">
Qark
</a>
</li>
<li>
<a style={hrefStyle} href="https://virustotal.com">
Virustotal
</a>{" "}
for malware checks in known APKs
</li>
<li>Some selfmade gibberish</li>
</ul>
<p>Hopefully it is of use to some people :)</p> <p>
This site currently uses the following projects
</p>
<ul>
<li><a style={hrefStyle} href="https://superanalyzer.rocks">SUPER Android Analyzer</a></li>
<li><a style={hrefStyle} href="https://github.com/linkedin/qark">Qark</a></li>
<li><a style={hrefStyle} href="https://virustotal.com">Virustotal</a> for malware checks in known APKs</li>
<li>Some selfmade gibberish</li>
</ul>
<h3>Thanks</h3> <p>Hopefully it is of use to some people :)</p>
<p>Thanks to Andy for the initial frontend help :)</p>
<h3>Regards</h3> <h3>Thanks</h3>
<p> <p>
<a href="https://twitter.com/frikkylikeme" style={hrefStyle}> Thanks to Andy for the initial frontend help :)
@frikkylikeme </p>
</a>
</p> <h3>Regards</h3>
</div> <p>
); <a href="https://twitter.com/frikkylikeme" style={hrefStyle}>@frikkylikeme</a>
}; </p>
</div>
)
}
export default About; export default About;
+3101 -3951
View File
File diff suppressed because it is too large Load Diff
+189 -199
View File
@@ -1,233 +1,223 @@
/* eslint-disable react/no-multi-comp */ /* eslint-disable react/no-multi-comp */
import React, { useState } from "react"; import React, {useState} from 'react';
import { makeStyles } from "@material-ui/styles"; import { makeStyles } from '@material-ui/styles';
import { import {CircularProgress, TextField, Button, Paper, Typography} from '@material-ui/core'
CircularProgress,
TextField,
Button,
Paper,
Typography,
} from "@material-ui/core";
const bodyDivStyle = { const bodyDivStyle = {
margin: "auto", margin: "auto",
marginTop: "100px", marginTop: "100px",
width: "500px", width: "500px",
}; }
const surfaceColor = "#27292D"; const surfaceColor = "#27292D"
const inputColor = "#383B40"; const inputColor = "#383B40"
const boxStyle = { const boxStyle = {
paddingLeft: "30px", paddingLeft: "30px",
paddingRight: "30px", paddingRight: "30px",
paddingBottom: "30px", paddingBottom: "30px",
paddingTop: "30px", paddingTop: "30px",
backgroundColor: surfaceColor, backgroundColor: surfaceColor,
}; }
const useStyles = makeStyles({ const useStyles = makeStyles({
notchedOutline: { notchedOutline: {
borderColor: "#f85a3e !important", borderColor: "#f85a3e !important"
}, },
}); });
const AdminAccount = (props) => { const AdminAccount = props => {
const { globalUrl, isLoaded, isLoggedIn } = props; const { globalUrl, isLoaded, isLoggedIn, } = props;
const [username, setUsername] = useState(""); const [username, setUsername] = useState("");
const [password, setPassword] = useState(""); const [password, setPassword] = useState("");
const [firstRequest, setFirstRequest] = useState(true); const [firstRequest, setFirstRequest] = useState(true);
const [loginLoading, setLoginLoading] = useState(false); const [loginLoading, setLoginLoading] = useState(false);
// Used to swap from login to register. True = login, false = register // Used to swap from login to register. True = login, false = register
const register = true; const register = true
const classes = useStyles(); const classes = useStyles();
// Error messages etc // Error messages etc
const [loginInfo, setLoginInfo] = useState(""); const [loginInfo, setLoginInfo] = useState("");
const handleValidateForm = () => { const handleValidateForm = () => {
return username.length > 1 && password.length > 1; return (username.length > 1 && password.length > 1);
}; }
if (isLoggedIn === true) { if (isLoggedIn === true) {
window.location.pathname = "/workflows"; window.location.pathname = "/workflows"
} }
const checkAdmin = () => { const checkAdmin = () => {
const url = globalUrl + "/api/v1/checkusers"; const url = globalUrl+'/api/v1/checkusers';
fetch(url, { fetch(url, {
method: "GET", method: 'GET',
headers: { headers: {
"Content-Type": "application/json", 'Content-Type': 'application/json',
}, },
}) })
.then((response) => .then(response =>
response.json().then((responseJson) => { response.json().then(responseJson => {
if (responseJson["success"] === false) { if (responseJson["success"] === false) {
setLoginInfo(responseJson["reason"]); setLoginInfo(responseJson["reason"])
} else { } else {
if (responseJson.reason === "redirect") { if (responseJson.reason === "redirect") {
window.location.pathname = "/login"; window.location.pathname = "/login"
} }
} }
}) }),
) )
.catch((error) => { .catch(error => {
setLoginInfo("Error in userdata: ", error); setLoginInfo("Error in userdata: ", error)
}); })
}; }
if (firstRequest) { if (firstRequest) {
setFirstRequest(false); setFirstRequest(false)
checkAdmin(); checkAdmin()
} }
const onSubmit = (e) => { const onSubmit = (e) => {
setLoginLoading(true); setLoginLoading(true)
e.preventDefault(); e.preventDefault()
// FIXME - add some check here ROFL // FIXME - add some check here ROFL
// Just use this one? // Just use this one?
var data = { username: username, password: password }; var data = {"username": username, "password": password}
var baseurl = globalUrl; var baseurl = globalUrl
const url = baseurl + "/api/v1/register"; const url = baseurl+'/api/v1/register';
fetch(url, { fetch(url, {
method: "POST", method: 'POST',
body: JSON.stringify(data), body: JSON.stringify(data),
headers: { headers: {
"Content-Type": "application/json", 'Content-Type': 'application/json',
}, },
}) })
.then((response) => .then(response =>
response.json().then((responseJson) => { response.json().then(responseJson => {
setLoginLoading(false); setLoginLoading(false)
if (responseJson["success"] === false) { if (responseJson["success"] === false) {
setLoginInfo(responseJson["reason"]); setLoginInfo(responseJson["reason"])
} else { } else {
setLoginInfo("Successful register :)"); setLoginInfo("Successful register :)")
window.location.pathname = "/login"; window.location.pathname = "/login"
} }
}) }),
) )
.catch((error) => { .catch(error => {
setLoginLoading(false); setLoginLoading(false)
setLoginInfo("Error in userdata: ", error); setLoginInfo("Error in userdata: ", error)
}); });
}; }
const onChangeUser = (e) => { const onChangeUser = (e) => {
setUsername(e.target.value); setUsername(e.target.value)
}; }
const onChangePass = (e) => { const onChangePass = (e) => {
setPassword(e.target.value); setPassword(e.target.value)
}; }
//const onClickRegister = () => { //const onClickRegister = () => {
// if (props.location.pathname === "/login") { // if (props.location.pathname === "/login") {
// window.location.pathname = "/register" // window.location.pathname = "/register"
// } else { // } else {
// window.location.pathname = "/login" // window.location.pathname = "/login"
// } // }
// setLoginCheck(!register) // setLoginCheck(!register)
//} //}
//var loginChange = register ? (<div><p onClick={setLoginCheck(false)}>Want to register? Click here.</p></div>) : (<div><p onClick={setLoginCheck(true)}>Go back to login? Click here.</p></div>); //var loginChange = register ? (<div><p onClick={setLoginCheck(false)}>Want to register? Click here.</p></div>) : (<div><p onClick={setLoginCheck(true)}>Go back to login? Click here.</p></div>);
var formtitle = register ? <div>Login</div> : <div>Register</div>; var formtitle = register ? <div>Login</div> : <div>Register</div>
formtitle = "Create administrator account"; formtitle = "Create administrator account"
const basedata =
<div style={bodyDivStyle}>
<Paper style={boxStyle}>
<form onSubmit={onSubmit} style={{color: "white", margin: "15px 15px 15px 15px"}}>
<h2>{formtitle}</h2>
Username
<div>
<TextField
color="primary"
style={{backgroundColor: inputColor}}
autoFocus
InputProps={{
classes: {
notchedOutline: classes.notchedOutline,
},
style:{
height: "50px",
color: "white",
fontSize: "1em",
},
}}
required
fullWidth={true}
autoComplete="username"
placeholder="username@example.com"
id="emailfield"
margin="normal"
variant="outlined"
onChange={onChangeUser}
/>
</div>
Password
<div>
<TextField
color="primary"
style={{backgroundColor: inputColor,}}
InputProps={{
classes: {
notchedOutline: classes.notchedOutline,
},
style:{
height: "50px",
color: "white",
fontSize: "1em",
},
}}
required
id="outlined-password-input"
fullWidth={true}
type="password"
autoComplete="current-password"
placeholder="**********"
margin="normal"
variant="outlined"
onChange={onChangePass}
/>
</div>
<div style={{display: "flex", marginTop: "15px"}}>
<Button color="primary" variant="contained" type="submit" style={{flex: "1", marginRight: "5px"}} disabled={!handleValidateForm() || loginLoading}>
{loginLoading ? <CircularProgress color="secondary" style={{color: "white",}} /> : "SUBMIT"}
</Button>
</div>
<div style={{marginTop: "10px"}}>
{loginInfo}
</div>
</form>
</Paper>
</div>
const basedata = ( const loadedCheck = isLoaded ?
<div style={bodyDivStyle}> <div>
<Paper style={boxStyle}> {basedata}
<form </div>
onSubmit={onSubmit} :
style={{ color: "white", margin: "15px 15px 15px 15px" }} <div>
> </div>
<h2>{formtitle}</h2>
Username
<div>
<TextField
color="primary"
style={{ backgroundColor: inputColor }}
autoFocus
InputProps={{
classes: {
notchedOutline: classes.notchedOutline,
},
style: {
height: "50px",
color: "white",
fontSize: "1em",
},
}}
required
fullWidth={true}
autoComplete="username"
placeholder="username@example.com"
id="emailfield"
margin="normal"
variant="outlined"
onChange={onChangeUser}
/>
</div>
Password
<div>
<TextField
color="primary"
style={{ backgroundColor: inputColor }}
InputProps={{
classes: {
notchedOutline: classes.notchedOutline,
},
style: {
height: "50px",
color: "white",
fontSize: "1em",
},
}}
required
id="outlined-password-input"
fullWidth={true}
type="password"
autoComplete="current-password"
placeholder="**********"
margin="normal"
variant="outlined"
onChange={onChangePass}
/>
</div>
<div style={{ display: "flex", marginTop: "15px" }}>
<Button
color="primary"
variant="contained"
type="submit"
style={{ flex: "1", marginRight: "5px" }}
disabled={!handleValidateForm() || loginLoading}
>
{loginLoading ? (
<CircularProgress
color="secondary"
style={{ color: "white" }}
/>
) : (
"SUBMIT"
)}
</Button>
</div>
<div style={{ marginTop: "10px" }}>{loginInfo}</div>
</form>
</Paper>
</div>
);
const loadedCheck = isLoaded ? <div>{basedata}</div> : <div></div>; return (
<div>
return <div>{loadedCheck}</div>; {loadedCheck}
}; </div>
)
}
export default AdminAccount; export default AdminAccount;
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
+1537 -2082
View File
File diff suppressed because it is too large Load Diff
+324 -344
View File
@@ -1,365 +1,345 @@
import React, { useState } from "react"; import React, { useState } from 'react';
import { BrowserView, MobileView } from "react-device-detect"; import { BrowserView, MobileView } from "react-device-detect";
import Paper from "@material-ui/core/Paper"; import Paper from '@material-ui/core/Paper';
import Button from "@material-ui/core/Button"; import Button from '@material-ui/core/Button';
import TextField from "@material-ui/core/TextField"; import TextField from '@material-ui/core/TextField';
import { useTheme } from "@material-ui/core/styles"; import { useTheme } from '@material-ui/core/styles';
const bodyDivStyle = { const bodyDivStyle = {
margin: "auto", margin: "auto",
textAlign: "center", textAlign: "center",
width: "900px", width: "900px",
}; }
// Should be different if logged in :| // Should be different if logged in :|
const Contact = (props) => { const Contact = (props) => {
const { globalUrl, isLoaded } = props; const { globalUrl, isLoaded } = props;
const theme = useTheme();
const theme = useTheme(); const boxStyle = {
flex: "1",
marginLeft: "10px",
marginRight: "10px",
paddingLeft: "30px",
paddingRight: "30px",
paddingBottom: "30px",
paddingTop: "30px",
backgroundColor: theme.palette.surfaceColor,
display: "flex",
flexDirection: "column"
}
const boxStyle = { const bodyTextStyle = {
flex: "1", color: "#ffffff",
marginLeft: "10px", }
marginRight: "10px",
paddingLeft: "30px",
paddingRight: "30px",
paddingBottom: "30px",
paddingTop: "30px",
backgroundColor: theme.palette.surfaceColor,
display: "flex",
flexDirection: "column",
};
const bodyTextStyle = { const [firstname, setFirstname] = useState("");
color: "#ffffff", const [lastname, setLastname] = useState("");
}; const [title, setTitle] = useState("");
const [companyname, setCompanyname] = useState("");
const [email, setEmail] = useState("");
const [phone, setPhone] = useState("");
const [message, setMessage] = useState("");
const [firstname, setFirstname] = useState(""); const [formMessage, setFormMessage] = useState("");
const [lastname, setLastname] = useState("");
const [title, setTitle] = useState("");
const [companyname, setCompanyname] = useState("");
const [email, setEmail] = useState("");
const [phone, setPhone] = useState("");
const [message, setMessage] = useState("");
const [formMessage, setFormMessage] = useState(""); const submitContact = () => {
const data = {
"firstname": firstname,
"lastname": lastname,
"title": title,
"companyname": companyname,
"email": email,
"phone": phone,
"message": message,
}
console.log(data)
const submitContact = () => { fetch(globalUrl + "/api/v1/contact", {
const data = { method: 'POST',
firstname: firstname, headers: {
lastname: lastname, 'Content-Type': 'application/json',
title: title, },
companyname: companyname, body: JSON.stringify(data),
email: email, })
phone: phone, .then(response => response.json())
message: message, .then(response => {
}; if (response.success === true) {
console.log(data); setFormMessage(response.message)
} else {
setFormMessage("Something went wrong. Please contact frikky@shuffler.io.")
}
console.log(response)
})
.catch(error => {
console.log(error)
});
}
fetch(globalUrl + "/api/v1/contact", { // Random names for type & autoComplete. Didn't research :^)
method: "POST", const landingpageDataBrowser =
headers: { <div>
"Content-Type": "application/json", <div style={bodyTextStyle}>
}, <h3 style={{ color: "#f85a3e" }}>Contact us</h3>
body: JSON.stringify(data), <h2>Lets talk!</h2>
}) </div>
.then((response) => response.json()) <div style={{ display: "flex" }}>
.then((response) => { <Paper style={boxStyle}>
if (response.success === true) { <h2>Contact Details</h2>
setFormMessage(response.message); <div style={{ flex: "1", display: "flex", flexDirection: "row" }}>
} else { <TextField
setFormMessage( required
"Something went wrong. Please contact frikky@shuffler.io." style={{ flex: "1", marginRight: "15px", backgroundColor: theme.palette.inputColor }}
); InputProps={{
} style: {
console.log(response); color: "white",
}) },
.catch((error) => { }}
console.log(error); color="primary"
}); fullWidth={true}
}; placeholder="First Name"
type="firstname"
id="standard-required"
autoComplete="firstname"
margin="normal"
variant="outlined"
onChange={e => setFirstname(e.target.value)}
/>
<TextField
style={{ flex: "1", marginLeft: "15px", backgroundColor: theme.palette.inputColor }}
InputProps={{
style: {
color: "white",
},
}}
color="primary"
fullWidth={true}
placeholder="Last Name"
type="lastname"
id="standard"
autoComplete="lastname"
margin="normal"
variant="outlined"
onChange={e => setLastname(e.target.value)}
/>
</div>
<div style={{ flex: "1", display: "flex", flexDirection: "row" }}>
<TextField
style={{ flex: "1", marginRight: "15px", backgroundColor: theme.palette.inputColor }}
InputProps={{
style: {
color: "white",
},
}}
color="primary"
fullWidth={true}
placeholder="Job Title"
type="jobtitle"
id="standard-required"
autoComplete="jobtitle"
margin="normal"
variant="outlined"
onChange={e => setTitle(e.target.value)}
/>
<TextField
style={{ flex: "1", marginLeft: "15px", backgroundColor: theme.palette.inputColor }}
InputProps={{
style: {
color: "white",
},
}}
color="primary"
fullWidth={true}
type="companyname"
placeholder="Company Name"
id="standard-required"
autoComplete="companyname"
margin="normal"
variant="outlined"
onChange={e => setCompanyname(e.target.value)}
/>
</div>
<div style={{ flex: "1", display: "flex", flexDirection: "row" }}>
<TextField
required
style={{ flex: "1", marginRight: "15px", backgroundColor: theme.palette.inputColor }}
InputProps={{
style: {
color: "white",
},
}}
color="primary"
fullWidth={true}
placeholder="Email"
type="email"
id="standard-required"
autoComplete="email"
margin="normal"
variant="outlined"
onChange={e => setEmail(e.target.value)}
/>
<TextField
style={{ flex: "1", marginLeft: "15px", backgroundColor: theme.palette.inputColor }}
InputProps={{
style: {
color: "white",
},
}}
color="primary"
fullWidth={true}
type="phone"
placeholder="Phone number"
id="standard-required"
autoComplete="phone"
margin="normal"
variant="outlined"
onChange={e => setPhone(e.target.value)}
/>
</div>
<div style={{ flex: 1 }}>
<h2>Message</h2>
</div>
<div style={{ flex: 4 }}>
<TextField
multiline
InputProps={{
style: {
color: "white",
},
}}
color="primary"
style={{ flex: "1", backgroundColor: theme.palette.inputColor }}
rows="6"
fullWidth={true}
placeholder="What can we help you with?"
id="filled-multiline-static"
margin="normal"
variant="outlined"
onChange={e => setMessage(e.target.value)}
/>
</div>
<Button
disabled={email.length <= 0 || message.length <= 0}
style={{ width: "100%", height: "60px", marginTop: "10px" }}
variant="contained"
color="primary"
onClick={submitContact}
>
Submit
</Button>
<h3>{formMessage}</h3>
</Paper>
</div>
</div>
// Random names for type & autoComplete. Didn't research :^) const landingpageDataMobile =
const landingpageDataBrowser = ( <div style={{ paddingBottom: "50px" }}>
<div> <div style={{ color: "white", textAlign: "center" }}>
<div style={bodyTextStyle}> <h3 style={{ color: "#f85a3e" }}>Contact us</h3>
<h3 style={{ color: "#f85a3e" }}>Contact us</h3> <h2>Lets talk!</h2>
<h2>Lets talk!</h2> </div>
</div> <div style={{ display: "flex" }}>
<div style={{ display: "flex" }}> <Paper style={boxStyle}>
<Paper style={boxStyle}> <h2>Contact Details</h2>
<h2>Contact Details</h2> <div style={{ flex: "1", display: "flex", flexDirection: "row" }}>
<div style={{ flex: "1", display: "flex", flexDirection: "row" }}> <TextField
<TextField required
required style={{ flex: "1", backgroundColor: theme.palette.inputColor }}
style={{ InputProps={{
flex: "1", style: {
marginRight: "15px", color: "white",
backgroundColor: theme.palette.inputColor, },
}} }}
InputProps={{ color="primary"
style: { fullWidth={true}
color: "white", placeholder="Name"
}, type="firstname"
}} id="standard-required"
color="primary" autoComplete="firstname"
fullWidth={true} margin="normal"
placeholder="First Name" variant="outlined"
type="firstname" onChange={e => setFirstname(e.target.value)}
id="standard-required" />
autoComplete="firstname" </div>
margin="normal" <div style={{ flex: "1", display: "flex", flexDirection: "row" }}>
variant="outlined" <TextField
onChange={(e) => setFirstname(e.target.value)} required
/> style={{ flex: "1", backgroundColor: theme.palette.inputColor }}
<TextField InputProps={{
style={{ style: {
flex: "1", color: "white",
marginLeft: "15px", },
backgroundColor: theme.palette.inputColor, }}
}} color="primary"
InputProps={{ fullWidth={true}
style: { placeholder="Email"
color: "white", type="email"
}, id="standard-required"
}} autoComplete="email"
color="primary" margin="normal"
fullWidth={true} variant="outlined"
placeholder="Last Name" onChange={e => setEmail(e.target.value)}
type="lastname" />
id="standard" </div>
autoComplete="lastname" <div style={{ flex: 1 }}>
margin="normal" <h2>Message</h2>
variant="outlined" </div>
onChange={(e) => setLastname(e.target.value)} <div style={{ flex: 4 }}>
/> <TextField
</div> multiline
<div style={{ flex: "1", display: "flex", flexDirection: "row" }}> style={{ flex: "1", backgroundColor: theme.palette.inputColor }}
<TextField InputProps={{
style={{ style: {
flex: "1", color: "white",
marginRight: "15px", },
backgroundColor: theme.palette.inputColor, }}
}} color="primary"
InputProps={{ rows="6"
style: { fullWidth={true}
color: "white", placeholder="What can we help you with?"
}, id="filled-multiline-static"
}} margin="normal"
color="primary" variant="outlined"
fullWidth={true} onChange={e => setMessage(e.target.value)}
placeholder="Job Title" />
type="jobtitle" </div>
id="standard-required" <Button
autoComplete="jobtitle" disabled={email.length <= 0 || message.length <= 0}
margin="normal" style={{ width: "100%", height: "60px", marginTop: "10px" }}
variant="outlined" variant="contained"
onChange={(e) => setTitle(e.target.value)} color="primary"
/> onClick={submitContact}
<TextField >
style={{ Submit
flex: "1", </Button>
marginLeft: "15px", <h3>{formMessage}</h3>
backgroundColor: theme.palette.inputColor, </Paper>
}} </div>
InputProps={{ </div>
style: {
color: "white",
},
}}
color="primary"
fullWidth={true}
type="companyname"
placeholder="Company Name"
id="standard-required"
autoComplete="companyname"
margin="normal"
variant="outlined"
onChange={(e) => setCompanyname(e.target.value)}
/>
</div>
<div style={{ flex: "1", display: "flex", flexDirection: "row" }}>
<TextField
required
style={{
flex: "1",
marginRight: "15px",
backgroundColor: theme.palette.inputColor,
}}
InputProps={{
style: {
color: "white",
},
}}
color="primary"
fullWidth={true}
placeholder="Email"
type="email"
id="standard-required"
autoComplete="email"
margin="normal"
variant="outlined"
onChange={(e) => setEmail(e.target.value)}
/>
<TextField
style={{
flex: "1",
marginLeft: "15px",
backgroundColor: theme.palette.inputColor,
}}
InputProps={{
style: {
color: "white",
},
}}
color="primary"
fullWidth={true}
type="phone"
placeholder="Phone number"
id="standard-required"
autoComplete="phone"
margin="normal"
variant="outlined"
onChange={(e) => setPhone(e.target.value)}
/>
</div>
<div style={{ flex: 1 }}>
<h2>Message</h2>
</div>
<div style={{ flex: 4 }}>
<TextField
multiline
InputProps={{
style: {
color: "white",
},
}}
color="primary"
style={{ flex: "1", backgroundColor: theme.palette.inputColor }}
rows="6"
fullWidth={true}
placeholder="What can we help you with?"
id="filled-multiline-static"
margin="normal"
variant="outlined"
onChange={(e) => setMessage(e.target.value)}
/>
</div>
<Button
disabled={email.length <= 0 || message.length <= 0}
style={{ width: "100%", height: "60px", marginTop: "10px" }}
variant="contained"
color="primary"
onClick={submitContact}
>
Submit
</Button>
<h3>{formMessage}</h3>
</Paper>
</div>
</div>
);
const landingpageDataMobile = (
<div style={{ paddingBottom: "50px" }}>
<div style={{ color: "white", textAlign: "center" }}>
<h3 style={{ color: "#f85a3e" }}>Contact us</h3>
<h2>Lets talk!</h2>
</div>
<div style={{ display: "flex" }}>
<Paper style={boxStyle}>
<h2>Contact Details</h2>
<div style={{ flex: "1", display: "flex", flexDirection: "row" }}>
<TextField
required
style={{ flex: "1", backgroundColor: theme.palette.inputColor }}
InputProps={{
style: {
color: "white",
},
}}
color="primary"
fullWidth={true}
placeholder="Name"
type="firstname"
id="standard-required"
autoComplete="firstname"
margin="normal"
variant="outlined"
onChange={(e) => setFirstname(e.target.value)}
/>
</div>
<div style={{ flex: "1", display: "flex", flexDirection: "row" }}>
<TextField
required
style={{ flex: "1", backgroundColor: theme.palette.inputColor }}
InputProps={{
style: {
color: "white",
},
}}
color="primary"
fullWidth={true}
placeholder="Email"
type="email"
id="standard-required"
autoComplete="email"
margin="normal"
variant="outlined"
onChange={(e) => setEmail(e.target.value)}
/>
</div>
<div style={{ flex: 1 }}>
<h2>Message</h2>
</div>
<div style={{ flex: 4 }}>
<TextField
multiline
style={{ flex: "1", backgroundColor: theme.palette.inputColor }}
InputProps={{
style: {
color: "white",
},
}}
color="primary"
rows="6"
fullWidth={true}
placeholder="What can we help you with?"
id="filled-multiline-static"
margin="normal"
variant="outlined"
onChange={(e) => setMessage(e.target.value)}
/>
</div>
<Button
disabled={email.length <= 0 || message.length <= 0}
style={{ width: "100%", height: "60px", marginTop: "10px" }}
variant="contained"
color="primary"
onClick={submitContact}
>
Submit
</Button>
<h3>{formMessage}</h3>
</Paper>
</div>
</div>
);
const loadedCheck = isLoaded ? ( const loadedCheck = isLoaded ?
<div> <div>
<BrowserView> <BrowserView>
<div style={bodyDivStyle}>{landingpageDataBrowser}</div> <div style={bodyDivStyle}>{landingpageDataBrowser}</div>
</BrowserView> </BrowserView>
<MobileView>{landingpageDataMobile}</MobileView> <MobileView>
</div> {landingpageDataMobile}
) : ( </MobileView>
<div></div> </div>
); :
<div>
</div>
return <div>{loadedCheck}</div>; return (
}; <div>
{loadedCheck}
</div>
)
}
export default Contact; export default Contact;
+398 -401
View File
@@ -1,5 +1,5 @@
import React, { useState } from "react"; import React, {useState} from 'react';
import { useInterval } from "react-powerhooks"; import { useInterval } from 'react-powerhooks';
// nodejs library that concatenates classes // nodejs library that concatenates classes
import classNames from "classnames"; import classNames from "classnames";
// react plugin used to create charts // react plugin used to create charts
@@ -26,7 +26,7 @@ import {
Table, Table,
Row, Row,
Col, Col,
UncontrolledTooltip, UncontrolledTooltip
} from "reactstrap"; } from "reactstrap";
// core components // core components
@@ -34,433 +34,430 @@ import {
chartExample1, chartExample1,
chartExample2, chartExample2,
chartExample3, chartExample3,
chartExample4, chartExample4
} from "../charts.js"; } from "../charts.js";
// This is the start of a dashboard that can be used. // This is the start of a dashboard that can be used.
// What data do we fill in here? Idk // What data do we fill in here? Idk
const Dashboard = (props) => { const Dashboard = (props) => {
const { globalUrl } = props; const { globalUrl } = props;
const alert = useAlert(); const alert = useAlert()
const [bigChartData, setBgChartData] = useState("data1"); const [bigChartData, setBgChartData] = useState("data1");
const [dayAmount, setDayAmount] = useState(7); const [dayAmount, setDayAmount] = useState(7);
const [firstRequest, setFirstRequest] = useState(true); const [firstRequest, setFirstRequest] = useState(true);
const [stats, setStats] = useState({}); const [stats, setStats] = useState({})
const [changeme, setChangeme] = useState(""); const [changeme, setChangeme] = useState("")
const [statsRan, setStatsRan] = useState(false); const [statsRan, setStatsRan] = useState(false)
document.title = "Shuffle - dashboard"
var dayGraphLabels = [60, 80, 65, 130, 80, 105, 90, 130, 70, 115, 60, 130]
var dayGraphData = [60, 80, 65, 130, 80, 105, 90, 130, 70, 115, 60, 130]
document.title = "Shuffle - dashboard"; const fetchdata = (stats_id) => {
var dayGraphLabels = [60, 80, 65, 130, 80, 105, 90, 130, 70, 115, 60, 130]; fetch(globalUrl+"/api/v1/stats/"+stats_id, {
var dayGraphData = [60, 80, 65, 130, 80, 105, 90, 130, 70, 115, 60, 130]; method: 'GET',
headers: {
const fetchdata = (stats_id) => { 'Content-Type': 'application/json',
fetch(globalUrl + "/api/v1/stats/" + stats_id, { 'Accept': 'application/json',
method: "GET", },
headers: { credentials: "include",
"Content-Type": "application/json",
Accept: "application/json",
},
credentials: "include",
}) })
.then((response) => { .then((response) => {
if (response.status !== 200) { if (response.status !== 200) {
console.log("Status not 200 for " + stats_id); console.log("Status not 200 for "+stats_id)
} }
return response.json(); return response.json()
}) })
.then((responseJson) => { .then((responseJson) => {
stats[stats_id] = responseJson; stats[stats_id] = responseJson
setStats(stats); setStats(stats)
// Used to force updates // Used to force updates
setChangeme(stats_id); setChangeme(stats_id)
}) })
.catch((error) => { .catch(error => {
alert.error("ERROR: " + error.toString()); alert.error("ERROR: "+error.toString())
}); });
}; }
let chart1_2_options = { let chart1_2_options = {
maintainAspectRatio: false, maintainAspectRatio: false,
legend: { legend: {
display: false, display: false
}, },
tooltips: { tooltips: {
backgroundColor: "#f5f5f5", backgroundColor: "#f5f5f5",
titleFontColor: "#333", titleFontColor: "#333",
bodyFontColor: "#666", bodyFontColor: "#666",
bodySpacing: 4, bodySpacing: 4,
xPadding: 12, xPadding: 12,
mode: "nearest", mode: "nearest",
intersect: 0, intersect: 0,
position: "nearest", position: "nearest"
}, },
responsive: true, responsive: true,
scales: { scales: {
yAxes: [ yAxes: [
{ {
barPercentage: 1.6, barPercentage: 1.6,
gridLines: { gridLines: {
drawBorder: false, drawBorder: false,
color: "rgba(29,140,248,0.0)", color: "rgba(29,140,248,0.0)",
zeroLineColor: "transparent", zeroLineColor: "transparent"
}, },
ticks: { ticks: {
suggestedMin: 60, suggestedMin: 60,
suggestedMax: 125, suggestedMax: 125,
padding: 20, padding: 20,
fontColor: "#9a9a9a", fontColor: "#9a9a9a"
}, }
}, }
], ],
xAxes: [ xAxes: [
{ {
barPercentage: 1.6, barPercentage: 1.6,
gridLines: { gridLines: {
drawBorder: false, drawBorder: false,
color: "rgba(29,140,248,0.1)", color: "rgba(29,140,248,0.1)",
zeroLineColor: "transparent", zeroLineColor: "transparent"
}, },
ticks: { ticks: {
padding: 20, padding: 20,
fontColor: "#9a9a9a", fontColor: "#9a9a9a"
}, }
}, }
], ]
}, }
}; }
const dayGraph = { const dayGraph = {
data: (canvas) => { data: canvas => {
let ctx = canvas.getContext("2d"); let ctx = canvas.getContext("2d");
let gradientStroke = ctx.createLinearGradient(0, 230, 0, 50); let gradientStroke = ctx.createLinearGradient(0, 230, 0, 50);
gradientStroke.addColorStop(1, "rgba(29,140,248,0.2)"); gradientStroke.addColorStop(1, "rgba(29,140,248,0.2)");
gradientStroke.addColorStop(0.4, "rgba(29,140,248,0.0)"); gradientStroke.addColorStop(0.4, "rgba(29,140,248,0.0)");
gradientStroke.addColorStop(0, "rgba(29,140,248,0)"); //blue colors gradientStroke.addColorStop(0, "rgba(29,140,248,0)"); //blue colors
return { return {
labels: dayGraphLabels, labels: dayGraphLabels,
datasets: [ datasets: [
{ {
label: "My First dataset", label: "My First dataset",
fill: true, fill: true,
backgroundColor: gradientStroke, backgroundColor: gradientStroke,
borderColor: "#1f8ef1", borderColor: "#1f8ef1",
borderWidth: 2, borderWidth: 2,
borderDash: [], borderDash: [],
borderDashOffset: 0.0, borderDashOffset: 0.0,
pointBackgroundColor: "#1f8ef1", pointBackgroundColor: "#1f8ef1",
pointBorderColor: "rgba(255,255,255,0)", pointBorderColor: "rgba(255,255,255,0)",
pointHoverBackgroundColor: "#1f8ef1", pointHoverBackgroundColor: "#1f8ef1",
pointBorderWidth: 20, pointBorderWidth: 20,
pointHoverRadius: 4, pointHoverRadius: 4,
pointHoverBorderWidth: 15, pointHoverBorderWidth: 15,
pointRadius: 4, pointRadius: 4,
data: dayGraphData, data: dayGraphData,
}, }
], ]
}; }
}, },
options: chart1_2_options, options: chart1_2_options,
}; }
// All these are currently tracked. // All these are currently tracked.
const variables = [ const variables = [
"backend_executions", "backend_executions",
"workflow_executions", "workflow_executions",
"workflow_executions_aborted", "workflow_executions_aborted",
"workflow_executions_success", "workflow_executions_success",
"total_apps_created", "total_apps_created",
"total_apps_loaded", "total_apps_loaded",
"openapi_apps_created", "openapi_apps_created",
"total_apps_deleted", "total_apps_deleted",
"total_webhooks_ran", "total_webhooks_ran",
"total_workflows", "total_workflows",
"total_workflow_actions", "total_workflow_actions",
"total_workflow_triggers", "total_workflow_triggers",
]; ]
const runUpdate = () => { const runUpdate = () => {
for (var key in variables) { for (var key in variables) {
fetchdata(variables[key]); fetchdata(variables[key])
} }
}; }
// Refresh every 60 seconds // Refresh every 60 seconds
const autoUpdate = 60000; const autoUpdate = 60000
const { start, stop } = useInterval({ const { start, stop } = useInterval({
duration: autoUpdate, duration: autoUpdate,
startImmediate: false, startImmediate: false,
callback: () => { callback: () => {
runUpdate(); runUpdate()
}, }
}); })
if (firstRequest) { if (firstRequest) {
console.log("HELO"); console.log("HELO")
setFirstRequest(false); setFirstRequest(false)
start(); start()
runUpdate(); runUpdate()
} else if (!statsRan) { } else if (!statsRan) {
// FIXME: Run this under runUpdate schedule? // FIXME: Run this under runUpdate schedule?
// 1. Fix labels in dayGraphy.data // 1. Fix labels in dayGraphy.data
// 2. Add data to the daygraph // 2. Add data to the daygraph
// Every time there's an update :)
// Every time there's an update :) // This should probably be done in the backend.. bleh
if (stats["workflow_executions"] !== undefined && stats["workflow_executions"] !== null && stats["workflow_executions"].data !== undefined) {
setStatsRan(true)
//console.log("NEW DATA?: ", stats)
console.log('SET WORKFLOW: ', stats["workflow_executions"])
//var curday = startDate.getDate()
// This should probably be done in the backend.. bleh // Index = what day are we on
if (
stats["workflow_executions"] !== undefined &&
stats["workflow_executions"] !== null &&
stats["workflow_executions"].data !== undefined
) {
setStatsRan(true);
//console.log("NEW DATA?: ", stats)
console.log("SET WORKFLOW: ", stats["workflow_executions"]);
//var curday = startDate.getDate()
// Index = what day are we on // 0 = today
var newDayGraphLabels = []
var newDayGraphData = []
for (var i = dayAmount; i > 0; i--) {
var enddate = new Date()
enddate.setDate(-i)
enddate.setHours(23,59,59,999)
// 0 = today var startdate = new Date()
var newDayGraphLabels = []; startdate.setDate(-i)
var newDayGraphData = []; startdate.setHours(0,0,0,0)
for (var i = dayAmount; i > 0; i--) {
var enddate = new Date();
enddate.setDate(-i);
enddate.setHours(23, 59, 59, 999);
var startdate = new Date(); var endtime = enddate.getTime()/1000
startdate.setDate(-i); var starttime = startdate.getTime()/1000
startdate.setHours(0, 0, 0, 0);
var endtime = enddate.getTime() / 1000; console.log("START: ", starttime, "END: ", endtime, "Data: ", stats["workflow_executions"])
var starttime = startdate.getTime() / 1000; for (var key in stats["workflow_executions"].data) {
const item = stats["workflow_executions"]["data"][key]
console.log("ITEM: ", item.timestamp, endtime)
console.log(endtime-starttime)
if (endtime-starttime > endtime-item.timestamp && endtime.timestamp >= 0) {
console.log("HIT? ")
}
console.log(item.timestamp-endtime)
//console.log(item.timestamp-endtime)
break
if (item.timestamp > endtime && item.timestamp < starttime) {
if (newDayGraphData[i-1] === undefined) {
newDayGraphData[i-1] = 1
} else {
newDayGraphData[i-1] += 1
}
console.log( //break
"START: ", }
starttime, }
"END: ",
endtime, newDayGraphLabels.push(i)
"Data: ", }
stats["workflow_executions"]
);
for (var key in stats["workflow_executions"].data) {
const item = stats["workflow_executions"]["data"][key];
console.log("ITEM: ", item.timestamp, endtime);
console.log(endtime - starttime);
if (
endtime - starttime > endtime - item.timestamp &&
endtime.timestamp >= 0
) {
console.log("HIT? ");
}
console.log(item.timestamp - endtime);
//console.log(item.timestamp-endtime)
break;
if (item.timestamp > endtime && item.timestamp < starttime) {
if (newDayGraphData[i - 1] === undefined) {
newDayGraphData[i - 1] = 1;
} else {
newDayGraphData[i - 1] += 1;
}
//break console.log(newDayGraphLabels)
} console.log(newDayGraphData)
} }
}
newDayGraphLabels.push(i); const newdata = Object.getOwnPropertyNames(stats).length > 0 ?
} <div>
Autoupdate every {autoUpdate/1000} seconds
{variables.map(data => {
if (stats[data] === undefined || stats[data] === null) {
return null
}
console.log(newDayGraphLabels); if (stats[data].total === undefined) {
console.log(newDayGraphData); return null
} }
}
const newdata = return (
Object.getOwnPropertyNames(stats).length > 0 ? ( <div>
<div> {data}: {stats[data].total}
Autoupdate every {autoUpdate / 1000} seconds </div>
{variables.map((data) => { )
if (stats[data] === undefined || stats[data] === null) { })}
return null; </div>
} : null
if (stats[data].total === undefined) { const data =
return null; <div className="content">
} {newdata}
<Row>
<Col xs="12">
<div className="chart-area">
<Line
data={dayGraph.data}
options={dayGraph.options}
/>
</div>
</Col>
<Col xs="12">
<Card className="card-chart">
<CardHeader>
<Row>
<Col className="text-left" sm="6">
<h5 className="card-category">Total Shipments</h5>
<CardTitle tag="h2">Workflows</CardTitle>
</Col>
<Col sm="6">
<ButtonGroup
className="btn-group-toggle float-right"
data-toggle="buttons"
>
<Button
tag="label"
className={classNames("btn-simple", {
active: bigChartData === "data1"
})}
color="info"
id="0"
size="sm"
onClick={() => setBgChartData("data1")}
>
<input
defaultChecked
className="d-none"
name="options"
type="radio"
/>
<span className="d-none d-sm-block d-md-block d-lg-block d-xl-block">
Accounts
</span>
<span className="d-block d-sm-none">
<i className="tim-icons icon-single-02" />
</span>
</Button>
<Button
color="info"
id="1"
size="sm"
tag="label"
className={classNames("btn-simple", {
active: bigChartData === "data2"
})}
onClick={() => setBgChartData("data2")}
>
<input
className="d-none"
name="options"
type="radio"
/>
<span className="d-none d-sm-block d-md-block d-lg-block d-xl-block">
Purchases
</span>
<span className="d-block d-sm-none">
<i className="tim-icons icon-gift-2" />
</span>
</Button>
<Button
color="info"
id="2"
size="sm"
tag="label"
className={classNames("btn-simple", {
active: bigChartData === "data3"
})}
onClick={() => setBgChartData("data3")}
>
<input
className="d-none"
name="options"
type="radio"
/>
<span className="d-none d-sm-block d-md-block d-lg-block d-xl-block">
Sessions
</span>
<span className="d-block d-sm-none">
<i className="tim-icons icon-tap-02" />
</span>
</Button>
</ButtonGroup>
</Col>
</Row>
</CardHeader>
<CardBody>
<div className="chart-area">
<Line
data={chartExample1[bigChartData]}
options={chartExample1.options}
/>
</div>
</CardBody>
</Card>
</Col>
</Row>
<Row>
<Col lg="4">
<Card className="card-chart">
<CardHeader>
<h5 className="card-category">Total Shipments</h5>
<CardTitle tag="h3">
<i className="tim-icons icon-bell-55 text-info" />{" "}
763,215
</CardTitle>
</CardHeader>
<CardBody>
<div className="chart-area">
<Line
data={chartExample2.data}
options={chartExample2.options}
/>
</div>
</CardBody>
</Card>
</Col>
<Col lg="4">
<Card className="card-chart">
<CardHeader>
<h5 className="card-category">Daily Sales</h5>
<CardTitle tag="h3">
<i className="tim-icons icon-delivery-fast text-primary" />{" "}
3,500
</CardTitle>
</CardHeader>
<CardBody>
<div className="chart-area">
<Bar
data={chartExample3.data}
options={chartExample3.options}
/>
</div>
</CardBody>
</Card>
</Col>
<Col lg="4">
<Card className="card-chart">
<CardHeader>
<h5 className="card-category">Completed Tasks</h5>
<CardTitle tag="h3">
<i className="tim-icons icon-send text-success" /> 12,100K
</CardTitle>
</CardHeader>
<CardBody>
<div className="chart-area">
<Line
data={chartExample4.data}
options={chartExample4.options}
/>
</div>
</CardBody>
</Card>
</Col>
</Row>
</div>
return ( const dataWrapper =
<div> <div style={{maxWidth: 1366, margin: "auto"}}>
{data}: {stats[data].total} {data}
</div> </div>
);
})}
</div>
) : null;
const data = ( return dataWrapper
<div className="content"> }
{newdata}
<Row>
<Col xs="12">
<div className="chart-area">
<Line data={dayGraph.data} options={dayGraph.options} />
</div>
</Col>
<Col xs="12">
<Card className="card-chart">
<CardHeader>
<Row>
<Col className="text-left" sm="6">
<h5 className="card-category">Total Shipments</h5>
<CardTitle tag="h2">Workflows</CardTitle>
</Col>
<Col sm="6">
<ButtonGroup
className="btn-group-toggle float-right"
data-toggle="buttons"
>
<Button
tag="label"
className={classNames("btn-simple", {
active: bigChartData === "data1",
})}
color="info"
id="0"
size="sm"
onClick={() => setBgChartData("data1")}
>
<input
defaultChecked
className="d-none"
name="options"
type="radio"
/>
<span className="d-none d-sm-block d-md-block d-lg-block d-xl-block">
Accounts
</span>
<span className="d-block d-sm-none">
<i className="tim-icons icon-single-02" />
</span>
</Button>
<Button
color="info"
id="1"
size="sm"
tag="label"
className={classNames("btn-simple", {
active: bigChartData === "data2",
})}
onClick={() => setBgChartData("data2")}
>
<input className="d-none" name="options" type="radio" />
<span className="d-none d-sm-block d-md-block d-lg-block d-xl-block">
Purchases
</span>
<span className="d-block d-sm-none">
<i className="tim-icons icon-gift-2" />
</span>
</Button>
<Button
color="info"
id="2"
size="sm"
tag="label"
className={classNames("btn-simple", {
active: bigChartData === "data3",
})}
onClick={() => setBgChartData("data3")}
>
<input className="d-none" name="options" type="radio" />
<span className="d-none d-sm-block d-md-block d-lg-block d-xl-block">
Sessions
</span>
<span className="d-block d-sm-none">
<i className="tim-icons icon-tap-02" />
</span>
</Button>
</ButtonGroup>
</Col>
</Row>
</CardHeader>
<CardBody>
<div className="chart-area">
<Line
data={chartExample1[bigChartData]}
options={chartExample1.options}
/>
</div>
</CardBody>
</Card>
</Col>
</Row>
<Row>
<Col lg="4">
<Card className="card-chart">
<CardHeader>
<h5 className="card-category">Total Shipments</h5>
<CardTitle tag="h3">
<i className="tim-icons icon-bell-55 text-info" /> 763,215
</CardTitle>
</CardHeader>
<CardBody>
<div className="chart-area">
<Line
data={chartExample2.data}
options={chartExample2.options}
/>
</div>
</CardBody>
</Card>
</Col>
<Col lg="4">
<Card className="card-chart">
<CardHeader>
<h5 className="card-category">Daily Sales</h5>
<CardTitle tag="h3">
<i className="tim-icons icon-delivery-fast text-primary" />{" "}
3,500
</CardTitle>
</CardHeader>
<CardBody>
<div className="chart-area">
<Bar
data={chartExample3.data}
options={chartExample3.options}
/>
</div>
</CardBody>
</Card>
</Col>
<Col lg="4">
<Card className="card-chart">
<CardHeader>
<h5 className="card-category">Completed Tasks</h5>
<CardTitle tag="h3">
<i className="tim-icons icon-send text-success" /> 12,100K
</CardTitle>
</CardHeader>
<CardBody>
<div className="chart-area">
<Line
data={chartExample4.data}
options={chartExample4.options}
/>
</div>
</CardBody>
</Card>
</Col>
</Row>
</div>
);
const dataWrapper = ( export default Dashboard
<div style={{ maxWidth: 1366, margin: "auto" }}>{data}</div>
);
return dataWrapper;
};
export default Dashboard;
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+325 -352
View File
@@ -1,393 +1,366 @@
import React, { useState, useEffect } from "react"; import React, {useState, useEffect} from 'react';
import Button from "@material-ui/core/Button"; import Button from '@material-ui/core/Button';
import Paper from "@material-ui/core/Paper"; import Paper from '@material-ui/core/Paper';
import Divider from "@material-ui/core/Divider"; import Divider from '@material-ui/core/Divider';
import Select from "@material-ui/core/Select"; import Select from '@material-ui/core/Select';
import MenuItem from "@material-ui/core/MenuItem"; import MenuItem from '@material-ui/core/MenuItem';
import WebhookImage from "../assets/img/webhook.png"; import WebhookImage from '../assets/img/webhook.png';
import KafkaImage from "../assets/img/kafka.png"; import KafkaImage from '../assets/img/kafka.png';
import EditWorkflow from "./EditWorkflow"; import EditWorkflow from "./EditWorkflow";
const EditWebhook = (props) => { const EditWebhook = (props) => {
const { globalUrl, isLoaded } = props; const { globalUrl, isLoaded } = props;
// FIXME // FIXME
//const [webhookData, setWebhookData] = useState(webhooktest) //const [webhookData, setWebhookData] = useState(webhooktest)
const [webhookData, setWebhookData] = useState({}); const [webhookData, setWebhookData] = useState({})
const [workflows, setWorkflows] = useState([]); const [workflows, setWorkflows] = useState([])
const [firstrequest, setFirstrequest] = React.useState(true); const [firstrequest, setFirstrequest] = React.useState(true);
const [selectedWorkflows, setSelectedWorkflows] = useState([]); const [selectedWorkflows, setSelectedWorkflows] = useState([])
const getWorkflows = () => { const getWorkflows = () => {
fetch(globalUrl + "/api/v1/workflows", { fetch(globalUrl+"/api/v1/workflows", {
method: "GET", method: 'GET',
headers: { headers: {
"Content-Type": "application/json", 'Content-Type': 'application/json',
Accept: "application/json", 'Accept': 'application/json',
}, },
credentials: "include", credentials: "include",
}) })
.then((response) => { .then((response) => {
if (response.status !== 200) { if (response.status !== 200) {
console.log("Status not 200 for workflows :O!"); console.log("Status not 200 for workflows :O!")
} }
return response.json(); return response.json()
}) })
.then((responseJson) => { .then((responseJson) => {
setWorkflows(responseJson); setWorkflows(responseJson)
})
.catch((error) => {
console.log(error);
});
};
const setWebhook = (inputdata) => { })
console.log(inputdata); .catch(error => {
console.log(error)
});
}
fetch(globalUrl + "/api/v1/hooks/" + props.match.params.key, { const setWebhook = (inputdata) => {
method: "PUT", console.log(inputdata)
headers: {
"Content-Type": "application/json",
Accept: "application/json",
},
credentials: "include",
body: JSON.stringify(inputdata),
})
.then((response) => response.json())
.then((responseJson) => {
console.log(responseJson);
})
.catch((error) => {
console.log(error);
});
};
const getCurrentWebhook = () => { fetch(globalUrl+"/api/v1/hooks/"+props.match.params.key, {
fetch(globalUrl + "/api/v1/hooks/" + props.match.params.key, { method: 'PUT',
method: "GET", headers: {
headers: { 'Content-Type': 'application/json',
"Content-Type": "application/json", 'Accept': 'application/json',
Accept: "application/json", },
}, credentials: "include",
credentials: "include", body: JSON.stringify(inputdata),
}) })
.then((response) => { .then((response) => response.json())
if (response.status !== 200) { .then((responseJson) => {
console.log("Status not 200!"); console.log(responseJson)
window.location.pathname = "webhooks"; })
} .catch(error => {
return response.json(); console.log(error)
}) });
.then((responseJson) => { }
if (responseJson.actions === null) {
responseJson.actions = [];
}
if (responseJson.transforms === null) { const getCurrentWebhook = () => {
responseJson.transforms = []; fetch(globalUrl+"/api/v1/hooks/"+props.match.params.key, {
} method: 'GET',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
},
credentials: "include",
})
.then((response) => {
if (response.status !== 200) {
console.log("Status not 200!")
window.location.pathname = "webhooks"
}
return response.json()
})
.then((responseJson) => {
if (responseJson.actions === null) {
responseJson.actions = []
}
setWebhookData(responseJson); if (responseJson.transforms === null) {
}) responseJson.transforms = []
.catch((error) => { }
console.log(error);
//window.location.pathname = "webhooks"
});
};
useEffect(() => { setWebhookData(responseJson)
if (firstrequest) { })
setFirstrequest(false); .catch(error => {
getCurrentWebhook(); console.log(error)
if (workflows.length <= 0) { //window.location.pathname = "webhooks"
getWorkflows(); });
} }
}
// After everything is loaded useEffect(() => {
if ( if (firstrequest) {
Object.getOwnPropertyNames(webhookData).length > 0 && setFirstrequest(false)
webhookData.actions.length > 0 && getCurrentWebhook()
workflows.length > 0 && if (workflows.length <= 0) {
selectedWorkflows.length === 0 getWorkflows()
) { }
// Setting startup actions. making like this in case we want other actions }
var tmpActionWorkflows = [];
for (var key in webhookData.actions) {
if (webhookData.actions[key].type === "workflow") {
tmpActionWorkflows.push(webhookData.actions[key]);
}
}
// Fix duplicates... Meh // After everything is loaded
var foundWorkflowIds = []; if (Object.getOwnPropertyNames(webhookData).length > 0 && webhookData.actions.length > 0 && workflows.length > 0 && selectedWorkflows.length === 0) {
var tmpWorkflows = []; // Setting startup actions. making like this in case we want other actions
for (key in tmpActionWorkflows) { var tmpActionWorkflows = []
if (foundWorkflowIds.includes(tmpActionWorkflows[key].id)) { for (var key in webhookData.actions) {
continue; if (webhookData.actions[key].type === "workflow") {
} tmpActionWorkflows.push(webhookData.actions[key])
}
}
for (var subkey in workflows) { // Fix duplicates... Meh
if (tmpActionWorkflows[key].id === workflows[subkey]["id_"]) { var foundWorkflowIds = []
console.log(tmpActionWorkflows[key].id, workflows[subkey]["id_"]); var tmpWorkflows = []
foundWorkflowIds.push(tmpActionWorkflows[key].id); for (key in tmpActionWorkflows) {
tmpWorkflows.push(workflows[subkey]); if (foundWorkflowIds.includes(tmpActionWorkflows[key].id)) {
break; continue
} }
}
}
if (tmpWorkflows.length > 0) { for (var subkey in workflows) {
setSelectedWorkflows(tmpWorkflows); if (tmpActionWorkflows[key].id === workflows[subkey]["id_"]) {
} console.log(tmpActionWorkflows[key].id, workflows[subkey]["id_"])
} foundWorkflowIds.push(tmpActionWorkflows[key].id)
}); tmpWorkflows.push(workflows[subkey])
break
}
}
}
const hookPicture = if (tmpWorkflows.length > 0) {
Object.getOwnPropertyNames(webhookData).length > 0 && setSelectedWorkflows(tmpWorkflows)
webhookData.type === "webhook" ? ( }
<img src={WebhookImage} alt="webhook" width="100px" height="100px" /> }
) : ( })
<img src={KafkaImage} alt="MQ" width="100px" height="100px" />
);
const executeHook = (action) => {
fetch(
globalUrl + "/api/v1/hooks/" + props.match.params.key + "/" + action,
{
method: "POST",
headers: {
"Content-Type": "application/json",
Accept: "application/json",
},
credentials: "include",
}
)
.then((response) => response.json())
.then((responseJson) => {
setWebhookData({});
})
.catch((error) => {
console.log(error);
});
};
const headerPaperStyle = { const hookPicture = Object.getOwnPropertyNames(webhookData).length > 0 && webhookData.type === "webhook" ?
display: "flex", <img
maxHeight: "800px", src={WebhookImage}
minHeight: "800px", alt="webhook"
margin: "10px 30px 10px 10px", width="100px"
padding: "10px 5px 5px 5px", height="100px"
flexDirection: "column", />
}; :
<img
src={KafkaImage}
alt="MQ"
width="100px"
height="100px"
/>
// FIXME - add with counter to change the correct one (not just edit) const executeHook = (action) => {
const addNewWorkflow = (event) => { fetch(globalUrl+"/api/v1/hooks/"+props.match.params.key+"/"+action, {
// Verify if it already exists in the array. Returns if it exists method: 'POST',
for (var key in selectedWorkflows) { headers: {
var item = selectedWorkflows[key]; 'Content-Type': 'application/json',
if (item["id_"] === event.target.value["id_"]) { 'Accept': 'application/json',
return; },
} credentials: "include",
} })
.then((response) => response.json())
.then((responseJson) => {
setWebhookData({})
})
.catch(error => {
console.log(error)
});
}
// FIXME - make this possible for all accounts const headerPaperStyle = {
if (selectedWorkflows.length === 0) { display: "flex",
console.log("ADD FIRST ITEM FOR SELECTEDWORKFLOWS"); maxHeight: "800px",
console.log(event.target.value); minHeight: "800px",
margin: "10px 30px 10px 10px",
padding: "10px 5px 5px 5px",
flexDirection: "column",
}
// Cleanup previous actions // FIXME - add with counter to change the correct one (not just edit)
var newActions = []; const addNewWorkflow = (event) => {
if (webhookData.actions.length > 0) { // Verify if it already exists in the array. Returns if it exists
for (key in webhookData.actions) { for (var key in selectedWorkflows) {
if ( var item = selectedWorkflows[key]
webhookData.actions[key].type === "" || if (item["id_"] === event.target.value["id_"]) {
webhookData.actions[key].type === undefined return
) { }
continue; }
}
newActions.push(webhookData.actions[key]); // FIXME - make this possible for all accounts
} if (selectedWorkflows.length === 0) {
} console.log("ADD FIRST ITEM FOR SELECTEDWORKFLOWS")
console.log(event.target.value)
// FIXME - how to stringify this better hurr // Cleanup previous actions
var formattedWorkflow = { var newActions = []
type: "workflow", if (webhookData.actions.length > 0) {
name: event.target.value.name, for (key in webhookData.actions) {
id: event.target.value.id_, if (webhookData.actions[key].type === "" || webhookData.actions[key].type === undefined) {
field: "", continue
}; }
// FIXME: patch this n newActions.push(webhookData.actions[key])
newActions.push(formattedWorkflow); }
console.log(newActions); }
webhookData.actions = newActions; // FIXME - how to stringify this better hurr
setWebhook(webhookData); var formattedWorkflow = {
} "type": "workflow",
"name": event.target.value.name,
"id": event.target.value.id_,
"field": "",
}
var tmpSelectedWorkflows = [].concat(selectedWorkflows, [ // FIXME: patch this n
event.target.value, newActions.push(formattedWorkflow)
]); console.log(newActions)
setSelectedWorkflows(tmpSelectedWorkflows);
};
// FIXME webhookData.actions = newActions
// Create a list with + button setWebhook(webhookData)
// For each, choose the new workflow I wanna add }
// Current: JUST ONE
const selectedWorkflowIds = selectedWorkflows.map((data) => {
return data["id_"];
});
const availableWorkflows = workflows.filter(
(data) => !selectedWorkflowIds.includes(data["id_"])
);
const WorkflowSelect = (counter) => { var tmpSelectedWorkflows = [].concat(selectedWorkflows, [event.target.value])
if (selectedWorkflows[counter.counter] === undefined) { setSelectedWorkflows(tmpSelectedWorkflows)
return null; }
}
console.log(selectedWorkflows[0]); // FIXME
console.log(selectedWorkflows[0]); // Create a list with + button
console.log(selectedWorkflows[0]); // For each, choose the new workflow I wanna add
console.log(selectedWorkflows[counter.counter]); // Current: JUST ONE
console.log(selectedWorkflows[counter.counter].name); const selectedWorkflowIds = selectedWorkflows.map(data => {return data["id_"]})
return ( const availableWorkflows = workflows.filter(data => !selectedWorkflowIds.includes(data["id_"]))
<div>
Workflow select:
<Select
value={selectedWorkflows[counter.counter].name}
onChange={(event) => {
addNewWorkflow(event, counter.counter);
}}
displayEmpty
name="workflow"
>
{availableWorkflows.map((data) => (
<MenuItem key={data.name} value={data} name={data.name}>
{data.name}
</MenuItem>
))}
</Select>
</div>
);
};
const extraWorkflow = const WorkflowSelect = (counter) => {
workflows.length > 0 && availableWorkflows.length > 0 ? ( if (selectedWorkflows[counter.counter] === undefined) {
<WorkflowSelect counter={selectedWorkflows.length} /> return null
) : null; }
const multiWorkflowSelect = console.log(selectedWorkflows[0])
workflows.length > 0 && selectedWorkflows.length > 0 ? ( console.log(selectedWorkflows[0])
<div> console.log(selectedWorkflows[0])
{selectedWorkflows.map((data, count) => ( console.log(selectedWorkflows[counter.counter])
<WorkflowSelect key={count} counter={count} /> console.log(selectedWorkflows[counter.counter].name)
))} return (
{extraWorkflow} <div>
</div> Workflow select:
) : ( <Select
<WorkflowSelect counter={0} /> value={selectedWorkflows[counter.counter].name}
); onChange={(event) => {addNewWorkflow(event, counter.counter)}}
displayEmpty
name="workflow"
>
{availableWorkflows.map(data => (
<MenuItem key={data.name} value={data} name={data.name}>{data.name}</MenuItem>
))}
</Select>
</div>
)
}
const headerInfo = const extraWorkflow = workflows.length > 0 && availableWorkflows.length > 0 ?
Object.getOwnPropertyNames(webhookData).length > 0 ? ( <WorkflowSelect counter={selectedWorkflows.length}/> : null
<div>
<Paper style={headerPaperStyle}>
<div style={{ display: "flex", flex: "1" }}>
<div style={{ flex: "1" }}>{hookPicture}</div>
<div
style={{ display: "flex", flexDirection: "column", flex: "5" }}
>
<div style={{ flex: "1" }}>
<h1>Name: {webhookData.info.name}</h1>
</div>
</div>
</div>
<div style={{ flex: "4" }}>
Description: {webhookData.info.description}
<div>Id: {webhookData.id}</div>
<div>Url: {webhookData.info.url}</div>
<div>Type: {webhookData.type}</div>
<div>Status: {webhookData.status}</div>
<div>
CHOOSE ACTIONS:
{multiWorkflowSelect}
</div>
</div>
<Divider />
<div style={{ flex: "1", display: "flex", flexDirection: "row" }}>
<div style={{ flex: "1" }}>
<Button
disabled={
webhookData.running === true && webhookData.name !== ""
}
onClick={() => {
executeHook("start");
}}
style={{
left: "50%",
top: "50%",
transform: "translate(-50%, -50%)",
}}
variant="outlined"
color="primary"
>
Start {webhookData.type}
</Button>
</div>
<div style={{ flex: "1" }}>
<Button
disabled={webhookData.running === false}
onClick={() => {
executeHook("stop");
}}
style={{
left: "50%",
top: "50%",
transform: "translate(-50%, -50%)",
}}
variant="outlined"
color="primary"
>
Stop {webhookData.type}
</Button>
</div>
</div>
</Paper>
</div>
) : null;
// FIXME - needs refresh every time you add a new workflow const multiWorkflowSelect = workflows.length > 0 && selectedWorkflows.length > 0 ?
const workflowdata = <div>
Object.getOwnPropertyNames(webhookData).length > 0 && {selectedWorkflows.map((data, count) => (
selectedWorkflows.length > 0 ? ( <WorkflowSelect key={count} counter={count}/>
<EditWorkflow ))}
globalUrl={globalUrl} {extraWorkflow}
inputworkflows={selectedWorkflows} </div>
inputname={webhookData.info.name} : <WorkflowSelect counter={0}/>
inputtype={webhookData.type}
/>
) : null;
const loadedCheck = isLoaded ? ( const headerInfo = Object.getOwnPropertyNames(webhookData).length > 0 ?
<div style={{ display: "flex", backgroundColor: "#f7f7f7" }}> <div>
<div style={{ flex: 1 }}>{workflowdata}</div> <Paper style={headerPaperStyle}>
<div style={{ flex: 1 }}>{headerInfo}</div> <div style={{display: "flex", flex: "1"}}>
</div> <div style={{flex: "1"}}>
) : ( {hookPicture}
<div></div> </div>
); <div style={{display: "flex", flexDirection: "column", flex: "5"}}>
<div style={{flex: "1"}}>
<h1>Name: {webhookData.info.name}</h1>
</div>
</div>
</div>
<div style={{flex: "4"}}>
Description: {webhookData.info.description}
<div>
Id: {webhookData.id}
</div>
<div>
Url: {webhookData.info.url}
</div>
<div>
Type: {webhookData.type}
</div>
<div>
Status: {webhookData.status}
</div>
<div>
CHOOSE ACTIONS:
{multiWorkflowSelect}
</div>
</div>
<Divider />
<div style={{flex: "1", display: "flex", flexDirection: "row"}}>
<div style={{flex: "1"}}>
<Button
disabled={webhookData.running === true && webhookData.name !== ""}
onClick={() => {executeHook("start")}}
style={{left: "50%", top: "50%", transform: "translate(-50%, -50%)"}}
variant="outlined"
color="primary"
>Start {webhookData.type}</Button>
</div>
<div style={{flex: "1"}}>
<Button
disabled={webhookData.running === false}
onClick={() => {executeHook("stop")}}
style={{left: "50%", top: "50%", transform: "translate(-50%, -50%)"}}
variant="outlined"
color="primary"
>Stop {webhookData.type}</Button>
</div>
</div>
</Paper>
</div>
: null
// FIXME - needs refresh every time you add a new workflow
const workflowdata = Object.getOwnPropertyNames(webhookData).length > 0 && selectedWorkflows.length > 0 ?
<EditWorkflow globalUrl={globalUrl} inputworkflows={selectedWorkflows} inputname={webhookData.info.name} inputtype={webhookData.type} /> : null
// FIXME: Use this for testing const loadedCheck = isLoaded ?
// <EditWorkflow globalUrl={globalUrl} inputname={"Helo?"} inputtype={"webhook"} /> : null <div style={{display: "flex", backgroundColor: "#f7f7f7"}}>
return <div>{loadedCheck}</div>; <div style={{"flex": 1}}>
}; {workflowdata}
</div>
<div style={{"flex": 1}}>
{headerInfo}
</div>
</div>
:
<div>
</div>
// FIXME: Use this for testing
// <EditWorkflow globalUrl={globalUrl} inputname={"Helo?"} inputtype={"webhook"} /> : null
return (
<div>
{loadedCheck}
</div>
)
}
export default EditWebhook; export default EditWebhook;
File diff suppressed because one or more lines are too long
+105 -101
View File
@@ -1,118 +1,122 @@
/* eslint-disable react/no-multi-comp */ /* eslint-disable react/no-multi-comp */
import React, { useState } from "react"; import React, {useState} from 'react';
import TextField from "@material-ui/core/TextField"; import TextField from '@material-ui/core/TextField';
import Button from "@material-ui/core/Button"; import Button from '@material-ui/core/Button';
import Paper from "@material-ui/core/Paper"; import Paper from '@material-ui/core/Paper';
const bodyDivStyle = { const bodyDivStyle = {
margin: "auto", margin: "auto",
marginTop: "100px", marginTop: "100px",
width: "500px", width: "500px",
}; }
const ForgotPassword = (props) => {
const { globalUrl, isLoaded, isLoggedIn, surfaceColor, inputColor } = props;
const boxStyle = { const ForgotPassword = props => {
paddingLeft: "30px", const { globalUrl, isLoaded, isLoggedIn, surfaceColor, inputColor } = props;
paddingRight: "30px",
paddingBottom: "30px",
paddingTop: "30px",
backgroundColor: surfaceColor,
};
const [username, setUsername] = useState("");
const [resetInfo, setResetInfo] = useState(
"You will receive an email with instructions shortly."
);
const handleValidateForm = () => { const boxStyle = {
return username.length > 3; paddingLeft: "30px",
}; paddingRight: "30px",
paddingBottom: "30px",
paddingTop: "30px",
backgroundColor: surfaceColor,
}
if (isLoggedIn === true) { const [username, setUsername] = useState("")
window.location.pathname = "/"; const [resetInfo, setResetInfo] = useState("You will receive an email with instructions shortly.")
}
const onSubmit = (e) => { const handleValidateForm = () => {
e.preventDefault(); return username.length > 3
// FIXME - add some check here ROFL }
// Just use this one? if (isLoggedIn === true) {
var data = { username: username }; window.location.pathname = "/"
var baseurl = globalUrl; }
var url = baseurl + "/api/v1/passwordresetmail";
fetch(url, {
method: "POST",
body: JSON.stringify(data),
headers: {
"Content-Type": "application/json; charset=utf-8",
},
})
.then((response) =>
response.json().then((responseJson) => {
if (responseJson["success"] === false) {
setResetInfo(responseJson["reason"]);
}
})
)
.catch((error) => {
setResetInfo("Error in userdata: " + error);
});
};
const onChangeUser = (e) => { const onSubmit = (e) => {
setUsername(e.target.value); e.preventDefault()
}; // FIXME - add some check here ROFL
const data = ( // Just use this one?
<div style={bodyDivStyle}> var data = {"username": username}
<Paper style={boxStyle}> var baseurl = globalUrl
<form onSubmit={onSubmit} style={{ margin: "15px 15px 15px 15px" }}> var url = baseurl+'/api/v1/passwordresetmail';
<h2>Password reset</h2> fetch(url, {
<div> method: 'POST',
<TextField body: JSON.stringify(data),
required headers: {
fullWidth={true} 'Content-Type': 'application/json; charset=utf-8',
color="primary" },
style={{ backgroundColor: inputColor }} })
InputProps={{ .then(response =>
style: { response.json().then(responseJson => {
height: "50px", if (responseJson["success"] === false) {
color: "white", setResetInfo(responseJson["reason"])
fontSize: "1em", }
}, }),
}} )
type="username" .catch(error => {
placeholder="Username / Email" setResetInfo("Error in userdata: " + error)
id="standard-required" });
autoComplete="username" }
margin="normal"
variant="outlined"
onChange={onChangeUser}
/>
</div>
<div style={{ display: "flex", marginTop: "15px" }}>
<Button
color="primary"
variant="contained"
type="submit"
style={{ flex: "1", marginRight: "5px" }}
disabled={!handleValidateForm()}
>
SUBMIT
</Button>
</div>
<div style={{ marginTop: "20px" }}>{resetInfo}</div>
</form>
</Paper>
</div>
);
const loadedCheck = isLoaded ? <div>{data}</div> : <div></div>; const onChangeUser = (e) => {
setUsername(e.target.value)
}
return <div>{loadedCheck}</div>; const data =
}; <div style={bodyDivStyle}>
<Paper style={boxStyle}>
<form onSubmit={onSubmit} style={{margin: "15px 15px 15px 15px"}}>
<h2>Password reset</h2>
<div>
<TextField
required
fullWidth={true}
color="primary"
style={{backgroundColor: inputColor}}
InputProps={{
style:{
height: "50px",
color: "white",
fontSize: "1em",
},
}}
type="username"
placeholder="Username / Email"
id="standard-required"
autoComplete="username"
margin="normal"
variant="outlined"
onChange={onChangeUser}
/>
</div>
<div style={{display: "flex", marginTop: "15px"}}>
<Button color="primary" variant="contained" type="submit" style={{flex: "1", marginRight: "5px"}} disabled={!handleValidateForm()}>SUBMIT</Button>
</div>
<div style={{marginTop: "20px"}}>
{resetInfo}
</div>
</form>
</Paper>
</div>
const loadedCheck = isLoaded ?
<div>
{data}
</div>
:
<div>
</div>
return (
<div>
{loadedCheck}
</div>
)
}
export default ForgotPassword; export default ForgotPassword;
+106 -108
View File
@@ -1,28 +1,28 @@
import React, { useState, useEffect } from "react"; import React, {useState, useEffect} from 'react';
import Paper from "@material-ui/core/Paper"; import Paper from '@material-ui/core/Paper';
import Button from "@material-ui/core/Button"; import Button from '@material-ui/core/Button';
import TextField from "@material-ui/core/TextField"; import TextField from '@material-ui/core/TextField';
const bodyDivStyle = { const bodyDivStyle = {
margin: "auto", margin: "auto",
textAlign: "center", textAlign: "center",
width: "768px", width: "768px",
}; }
const boxStyle = { const boxStyle = {
flex: "1", flex: "1",
marginLeft: "10px", marginLeft: "10px",
marginRight: "10px", marginRight: "10px",
paddingLeft: "30px", paddingLeft: "30px",
paddingRight: "30px", paddingRight: "30px",
paddingBottom: "30px", paddingBottom: "30px",
paddingTop: "30px", paddingTop: "30px",
backgroundColor: "#e8eaf6", backgroundColor: "#e8eaf6",
display: "flex", display: "flex",
flexDirection: "column", flexDirection: "column"
}; }
//const tmpdata = { //const tmpdata = {
// "username": "frikky", // "username": "frikky",
@@ -38,99 +38,97 @@ const boxStyle = {
// FIXME - remove tmpdata // FIXME - remove tmpdata
// FIXME: Use isLoggedIn :) // FIXME: Use isLoggedIn :)
const Settings = (props) => { const Settings = (props) => {
const { globalUrl, isLoaded } = props; const { globalUrl, isLoaded, } = props;
const [newPassword, setNewPassword] = useState(""); const [newPassword, setNewPassword] = useState("");
const [newPassword2, setNewPassword2] = useState(""); const [newPassword2, setNewPassword2] = useState("");
const [passwordFormMessage, setPasswordFormMessage] = useState(""); const [passwordFormMessage, setPasswordFormMessage] = useState("");
const onPasswordChange = () => { const onPasswordChange = () => {
const data = { const data = {"newpassword": newPassword, "newpassword2": newPassword2, "reference": props.match.params.key}
newpassword: newPassword, const url = globalUrl+'/api/v1/passwordreset';
newpassword2: newPassword2, fetch(url, {
reference: props.match.params.key, mode: 'cors',
}; method: 'POST',
const url = globalUrl + "/api/v1/passwordreset"; body: JSON.stringify(data),
fetch(url, { credentials: 'include',
mode: "cors", crossDomain: true,
method: "POST", withCredentials: true,
body: JSON.stringify(data), headers: {
credentials: "include", 'Content-Type': 'application/json; charset=utf-8',
crossDomain: true, },
withCredentials: true, })
headers: { .then(response =>
"Content-Type": "application/json; charset=utf-8", response.json().then(responseJson => {
}, if (responseJson["success"] === false) {
}) setPasswordFormMessage(responseJson["reason"])
.then((response) => }
response.json().then((responseJson) => { }),
if (responseJson["success"] === false) { )
setPasswordFormMessage(responseJson["reason"]); .catch(error => {
} setPasswordFormMessage("Something went wrong.")
}) });
) }
.catch((error) => {
setPasswordFormMessage("Something went wrong.");
});
};
// This should "always" have data // This should "always" have data
useEffect(() => {}); useEffect(() => {
})
// Random names for type & autoComplete. Didn't research :^) // Random names for type & autoComplete. Didn't research :^)
const landingpageData = ( const landingpageData =
<div style={{ display: "flex", marginTop: "80px" }}> <div style={{display: "flex", marginTop: "80px"}}>
<Paper style={boxStyle}> <Paper style={boxStyle}>
<h2>Password Reset</h2> <h2>Password Reset</h2>
<div style={{ flex: "1", display: "flex", flexDirection: "column" }}> <div style={{flex: "1", display: "flex", flexDirection: "column"}}>
<TextField <TextField
required required
style={{ flex: "1" }} style={{flex: "1"}}
fullWidth={true} fullWidth={true}
placeholder="New password" placeholder="New password"
type="password" type="password"
id="standard-required" id="standard-required"
autoComplete="password" autoComplete="password"
margin="normal" margin="normal"
variant="outlined" variant="outlined"
onChange={(e) => setNewPassword(e.target.value)} onChange={e => setNewPassword(e.target.value)}
/> />
<TextField <TextField
required required
style={{ flex: "1" }} style={{flex: "1"}}
fullWidth={true} fullWidth={true}
type="password" type="password"
placeholder="Repeat new password" placeholder="Repeat new password"
id="standard-required" id="standard-required"
margin="normal" margin="normal"
variant="outlined" variant="outlined"
onChange={(e) => setNewPassword2(e.target.value)} onChange={e => setNewPassword2(e.target.value)}
/> />
</div> </div>
<Button <Button
disabled={ disabled={(newPassword.length < 10 || newPassword2.length < 10) || newPassword !== newPassword2}
newPassword.length < 10 || style={{width: "100%", height: "60px", marginTop: "10px"}}
newPassword2.length < 10 || variant="contained"
newPassword !== newPassword2 color="primary"
} onClick={() => onPasswordChange()}
style={{ width: "100%", height: "60px", marginTop: "10px" }} >
variant="contained" Submit password change
color="primary" </Button>
onClick={() => onPasswordChange()} <h3>{passwordFormMessage}</h3>
> </Paper>
Submit password change </div>
</Button>
<h3>{passwordFormMessage}</h3>
</Paper>
</div>
);
const loadedCheck = isLoaded ? ( const loadedCheck = isLoaded ?
<div style={bodyDivStyle}>{landingpageData}</div> <div style={bodyDivStyle}>
) : ( {landingpageData}
<div></div> </div>
); :
<div>
</div>
return <div>{loadedCheck}</div>; return(
}; <div>
{loadedCheck}
</div>
)
}
export default Settings; export default Settings;
+6 -4
View File
@@ -1,7 +1,9 @@
import React from "react"; import React from 'react';
const HandlePayment = () => { const HandlePayment = () => {
return null; return (
}; null
)
}
export default HandlePayment; export default HandlePayment
+171 -169
View File
@@ -1,182 +1,181 @@
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from 'react';
import { useTheme } from "@material-ui/core/styles"; import { useTheme } from '@material-ui/core/styles';
import Grid from "@material-ui/core/Grid"; import Grid from '@material-ui/core/Grid';
import Card from "@material-ui/core/Card"; import Card from '@material-ui/core/Card';
import CardActionArea from "@material-ui/core/CardActionArea"; import CardActionArea from '@material-ui/core/CardActionArea';
import CardContent from "@material-ui/core/CardContent"; import CardContent from '@material-ui/core/CardContent';
import CardHeader from "@material-ui/core/CardHeader"; import CardHeader from '@material-ui/core/CardHeader';
import Typography from "@material-ui/core/Typography"; import Typography from '@material-ui/core/Typography';
import Button from "@material-ui/core/Button"; import Button from '@material-ui/core/Button';
const Workflows = (props) => { const Workflows = (props) => {
const { globalUrl, isLoggedIn, isLoaded } = props; const { globalUrl, isLoggedIn, isLoaded, } = props
const theme = useTheme(); const theme = useTheme();
const [curView, setCurView] = useState(0); const [curView, setCurView] = useState(0);
const [firstrequest, setFirstrequest] = useState(true); const [firstrequest, setFirstrequest] = useState(true)
const [selectedItems, setSelectedItems] = useState([]); const [selectedItems, setSelectedItems] = useState([])
const viewdata1 = [ const viewdata1 = [
{ {
title: "General", "title": "General",
content: "Learn about our ticketing solutions", "content": "Learn about our ticketing solutions",
subitems: [ "subitems": [
{ {
name: "Search", "name": "Search",
subtitle: "Search for anything, anywhere", "subtitle": "Search for anything, anywhere",
}, },
{ {
name: "Message", "name": "Message",
subtitle: "Read and send messages", "subtitle": "Read and send messages",
}, },
{ {
name: "Parse emails", "name": "Parse emails",
subtitle: "what", "subtitle": "what",
}, },
], ],
}, },
{ {
title: "Ticketing", "title": "Ticketing",
subitems: [ "subitems": [
{ {
name: "Search", "name": "Search",
subtitle: "Search for anything, anywhere", "subtitle": "Search for anything, anywhere",
}, },
{ {
name: "Message", "name": "Message",
subtitle: "Read and send messages", "subtitle": "Read and send messages",
}, },
{ {
name: "Parse emails", "name": "Parse emails",
subtitle: "what", "subtitle": "what",
}, },
], ],
}, },
{ {
title: "Threat intel", "title": "Threat intel",
subitems: [ "subitems": [
{ {
name: "Search", "name": "Search",
subtitle: "Search for anything, anywhere", "subtitle": "Search for anything, anywhere",
}, },
{ {
name: "Message", "name": "Message",
subtitle: "Read and send messages", "subtitle": "Read and send messages",
}, },
{ {
name: "Parse emails", "name": "Parse emails",
subtitle: "what", "subtitle": "what",
}, },
], ],
}, },
]; ]
if (firstrequest) { if (firstrequest) {
setFirstrequest(false); setFirstrequest(false)
if (props.match.params.key) { if (props.match.params.key) {
console.log("PROPS: ", props.match.params.key); console.log("PROPS: ", props.match.params.key)
const viewitem = viewdata1.find( const viewitem = viewdata1.find(item => item.title.toLowerCase() === props.match.params.key.toLowerCase())
(item) => if (viewitem !== undefined && viewitem !== null) {
item.title.toLowerCase() === props.match.params.key.toLowerCase() setCurView(1)
); //setSelectedItem(viewitem)
if (viewitem !== undefined && viewitem !== null) { }
setCurView(1); }
//setSelectedItem(viewitem) }
}
}
}
const cardContentStyle = {
height: "100%",
width: "100%",
padding: 40,
};
const outerGridView = { const cardContentStyle = {
width: "100%", height: "100%",
marginTop: 15, width: "100%",
}; padding: 40,
}
const paperStyle = { const outerGridView = {
height: 300, width: "100%",
color: "white", marginTop: 15,
backgroundColor: theme.palette.surfaceColor, }
color: "white",
cursor: "pointer",
display: "flex",
textAlign: "center",
};
const HandleSelection = (data) => { const paperStyle = {
const [selected, setSelected] = useState(false); height: 300,
color: "white",
backgroundColor: theme.palette.surfaceColor,
color: "white",
cursor: "pointer",
display: "flex",
textAlign: "center",
}
var baseStyle = JSON.parse(JSON.stringify(paperStyle)); const HandleSelection = (data) => {
if (selected) { const [selected, setSelected] = useState(false);
baseStyle.backgroundColor = "white";
baseStyle.color = "black";
}
return ( var baseStyle = JSON.parse(JSON.stringify(paperStyle))
<Grid if (selected) {
item baseStyle.backgroundColor = "white"
xs={4} baseStyle.color = "black"
onClick={() => { }
console.log(selectedItems);
if (selected) {
const index = selectedItems.findIndex(
(item) => item.title === data.title
);
if (index >= 0) {
selectedItems.splice(index, 1);
setSelectedItems(selectedItems);
}
} else {
selectedItems.push(data);
setSelectedItems(selectedItems);
}
setSelected(!selected); return (
<Grid item xs={4} onClick={() => {
console.log(selectedItems)
if (selected) {
const index = selectedItems.findIndex(item => item.title === data.title)
if (index >= 0) {
selectedItems.splice(index, 1)
setSelectedItems(selectedItems)
}
} else {
selectedItems.push(data)
setSelectedItems(selectedItems)
}
//setCurView(1) setSelected(!selected)
//setSelectedItem(data)
//window.location.pathname += "/"+data.title.toLowerCase() //setCurView(1)
}} //setSelectedItem(data)
> //window.location.pathname += "/"+data.title.toLowerCase()
<Card style={baseStyle}> }}>
<CardActionArea style={cardContentStyle}> <Card style={baseStyle}>
<CardContent> <CardActionArea style={cardContentStyle}>
<Typography variant="h4">{data.title}</Typography> <CardContent>
</CardContent> <Typography variant="h4">
</CardActionArea> {data.title}
</Card> </Typography>
</Grid> </CardContent>
); </CardActionArea>
}; </Card>
</Grid>
)
}
const view1 = const view1 = curView === 0 ?
curView === 0 ? ( <div>
<div> <Typography variant="h4">
<Typography variant="h4">What are you interested in?</Typography> What are you interested in?
<Grid container style={outerGridView} spacing={3}> </Typography>
{viewdata1.map((data) => { <Grid container style={outerGridView} spacing={3}>
return HandleSelection(data); {viewdata1.map(data => {
})} return (
</Grid> HandleSelection(data)
{/* )
})}
</Grid>
{/*
<Button variant="contained" color="primary" style={{height: 50, width: 300, margin: "auto",}} onClick={() => { <Button variant="contained" color="primary" style={{height: 50, width: 300, margin: "auto",}} onClick={() => {
setCurView(1) setCurView(1)
}}> }}>
Continue Continue
</Button> </Button>
*/} */}
</div> </div>
) : null; : null
const view2 = const view2 = curView === 1 ?
curView === 1 ? ( <div>
<div> <Typography variant="h4">
<Typography variant="h4">Step 2.</Typography> Step 2.
{/* </Typography>
{/*
<Grid container style={outerGridView} spacing={3}> <Grid container style={outerGridView} spacing={3}>
{selectedItem.subitems === undefined ? null : {selectedItem.subitems === undefined ? null :
selectedItem.subitems.map(data => { selectedItem.subitems.map(data => {
@@ -199,17 +198,20 @@ const Workflows = (props) => {
})} })}
</Grid> </Grid>
*/} */}
</div> </div>
) : null; : null
const baseView = ( const baseView =
<div style={{ maxWidth: 1024, margin: "auto", paddingTop: 50 }}> <div style={{maxWidth: 1024, margin: "auto", paddingTop: 50,}}>
{view1} {view1}
{view2} {view2}
</div> </div>
);
return <div>{baseView}</div>; return (
}; <div>
{baseView}
</div>
)
}
export default Workflows; export default Workflows
+159 -185
View File
@@ -1,205 +1,179 @@
import React from "react"; import React, {} from 'react';
import Paper from "@material-ui/core/Paper"; import Paper from '@material-ui/core/Paper';
import Button from "@material-ui/core/Button"; import Button from '@material-ui/core/Button';
import Divider from "@material-ui/core/Divider"; import Divider from '@material-ui/core/Divider';
import { BrowserView, MobileView } from "react-device-detect"; import {BrowserView, MobileView} from "react-device-detect";
import ScheduleIcon from "@material-ui/icons/Schedule"; import ScheduleIcon from '@material-ui/icons/Schedule';
import Web from "@material-ui/icons/Web"; import Web from '@material-ui/icons/Web';
import AccountTree from "@material-ui/icons/AccountTree"; import AccountTree from '@material-ui/icons/AccountTree';
const bodyDivStyle = { const bodyDivStyle = {
margin: "auto", margin: "auto",
marginTop: "75px", marginTop: "75px",
textAlign: "center", textAlign: "center",
width: "1100px", width: "1100px",
}; }
const surfaceColor = "#27292D"; const surfaceColor = "#27292D"
const boxStyle = { const boxStyle = {
flex: "1", flex: "1",
marginLeft: "10px", marginLeft: "10px",
marginRight: "10px", marginRight: "10px",
height: "400px", height: "400px",
//backgroundColor: "#e8eaf6", //backgroundColor: "#e8eaf6",
backgroundColor: surfaceColor, backgroundColor: surfaceColor,
textAlign: "center", textAlign: "center",
display: "flex", display: "flex",
flexDirection: "column", flexDirection: "column",
}; }
const bodyTextStyle = { const bodyTextStyle = {
color: "#ffffff", color: "#ffffff",
}; }
const hrefStyle = { const hrefStyle = {
color: "black", color: "black",
textDecoration: "none", textDecoration: "none",
}; }
// Should be different if logged in :| // Should be different if logged in :|
const LandingPage = (props) => { const LandingPage = (props) => {
const { isLoaded } = props; const { isLoaded} = props;
const textColor = "#8899A6"; const textColor = "#8899A6"
const iconColor = "#1DA1F2"; const iconColor = "#1DA1F2"
const iconSize = "8em"; const iconSize = "8em"
const GridLayout = (header, description, link, icon) => { const GridLayout = (header, description, link, icon) => {
return ( return (
<Paper style={boxStyle}> <Paper style={boxStyle}>
<a href={link} style={hrefStyle}> <a href={link} style={hrefStyle}>
<div style={{ flex: "1", color: "#FFFFFF" }}> <div style={{flex: "1", color: "#FFFFFF"}}>
<h2>{header}</h2> <h2>{header}</h2>
</div> </div>
<Divider /> <Divider />
<div <div style={{flex: "3", marginLeft: "10px", marginRight: "10px", marginTop: "10px", color: textColor}}>
style={{ {description}
flex: "3", </div>
marginLeft: "10px", <div style={{margin: "auto"}}>
marginRight: "10px", {icon}
marginTop: "10px", </div>
color: textColor, <Divider style={{marginTop: "20px", marginBottom: "20px"}} />
}} <div style={{flex: "1", color: "#f85a3e"}}>
> <div style={{}} >
{description} Learn more
</div> </div>
<div style={{ margin: "auto" }}>{icon}</div> </div>
<Divider style={{ marginTop: "20px", marginBottom: "20px" }} /> </a>
<div style={{ flex: "1", color: "#f85a3e" }}> </Paper>
<div style={{}}>Learn more</div> )
</div> }
</a>
</Paper>
);
};
const listitems = [ const listitems = [
GridLayout( GridLayout("Simple integrations", "Easily use others' or create your own integration", "/docs/apps", <Web style={{fontSize: iconSize, marginTop: "20px", color: iconColor}} />),
"Simple integrations", GridLayout("Workflows", "Access the power of automation within minutes, whether its on premise or in the cloud", "/docs/workflows", <AccountTree style={{fontSize: iconSize, marginTop: "20px", color: iconColor}} />),
"Easily use others' or create your own integration", GridLayout("Realtime actions", "Beat the clock by leveraging our realtime triggers", "/docs/triggers", <ScheduleIcon style={{fontSize: iconSize, marginTop: "20px", color: iconColor}} />),
"/docs/apps", ]
<Web
style={{ fontSize: iconSize, marginTop: "20px", color: iconColor }}
/>
),
GridLayout(
"Workflows",
"Access the power of automation within minutes, whether its on premise or in the cloud",
"/docs/workflows",
<AccountTree
style={{ fontSize: iconSize, marginTop: "20px", color: iconColor }}
/>
),
GridLayout(
"Realtime actions",
"Beat the clock by leveraging our realtime triggers",
"/docs/triggers",
<ScheduleIcon
style={{ fontSize: iconSize, marginTop: "20px", color: iconColor }}
/>
),
];
// The actual landing page // The actual landing page
// <img style={{width: "400px"}} alt={"logo"} src={Default}/> // <img style={{width: "400px"}} alt={"logo"} src={Default}/>
const landingpageDataBrowser = ( const landingpageDataBrowser =
<div> <div>
<div style={bodyTextStyle}> <div style={bodyTextStyle}>
<h1>Shuffle</h1> <h1>Shuffle</h1>
<h3 style={{ color: "#8899A6" }}> <h3 style={{color: "#8899A6"}}>A general automation solution for Infosec and IT Professionals</h3>
A general automation solution for Infosec and IT Professionals </div>
</h3> <a href="/register" style={hrefStyle}>
</div> <Button
<a href="/register" style={hrefStyle}> style={{width: "180px", height: "50px", borderRadius: "0px"}}
<Button variant="outlined"
style={{ width: "180px", height: "50px", borderRadius: "0px" }} color="primary"
variant="outlined" >
color="primary" Try it out
> </Button>
Try it out </a>
</Button> <a href="/contact" style={hrefStyle}>
</a> <Button
<a href="/contact" style={hrefStyle}> style={{width: "180px", height: "50px", borderRadius: "0px"}}
<Button variant="contained"
style={{ width: "180px", height: "50px", borderRadius: "0px" }} color="primary"
variant="contained" >
color="primary" Contact
> </Button>
Contact </a>
</Button> <div style={{display: "flex", marginTop: "100px"}}>
</a> {listitems.map(item => {
<div style={{ display: "flex", marginTop: "100px" }}> return (
{listitems.map((item) => { <div>
return <div>{item}</div>; {item}
})} </div>
</div> )
</div> })}
); </div>
</div>
const landingpageDataMobile = ( const landingpageDataMobile =
<div> <div>
<div <div style={{color: "white", textAlign: "center", marginLeft: "10px", marginRight: "10px"}}>
style={{ <h1>Shuffle</h1>
color: "white", <h3>A general automation solution for Infosec and IT Professionals</h3>
textAlign: "center", <a href="/contact" style={hrefStyle}>
marginLeft: "10px", <Button
marginRight: "10px", style={{width: "220px", height: "60px", borderRadius: "0px"}}
}} variant="contained"
> color="primary"
<h1>Shuffle</h1> >
<h3>A general automation solution for Infosec and IT Professionals</h3> Contact
<a href="/contact" style={hrefStyle}> </Button>
<Button </a>
style={{ width: "220px", height: "60px", borderRadius: "0px" }} </div>
variant="contained" <div style={{display: "flex", flexDirection: "column", marginTop: "100px"}}>
color="primary" <div>
> {listitems[0]}
Contact </div>
</Button> <div style={{marginTop: "20px"}}>
</a> {listitems[1]}
</div> </div>
<div <div style={{marginTop: "20px", marginBottom: "30px"}}>
style={{ display: "flex", flexDirection: "column", marginTop: "100px" }} {listitems[2]}
> </div>
<div>{listitems[0]}</div> <div style={{marginTop: "20px", marginBottom: "30px", textAlign: "center"}}>
<div style={{ marginTop: "20px" }}>{listitems[1]}</div> <a href="/contact" style={hrefStyle}>
<div style={{ marginTop: "20px", marginBottom: "30px" }}> <Button
{listitems[2]} style={{width: "220px", height: "60px", borderRadius: "0px"}}
</div> variant="contained"
<div color="primary"
style={{ >
marginTop: "20px", Contact
marginBottom: "30px", </Button>
textAlign: "center", </a>
}} </div>
> </div>
<a href="/contact" style={hrefStyle}> </div>
<Button
style={{ width: "220px", height: "60px", borderRadius: "0px" }}
variant="contained"
color="primary"
>
Contact
</Button>
</a>
</div>
</div>
</div>
);
// Reroute if the user is logged in
// const landingSite = isLoggedIn ? <Workflows globalUrl={globalUrl}{...props} /> : <div style={bodyDivStyle}>{landingpageData}</div>
const landingSite = <div style={bodyDivStyle}>{landingpageDataBrowser}</div>;
const loadedCheck = isLoaded ? ( // Reroute if the user is logged in
<div> // const landingSite = isLoggedIn ? <Workflows globalUrl={globalUrl}{...props} /> : <div style={bodyDivStyle}>{landingpageData}</div>
<BrowserView>{landingSite}</BrowserView> const landingSite = <div style={bodyDivStyle}>{landingpageDataBrowser}</div>
<MobileView>{landingpageDataMobile}</MobileView>
</div>
) : (
<div></div>
);
return <div>{loadedCheck}</div>; const loadedCheck = isLoaded ?
}; <div>
<BrowserView>
{landingSite}
</BrowserView>
<MobileView>
{landingpageDataMobile}
</MobileView>
</div>
:
<div>
</div>
return(
<div>
{loadedCheck}
</div>
)
}
export default LandingPage; export default LandingPage;
+15 -10
View File
@@ -1,16 +1,21 @@
import React from "react"; import React, {} from 'react';
const bodyDivStyle = { const bodyDivStyle = {
transform: "translate(-50%, -50%)", transform: "translate(-50%, -50%)",
top: "50%", top: "50%",
left: "50%", left: "50%",
position: "absolute", position: "absolute",
width: "500px", width: "500px",
color: "white", color: "white",
}; }
// Should be different if logged in :| // Should be different if logged in :|
const LandingPageLoggedin = (props) => { const LandingPageLoggedin = (props) => {
return <div style={bodyDivStyle}>TMP landingpage when logged in</div>;
}; return(
<div style={bodyDivStyle}>
TMP landingpage when logged in
</div>
)
}
export default LandingPageLoggedin; export default LandingPageLoggedin;
+324 -504
View File
@@ -1,529 +1,349 @@
import React, { useState } from "react"; import React, {useState } from 'react';
import Paper from "@material-ui/core/Paper"; import Paper from '@material-ui/core/Paper';
import Card from "@material-ui/core/Card"; import Card from '@material-ui/core/Card';
import CardActionArea from "@material-ui/core/CardActionArea"; import CardActionArea from '@material-ui/core/CardActionArea';
import CardMedia from "@material-ui/core/CardMedia"; import CardMedia from '@material-ui/core/CardMedia';
import CardContent from "@material-ui/core/CardContent"; import CardContent from '@material-ui/core/CardContent';
import CardActions from "@material-ui/core/CardActions"; import CardActions from '@material-ui/core/CardActions';
import Button from "@material-ui/core/Button"; import Button from '@material-ui/core/Button';
import Divider from "@material-ui/core/Divider"; import Divider from '@material-ui/core/Divider';
import Grid from "@material-ui/core/Grid"; import Grid from '@material-ui/core/Grid';
import { BrowserView, MobileView } from "react-device-detect"; import {BrowserView, MobileView} from "react-device-detect";
import ScheduleIcon from "@material-ui/icons/Schedule"; import ScheduleIcon from '@material-ui/icons/Schedule';
import Web from "@material-ui/icons/Web"; import Web from '@material-ui/icons/Web';
import AccountTree from "@material-ui/icons/AccountTree"; import AccountTree from '@material-ui/icons/AccountTree';
import InfoIcon from "@material-ui/icons/Info"; import InfoIcon from '@material-ui/icons/Info';
import ArrowForwardIcon from "@material-ui/icons/ArrowForward"; import ArrowForwardIcon from '@material-ui/icons/ArrowForward';
import CreateIcon from "@material-ui/icons/Create"; import CreateIcon from '@material-ui/icons/Create';
const bodyDivStyle = { const bodyDivStyle = {
margin: "auto", margin: "auto",
}; }
const surfaceColor = "#27292D"; const surfaceColor = "#27292D"
const boxStyle = { const boxStyle = {
flex: "1", flex: "1",
marginLeft: "10px", marginLeft: "10px",
marginRight: "10px", marginRight: "10px",
height: "400px", height: "400px",
//backgroundColor: "#e8eaf6", //backgroundColor: "#e8eaf6",
backgroundColor: surfaceColor, backgroundColor: surfaceColor,
textAlign: "center", textAlign: "center",
display: "flex", display: "flex",
flexDirection: "column", flexDirection: "column",
}; }
const bodyTextStyle = { const bodyTextStyle = {
color: "#ffffff", color: "#ffffff",
}; }
const hrefStyle = { const hrefStyle = {
color: "inherit", color: "inherit",
textDecoration: "none", textDecoration: "none",
}; }
// Should be different if logged in :| // Should be different if logged in :|
const LandingPage = (props) => { const LandingPage = (props) => {
const { isLoaded } = props; const { isLoaded} = props;
const textColor = "#8899A6"; const textColor = "#8899A6"
const iconColor = "#1DA1F2"; const iconColor = "#1DA1F2"
const iconSize = "8em"; const iconSize = "8em"
const GridLayout = (header, description, link, icon) => { const GridLayout = (header, description, link, icon) => {
return ( return (
<Paper style={boxStyle}> <Paper style={boxStyle}>
<a href={link} style={hrefStyle}> <a href={link} style={hrefStyle}>
<div style={{ flex: "1", color: "#FFFFFF" }}> <div style={{flex: "1", color: "#FFFFFF"}}>
<h2>{header}</h2> <h2>{header}</h2>
</div> </div>
<Divider /> <Divider />
<div <div style={{flex: "3", marginLeft: "10px", marginRight: "10px", marginTop: "10px", color: textColor}}>
style={{ {description}
flex: "3", </div>
marginLeft: "10px", <div style={{margin: "auto"}}>
marginRight: "10px", {icon}
marginTop: "10px", </div>
color: textColor, <Divider style={{marginTop: "20px", marginBottom: "20px"}} />
}} <div style={{flex: "1", color: "#f85a3e"}}>
> <div style={{}} >
{description} Learn more
</div> </div>
<div style={{ margin: "auto" }}>{icon}</div> </div>
<Divider style={{ marginTop: "20px", marginBottom: "20px" }} /> </a>
<div style={{ flex: "1", color: "#f85a3e" }}> </Paper>
<div style={{}}>Learn more</div> )
</div> }
</a>
</Paper>
);
};
const listitems = [ const listitems = [
GridLayout( GridLayout("Simple integrations", "Easily use others' or create your own integration", "/docs/features", <Web style={{fontSize: iconSize, marginTop: "20px", color: iconColor}} />),
"Simple integrations", GridLayout("Workflows", "Access the power of automation within minutes, whether its on premise or in the cloud", "/docs/features", <AccountTree style={{fontSize: iconSize, marginTop: "20px", color: iconColor}} />),
"Easily use others' or create your own integration", GridLayout("Realtime actions", "Beat the clock by leveraging our realtime triggers", "/docs/features", <ScheduleIcon style={{fontSize: iconSize, marginTop: "20px", color: iconColor}} />),
"/docs/features", ]
<Web
style={{ fontSize: iconSize, marginTop: "20px", color: iconColor }}
/>
),
GridLayout(
"Workflows",
"Access the power of automation within minutes, whether its on premise or in the cloud",
"/docs/features",
<AccountTree
style={{ fontSize: iconSize, marginTop: "20px", color: iconColor }}
/>
),
GridLayout(
"Realtime actions",
"Beat the clock by leveraging our realtime triggers",
"/docs/features",
<ScheduleIcon
style={{ fontSize: iconSize, marginTop: "20px", color: iconColor }}
/>
),
];
// The actual landing page // The actual landing page
// <img style={{width: "400px"}} alt={"logo"} src={Default}/> // <img style={{width: "400px"}} alt={"logo"} src={Default}/>
//We start by understanding your unique environment to help identify the right thing to automate. //We start by understanding your unique environment to help identify the right thing to automate.
const secondaryColor = "rgba(167,46,87,1)"; const secondaryColor = "rgba(167,46,87,1)"
const primaryColor = "rgba(25, 35, 94, 1)"; const primaryColor = "rgba(25, 35, 94, 1)"
const paperStyle = { const paperStyle = {
flex: 1, flex: 1,
backgroundColor: "inherit", backgroundColor: "inherit",
cursor: "pointer", cursor: "pointer",
}; }
const secondaryItemList = [
{
primaryText: "No time to waste",
secondaryText: "Bring all your applications into a single view, and make them all work together flawlessly!",
image: "/images/time.jpg",
}, {
primaryText: "Get a better overview",
secondaryText: "Don't know what's happening? We'll help you track and act on your most valuable KPI's!",
image: "/images/overview.jpg",
}, {
primaryText: "Conquer your tasks",
secondaryText: "Get access to powerful tools and pre-made workflows to help you crush your teams daily tasks!",
image: "/images/burnout.jpg",
},
]
const [image, setImage] = useState(secondaryItemList[0].image);
const secondaryItemList = [ const landingpageDataBrowser =
{ <div>
primaryText: "No time to waste", <div style={{backgroundImage: "url('/images/test.jpg')", backgroundSize: "80% 100%", backgroundRepeat: "no-repeat", minHeight: "100vh", maxHeight: 1024}}>
secondaryText: <div style={{textAlign: "left", paddingTop: 135, maxWidth: 700, paddingLeft: "50%", color: secondaryColor, display: "flex", fontSize: 25}}>
"Bring all your applications into a single view, and make them all work together flawlessly!", <div style={{flex: 1}}>
image: "/images/time.jpg", <a href="/docs/about" style={hrefStyle}>
}, <Grid container direction="row" alignItems="center">
{ <Grid item>
primaryText: "Get a better overview", <InfoIcon />
secondaryText: </Grid>
"Don't know what's happening? We'll help you track and act on your most valuable KPI's!", <Grid item style={{marginLeft: 5}}>
image: "/images/overview.jpg", About
}, </Grid>
{ </Grid>
primaryText: "Conquer your tasks", </a>
secondaryText: </div>
"Get access to powerful tools and pre-made workflows to help you crush your teams daily tasks!", <div style={{flex: 1}}>
image: "/images/burnout.jpg", <a href="/contact" style={hrefStyle}>
}, <Grid container direction="row" alignItems="center">
]; <Grid item>
const [image, setImage] = useState(secondaryItemList[0].image); <CreateIcon />
</Grid>
<Grid item style={{marginLeft: 5}}>
Get in touch
</Grid>
</Grid>
</a>
</div>
<div style={{flex: 1}}>
<a href="/login" style={hrefStyle}>
<Button
style={{borderRadius: 25, height: 50, minWidth: 200, backgroundColor: secondaryColor, color: "white"}} variant="contained">
Try it out <ArrowForwardIcon />
</Button>
</a>
</div>
</div>
<div style={bodyTextStyle, {textAlign: "left", paddingTop: "8%", paddingLeft: "28%", maxWidth: 430,}}>
<div style={{fontSize: 25, color:"rgba(0,0,0,0.45)"}}>
Shuffle
</div>
<div style={{fontSize: 50, color: "rgba(0,0,0,0.7)"}}>
INFORMATION <div style={{color: secondaryColor}}>OVERLOAD</div>
</div>
<div style={{fontSize: 20, color: "rgba(0, 0, 0, 0.45)", marginTop: 20,}}>
Everyone run into the same fundamental operational problems. Mailbox chaos, tickets getting out of hand and a constant feeling of being overwhelmed. The good news? <div style={{color: secondaryColor, marginTop: 10}}>Shuffle solves them.</div>
</div>
<a href="/docs/features" style={hrefStyle}>
<Button
style={{borderRadius: 25, height: 50, marginTop: 50, width: 200, backgroundColor: secondaryColor, color: "white"}}
variant="contained"
>Learn how</Button>
</a>
</div>
</div>
<div style={{minHeight: 1024, width: "100%", backgroundImage: "linear-gradient(to bottom right, #19235e, #19235e)",}}>
<div style={{minHeight: 1000, paddingTop: 150, maxWidth: 1250, margin: "auto"}}>
<div style={{color: "rgba(255,255,255,0.8", fontSize: 60, marginLeft: 25, }}>
<b>Automation is just the beginning </b>
</div>
<div style={{marginTop: 40, display: 'flex', flexDirection: "row"}}>
<div style={{flex: 8, display: "flex", flexDirection: "column", fontSize: 40, }}>
{secondaryItemList.map((data, index) => {
const color = image === data.image ? "rgba(255,255,255,1)" : "rgba(255,255,255,0.4)"
return (
<div style={{borderRadius: 15, padding: 25, maxWidth: 600, height: 150, fontSize: 40, color: color, cursor: "pointer"}} onClick={() => setImage(data.image)}>
{data.primaryText}
<div style={{fontSize: 22, marginTop: 10, }}>
{data.secondaryText}
</div>
</div>
)
})}
</div>
<div style={{flex: 1}} />
<div style={{flex: 10, height: "100%", width: "100%",}}>
<img src={image} style={{borderRadius: 15, minHeight: "100%", minWidth: "100%", maxWidth: "100%", maxHeight: "100%"}}/>
</div>
</div>
</div>
<div style={{maxWidth: 1250, paddingTop: 100, paddingBottom: 100, margin: "auto", color: "rgba(255,255,255,0.8)"}}>
<Divider style={{backgroundColor: "rgba(255,255,255,0.6)"}} />
<div style={{marginTop: 100, fontSize: 40, display: "flex", marginLeft: 100, marginRight: 100}}>
<div style={{flex: 3}}>
Learn more about the benefits of Shuffle
</div>
<div style={{flex: 1}}>
<a href="/docs/features" style={hrefStyle}>
<Button
fullWidth
style={{borderRadius: 25, minHeight: 50, minWidth: 200, backgroundColor: secondaryColor, color: "white"}} variant="contained">
See features
</Button>
</a>
</div>
</div>
</div>
</div>
<div style={{textAlign: "center", maxWidth: 1100, minHeight: 600, paddingTop: 100, margin: "auto", color: "rgba(0,0,0,1)"}}>
<div style={{fontSize: 50}}>
<b>Focus on the work that matters to you</b>
</div>
<div style={{fontSize: 20, color: "rgba(0,0,0,0.7)", maxWidth: "100%"}}>
Menial tasks, scattered content, constant copy pasting, waste of talent - <b>there's a smarter way to work.</b>
</div>
<div style={{display: "flex", marginTop: 50}}>
<Card onClick={() => {window.location.pathname = "/docs/features"}} style={{flex: 1, margin: 10, textAlign: "center"}}>
<CardActionArea>
<CardMedia
title="TEST"
image="/images/time.jpg"
/>
<CardContent>
<h3>Premade playbooks</h3>
<p>Get your automation done with minimal effort</p>
</CardContent>
</CardActionArea>
<Button size="medium" color="green">
Learn more
</Button>
</Card>
<Card onClick={() => {window.location.pathname = "/docs/features"}} style={{flex: 1, margin: 10, textAlign: "center"}}>
<CardActionArea>
<CardMedia
title="TEST"
image="/images/time.jpg"
/>
<CardContent>
<h3>Open frameworks</h3>
<p>Mitre Att&ck, OpenAPI and more!</p>
</CardContent>
</CardActionArea>
<Button size="medium" color="green">
Learn more
</Button>
</Card>
<Card onClick={() => {window.location.pathname = "/docs/features"}} style={{flex: 1, margin: 10, textAlign: "center"}}>
<CardActionArea>
<CardMedia
title="TEST"
image="/images/time.jpg"
/>
<CardContent>
<h3>Hundreds of integrations</h3>
<p>Quickly integrate your software applications</p>
</CardContent>
</CardActionArea>
<Button size="medium" color="green">
Learn more
</Button>
</Card>
<Card style={{flex: 1, margin: 10, textAlign: "center"}} onClick={() => {window.location.pathname = "/docs/features"}}>
<CardActionArea>
<CardMedia
title="TEST"
image="images/time.jpg"
/>
<CardContent>
<h3>Automated compliance</h3>
<p>Stuck with compliance needs you can't meet?</p>
</CardContent>
</CardActionArea>
<Button size="medium" color="green">
Learn more
</Button>
</Card>
</div>
</div>
</div>
const landingpageDataBrowser = ( const landingpageDataMobile =
<div> <div style={{backgroundColor: "#1F2023", paddingTop: 30}}>
<div <div style={{color: "white", textAlign: "center", marginLeft: "10px", marginRight: "10px"}}>
style={{ <h1>Shuffle</h1>
backgroundImage: "url('/images/test.jpg')", <h3>A general automation solution for Infosec and IT Professionals</h3>
backgroundSize: "80% 100%", <a href="/contact" style={hrefStyle}>
backgroundRepeat: "no-repeat", <Button
minHeight: "100vh", style={{width: "220px", height: "60px", borderRadius: "0px"}}
maxHeight: 1024, variant="contained"
}} color="primary"
> >
<div Contact
style={{ </Button>
textAlign: "left", </a>
paddingTop: 135, </div>
maxWidth: 700, <div style={{display: "flex", flexDirection: "column", marginTop: "100px"}}>
paddingLeft: "50%", <div>
color: secondaryColor, {listitems[0]}
display: "flex", </div>
fontSize: 25, <div style={{marginTop: "20px"}}>
}} {listitems[1]}
> </div>
<div style={{ flex: 1 }}> <div style={{marginTop: "20px", marginBottom: "30px"}}>
<a href="/docs/about" style={hrefStyle}> {listitems[2]}
<Grid container direction="row" alignItems="center"> </div>
<Grid item> <div style={{marginTop: "20px", marginBottom: "30px", textAlign: "center"}}>
<InfoIcon /> <a href="/contact" style={hrefStyle}>
</Grid> <Button
<Grid item style={{ marginLeft: 5 }}> style={{width: "220px", height: "60px", borderRadius: "0px"}}
About variant="contained"
</Grid> color="primary"
</Grid> >
</a> Contact
</div> </Button>
<div style={{ flex: 1 }}> </a>
<a href="/contact" style={hrefStyle}> </div>
<Grid container direction="row" alignItems="center"> </div>
<Grid item> </div>
<CreateIcon />
</Grid>
<Grid item style={{ marginLeft: 5 }}>
Get in touch
</Grid>
</Grid>
</a>
</div>
<div style={{ flex: 1 }}>
<a href="/login" style={hrefStyle}>
<Button
style={{
borderRadius: 25,
height: 50,
minWidth: 200,
backgroundColor: secondaryColor,
color: "white",
}}
variant="contained"
>
Try it out <ArrowForwardIcon />
</Button>
</a>
</div>
</div>
<div
style={
(bodyTextStyle,
{
textAlign: "left",
paddingTop: "8%",
paddingLeft: "28%",
maxWidth: 430,
})
}
>
<div style={{ fontSize: 25, color: "rgba(0,0,0,0.45)" }}>Shuffle</div>
<div style={{ fontSize: 50, color: "rgba(0,0,0,0.7)" }}>
INFORMATION <div style={{ color: secondaryColor }}>OVERLOAD</div>
</div>
<div
style={{
fontSize: 20,
color: "rgba(0, 0, 0, 0.45)",
marginTop: 20,
}}
>
Everyone run into the same fundamental operational problems. Mailbox
chaos, tickets getting out of hand and a constant feeling of being
overwhelmed. The good news?{" "}
<div style={{ color: secondaryColor, marginTop: 10 }}>
Shuffle solves them.
</div>
</div>
<a href="/docs/features" style={hrefStyle}>
<Button
style={{
borderRadius: 25,
height: 50,
marginTop: 50,
width: 200,
backgroundColor: secondaryColor,
color: "white",
}}
variant="contained"
>
Learn how
</Button>
</a>
</div>
</div>
<div
style={{
minHeight: 1024,
width: "100%",
backgroundImage: "linear-gradient(to bottom right, #19235e, #19235e)",
}}
>
<div
style={{
minHeight: 1000,
paddingTop: 150,
maxWidth: 1250,
margin: "auto",
}}
>
<div
style={{
color: "rgba(255,255,255,0.8",
fontSize: 60,
marginLeft: 25,
}}
>
<b>Automation is just the beginning </b>
</div>
<div style={{ marginTop: 40, display: "flex", flexDirection: "row" }}>
<div
style={{
flex: 8,
display: "flex",
flexDirection: "column",
fontSize: 40,
}}
>
{secondaryItemList.map((data, index) => {
const color =
image === data.image
? "rgba(255,255,255,1)"
: "rgba(255,255,255,0.4)";
return (
<div
style={{
borderRadius: 15,
padding: 25,
maxWidth: 600,
height: 150,
fontSize: 40,
color: color,
cursor: "pointer",
}}
onClick={() => setImage(data.image)}
>
{data.primaryText}
<div style={{ fontSize: 22, marginTop: 10 }}>
{data.secondaryText}
</div>
</div>
);
})}
</div>
<div style={{ flex: 1 }} />
<div style={{ flex: 10, height: "100%", width: "100%" }}>
<img
src={image}
style={{
borderRadius: 15,
minHeight: "100%",
minWidth: "100%",
maxWidth: "100%",
maxHeight: "100%",
}}
/>
</div>
</div>
</div>
<div
style={{
maxWidth: 1250,
paddingTop: 100,
paddingBottom: 100,
margin: "auto",
color: "rgba(255,255,255,0.8)",
}}
>
<Divider style={{ backgroundColor: "rgba(255,255,255,0.6)" }} />
<div
style={{
marginTop: 100,
fontSize: 40,
display: "flex",
marginLeft: 100,
marginRight: 100,
}}
>
<div style={{ flex: 3 }}>
Learn more about the benefits of Shuffle
</div>
<div style={{ flex: 1 }}>
<a href="/docs/features" style={hrefStyle}>
<Button
fullWidth
style={{
borderRadius: 25,
minHeight: 50,
minWidth: 200,
backgroundColor: secondaryColor,
color: "white",
}}
variant="contained"
>
See features
</Button>
</a>
</div>
</div>
</div>
</div>
<div
style={{
textAlign: "center",
maxWidth: 1100,
minHeight: 600,
paddingTop: 100,
margin: "auto",
color: "rgba(0,0,0,1)",
}}
>
<div style={{ fontSize: 50 }}>
<b>Focus on the work that matters to you</b>
</div>
<div
style={{ fontSize: 20, color: "rgba(0,0,0,0.7)", maxWidth: "100%" }}
>
Menial tasks, scattered content, constant copy pasting, waste of
talent - <b>there's a smarter way to work.</b>
</div>
<div style={{ display: "flex", marginTop: 50 }}>
<Card
onClick={() => {
window.location.pathname = "/docs/features";
}}
style={{ flex: 1, margin: 10, textAlign: "center" }}
>
<CardActionArea>
<CardMedia title="TEST" image="/images/time.jpg" />
<CardContent>
<h3>Premade playbooks</h3>
<p>Get your automation done with minimal effort</p>
</CardContent>
</CardActionArea>
<Button size="medium" color="green">
Learn more
</Button>
</Card>
<Card
onClick={() => {
window.location.pathname = "/docs/features";
}}
style={{ flex: 1, margin: 10, textAlign: "center" }}
>
<CardActionArea>
<CardMedia title="TEST" image="/images/time.jpg" />
<CardContent>
<h3>Open frameworks</h3>
<p>Mitre Att&ck, OpenAPI and more!</p>
</CardContent>
</CardActionArea>
<Button size="medium" color="green">
Learn more
</Button>
</Card>
<Card
onClick={() => {
window.location.pathname = "/docs/features";
}}
style={{ flex: 1, margin: 10, textAlign: "center" }}
>
<CardActionArea>
<CardMedia title="TEST" image="/images/time.jpg" />
<CardContent>
<h3>Hundreds of integrations</h3>
<p>Quickly integrate your software applications</p>
</CardContent>
</CardActionArea>
<Button size="medium" color="green">
Learn more
</Button>
</Card>
<Card
style={{ flex: 1, margin: 10, textAlign: "center" }}
onClick={() => {
window.location.pathname = "/docs/features";
}}
>
<CardActionArea>
<CardMedia title="TEST" image="images/time.jpg" />
<CardContent>
<h3>Automated compliance</h3>
<p>Stuck with compliance needs you can't meet?</p>
</CardContent>
</CardActionArea>
<Button size="medium" color="green">
Learn more
</Button>
</Card>
</div>
</div>
</div>
);
const landingpageDataMobile = (
<div style={{ backgroundColor: "#1F2023", paddingTop: 30 }}>
<div
style={{
color: "white",
textAlign: "center",
marginLeft: "10px",
marginRight: "10px",
}}
>
<h1>Shuffle</h1>
<h3>A general automation solution for Infosec and IT Professionals</h3>
<a href="/contact" style={hrefStyle}>
<Button
style={{ width: "220px", height: "60px", borderRadius: "0px" }}
variant="contained"
color="primary"
>
Contact
</Button>
</a>
</div>
<div
style={{ display: "flex", flexDirection: "column", marginTop: "100px" }}
>
<div>{listitems[0]}</div>
<div style={{ marginTop: "20px" }}>{listitems[1]}</div>
<div style={{ marginTop: "20px", marginBottom: "30px" }}>
{listitems[2]}
</div>
<div
style={{
marginTop: "20px",
marginBottom: "30px",
textAlign: "center",
}}
>
<a href="/contact" style={hrefStyle}>
<Button
style={{ width: "220px", height: "60px", borderRadius: "0px" }}
variant="contained"
color="primary"
>
Contact
</Button>
</a>
</div>
</div>
</div>
);
// Reroute if the user is logged in // Reroute if the user is logged in
// const landingSite = isLoggedIn ? <Workflows globalUrl={globalUrl}{...props} /> : <div style={bodyDivStyle}>{landingpageData}</div> // const landingSite = isLoggedIn ? <Workflows globalUrl={globalUrl}{...props} /> : <div style={bodyDivStyle}>{landingpageData}</div>
const landingSite = <div style={bodyDivStyle}>{landingpageDataBrowser}</div>; const landingSite = <div style={bodyDivStyle}>{landingpageDataBrowser}</div>
const loadedCheck = isLoaded ? ( const loadedCheck = isLoaded ?
<div> <div>
<BrowserView>{landingSite}</BrowserView> <BrowserView>
<MobileView>{landingpageDataMobile}</MobileView> {landingSite}
</div> </BrowserView>
) : ( <MobileView>
<div></div> {landingpageDataMobile}
); </MobileView>
</div>
:
<div>
</div>
return <div>{loadedCheck}</div>; return(
}; <div>
{loadedCheck}
</div>
)
}
export default LandingPage; export default LandingPage;
+347 -446
View File
@@ -1,490 +1,391 @@
/* eslint-disable react/no-multi-comp */ /* eslint-disable react/no-multi-comp */
import React, { useState } from "react"; import React, { useState } from 'react';
import { makeStyles } from "@material-ui/styles"; import { makeStyles } from '@material-ui/styles';
import { useInterval } from "react-powerhooks"; import { useInterval } from 'react-powerhooks';
import {CircularProgress, TextField, Button, Paper, Typography} from '@material-ui/core'
import { useTheme } from '@material-ui/core/styles';
import {
CircularProgress,
TextField,
Button,
Paper,
Typography,
} from "@material-ui/core";
import { useTheme } from "@material-ui/core/styles";
const hrefStyle = { const hrefStyle = {
color: "white", color: "white",
textDecoration: "none", textDecoration: "none"
}; }
const bodyDivStyle = { const bodyDivStyle = {
margin: "auto", margin: "auto",
marginTop: 150, marginTop: 150,
width: "500px", width: "500px",
}; }
const useStyles = makeStyles({ const useStyles = makeStyles({
notchedOutline: { notchedOutline: {
borderColor: "#f85a3e !important", borderColor: "#f85a3e !important"
}, },
}); });
const LoginDialog = (props) => { const LoginDialog = props => {
const theme = useTheme(); const theme = useTheme();
const { const { globalUrl, isLoaded, isLoggedIn, setIsLoggedIn, setCookie, register, checkLogin } = props;
globalUrl, const [username, setUsername] = useState("");
isLoaded, const [password, setPassword] = useState("");
isLoggedIn, const [firstRequest, setFirstRequest] = useState(true);
setIsLoggedIn,
setCookie,
register,
checkLogin,
} = props;
const [username, setUsername] = useState("");
const [password, setPassword] = useState("");
const [firstRequest, setFirstRequest] = useState(true);
const [loginLoading, setLoginLoading] = useState(false); const [loginLoading, setLoginLoading] = useState(false);
const [loginViewLoading, setLoginViewLoading] = useState(false); const [loginViewLoading, setLoginViewLoading] = useState(false);
const [ssoUrl, setSSOUrl] = useState(""); const [ssoUrl, setSSOUrl] = useState("")
const [MFAField, setMFAField] = useState(false); const [MFAField, setMFAField] = useState(false);
const [MFAValue, setMFAValue] = useState(""); const [MFAValue, setMFAValue] = useState("");
// Used to swap from login to register. True = login, false = register // Used to swap from login to register. True = login, false = register
const classes = useStyles(); const classes = useStyles();
// Error messages etc // Error messages etc
const [loginInfo, setLoginInfo] = useState(""); const [loginInfo, setLoginInfo] = useState("");
const handleValidateForm = () => { const handleValidateForm = () => {
return username.length > 1 && password.length > 1; return (username.length > 1 && password.length > 1);
}; }
if (isLoggedIn === true) { if (isLoggedIn === true) {
window.location.pathname = "/workflows"; window.location.pathname = "/workflows"
} }
const checkAdmin = () => { const checkAdmin = () => {
const url = globalUrl + "/api/v1/checkusers"; const url = globalUrl + '/api/v1/checkusers';
fetch(url, { fetch(url, {
method: "GET", method: 'GET',
headers: { headers: {
"Content-Type": "application/json", 'Content-Type': 'application/json',
}, },
}) })
.then((response) => .then(response =>
response.json().then((responseJson) => { response.json().then(responseJson => {
if (responseJson["success"] === false) { if (responseJson["success"] === false) {
setLoginInfo(responseJson["reason"]); setLoginInfo(responseJson["reason"])
} else { } else {
if ( if (responseJson.sso_url !== undefined && responseJson.sso_url !== null) {
responseJson.sso_url !== undefined && setSSOUrl(responseJson.sso_url)
responseJson.sso_url !== null }
) {
setSSOUrl(responseJson.sso_url);
}
if (loginViewLoading) { if (loginViewLoading) {
setLoginViewLoading(false); setLoginViewLoading(false)
checkLogin(); checkLogin()
stop(); stop()
if ( if (responseJson.reason !== undefined && responseJson.reason !== null) {
responseJson.reason !== undefined && setLoginInfo(responseJson.reason)
responseJson.reason !== null }
) { }
setLoginInfo(responseJson.reason);
}
}
if (responseJson.reason === "stay") { if (responseJson.reason === "stay") {
window.location.pathname = "/adminsetup"; window.location.pathname = "/adminsetup"
} }
} }
}) }),
) )
.catch((error) => { .catch(error => {
if (!loginViewLoading) { if (!loginViewLoading) {
setLoginViewLoading(true); setLoginViewLoading(true)
start(); start()
} }
}); })
}; }
const { start, stop } = useInterval({ const { start, stop } = useInterval({
duration: 3000, duration: 3000,
startImmediate: false, startImmediate: false,
callback: () => { callback: () => {
checkAdmin(); checkAdmin()
}, }
}); })
if (firstRequest) { if (firstRequest) {
setFirstRequest(false); setFirstRequest(false)
checkAdmin(); checkAdmin()
} }
const onSubmit = (e) => { const onSubmit = (e) => {
setLoginLoading(true); setLoginLoading(true)
e.preventDefault(); e.preventDefault()
setLoginInfo(""); setLoginInfo("")
// FIXME - add some check here ROFL // FIXME - add some check here ROFL
// Just use this one? // Just use this one?
var data = { username: username, password: password }; var data = {"username": username, "password": password}
if (MFAValue !== undefined && MFAValue !== null && MFAValue.length > 0) { if (MFAValue !== undefined && MFAValue !== null && MFAValue.length > 0) {
data["mfa_code"] = MFAValue; data["mfa_code"] = MFAValue
} }
var baseurl = globalUrl; var baseurl = globalUrl
if (register) { if (register) {
var url = baseurl + "/api/v1/users/login"; var url = baseurl + '/api/v1/users/login';
fetch(url, { fetch(url, {
mode: "cors", mode: 'cors',
method: "POST", method: 'POST',
body: JSON.stringify(data), body: JSON.stringify(data),
credentials: "include", credentials: 'include',
crossDomain: true, crossDomain: true,
withCredentials: true, withCredentials: true,
headers: { headers: {
"Content-Type": "application/json; charset=utf-8", 'Content-Type': 'application/json; charset=utf-8',
}, },
}) })
.then((response) => .then(response =>
response.json().then((responseJson) => { response.json().then(responseJson => {
setLoginLoading(false); setLoginLoading(false)
if (responseJson["success"] === false) { if (responseJson["success"] === false) {
setLoginInfo(responseJson["reason"]); setLoginInfo(responseJson["reason"])
} else { } else {
if (responseJson["reason"] === "MFA_REDIRECT") { if (responseJson["reason"] === "MFA_REDIRECT") {
setLoginInfo( setLoginInfo("MFA required. Please the 6-digit code from your authenticator")
"MFA required. Please the 6-digit code from your authenticator" setMFAField(true)
); return
setMFAField(true); }
return;
}
setLoginInfo("Successful login, rerouting"); setLoginInfo("Successful login, rerouting")
for (var key in responseJson["cookies"]) { for (var key in responseJson["cookies"]) {
setCookie( setCookie(responseJson["cookies"][key].key, responseJson["cookies"][key].value, { path: "/" })
responseJson["cookies"][key].key, }
responseJson["cookies"][key].value,
{ path: "/" }
);
}
setIsLoggedIn(true); setIsLoggedIn(true)
window.location.pathname = "/workflows"; window.location.pathname = "/workflows"
} }
}) }),
) )
.catch((error) => { .catch(error => {
setLoginLoading(false); setLoginLoading(false)
setLoginInfo("Error logging in: " + error); setLoginInfo("Error logging in: " + error)
}); });
} else { } else {
url = baseurl + "/api/v1/users/register"; url = baseurl + '/api/v1/users/register';
fetch(url, { fetch(url, {
method: "POST", method: 'POST',
body: JSON.stringify(data), body: JSON.stringify(data),
headers: { headers: {
"Content-Type": "application/json", 'Content-Type': 'application/json',
}, },
}) })
.then((response) => .then(response =>
response.json().then((responseJson) => { response.json().then(responseJson => {
if (responseJson["success"] === false) { if (responseJson["success"] === false) {
setLoginInfo(responseJson["reason"]); setLoginInfo(responseJson["reason"])
} else { } else {
setLoginInfo("Successful register!"); setLoginInfo("Successful register!")
} }
}) }),
) )
.catch((error) => { .catch(error => {
setLoginInfo("Error in from backend: ", error); setLoginInfo("Error in from backend: ", error)
}); });
} }
}; }
const onChangeUser = (e) => { const onChangeUser = (e) => {
setUsername(e.target.value); setUsername(e.target.value)
}; }
const onChangePass = (e) => { const onChangePass = (e) => {
setPassword(e.target.value); setPassword(e.target.value)
}; }
//const onClickRegister = () => { //const onClickRegister = () => {
// if (props.location.pathname === "/login") { // if (props.location.pathname === "/login") {
// window.location.pathname = "/register" // window.location.pathname = "/register"
// } else { // } else {
// window.location.pathname = "/login" // window.location.pathname = "/login"
// } // }
// setLoginCheck(!register) // setLoginCheck(!register)
//} //}
//var loginChange = register ? (<div><p onClick={setLoginCheck(false)}>Want to register? Click here.</p></div>) : (<div><p onClick={setLoginCheck(true)}>Go back to login? Click here.</p></div>); //var loginChange = register ? (<div><p onClick={setLoginCheck(false)}>Want to register? Click here.</p></div>) : (<div><p onClick={setLoginCheck(true)}>Go back to login? Click here.</p></div>);
var formtitle = register ? <div>Login</div> : <div>Register</div>; var formtitle = register ? <div>Login</div> : <div>Register</div>
const imgsize = 100; const imgsize = 100
const basedata = ( const basedata =
<div style={bodyDivStyle}> <div style={bodyDivStyle}>
<Paper <Paper style={{
style={{ paddingLeft: "30px",
paddingLeft: "30px", paddingRight: "30px",
paddingRight: "30px", paddingBottom: "30px",
paddingBottom: "30px", paddingTop: "30px",
paddingTop: "30px", position: "relative",
position: "relative", backgroundColor: theme.palette.surfaceColor,
backgroundColor: theme.palette.surfaceColor, }}>
}} <div style={{position: "absolute", top: -imgsize/2-10, left: 250-imgsize/2, height: imgsize, width: imgsize, }}>
> <img src="images/Shuffle_logo.png" style={{height: imgsize+10, width: imgsize+10, border: "2px solid rgba(255,255,255,0.6)", borderRadius: imgsize,}}/>
<div </div>
style={{ {loginViewLoading ?
position: "absolute", <div style={{textAlign: "center", marginTop: 50, }}>
top: -imgsize / 2 - 10, <Typography variant="body2" style={{marginBottom: 20, color: "white",}}>
left: 250 - imgsize / 2, Waiting for the Shuffle database to become available. This may take up to a minute.
height: imgsize, </Typography>
width: imgsize,
}}
>
<img
src="images/Shuffle_logo.png"
style={{
height: imgsize + 10,
width: imgsize + 10,
border: "2px solid rgba(255,255,255,0.6)",
borderRadius: imgsize,
}}
/>
</div>
{loginViewLoading ? (
<div style={{ textAlign: "center", marginTop: 50 }}>
<Typography
variant="body2"
style={{ marginBottom: 20, color: "white" }}
>
Waiting for the Shuffle database to become available. This may
take up to a minute.
</Typography>
{loginInfo === undefined || {loginInfo === undefined || loginInfo === null || loginInfo.length === 0 ?
loginInfo === null || null
loginInfo.length === 0 ? null : ( :
<div style={{ marginTop: "10px" }}>Response: {loginInfo}</div> <div style={{ marginTop: "10px" }}>
)} Response: {loginInfo}
<CircularProgress color="secondary" style={{ color: "white" }} /> </div>
}
<CircularProgress color="secondary" style={{color: "white",}} />
<Paper
style={{
paddingLeft: "30px",
paddingRight: "30px",
paddingBottom: "30px",
paddingTop: "30px",
position: "relative",
backgroundColor: theme.palette.inputColor,
textAlign: "left",
marginTop: 15,
}}
>
<Typography
variant="body2"
style={{ marginBottom: 20, color: "white" }}
>
<b>
Are you sure Shuffle is{" "}
<a
rel="norefferer"
target="_blank"
href="https://github.com/frikky/Shuffle/blob/master/.github/install-guide.md"
style={{ textDecoration: "none", color: "#f86a3e" }}
>
installed correctly
</a>
?
</b>
</Typography>
<Typography
variant="body2"
style={{ marginBottom: 20, color: "white" }}
>
<b>1.</b> Make sure shuffle-database folder has correct access:{" "}
<br />
<br />
sudo chown 1000:1000 -R shuffle-database
</Typography>
<Typography <Paper style={{
variant="body2" paddingLeft: "30px",
style={{ marginBottom: 20, color: "white" }} paddingRight: "30px",
> paddingBottom: "30px",
<b>2</b>. Restart docker-compose: paddingTop: "30px",
<br /> position: "relative",
<br /> backgroundColor: theme.palette.inputColor,
sudo docker-compose restart textAlign: "left",
</Typography> marginTop: 15,
</Paper> }}>
<Typography <Typography variant="body2" style={{marginBottom: 20, color: "white",}}>
variant="body2" <b>Are you sure Shuffle is <a rel="norefferer" target="_blank" href="https://github.com/frikky/Shuffle/blob/master/.github/install-guide.md" style={{textDecoration: "none", color: "#f86a3e"}}>installed correctly</a>?</b>
style={{ marginBottom: 10, color: "white", marginTop: 20 }} </Typography>
> <Typography variant="body2" style={{marginBottom: 20, color: "white",}}>
Need help?{" "} <b>1.</b> Make sure shuffle-database folder has correct access: <br/><br/>
<a sudo chown 1000:1000 -R shuffle-database
rel="norefferer" </Typography>
target="_blank"
href="https://discord.gg/B2CBzUm"
style={{ textDecoration: "none", color: "#f86a3e" }}
>
Join the Discord!
</a>
</Typography>
</div>
) : (
<form
onSubmit={onSubmit}
style={{ margin: "15px 15px 15px 15px", color: "white" }}
>
<h2>{formtitle}</h2>
Username
<div>
<TextField
color="primary"
style={{
backgroundColor: theme.palette.inputColor,
marginTop: 5,
}}
autoFocus
InputProps={{
classes: {
notchedOutline: classes.notchedOutline,
},
style: {
height: "50px",
color: "white",
fontSize: "1em",
},
}}
required
fullWidth={true}
autoComplete="username"
placeholder="username@example.com"
id="emailfield"
margin="normal"
variant="outlined"
onChange={onChangeUser}
/>
</div>
Password
<div>
<TextField
color="primary"
style={{
backgroundColor: theme.palette.inputColor,
marginTop: 5,
}}
InputProps={{
classes: {
notchedOutline: classes.notchedOutline,
},
style: {
height: "50px",
color: "white",
fontSize: "1em",
},
}}
required
id="outlined-password-input"
fullWidth={true}
type="password"
autoComplete="current-password"
placeholder="**********"
margin="normal"
variant="outlined"
onChange={onChangePass}
/>
</div>
{MFAField === true ? (
<div style={{ marginTop: 15 }}>
5-factor code
<TextField
color="primary"
style={{
backgroundColor: theme.palette.inputColor,
marginTop: 5,
}}
InputProps={{
classes: {
notchedOutline: classes.notchedOutline,
},
style: {
height: "50px",
color: "white",
fontSize: "1em",
},
}}
required
id="outlined-password-input"
fullWidth={true}
type="text"
placeholder="6-digit code"
margin="normal"
variant="outlined"
onChange={(event) => {
setMFAValue(event.target.value);
}}
/>
</div>
) : null}
<div style={{ display: "flex", marginTop: "15px" }}>
<Button
color="primary"
variant="contained"
type="submit"
style={{ flex: "1" }}
disabled={!handleValidateForm() || loginLoading}
>
{loginLoading ? (
<CircularProgress
color="secondary"
style={{ color: "white" }}
/>
) : (
"SUBMIT"
)}
</Button>
</div>
<div style={{ marginTop: "10px" }}>{loginInfo}</div>
{ssoUrl !== undefined && ssoUrl !== null && ssoUrl.length > 0 ? (
<div>
<Typography style={{ textAlign: "center" }}>Or</Typography>
<div style={{ textAlign: "center", margin: 10 }}>
<Button
fullWidth
color="secondary"
variant="outlined"
type="button"
style={{ flex: "1", marginTop: 5 }}
onClick={() => {
console.log("CLICK");
window.location = ssoUrl;
}}
>
Use SSO
</Button>
</div>
</div>
) : null}
</form>
)}
</Paper>
</div>
);
const loadedCheck = isLoaded ? <div>{basedata}</div> : <div></div>; <Typography variant="body2" style={{marginBottom: 20, color: "white",}}>
<b>2</b>. Restart docker-compose:<br/><br/>
sudo docker-compose restart
</Typography>
</Paper>
<Typography variant="body2" style={{marginBottom: 10, color: "white", marginTop: 20, }}>
Need help? <a rel="norefferer" target="_blank" href="https://discord.gg/B2CBzUm" style={{textDecoration: "none", color: "#f86a3e"}}>Join the Discord!</a>
</Typography>
</div>
:
<form onSubmit={onSubmit} style={{ margin: "15px 15px 15px 15px", color: "white", }}>
<h2>{formtitle}</h2>
Username
<div>
<TextField
color="primary"
style={{ backgroundColor: theme.palette.inputColor, marginTop: 5, }}
autoFocus
InputProps={{
classes: {
notchedOutline: classes.notchedOutline,
},
style: {
height: "50px",
color: "white",
fontSize: "1em",
},
}}
required
fullWidth={true}
autoComplete="username"
placeholder="username@example.com"
id="emailfield"
margin="normal"
variant="outlined"
onChange={onChangeUser}
/>
</div>
Password
<div>
<TextField
color="primary"
style={{ backgroundColor: theme.palette.inputColor, marginTop: 5,}}
InputProps={{
classes: {
notchedOutline: classes.notchedOutline,
},
style: {
height: "50px",
color: "white",
fontSize: "1em",
},
}}
required
id="outlined-password-input"
fullWidth={true}
type="password"
autoComplete="current-password"
placeholder="**********"
margin="normal"
variant="outlined"
onChange={onChangePass}
/>
</div>
{MFAField === true ?
<div style={{marginTop: 15}}>
5-factor code
<TextField
color="primary"
style={{backgroundColor: theme.palette.inputColor, marginTop: 5, }}
InputProps={{
classes: {
notchedOutline: classes.notchedOutline,
},
style:{
height: "50px",
color: "white",
fontSize: "1em",
},
}}
required
id="outlined-password-input"
fullWidth={true}
type="text"
placeholder="6-digit code"
margin="normal"
variant="outlined"
onChange={(event) => {
setMFAValue(event.target.value)
}}
/>
</div>
: null}
<div style={{ display: "flex", marginTop: "15px" }}>
<Button color="primary" variant="contained" type="submit" style={{ flex: "1", }} disabled={!handleValidateForm() || loginLoading}>
{loginLoading ? <CircularProgress color="secondary" style={{color: "white",}} /> : "SUBMIT"}
</Button>
</div>
<div style={{ marginTop: "10px" }}>
{loginInfo}
</div>
{ssoUrl !== undefined && ssoUrl !== null && ssoUrl.length > 0 ?
<div>
<Typography style={{textAlign: "center", }}>
Or
</Typography>
<div style={{textAlign: "center", margin: 10, }}>
<Button fullWidth color="secondary" variant="outlined" type="button" style={{ flex: "1", marginTop: 5}} onClick={() => {
console.log("CLICK")
window.location = ssoUrl
}}>
Use SSO
</Button>
</div>
</div>
: null}
</form>
}
</Paper>
</div>
return <div>{loadedCheck}</div>; const loadedCheck = isLoaded ?
}; <div>
{basedata}
</div>
:
<div>
</div>
return (
<div>
{loadedCheck}
</div>
)
}
export default LoginDialog; export default LoginDialog;
+1515 -1978
View File
File diff suppressed because it is too large Load Diff
+8 -4
View File
@@ -1,7 +1,11 @@
import React from "react"; import React, { } from 'react';
const Oauth2 = (props) => { const Oauth2 = (props) => {
return <div>tmp</div>; return (
}; <div>
tmp
</div>
)
}
export default Oauth2; export default Oauth2;
+58 -47
View File
@@ -1,61 +1,72 @@
import React from "react"; import React from 'react';
const Body = { const Body = {
maxWidth: "1000px", maxWidth: '1000px',
minWidth: "768px", minWidth: '768px',
margin: "auto", margin: 'auto',
display: "flex", display: "flex",
heigth: "100%", heigth: "100%",
color: "white", color: "white",
//textAlign: "center", //textAlign: "center",
}; };
const SideBar = { const SideBar = {
maxWidth: "250px", maxWidth: "250px",
flex: "1", flex: "1",
}; }
const hrefStyle = { const hrefStyle = {
color: "#385f71", color: "#385f71",
textDecoration: "none", textDecoration: "none"
}; }
const Post = (props) => { const Post = (props) => {
const { currentPost, isLoaded } = props; const { currentPost, isLoaded } = props;
const postData = ( const postData =
<div style={Body}> <div style={Body}>
<div style={SideBar}> <div style={SideBar}>
<ul style={{ listStyle: "none", paddingLeft: "0" }}> <ul style={{listStyle: "none", paddingLeft: "0"}}>
<li style={{ marginTop: "10px" }}> <li style={{marginTop: "10px"}}>
<a style={hrefStyle} href="/"> <a style={hrefStyle} href="/">
<h2>Home</h2> <h2>Home</h2>
</a> </a>
</li> </li>
<li style={{ marginTop: "10px" }}> <li style={{marginTop: "10px"}}>
<a style={hrefStyle} href="/docs"> <a style={hrefStyle} href="/docs">
<h2>Schedules</h2> <h2>Schedules</h2>
</a> </a>
</li> </li>
<li style={{ marginTop: "10px" }}> <li style={{marginTop: "10px"}}>
<a style={hrefStyle} href="/docs/about"> <a style={hrefStyle} href="/docs/about">
<h2>About</h2> <h2>About</h2>
</a> </a>
</li> </li>
<li style={{ marginTop: "10px" }}> <li style={{marginTop: "10px"}}>
<a style={hrefStyle} href="/docs/privacy-policy"> <a style={hrefStyle} href="/docs/privacy-policy">
<h2>Privacy Policy</h2> <h2>Privacy Policy</h2>
</a> </a>
</li> </li>
</ul> </ul>
</div> </div>
<div style={{ flex: "1" }}>{currentPost}</div> <div style={{flex: "1"}}>
</div> {currentPost}
); </div>
</div>
const loadedCheck = isLoaded ? <div>{postData}</div> : <div></div>; const loadedCheck = isLoaded ?
<div>
{postData}
</div>
:
<div>
</div>
return <div>{loadedCheck}</div>; return (
}; <div>
{loadedCheck}
</div>
)
}
export default Post; export default Post;
+118 -260
View File
@@ -1,264 +1,122 @@
import React from "react"; import React from 'react';
const PrivacyPolicy = () => { const PrivacyPolicy = () => {
return ( return (
<div> <div>
<h1>Privacy Policy</h1> <h1>Privacy Policy</h1>
<p>Effective date: 17.08.2019</p> <p>Effective date: 17.08.2019</p>
<p>We operate the shuffler.io website.</p>
<p>We operate the shuffler.io website.</p>
<p>
This page informs you of our policies regarding the collection, use, and <p>This page informs you of our policies regarding the collection, use, and disclosure of personal data when you use our service and the choices you have associated with that data.</p>
disclosure of personal data when you use our service and the choices you
have associated with that data. <p>We use your data to provide and improve the service. By using the service, you agree to the collection and use of information in accordance with this policy. Unless otherwise defined in this Privacy Policy, terms used in this Privacy Policy have the same meanings as in our Terms and Conditions, accessible from shuffler.io</p>
</p>
<p> <h2>Information Collection And Use</h2>
We use your data to provide and improve the service. By using the
service, you agree to the collection and use of information in <p>We collect several different types of information for various purposes to provide and improve our service to you.</p>
accordance with this policy. Unless otherwise defined in this Privacy
Policy, terms used in this Privacy Policy have the same meanings as in <h3>Types of Data Collected</h3>
our Terms and Conditions, accessible from shuffler.io
</p> <h4>Personal Data</h4>
<h2>Information Collection And Use</h2> <p>While using our service, we may ask you to provide us with certain personally identifiable information that can be used to contact or identify you ("Personal Data"). Personally identifiable information may include, but is not limited to:</p>
<p> <ul>
We collect several different types of information for various purposes <li>Cookies and Usage Data</li>
to provide and improve our service to you. </ul>
</p>
<h4>Usage Data</h4>
<h3>Types of Data Collected</h3>
<p>We may also collect information how the service is accessed and used ("Usage Data"). This Usage Data may include information such as your computer's Internet Protocol address (e.g. IP address), browser type, browser version, the pages of our service that you visit, the time and date of your visit, the time spent on those pages, unique device identifiers and other diagnostic data.</p>
<h4>Personal Data</h4>
<h4>Tracking & Cookies Data</h4>
<p> <p>We use cookies and similar tracking technologies to track the activity on our service and hold certain information.</p>
While using our service, we may ask you to provide us with certain <p>Cookies are files with small amount of data which may include an anonymous unique identifier. Cookies are sent to your browser from a website and stored on your device. Tracking technologies also used are beacons, tags, and scripts to collect and track information and to improve and analyze our service.</p>
personally identifiable information that can be used to contact or <p>You can instruct your browser to refuse all cookies or to indicate when a cookie is being sent. However, if you do not accept cookies, you may not be able to use some portions of our service.</p>
identify you ("Personal Data"). Personally identifiable information may <p>Examples of Cookies we use:</p>
include, but is not limited to: <ul>
</p> <li><strong>Session Cookies.</strong> We use Session Cookies to operate our service.</li>
<li><strong>Preference Cookies.</strong> We use Preference Cookies to remember your preferences and various settings.</li>
<ul> <li><strong>Security Cookies.</strong> We use Security Cookies for security purposes.</li>
<li>Cookies and Usage Data</li> </ul>
</ul>
<h2>Use of Data</h2>
<h4>Usage Data</h4>
<p>Shuffler uses the collected data for various purposes:</p>
<p> <ul>
We may also collect information how the service is accessed and used <li>To provide and maintain the service</li>
("Usage Data"). This Usage Data may include information such as your <li>To notify you about changes to our service</li>
computer's Internet Protocol address (e.g. IP address), browser type, <li>To allow you to participate in interactive features of our service when you choose to do so</li>
browser version, the pages of our service that you visit, the time and <li>To provide customer care and support</li>
date of your visit, the time spent on those pages, unique device <li>To provide analysis or valuable information so that we can improve the service</li>
identifiers and other diagnostic data. <li>To monitor the usage of the service</li>
</p> <li>To detect, prevent and address technical issues</li>
</ul>
<h4>Tracking & Cookies Data</h4>
<p> <h2>Transfer Of Data</h2>
We use cookies and similar tracking technologies to track the activity <p>Your information, including Personal Data, may be transferred to and maintained on computers located outside of your state, province, country or other governmental jurisdiction where the data protection laws may differ than those from your jurisdiction.</p>
on our service and hold certain information. <p>If you are located outside Norway and choose to provide information to us, please note that we transfer the data, including Personal Data, to Norway and process it there.</p>
</p> <p>Your consent to this Privacy Policy followed by your submission of such information represents your agreement to that transfer.</p>
<p> <p>Shuffler will take all steps reasonably necessary to ensure that your data is treated securely and in accordance with this Privacy Policy and no transfer of your Personal Data will take place to an organization or a country unless there are adequate controls in place including the security of your data and other personal information.</p>
Cookies are files with small amount of data which may include an
anonymous unique identifier. Cookies are sent to your browser from a <h2>Disclosure Of Data</h2>
website and stored on your device. Tracking technologies also used are
beacons, tags, and scripts to collect and track information and to <h3>Legal Requirements</h3>
improve and analyze our service. <p>Shuffler may disclose your Personal Data in the good faith belief that such action is necessary to:</p>
</p> <ul>
<p> <li>To comply with a legal obligation</li>
You can instruct your browser to refuse all cookies or to indicate when <li>To protect and defend the rights or property of Shuffler</li>
a cookie is being sent. However, if you do not accept cookies, you may <li>To prevent or investigate possible wrongdoing in connection with the service</li>
not be able to use some portions of our service. <li>To protect the personal safety of users of the service or the public</li>
</p> <li>To protect against legal liability</li>
<p>Examples of Cookies we use:</p> </ul>
<ul>
<li> <h2>Security Of Data</h2>
<strong>Session Cookies.</strong> We use Session Cookies to operate <p>The security of your data is important to us, but remember that no method of transmission over the Internet, or method of electronic storage is 100% secure. While we strive to use commercially acceptable means to protect your Personal Data, we cannot guarantee its absolute security.</p>
our service.
</li> <h2>Service Providers</h2>
<li> <p>We may employ third party companies and individuals to facilitate our service ("service Providers"), to provide the service on our behalf, to perform service-related services or to assist us in analyzing how our service is used.</p>
<strong>Preference Cookies.</strong> We use Preference Cookies to <p>These third parties have access to your Personal Data only to perform these tasks on our behalf and are obligated not to disclose or use it for any other purpose.</p>
remember your preferences and various settings.
</li> <h3>Analytics</h3>
<li> <p>We may use third-party service Providers to monitor and analyze the use of our service.</p>
<strong>Security Cookies.</strong> We use Security Cookies for <ul>
security purposes. <li>
</li> <p><strong>Google Analytics</strong></p>
</ul> <p>Google Analytics is a web analytics service offered by Google that tracks and reports website traffic. Google uses the data collected to track and monitor the use of our service. This data is shared with other Google services. Google may use the collected data to contextualize and personalize the ads of its own advertising network.</p>
<p>You can opt-out of having made your activity on the service available to Google Analytics by installing the Google Analytics opt-out browser add-on. The add-on prevents the Google Analytics JavaScript (ga.js, analytics.js, and dc.js) from sharing information with Google Analytics about visits activity.</p> <p>For more information on the privacy practices of Google, please visit the Google Privacy & Terms web page: <a href="https://policies.google.com/privacy?hl=en">https://policies.google.com/privacy?hl=en</a></p>
<h2>Use of Data</h2> </li>
</ul>
<p>Shuffler uses the collected data for various purposes:</p>
<ul>
<li>To provide and maintain the service</li> <h2>Links To Other Sites</h2>
<li>To notify you about changes to our service</li> <p>Our service may contain links to other sites that are not operated by us. If you click on a third party link, you will be directed to that third party's site. We strongly advise you to review the Privacy Policy of every site you visit.</p>
<li> <p>We have no control over and assume no responsibility for the content, privacy policies or practices of any third party sites or services.</p>
To allow you to participate in interactive features of our service
when you choose to do so
</li> <h2>Children's Privacy</h2>
<li>To provide customer care and support</li> <p>Our service does not address anyone under the age of 18 ("Children").</p>
<li> <p>We do not knowingly collect personally identifiable information from anyone under the age of 18. If you are a parent or guardian and you are aware that your Children has provided us with Personal Data, please contact us. If we become aware that we have collected Personal Data from children without verification of parental consent, we take steps to remove that information from our servers.</p>
To provide analysis or valuable information so that we can improve the
service
</li> <h2>Changes To This Privacy Policy</h2>
<li>To monitor the usage of the service</li> <p>We may update our Privacy Policy from time to time. We will notify you of any changes by posting the new Privacy Policy on this page.</p>
<li>To detect, prevent and address technical issues</li> <p>We will let you know via email and/or a prominent notice on our service, prior to the change becoming effective and update the "effective date" at the top of this Privacy Policy.</p>
</ul> <p>You are advised to review this Privacy Policy periodically for any changes. Changes to this Privacy Policy are effective when they are posted on this page.</p>
<h2>Transfer Of Data</h2>
<p> <h2>Contact Us</h2>
Your information, including Personal Data, may be transferred to and <p>If you have any questions about this Privacy Policy, please contact us:</p>
maintained on computers located outside of your state, province, <ul>
country or other governmental jurisdiction where the data protection <li>By email: fredrik_9490@hotmail.com</li>
laws may differ than those from your jurisdiction.
</p> </ul>
<p> </div>
If you are located outside Norway and choose to provide information to )
us, please note that we transfer the data, including Personal Data, to }
Norway and process it there.
</p>
<p>
Your consent to this Privacy Policy followed by your submission of such
information represents your agreement to that transfer.
</p>
<p>
Shuffler will take all steps reasonably necessary to ensure that your
data is treated securely and in accordance with this Privacy Policy and
no transfer of your Personal Data will take place to an organization or
a country unless there are adequate controls in place including the
security of your data and other personal information.
</p>
<h2>Disclosure Of Data</h2>
<h3>Legal Requirements</h3>
<p>
Shuffler may disclose your Personal Data in the good faith belief that
such action is necessary to:
</p>
<ul>
<li>To comply with a legal obligation</li>
<li>To protect and defend the rights or property of Shuffler</li>
<li>
To prevent or investigate possible wrongdoing in connection with the
service
</li>
<li>
To protect the personal safety of users of the service or the public
</li>
<li>To protect against legal liability</li>
</ul>
<h2>Security Of Data</h2>
<p>
The security of your data is important to us, but remember that no
method of transmission over the Internet, or method of electronic
storage is 100% secure. While we strive to use commercially acceptable
means to protect your Personal Data, we cannot guarantee its absolute
security.
</p>
<h2>Service Providers</h2>
<p>
We may employ third party companies and individuals to facilitate our
service ("service Providers"), to provide the service on our behalf, to
perform service-related services or to assist us in analyzing how our
service is used.
</p>
<p>
These third parties have access to your Personal Data only to perform
these tasks on our behalf and are obligated not to disclose or use it
for any other purpose.
</p>
<h3>Analytics</h3>
<p>
We may use third-party service Providers to monitor and analyze the use
of our service.
</p>
<ul>
<li>
<p>
<strong>Google Analytics</strong>
</p>
<p>
Google Analytics is a web analytics service offered by Google that
tracks and reports website traffic. Google uses the data collected
to track and monitor the use of our service. This data is shared
with other Google services. Google may use the collected data to
contextualize and personalize the ads of its own advertising
network.
</p>
<p>
You can opt-out of having made your activity on the service
available to Google Analytics by installing the Google Analytics
opt-out browser add-on. The add-on prevents the Google Analytics
JavaScript (ga.js, analytics.js, and dc.js) from sharing information
with Google Analytics about visits activity.
</p>{" "}
<p>
For more information on the privacy practices of Google, please
visit the Google Privacy & Terms web page:{" "}
<a href="https://policies.google.com/privacy?hl=en">
https://policies.google.com/privacy?hl=en
</a>
</p>
</li>
</ul>
<h2>Links To Other Sites</h2>
<p>
Our service may contain links to other sites that are not operated by
us. If you click on a third party link, you will be directed to that
third party's site. We strongly advise you to review the Privacy Policy
of every site you visit.
</p>
<p>
We have no control over and assume no responsibility for the content,
privacy policies or practices of any third party sites or services.
</p>
<h2>Children's Privacy</h2>
<p>
Our service does not address anyone under the age of 18 ("Children").
</p>
<p>
We do not knowingly collect personally identifiable information from
anyone under the age of 18. If you are a parent or guardian and you are
aware that your Children has provided us with Personal Data, please
contact us. If we become aware that we have collected Personal Data from
children without verification of parental consent, we take steps to
remove that information from our servers.
</p>
<h2>Changes To This Privacy Policy</h2>
<p>
We may update our Privacy Policy from time to time. We will notify you
of any changes by posting the new Privacy Policy on this page.
</p>
<p>
We will let you know via email and/or a prominent notice on our service,
prior to the change becoming effective and update the "effective date"
at the top of this Privacy Policy.
</p>
<p>
You are advised to review this Privacy Policy periodically for any
changes. Changes to this Privacy Policy are effective when they are
posted on this page.
</p>
<h2>Contact Us</h2>
<p>
If you have any questions about this Privacy Policy, please contact us:
</p>
<ul>
<li>By email: fredrik_9490@hotmail.com</li>
</ul>
</div>
);
};
export default PrivacyPolicy; export default PrivacyPolicy;
+68 -62
View File
@@ -1,12 +1,13 @@
import React, { useState, useEffect } from "react"; import React, {useState, useEffect} from 'react';
import Paper from "@material-ui/core/Paper"; import Paper from '@material-ui/core/Paper';
const bodyDivStyle = { const bodyDivStyle = {
margin: "auto", margin: "auto",
textAlign: "center", textAlign: "center",
width: "768px", width: "768px",
}; }
//const tmpdata = { //const tmpdata = {
// "username": "frikky", // "username": "frikky",
@@ -22,66 +23,71 @@ const bodyDivStyle = {
// FIXME - remove tmpdata // FIXME - remove tmpdata
// FIXME: Use isLoggedIn :) // FIXME: Use isLoggedIn :)
const Settings = (props) => { const Settings = (props) => {
const { globalUrl, isLoaded, surfaceColor } = props; const { globalUrl, isLoaded, surfaceColor, } = props;
const [firstRequest, setFirstRequest] = useState(true); const [firstRequest, setFirstRequest] = useState(true);
const boxStyle = { const boxStyle = {
flex: "1", flex: "1",
marginLeft: "10px", marginLeft: "10px",
marginRight: "10px", marginRight: "10px",
paddingLeft: "30px", paddingLeft: "30px",
paddingRight: "30px", paddingRight: "30px",
paddingBottom: "30px", paddingBottom: "30px",
paddingTop: "30px", paddingTop: "30px",
backgroundColor: surfaceColor, backgroundColor: surfaceColor,
color: "white", color: "white",
display: "flex", display: "flex",
flexDirection: "column", flexDirection: "column"
}; }
const registerCall = () => { const registerCall = () => {
const url = globalUrl + "/api/v1/register/" + props.match.params.key; const url = globalUrl+'/api/v1/register/'+props.match.params.key
fetch(url, { fetch(url, {
method: "GET", method: 'GET',
credentials: "include", credentials: 'include',
headers: { headers: {
"Content-Type": "application/json; charset=utf-8", 'Content-Type': 'application/json; charset=utf-8',
}, },
}) })
.then((response) => .then(response =>
response.json().then((responseJson) => { response.json().then(responseJson => {
console.log(responseJson); console.log(responseJson)
}) }),
) )
.catch((error) => { .catch(error => {
console.log("SOMETHING WRONG"); console.log("SOMETHING WRONG")
}); });
}; }
// This should "always" have data // This should "always" have data
useEffect(() => { useEffect(() => {
if (firstRequest) { if (firstRequest) {
setFirstRequest(false); setFirstRequest(false)
registerCall(); registerCall()
} }
}); })
// Random names for type & autoComplete. Didn't research :^) // Random names for type & autoComplete. Didn't research :^)
const landingpageData = ( const landingpageData =
<div style={{ display: "flex", marginTop: "80px" }}> <div style={{display: "flex", marginTop: "80px"}}>
<Paper style={boxStyle}> <Paper style={boxStyle}>
<h2>Registration verification</h2> <h2>Registration verification</h2>
<p>Thanks for verifying, redirecting you to our login!</p> <p>Thanks for verifying, redirecting you to our login!</p>
</Paper> </Paper>
</div> </div>
);
const loadedCheck = isLoaded ? ( const loadedCheck = isLoaded ?
<div style={bodyDivStyle}>{landingpageData}</div> <div style={bodyDivStyle}>
) : ( {landingpageData}
<div></div> </div>
); :
<div>
</div>
return <div>{loadedCheck}</div>; return(
}; <div>
{loadedCheck}
</div>
)
}
export default Settings; export default Settings;
+123 -160
View File
@@ -1,176 +1,139 @@
/* eslint-disable react/no-multi-comp */ /* eslint-disable react/no-multi-comp */
import React, { useState } from "react"; import React, {useState} from 'react';
import DialogTitle from "@material-ui/core/DialogTitle"; import DialogTitle from '@material-ui/core/DialogTitle';
import Dialog from "@material-ui/core/Dialog"; import Dialog from '@material-ui/core/Dialog';
import TextField from "@material-ui/core/TextField"; import TextField from '@material-ui/core/TextField';
import Button from "@material-ui/core/Button"; import Button from '@material-ui/core/Button';
const LoginDialog = (props) => { const LoginDialog = props => {
const { const { classes, onClose, open, globalUrl, isLoggedIn, setIsLoggedIn, ...other } = props;
classes,
onClose,
open,
globalUrl,
isLoggedIn,
setIsLoggedIn,
...other
} = props;
const [username, setUsername] = useState(""); const [username, setUsername] = useState("");
const [password, setPassword] = useState(""); const [password, setPassword] = useState("");
//const [selectedValue, setSelectedValue] = useState(false); //const [selectedValue, setSelectedValue] = useState(false);
// Used to swap from login to register. True = login, false = register // Used to swap from login to register. True = login, false = register
const [loginCheck, setLoginCheck] = useState(true); const [loginCheck, setLoginCheck] = useState(true);
// Error messages etc // Error messages etc
const [loginInfo, setLoginInfo] = useState(""); const [loginInfo, setLoginInfo] = useState("");
const handleValidateForm = () => { const handleValidateForm = () => {
return username.length > 1 && password.length > 8; return (username.length > 1 && password.length > 8);
}; }
const onSubmit = (e) => { const onSubmit = (e) => {
e.preventDefault(); e.preventDefault()
// Just use this one? // Just use this one?
var data = var data = '{"username": "' + username + '", "password": "' + password + '"}';
'{"username": "' + username + '", "password": "' + password + '"}'; var baseurl = globalUrl
var baseurl = globalUrl; if (loginCheck) {
if (loginCheck) { var url = baseurl+'/login';
var url = baseurl + "/login"; fetch(url, {
fetch(url, { method: 'POST',
method: "POST", body: data,
body: data, headers: {
headers: { 'Content-Type': 'application/json',
"Content-Type": "application/json", },
}, })
}) .then(response =>
.then((response) => response.json().then(responseJson => {
response.json().then((responseJson) => { console.log(responseJson)
console.log(responseJson); //console.log(e)
//console.log(e) if (responseJson["success"] === false) {
if (responseJson["success"] === false) { setLoginInfo(responseJson["reason"])
setLoginInfo(responseJson["reason"]); } else {
} else { setLoginInfo("Successful login :)")
setLoginInfo("Successful login :)"); onClose()
onClose(); setIsLoggedIn(true)
setIsLoggedIn(true); }
} }),
}) )
) .catch(error => {
.catch((error) => { setLoginInfo("Error in userdata")
setLoginInfo("Error in userdata"); });
}); } else {
} else { url = baseurl+'/register';
url = baseurl + "/register"; fetch(url, {
fetch(url, { method: 'POST',
method: "POST", body: data,
body: data, headers: {
headers: { 'Content-Type': 'application/json',
"Content-Type": "application/json", },
}, })
}) .then(response =>
.then((response) => response.json().then(responseJson => {
response.json().then((responseJson) => { if (responseJson["success"] === false) {
if (responseJson["success"] === false) { setLoginInfo(responseJson["reason"])
setLoginInfo(responseJson["reason"]); } else {
} else { setLoginInfo("Successful register. Please check your mail :)")
setLoginInfo("Successful register. Please check your mail :)"); onClose()
onClose(); setIsLoggedIn(true)
setIsLoggedIn(true); }
} }),
}) )
) .catch(error => {
.catch((error) => { setLoginInfo("Error in userdata")
setLoginInfo("Error in userdata"); });
}); }
} }
};
const onChangeUser = (e) => { const onChangeUser = (e) => {
setUsername(e.target.value); setUsername(e.target.value)
}; }
const onChangePass = (e) => { const onChangePass = (e) => {
setPassword(e.target.value); setPassword(e.target.value)
}; }
const onClickRegister = () => { const onClickRegister = () => {
setLoginCheck(!loginCheck); setLoginCheck(!loginCheck)
}; }
//var loginChange = loginCheck ? (<div><p onClick={setLoginCheck(false)}>Want to register? Click here.</p></div>) : (<div><p onClick={setLoginCheck(true)}>Go back to login? Click here.</p></div>); //var loginChange = loginCheck ? (<div><p onClick={setLoginCheck(false)}>Want to register? Click here.</p></div>) : (<div><p onClick={setLoginCheck(true)}>Go back to login? Click here.</p></div>);
var formtitle = loginCheck ? <div>Login</div> : <div>Register</div>; var formtitle = loginCheck ? <div>Login</div> : <div>Register</div>
var formButton = loginCheck ? ( var formButton = loginCheck ? <div>Click to Register</div> : <div>Click to Login</div>
<div>Click to Register</div>
) : (
<div>Click to Login</div>
);
return ( return (
<Dialog modal open={open} onClose={onClose} {...other}> <Dialog modal open={open} onClose={onClose} {...other}>
<DialogTitle>{formtitle}</DialogTitle> <DialogTitle>{formtitle}</DialogTitle>
<form onSubmit={onSubmit} style={{ margin: "15px 15px 15px 15px" }}> <form onSubmit={onSubmit} style={{margin: "15px 15px 15px 15px"}}>
Username Username
<div> <div>
<TextField <TextField
required required
id="standard-required" id="standard-required"
autoComplete="username" autoComplete="username"
margin="normal" margin="normal"
variant="outlined" variant="outlined"
onChange={onChangeUser} onChange={onChangeUser}
/> />
</div> </div>
Password Password
<div> <div>
<TextField <TextField
id="outlined-password-input" id="outlined-password-input"
type="password" type="password"
autoComplete="current-password" autoComplete="current-password"
margin="normal" margin="normal"
variant="outlined" variant="outlined"
onChange={onChangePass} onChange={onChangePass}
/> />
</div> </div>
<div style={{ display: "flex", marginTop: "15px" }}> <div style={{display: "flex", marginTop: "15px"}}>
<Button <Button color="secondary" variant="contained" type="submit" style={{flex: "1", marginRight: "5px"}} disabled={!handleValidateForm()}>SUBMIT</Button>
color="secondary"
variant="contained" <Button color="primary" variant="contained" type="button" style={{flex: "1"}} onClick={onClose}>Cancel</Button>
type="submit" </div>
style={{ flex: "1", marginRight: "5px" }} {loginInfo}
disabled={!handleValidateForm()} </form>
> <div style={{display: "flex"}}>
SUBMIT <Button color="secondary" variant="contained" onClick={onClickRegister} type="button" style={{flex: "1"}}>{formButton}</Button>
</Button> </div>
</Dialog>
<Button );
color="primary" }
variant="contained"
type="button"
style={{ flex: "1" }}
onClick={onClose}
>
Cancel
</Button>
</div>
{loginInfo}
</form>
<div style={{ display: "flex" }}>
<Button
color="secondary"
variant="contained"
onClick={onClickRegister}
type="button"
style={{ flex: "1" }}
>
{formButton}
</Button>
</div>
</Dialog>
);
};
export default LoginDialog; export default LoginDialog;
+200 -212
View File
@@ -1,232 +1,220 @@
import React, { useEffect } from "react"; import React, { useEffect} from 'react';
import Paper from "@material-ui/core/Paper"; import Paper from '@material-ui/core/Paper';
import Grid from "@material-ui/core/Grid"; import Grid from '@material-ui/core/Grid';
import ButtonBase from "@material-ui/core/ButtonBase"; import ButtonBase from '@material-ui/core/ButtonBase';
import List from "@material-ui/core/List"; import List from '@material-ui/core/List';
import ListItem from "@material-ui/core/ListItem"; import ListItem from '@material-ui/core/ListItem';
import Button from "@material-ui/core/Button"; import Button from '@material-ui/core/Button';
//import Breadcrumbs from '@material-ui/core/Breadcrumbs'; //import Breadcrumbs from '@material-ui/core/Breadcrumbs';
const Schedules = (props) => { const Schedules = (props) => {
const { globalUrl } = props; const { globalUrl } = props;
//const [schedules, setSchedules] = React.useState(scheduledata); //const [schedules, setSchedules] = React.useState(scheduledata);
const [schedules, setSchedules] = React.useState({}); const [schedules, setSchedules] = React.useState({});
const getAvailableSchedules = () => { const getAvailableSchedules = () => {
fetch(globalUrl + "/api/v1/schedules", { fetch(globalUrl+"/api/v1/schedules", {
method: "GET", method: 'GET',
headers: { headers: {
"Content-Type": "application/json", 'Content-Type': 'application/json',
Accept: "application/json", 'Accept': 'application/json',
}, },
}) })
.then((response) => response.json()) .then((response) => response.json())
.then((responseJson) => { .then((responseJson) => {
setSchedules(responseJson); setSchedules(responseJson)
}) })
.catch((error) => { .catch(error => {
console.log(error); console.log(error)
}); });
}; }
// FIXME - add automated redirection, as empty apps look horrible currently // FIXME - add automated redirection, as empty apps look horrible currently
const newSchedule = () => { const newSchedule = () => {
fetch(globalUrl + "/api/v1/schedules/new", { fetch(globalUrl+"/api/v1/schedules/new", {
method: "POST", method: "POST",
headers: { "content-type": "application/json" }, headers: {"content-type": "application/json"},
body: JSON.stringify(), body: JSON.stringify(),
}) })
.then((response) => response.json()) .then((response) => response.json())
.then((responseJson) => { .then((responseJson) => {
console.log(responseJson); console.log(responseJson)
setSchedules({}); setSchedules({})
}) })
.catch((error) => { .catch(error => {
console.log(error); console.log(error)
}); });
}; }
const deleteSchedule = (id) => { const deleteSchedule = (id) => {
if (id === undefined) { if (id === undefined) {
return; return
} }
fetch(globalUrl + "/api/v1/schedules/" + id + "/delete", { fetch(globalUrl+"/api/v1/schedules/"+id+"/delete", {
method: "DELETE", method: 'DELETE',
headers: { headers: {
"Content-Type": "application/json", 'Content-Type': 'application/json',
Accept: "application/json", 'Accept': 'application/json',
}, },
}) })
.then((response) => response.json()) .then((response) => response.json())
.then((responseJson) => { .then((responseJson) => {
setSchedules({}); setSchedules({})
}) })
.catch((error) => { .catch(error => {
console.log(error); console.log(error)
}); });
}; }
// FIXME - use this? // FIXME - use this?
//const getNewScheduleInfo = () => { //const getNewScheduleInfo = () => {
// fetch(globalUrl+"/api/v1/schedules", { // fetch(globalUrl+"/api/v1/schedules", {
// method: 'GET', // method: 'GET',
// headers: { // headers: {
// 'Content-Type': 'application/json', // 'Content-Type': 'application/json',
// 'Accept': 'application/json', // 'Accept': 'application/json',
// }, // },
// }) // })
// .then((response) => response.json()) // .then((response) => response.json())
// .then((responseJson) => { // .then((responseJson) => {
// setSchedules(responseJson) // setSchedules(responseJson)
// }) // })
// .catch(error => { // .catch(error => {
// console.log(error) // console.log(error)
// }); // });
//} //}
useEffect(() => { useEffect(() => {
if (Object.getOwnPropertyNames(schedules).length <= 0) { if (Object.getOwnPropertyNames(schedules).length <= 0) {
getAvailableSchedules(); getAvailableSchedules()
} }
}); })
const bodyDivStyle = {
marginLeft: "20px",
marginRight: "20px",
width: "1350px",
minWidth: "1350px",
maxWidth: "1350px",
};
const scheduleApp = (app) => { const bodyDivStyle = {
console.log(app); marginLeft: "20px",
return ( marginRight: "20px",
<Grid container spacing={2} style={{ margin: "10px 10px 10px 10px" }}> width: "1350px",
<Grid item> minWidth: "1350px",
<ButtonBase> maxWidth: "1350px",
<img alt="" style={{ width: "100px", height: "100px" }} /> }
</ButtonBase>
</Grid>
<Grid item xs={12} sm container>
<Grid item xs container direction="column" spacing={2}>
<Grid item xs>
<div>
<h2>{app.name}</h2>
</div>
<div>{app.description}</div>
</Grid>
<Grid item>{app.action}</Grid>
</Grid>
</Grid>
</Grid>
);
};
const splitter = ( const scheduleApp = (app) => {
<div console.log(app)
style={{ return(
width: "1px", <Grid container spacing={2} style={{margin: "10px 10px 10px 10px"}}>
backgroundColor: "grey", <Grid item>
margin: "5px 5px 5px 5px", <ButtonBase>
}} <img alt="" style={{width: "100px", height: "100px"}} />
/> </ButtonBase>
); </Grid>
<Grid item xs={12} sm container>
<Grid item xs container direction="column" spacing={2}>
<Grid item xs>
<div>
<h2>{app.name}</h2>
</div>
<div>
{app.description}
</div>
</Grid>
<Grid item>
{app.action}
</Grid>
</Grid>
</Grid>
</Grid>
)
}
const hrefStyle = { const splitter = <div style={{width: "1px", backgroundColor: "grey", margin:"5px 5px 5px 5px"}} />
color: "#385f71",
textDecoration: "none",
};
// FIXME - add Schedule modal const hrefStyle = {
const schedulePaper = (schedule) => { color: "#385f71",
return ( textDecoration: "none"
<div> }
<Paper
style={{
maxWidth: "1000px",
display: "flex",
padding: "10px 10px 10px 10px",
}}
>
<div style={{ flex: "5" }}>
{scheduleApp(schedule.appinfo.sourceapp)}
</div>
<div style={{ flex: "1", alignItems: "center" }}>ARROW</div>
<div style={{ flex: "5" }}>
{scheduleApp(schedule.appinfo.destinationapp)}
</div>
{splitter}
<div style={{ flex: "1" }}>
<List style={{ backgroundColor: "#ffffff" }}>
<ListItem style={{ flex: "1", textAlign: "center" }}>
<a href={"/schedules/" + schedule.id} style={hrefStyle}>
<Button disabled={false} color="primary">
Edit
</Button>
</a>
</ListItem>
<ListItem style={{ flex: "1", textAlign: "center" }}>
<Button
disabled={false}
onClick={() => {
deleteSchedule(schedule.id);
}}
color="primary"
>
Delete
</Button>
</ListItem>
</List>
</div>
</Paper>
</div>
);
};
console.log(schedules); // FIXME - add Schedule modal
console.log(schedules); const schedulePaper = (schedule) => {
console.log(schedules.schedules); return(
const schedulemap = <div>
Object.getOwnPropertyNames(schedules).length > 0 && <Paper style={{maxWidth: "1000px", display: "flex", padding: "10px 10px 10px 10px"}}>
schedules.schedules && <div style={{flex: "5"}}>
schedules.schedules.length > 0 ? ( {scheduleApp(schedule.appinfo.sourceapp)}
<div>{schedules.schedules.map((data) => schedulePaper(data))}</div> </div>
) : ( <div style={{flex: "1", alignItems: "center"}}>
<div style={{ marginTop: "10%", marginLeft: "50%" }}> ARROW
<Button </div>
disabled={false} <div style={{flex: "5"}}>
onClick={() => { {scheduleApp(schedule.appinfo.destinationapp)}
newSchedule(); </div>
}} {splitter}
variant="outlined" <div style={{flex: "1"}}>
color="primary" <List style={{backgroundColor: "#ffffff"}}>
> <ListItem style={{flex: "1", textAlign: "center"}}>
CREATE NEW SCHEDULE <a href={"/schedules/"+schedule.id} style={hrefStyle} >
</Button> <Button
</div> disabled={false}
); color="primary"
>
Edit
</Button>
</a>
</ListItem>
<ListItem style={{flex: "1", textAlign: "center"}}>
<Button
disabled={false}
onClick={() => {deleteSchedule(schedule.id)}}
color="primary"
>Delete</Button>
</ListItem>
const scheduleView = </List>
Object.getOwnPropertyNames(schedules).length > 0 ? ( </div>
<div style={bodyDivStyle}> </Paper>
<Button </div>
disabled={false} )
onClick={() => { }
newSchedule();
}}
color="primary"
>
New
</Button>
{schedulemap}
</div>
) : null;
// Maybe use gridview or something, idk console.log(schedules)
return <div>{scheduleView}</div>; console.log(schedules)
}; console.log(schedules.schedules)
const schedulemap = Object.getOwnPropertyNames(schedules).length > 0 && schedules.schedules && schedules.schedules.length > 0 ?
<div>
{schedules.schedules.map(data => (
schedulePaper(data)
))}
</div>
:
<div style={{marginTop: "10%", marginLeft: "50%"}} >
<Button
disabled={false}
onClick={() => {newSchedule()}}
variant="outlined"
color="primary"
>CREATE NEW SCHEDULE</Button>
</div>
export default Schedules; const scheduleView = Object.getOwnPropertyNames(schedules).length > 0 ?
<div style={bodyDivStyle}>
<Button
disabled={false}
onClick={() => {newSchedule()}}
color="primary"
>New</Button>
{schedulemap}
</div>
: null
// Maybe use gridview or something, idk
return (
<div>
{scheduleView}
</div>
)
}
export default Schedules
+122 -137
View File
@@ -1,170 +1,155 @@
import React, { useRef, useState, useEffect, useLayoutEffect } from "react"; import React, {useRef, useState, useEffect, useLayoutEffect} from 'react';
import { Typography, CircularProgress } from "@material-ui/core"; import { Typography, CircularProgress } from '@material-ui/core';
const SetAuthentication = (props) => { const SetAuthentication = (props) => {
const { globalUrl, isLoggedIn, isLoaded, userdata } = props; const { globalUrl, isLoggedIn, isLoaded, userdata } = props;
const [firstRequest, setFirstRequest] = useState(true); const [firstRequest, setFirstRequest] = useState(true)
const [finished, setFinished] = useState(false); const [finished, setFinished] = useState(false)
const [response, setResponse] = useState(""); const [response, setResponse] = useState("")
const [failed, setFailed] = useState(false); const [failed, setFailed] = useState(false)
if (firstRequest) { if (firstRequest) {
setFirstRequest(false); setFirstRequest(false)
//code //code
//session_state //session_state
const urlSearchParams = new URLSearchParams(window.location.search); const urlSearchParams = new URLSearchParams(window.location.search);
const params = Object.fromEntries(urlSearchParams.entries()); const params = Object.fromEntries(urlSearchParams.entries());
const authenticationStore = []; const authenticationStore = []
var appAuthData = { var appAuthData = {
label: "", "label": "",
app: { "app": {
name: "", "name": "",
id: "", "id": "",
app_version: "", "app_version": "",
}, },
fields: [], "fields": [],
type: "oauth2", "type": "oauth2",
}; }
if (window !== undefined && window !== null) { if (window !== undefined && window !== null) {
console.log(window.location); console.log(window.location)
appAuthData.fields.push({ appAuthData.fields.push({"key": "redirect_uri", "value": window.location.origin+window.location.pathname})
key: "redirect_uri", }
value: window.location.origin + window.location.pathname,
});
}
if (params.code !== undefined && params.code !== null) { if (params.code !== undefined && params.code !== null) {
appAuthData.fields.push({ key: "code", value: params.code }); appAuthData.fields.push({"key": "code", "value": params.code})
} }
if (params.session_state !== undefined && params.session_state !== null) { if (params.session_state !== undefined && params.session_state !== null) {
appAuthData.fields.push({ appAuthData.fields.push({"key": "session_state", "value": params.session_state})
key: "session_state", }
value: params.session_state,
});
}
if (params.state !== undefined && params.state !== null) { if (params.state !== undefined && params.state !== null) {
const paramsplit = params.state.split("&"); const paramsplit = params.state.split("&")
console.log(paramsplit); console.log(paramsplit)
for (var key in paramsplit) { for (var key in paramsplit) {
const query = paramsplit[key].split("="); const query = paramsplit[key].split("=")
console.log(query); console.log(query)
if (query.length !== 2) { if (query.length !== 2) {
console.log("INVALID QUERY: ", query); console.log("INVALID QUERY: ", query)
continue; continue
} }
if (query[0] === "workflow_id") { if (query[0] === "workflow_id") {
appAuthData.reference_workflow = query[1]; appAuthData.reference_workflow = query[1]
} }
if (query[0] === "reference_action_id") { if (query[0] === "reference_action_id") {
//appAuthData.ReferenceWorkflow = query[1] //appAuthData.ReferenceWorkflow = query[1]
} }
if (query[0] === "app_name") { if (query[0] === "app_name") {
appAuthData.app.name = query[1]; appAuthData.app.name = query[1]
appAuthData.label = "Oauth2 for " + query[1]; appAuthData.label = "Oauth2 for "+query[1]
} }
if (query[0] === "app_id") { if (query[0] === "app_id") {
appAuthData.app.id = query[1]; appAuthData.app.id = query[1]
} }
if (query[0] === "app_version") { if (query[0] === "app_version") {
appAuthData.app.app_version = query[1]; appAuthData.app.app_version = query[1]
} }
if (query[0] === "authentication_url") { if (query[0] === "authentication_url") {
appAuthData.fields.push({ appAuthData.fields.push({"key": "authentication_url", "value": query[1]})
key: "authentication_url", }
value: query[1],
});
}
if (query[0] === "scope") { if (query[0] === "scope") {
appAuthData.fields.push({ key: "scope", value: query[1] }); appAuthData.fields.push({"key": "scope", "value": query[1]})
} }
if (query[0] === "client_id") { if (query[0] === "client_id") {
appAuthData.fields.push({ key: "client_id", value: query[1] }); appAuthData.fields.push({"key": "client_id", "value": query[1]})
} }
if (query[0] === "client_secret") { if (query[0] === "client_secret") {
appAuthData.fields.push({ key: "client_secret", value: query[1] }); appAuthData.fields.push({"key": "client_secret", "value": query[1]})
} }
if (query[0] === "oauth_url") { if (query[0] === "oauth_url") {
appAuthData.fields.push({ key: "oauth_url", value: query[1] }); appAuthData.fields.push({"key": "oauth_url", "value": query[1]})
} }
if (query[0] === "refresh_uri") { if (query[0] === "refresh_uri") {
appAuthData.fields.push({ key: "refresh_uri", value: query[1] }); appAuthData.fields.push({"key": "refresh_uri", "value": query[1]})
} }
if (query[0] === "refresh_url") { if (query[0] === "refresh_url") {
appAuthData.fields.push({ key: "refresh_url", value: query[1] }); appAuthData.fields.push({"key": "refresh_url", "value": query[1]})
} }
} }
} }
console.log(appAuthData); console.log(appAuthData)
fetch(globalUrl + "/api/v1/apps/authentication", { fetch(globalUrl+"/api/v1/apps/authentication", {
method: "PUT", method: 'PUT',
headers: { headers: {
"Content-Type": "application/json", 'Content-Type': 'application/json',
Accept: "application/json", 'Accept': 'application/json',
}, },
credentials: "include", credentials: "include",
body: JSON.stringify(appAuthData), body: JSON.stringify(appAuthData),
}) })
.then((response) => { .then((response) => {
if (response.status !== 200) { if (response.status !== 200) {
console.log("Status not 200 for oauth2 authentication"); console.log("Status not 200 for oauth2 authentication")
setFailed(true); setFailed(true)
} }
return response.json(); return response.json()
}) })
.then((responseJson) => { .then((responseJson) => {
//setUserSettings(responseJson) //setUserSettings(responseJson)
console.log("Resp: ", responseJson); console.log("Resp: ", responseJson)
setFinished(true); setFinished(true)
setResponse(responseJson.reason); setResponse(responseJson.reason)
setTimeout(() => { setTimeout(() => {
window.close(); window.close()
}, 1000); }, 1000)
}) })
.catch((error) => { .catch(error => {
console.log(error); console.log(error)
}); });
}
return ( }
<div style={{ width: 1000, margin: "auto", itemAlign: "center" }}>
<Typography return (
variant="h6" <div style={{width: 1000, margin: "auto", itemAlign: "center",}}>
style={{ marginLeft: "auto", marginRight: "auto", marginTop: 200 }} <Typography variant="h6" style={{marginLeft: "auto", marginRight: "auto", marginTop: 200, }}>
> {!finished ? <CircularProgress /> : "DONE WITH AUTH - this will close soon!!"}
{!finished ? ( <div />
<CircularProgress /> {failed ? "Failed setup. Error: " : ""} {response}
) : ( </Typography>
"DONE WITH AUTH - this will close soon!!" </div>
)} )
<div /> }
{failed ? "Failed setup. Error: " : ""} {response}
</Typography>
</div>
);
};
export default SetAuthentication; export default SetAuthentication;
+113 -128
View File
@@ -1,158 +1,143 @@
import React, { useRef, useState, useEffect, useLayoutEffect } from "react"; import React, {useRef, useState, useEffect, useLayoutEffect} from 'react';
import { Typography, CircularProgress } from "@material-ui/core"; import { Typography, CircularProgress } from '@material-ui/core';
const SetAuthentication = (props) => { const SetAuthentication = (props) => {
const { globalUrl, isLoggedIn, isLoaded, userdata } = props; const { globalUrl, isLoggedIn, isLoaded, userdata } = props;
const [firstRequest, setFirstRequest] = useState(true); const [firstRequest, setFirstRequest] = useState(true)
const [finished, setFinished] = useState(false); const [finished, setFinished] = useState(false)
const [response, setResponse] = useState(""); const [response, setResponse] = useState("")
const [failed, setFailed] = useState(false); const [failed, setFailed] = useState(false)
if (firstRequest) { if (firstRequest) {
setFirstRequest(false); setFirstRequest(false)
//code //code
//session_state //session_state
const urlSearchParams = new URLSearchParams(window.location.search); const urlSearchParams = new URLSearchParams(window.location.search);
const params = Object.fromEntries(urlSearchParams.entries()); const params = Object.fromEntries(urlSearchParams.entries());
const authenticationStore = []; const authenticationStore = []
var appAuthData = { var appAuthData = {
label: "", "label": "",
app: { "app": {
name: "", "name": "",
id: "", "id": "",
app_version: "", "app_version": "",
}, },
fields: [], "fields": [],
type: "oauth2", "type": "oauth2",
}; }
if (window !== undefined && window !== null) { if (window !== undefined && window !== null) {
console.log(window.location); console.log(window.location)
appAuthData.fields.push({ appAuthData.fields.push({"key": "redirect_uri", "value": window.location.origin+window.location.pathname})
key: "redirect_uri", }
value: window.location.origin + window.location.pathname,
});
}
if (params.code !== undefined && params.code !== null) { if (params.code !== undefined && params.code !== null) {
appAuthData.fields.push({ key: "code", value: params.code }); appAuthData.fields.push({"key": "code", "value": params.code})
} }
if (params.session_state !== undefined && params.session_state !== null) { if (params.session_state !== undefined && params.session_state !== null) {
appAuthData.fields.push({ appAuthData.fields.push({"key": "session_state", "value": params.session_state})
key: "session_state", }
value: params.session_state,
});
}
if (params.state !== undefined && params.state !== null) { if (params.state !== undefined && params.state !== null) {
const paramsplit = params.state.split("&"); const paramsplit = params.state.split("&")
console.log(paramsplit); console.log(paramsplit)
for (var key in paramsplit) { for (var key in paramsplit) {
const query = paramsplit[key].split("="); const query = paramsplit[key].split("=")
console.log(query); console.log(query)
if (query.length !== 2) { if (query.length !== 2) {
console.log("INVALID QUERY: ", query); console.log("INVALID QUERY: ", query)
continue; continue
} }
if (query[0] === "workflow_id") { if (query[0] === "workflow_id") {
appAuthData.reference_workflow = query[1]; appAuthData.reference_workflow = query[1]
} }
if (query[0] === "reference_action_id") { if (query[0] === "reference_action_id") {
//appAuthData.ReferenceWorkflow = query[1] //appAuthData.ReferenceWorkflow = query[1]
} }
if (query[0] === "app_name") { if (query[0] === "app_name") {
appAuthData.app.name = query[1]; appAuthData.app.name = query[1]
appAuthData.label = "Oauth2 for " + query[1]; appAuthData.label = "Oauth2 for "+query[1]
} }
if (query[0] === "app_id") { if (query[0] === "app_id") {
appAuthData.app.id = query[1]; appAuthData.app.id = query[1]
} }
if (query[0] === "app_version") { if (query[0] === "app_version") {
appAuthData.app.app_version = query[1]; appAuthData.app.app_version = query[1]
} }
if (query[0] === "authentication_url") { if (query[0] === "authentication_url") {
appAuthData.fields.push({ appAuthData.fields.push({"key": "authentication_url", "value": query[1]})
key: "authentication_url", }
value: query[1],
});
}
if (query[0] === "scope") { if (query[0] === "scope") {
appAuthData.fields.push({ key: "scope", value: query[1] }); appAuthData.fields.push({"key": "scope", "value": query[1]})
} }
if (query[0] === "client_id") { if (query[0] === "client_id") {
appAuthData.fields.push({ key: "client_id", value: query[1] }); appAuthData.fields.push({"key": "client_id", "value": query[1]})
} }
if (query[0] === "client_secret") { if (query[0] === "client_secret") {
appAuthData.fields.push({ key: "client_secret", value: query[1] }); appAuthData.fields.push({"key": "client_secret", "value": query[1]})
} }
} }
} }
console.log(appAuthData); console.log(appAuthData)
fetch(globalUrl + "/api/v1/apps/authentication", { fetch(globalUrl+"/api/v1/apps/authentication", {
method: "PUT", method: 'PUT',
headers: { headers: {
"Content-Type": "application/json", 'Content-Type': 'application/json',
Accept: "application/json", 'Accept': 'application/json',
}, },
credentials: "include", credentials: "include",
body: JSON.stringify(appAuthData), body: JSON.stringify(appAuthData),
}) })
.then((response) => { .then((response) => {
if (response.status !== 200) { if (response.status !== 200) {
console.log("Status not 200 for oauth2 authentication"); console.log("Status not 200 for oauth2 authentication")
setFailed(true); setFailed(true)
} }
return response.json(); return response.json()
}) })
.then((responseJson) => { .then((responseJson) => {
//setUserSettings(responseJson) //setUserSettings(responseJson)
console.log("Resp: ", responseJson); console.log("Resp: ", responseJson)
setFinished(true); setFinished(true)
setResponse(responseJson.reason); setResponse(responseJson.reason)
setTimeout(() => { setTimeout(() => {
window.close(); window.close()
}, 1000); }, 1000)
}) })
.catch((error) => { .catch(error => {
console.log(error); console.log(error)
}); });
}
return ( }
<div style={{ width: 1000, margin: "auto", itemAlign: "center" }}>
<Typography return (
variant="h6" <div style={{width: 1000, margin: "auto", itemAlign: "center",}}>
style={{ marginLeft: "auto", marginRight: "auto", marginTop: 200 }} <Typography variant="h6" style={{marginLeft: "auto", marginRight: "auto", marginTop: 200, }}>
> {!finished ? <CircularProgress /> : "DONE WITH AUTH - this will close soon!!"}
{!finished ? ( <div />
<CircularProgress /> {failed ? "Failed setup. Error: " : ""} {response}
) : ( </Typography>
"DONE WITH AUTH - this will close soon!!" </div>
)} )
<div /> }
{failed ? "Failed setup. Error: " : ""} {response}
</Typography>
</div>
);
};
export default SetAuthentication; export default SetAuthentication;
File diff suppressed because it is too large Load Diff
+269 -290
View File
@@ -1,316 +1,295 @@
import React, { useEffect } from "react"; import React, { useEffect} from 'react';
import Paper from "@material-ui/core/Paper"; import Paper from '@material-ui/core/Paper';
import Grid from "@material-ui/core/Grid"; import Grid from '@material-ui/core/Grid';
import ButtonBase from "@material-ui/core/ButtonBase"; import ButtonBase from '@material-ui/core/ButtonBase';
import Button from "@material-ui/core/Button"; import Button from '@material-ui/core/Button';
import List from "@material-ui/core/List"; import List from '@material-ui/core/List';
import ListItem from "@material-ui/core/ListItem"; import ListItem from '@material-ui/core/ListItem';
import TextField from "@material-ui/core/TextField"; import TextField from '@material-ui/core/TextField';
import Select from "@material-ui/core/Select"; import Select from '@material-ui/core/Select';
import MenuItem from "@material-ui/core/MenuItem"; import MenuItem from '@material-ui/core/MenuItem';
import Dialog from "@material-ui/core/Dialog"; import Dialog from '@material-ui/core/Dialog';
import DialogTitle from "@material-ui/core/DialogTitle"; import DialogTitle from '@material-ui/core/DialogTitle';
import DialogActions from "@material-ui/core/DialogActions"; import DialogActions from '@material-ui/core/DialogActions';
import DialogContent from "@material-ui/core/DialogContent"; import DialogContent from '@material-ui/core/DialogContent';
import WebhookImage from "../assets/img/webhook.png"; import WebhookImage from '../assets/img/webhook.png';
import KafkaImage from "../assets/img/kafka.png"; import KafkaImage from '../assets/img/kafka.png';
const Webhooks = (props) => { const Webhooks = (props) => {
const { globalUrl, isLoaded } = props; const { globalUrl, isLoaded } = props;
const validtypes = ["webhook"]; const validtypes = ["webhook"]
//const [hooks, setSchedules] = React.useState(hookdata); //const [hooks, setSchedules] = React.useState(hookdata);
const [hooks, setHooks] = React.useState([]); const [hooks, setHooks] = React.useState([]);
const [modalOpen, setModalOpen] = React.useState(false); const [modalOpen, setModalOpen] = React.useState(false);
const [newHookName, setNewHookName] = React.useState(""); const [newHookName, setNewHookName] = React.useState("");
const [newHookDescription, setNewHookDescription] = React.useState(""); const [newHookDescription, setNewHookDescription] = React.useState("");
const [newHookType, setNewHookType] = React.useState(""); const [newHookType, setNewHookType] = React.useState("");
const [firstrequest, setFirstrequest] = React.useState(true); const [firstrequest, setFirstrequest] = React.useState(true);
const [, setModalError] = React.useState(""); const [, setModalError] = React.useState("");
useEffect(() => { useEffect(() => {
if (firstrequest) { if (firstrequest) {
setFirstrequest(false); setFirstrequest(false)
getAvailableHooks(); getAvailableHooks()
} }
}); })
const newHook = () => { const newHook = () => {
if (newHookName.length === 0) { if (newHookName.length === 0) {
setModalError("Missing name in modal"); setModalError("Missing name in modal")
return; return
} }
if (!validtypes.includes(newHookType)) { if (!validtypes.includes(newHookType)) {
setModalError( setModalError(newHookType + " is not a valid type. Try this: "+validtypes)
newHookType + " is not a valid type. Try this: " + validtypes }
);
}
fetch(globalUrl + "/api/v1/hooks/new", { fetch(globalUrl+"/api/v1/hooks/new", {
method: "POST", method: "POST",
headers: { "content-type": "application/json" }, headers: {"content-type": "application/json"},
body: JSON.stringify({ body: JSON.stringify({"name": newHookName, "description": newHookDescription, "type": newHookType}),
name: newHookName, credentials: "include",
description: newHookDescription, })
type: newHookType, .then((response) => response.json())
}), .then((responseJson) => {
credentials: "include", console.log(responseJson)
}) setHooks([])
.then((response) => response.json()) })
.then((responseJson) => { .catch(error => {
console.log(responseJson); console.log(error)
setHooks([]); });
}) }
.catch((error) => {
console.log(error);
});
};
const getAvailableHooks = () => { const getAvailableHooks = () => {
fetch(globalUrl + "/api/v1/hooks", { fetch(globalUrl+"/api/v1/hooks", {
method: "GET", method: 'GET',
headers: { headers: {
"Content-Type": "application/json", 'Content-Type': 'application/json',
Accept: "application/json", 'Accept': 'application/json',
}, },
credentials: "include", credentials: "include",
}) })
.then((response) => response.json()) .then((response) => response.json())
.then((responseJson) => { .then((responseJson) => {
setHooks(responseJson); setHooks(responseJson)
}) })
.catch((error) => { .catch(error => {
console.log(error); console.log(error)
// window.location.pathname = "/" // window.location.pathname = "/"
}); });
}; }
const deleteHook = (id) => { const deleteHook = (id) => {
if (id === undefined) { if (id === undefined) {
return; return
} }
fetch(globalUrl + "/api/v1/hooks/" + id + "/delete", { fetch(globalUrl+"/api/v1/hooks/"+id+"/delete", {
method: "DELETE", method: 'DELETE',
headers: { headers: {
"Content-Type": "application/json", 'Content-Type': 'application/json',
Accept: "application/json", 'Accept': 'application/json',
}, },
credentials: "include", credentials: "include",
}) })
.then((response) => response.json()) .then((response) => response.json())
.then((responseJson) => { .then((responseJson) => {
setHooks([]); setHooks([])
}) })
.catch((error) => { .catch(error => {
console.log(error); console.log(error)
}); });
}; }
const bodyDivStyle = { const bodyDivStyle = {
marginLeft: "20px", marginLeft: "20px",
marginRight: "20px", marginRight: "20px",
width: "1350px", width: "1350px",
minWidth: "1350px", minWidth: "1350px",
maxWidth: "1350px", maxWidth: "1350px",
}; }
const hookApp = (app) => { const hookApp = (app) => {
// Might be more options, but should be webhook or MQ
const appPicture =
app.type === "webhook" ? (
<img src={WebhookImage} alt="webhook" width="100px" height="100px" />
) : (
<img src={KafkaImage} alt="MQ" width="100px" height="100px" />
);
return ( // Might be more options, but should be webhook or MQ
<Grid container spacing={2} style={{ margin: "10px 10px 10px 10px" }}> const appPicture = app.type === "webhook" ?
<Grid item style={{ marginRight: "10px" }}> <img
<ButtonBase>{appPicture}</ButtonBase> src={WebhookImage}
</Grid> alt="webhook"
{splitter} width="100px"
<Grid item xs={12} sm container style={{ marginLeft: "10px" }}> height="100px"
<Grid item xs container direction="column" spacing={2}> />
<Grid item xs> :
<div> <img
<h2>{app.info.name}</h2> src={KafkaImage}
</div> alt="MQ"
<div>Desc: {app.info.description}</div> width="100px"
<div>Status: {app.status}</div> height="100px"
</Grid> />
<Grid item>{app.action}</Grid>
</Grid>
</Grid>
</Grid>
);
};
const splitter = ( return(
<div <Grid container spacing={2} style={{margin: "10px 10px 10px 10px"}}>
style={{ <Grid item style={{marginRight: "10px"}}>
width: "1px", <ButtonBase>
backgroundColor: "grey", {appPicture}
margin: "5px 5px 5px 5px", </ButtonBase>
}} </Grid>
/> {splitter}
); <Grid item xs={12} sm container style={{marginLeft: "10px"}}>
<Grid item xs container direction="column" spacing={2}>
<Grid item xs>
<div>
<h2>{app.info.name}</h2>
</div>
<div>
Desc: {app.info.description}
</div>
<div>
Status: {app.status}
</div>
</Grid>
<Grid item>
{app.action}
</Grid>
</Grid>
</Grid>
</Grid>
)
}
const hrefStyle = { const splitter = <div style={{width: "1px", backgroundColor: "grey", margin:"5px 5px 5px 5px"}} />
color: "#385f71",
textDecoration: "none",
};
// FIXME - add Schedule modal const hrefStyle = {
const hookPaper = (hook) => { color: "#385f71",
return ( textDecoration: "none"
<div> }
<Paper
style={{
maxWidth: "500px",
display: "flex",
padding: "10px 10px 10px 10px",
marginTop: "10px",
}}
>
<div style={{ flex: "5" }}>{hookApp(hook)}</div>
{splitter}
<div style={{ flex: "1" }}>
<List style={{ backgroundColor: "#ffffff" }}>
<ListItem style={{ flex: "1", textAlign: "center" }}>
<a href={"/webhooks/" + hook.id} style={hrefStyle}>
<Button disabled={false} color="primary">
Edit
</Button>
</a>
</ListItem>
<ListItem style={{ flex: "1", textAlign: "center" }}>
<Button
disabled={false}
onClick={() => {
deleteHook(hook.id);
}}
color="primary"
>
Delete
</Button>
</ListItem>
</List>
</div>
</Paper>
</div>
);
};
const modalView = modalOpen ? ( // FIXME - add Schedule modal
<Dialog const hookPaper = (hook) => {
modal return(
open={modalOpen} <div>
onClose={() => { <Paper style={{maxWidth: "500px", display: "flex", padding: "10px 10px 10px 10px", marginTop: "10px"}}>
setModalOpen(false); <div style={{flex: "5"}}>
}} {hookApp(hook)}
> </div>
<DialogTitle>Hook configuration</DialogTitle> {splitter}
<DialogContent> <div style={{flex: "1"}}>
<TextField <List style={{backgroundColor: "#ffffff"}}>
onChange={(event) => { <ListItem style={{flex: "1", textAlign: "center"}}>
setNewHookName(event.target.value); <a href={"/webhooks/"+hook.id} style={hrefStyle} >
}} <Button
color="primary" disabled={false}
placeholder="Name" color="primary"
margin="dense" >
fullWidth Edit
/> </Button>
<TextField </a>
onChange={(event) => { </ListItem>
setNewHookDescription(event.target.value); <ListItem style={{flex: "1", textAlign: "center"}}>
}} <Button
color="primary" disabled={false}
placeholder="Description" onClick={() => {deleteHook(hook.id)}}
margin="dense" color="primary"
fullWidth >Delete</Button>
/> </ListItem>
</List>
</div>
</Paper>
</div>
)
}
<Select const modalView = modalOpen ?
value={newHookType} <Dialog modal
onChange={(event) => { open={modalOpen}
setNewHookType(event.target.value); onClose={() => {setModalOpen(false)}}
}} >
fullWidth="true" <DialogTitle>Hook configuration</DialogTitle>
> <DialogContent>
{validtypes.map((data) => ( <TextField
<MenuItem value={data}>{data}</MenuItem> onChange={(event) => {setNewHookName(event.target.value)}}
))} color="primary"
</Select> placeholder="Name"
</DialogContent> margin="dense"
<DialogActions> fullWidth
<Button onClick={() => setModalOpen(false)} color="primary"> />
Cancel <TextField
</Button> onChange={(event) => {setNewHookDescription(event.target.value)}}
<Button color="primary"
disabled={ placeholder="Description"
newHookName.length === 0 || !validtypes.includes(newHookType) margin="dense"
} fullWidth
onClick={() => { />
newHook();
setModalOpen(false);
}}
color="primary"
>
Submit
</Button>
</DialogActions>
</Dialog>
) : null;
const hookmap = <Select
hooks.length > 0 ? ( value={newHookType}
<div>{hooks.map((data) => hookPaper(data))}</div> onChange={(event) => {setNewHookType(event.target.value)}}
) : ( fullWidth="true"
<div style={{ marginTop: "10%", marginLeft: "50%" }}> >
<Button {validtypes.map(data => (
disabled={false} <MenuItem value={data}>
onClick={() => { {data}
setModalOpen(true); </MenuItem>
}} ))}
variant="outlined" </Select>
color="primary" </DialogContent>
> <DialogActions>
CREATE NEW HOOK <Button onClick={() => setModalOpen(false)} color="primary">
</Button> Cancel
</div> </Button>
); <Button disabled={newHookName.length === 0 || !validtypes.includes(newHookType)} onClick={() => {newHook(); setModalOpen(false)}} color="primary">
Submit
</Button>
</DialogActions>
</Dialog>
: null
const hookView = ( const hookmap = hooks.length > 0 ?
<div style={bodyDivStyle}> <div>
<Button {hooks.map(data => (
disabled={false} hookPaper(data)
onClick={() => { ))}
setModalOpen(true); </div>
}} :
color="primary" <div style={{marginTop: "10%", marginLeft: "50%"}} >
> <Button
New disabled={false}
</Button> onClick={() => {setModalOpen(true)}}
{hookmap} variant="outlined"
</div> color="primary"
); >CREATE NEW HOOK</Button>
</div>
const loadedCheck = isLoaded ? ( const hookView =
<div> <div style={bodyDivStyle}>
{modalView} <Button
{hookView} disabled={false}
</div> onClick={() => {setModalOpen(true)}}
) : ( color="primary"
<div></div> >New</Button>
); {hookmap}
</div>
// Maybe use gridview or something, idk const loadedCheck = isLoaded ?
return <div>{loadedCheck}</div>; <div>
}; {modalView}
{hookView}
</div>
:
<div>
</div>
export default Webhooks;
// Maybe use gridview or something, idk
return (
<div>
{loadedCheck}
</div>
)
}
export default Webhooks
File diff suppressed because it is too large Load Diff