#245: Started work on a new, simple tutorial system

This commit is contained in:
frikky
2022-01-02 18:20:43 +01:00
parent 1b0d517fec
commit 5123f5ce36
13 changed files with 459 additions and 359 deletions
+3 -1
View File
@@ -1021,6 +1021,7 @@ func handleInfo(resp http.ResponseWriter, request *http.Request) {
} }
} }
tutorialsFinished := []string{}
returnValue := shuffle.HandleInfo{ returnValue := shuffle.HandleInfo{
Success: true, Success: true,
Username: userInfo.Username, Username: userInfo.Username,
@@ -1035,7 +1036,8 @@ func handleInfo(resp http.ResponseWriter, request *http.Request) {
Expiration: expiration.Unix(), Expiration: expiration.Unix(),
}, },
}, },
EthInfo: userInfo.EthInfo, EthInfo: userInfo.EthInfo,
Tutorials: tutorialsFinished,
} }
returnData, err := json.Marshal(returnValue) returnData, err := json.Marshal(returnValue)
+3 -3
View File
@@ -1,7 +1,7 @@
{ {
"name": "shuffler", "name": "shuffler",
"homepage": "https://shuffler.io", "homepage": "https://shuffler.io",
"version": "0.9.25", "version": "0.9.50",
"private": true, "private": true,
"dependencies": { "dependencies": {
"@babel/core": "^7.15.8", "@babel/core": "^7.15.8",
@@ -61,8 +61,8 @@
"react-markdown": "^4.2.2", "react-markdown": "^4.2.2",
"react-markdown-github": "^3.3.1", "react-markdown-github": "^3.3.1",
"react-powerhooks": "0.0.7", "react-powerhooks": "0.0.7",
"react-router": "^4.3.1", "react-router": "6.2.1",
"react-router-dom": "^4.3.1", "react-router-dom": "6.2.1",
"react-scripts": "^4.0.1", "react-scripts": "^4.0.1",
"react-shepherd": "^3.3.6", "react-shepherd": "^3.3.6",
"reactstrap": "^7.1.0", "reactstrap": "^7.1.0",
+297 -296
View File
@@ -1,14 +1,12 @@
import React, { useState, useEffect } from "react"; import React, { useState, useEffect } from "react";
import { Route } from "react-router"; //import { Route, Routes } from "react-router";
import { BrowserRouter } from "react-router-dom"; import { Route, Routes, 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 Schedules from "./views/Schedules";
import Webhooks from "./views/Webhooks";
import Workflows from "./views/Workflows"; import Workflows from "./views/Workflows";
import GettingStarted from "./views/GettingStarted";
import EditWebhook from "./views/EditWebhook"; import EditWebhook from "./views/EditWebhook";
import AngularWorkflow from "./views/AngularWorkflow"; import AngularWorkflow from "./views/AngularWorkflow";
@@ -52,6 +50,7 @@ if (window.location.port === "3000") {
} }
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([])
@@ -271,11 +270,13 @@ const App = (message, props) => {
window.location.pathname === "/home" || window.location.pathname === "/home" ||
window.location.pathname === "/features" ? ( window.location.pathname === "/features" ? (
<div> <div>
<Route <Routes>
exact <Route
path="/home" exact
render={(props) => <LandingPageNew isLoaded={isLoaded} {...props} />} path="/home"
/> render={(props) => <LandingPageNew isLoaded={isLoaded} {...props} />}
/>
</Routes>
</div> </div>
) : ( ) : (
<div <div
@@ -303,293 +304,293 @@ const App = (message, props) => {
{...props} {...props}
/> />
<div style={{ height: 60 }} /> <div style={{ height: 60 }} />
<Route <Routes>
exact <Route
path="/login" exact
render={(props) => ( path="/login"
<LoginPage element={
isLoggedIn={isLoggedIn} <LoginPage
setIsLoggedIn={setIsLoggedIn} isLoggedIn={isLoggedIn}
register={true} setIsLoggedIn={setIsLoggedIn}
isLoaded={isLoaded} register={true}
globalUrl={globalUrl} isLoaded={isLoaded}
setCookie={setCookie} globalUrl={globalUrl}
cookies={cookies} setCookie={setCookie}
checkLogin={checkLogin} cookies={cookies}
{...props} checkLogin={checkLogin}
/> {...props}
)} />
/> }
<Route />
exact <Route
path="/admin" exact
render={(props) => ( path="/admin"
<Admin element={
userdata={userdata} <Admin
isLoggedIn={isLoggedIn} userdata={userdata}
setIsLoggedIn={setIsLoggedIn} isLoggedIn={isLoggedIn}
register={true} setIsLoggedIn={setIsLoggedIn}
isLoaded={isLoaded} register={true}
globalUrl={globalUrl} isLoaded={isLoaded}
setCookie={setCookie} globalUrl={globalUrl}
cookies={cookies} setCookie={setCookie}
{...props} cookies={cookies}
/> {...props}
)} />
/> }
<Route />
exact <Route
path="/admin/:key" exact
render={(props) => ( path="/admin/:key"
<Admin element={
isLoggedIn={isLoggedIn} <Admin
setIsLoggedIn={setIsLoggedIn} isLoggedIn={isLoggedIn}
register={true} setIsLoggedIn={setIsLoggedIn}
isLoaded={isLoaded} register={true}
globalUrl={globalUrl} isLoaded={isLoaded}
setCookie={setCookie} globalUrl={globalUrl}
cookies={cookies} setCookie={setCookie}
{...props} cookies={cookies}
/> {...props}
)} />
/> }
{userdata.id !== undefined ? ( />
<Route {userdata.id !== undefined ? (
exact <Route
path="/settings" exact
render={(props) => ( path="/settings"
<SettingsPage element={
isLoaded={isLoaded} <SettingsPage
setUserData={setUserData} isLoaded={isLoaded}
userdata={userdata} setUserData={setUserData}
globalUrl={globalUrl} userdata={userdata}
{...props} globalUrl={globalUrl}
/> {...props}
)} />
/> }
) : null} />
<Route ) : null}
exact <Route
path="/AdminSetup" exact
render={(props) => ( path="/AdminSetup"
<AdminSetup element={
isLoaded={isLoaded} <AdminSetup
userdata={userdata} isLoaded={isLoaded}
globalUrl={globalUrl} userdata={userdata}
{...props} globalUrl={globalUrl}
/> {...props}
)} />
/> }
<Route />
exact <Route
path="/webhooks" exact
render={(props) => ( path="/detectionframework"
<Webhooks isLoaded={isLoaded} globalUrl={globalUrl} {...props} /> element={
)} <DetectionFramework
/> frameworkData={FrameworkData}
<Route selectedOption={"Draw"}
exact showOptions={false}
path="/webhooks/:key"
render={(props) => (
<EditWebhook isLoaded={isLoaded} globalUrl={globalUrl} {...props} />
)}
/>
<Route
exact
path="/schedules"
render={(props) => <Schedules globalUrl={globalUrl} {...props} />}
/>
<Route
exact
path="/detectionframework"
render={(props) => (
<DetectionFramework
frameworkData={FrameworkData}
selectedOption={"Draw"}
showOptions={false}
isLoaded={isLoaded} isLoaded={isLoaded}
isLoggedIn={isLoggedIn} isLoggedIn={isLoggedIn}
globalUrl={globalUrl} globalUrl={globalUrl}
{...props} {...props}
/> />
)} }
/> />
<Route <Route
exact exact
path="/dashboard" path="/dashboard"
render={(props) => ( element={
<Dashboard <Dashboard
isLoaded={isLoaded} isLoaded={isLoaded}
isLoggedIn={isLoggedIn} isLoggedIn={isLoggedIn}
globalUrl={globalUrl} globalUrl={globalUrl}
{...props} {...props}
/> />
)} }
/> />
<Route <Route
exact exact
path="/apps/new" path="/apps/new"
render={(props) => ( element={
<AppCreator <AppCreator
isLoaded={isLoaded} isLoaded={isLoaded}
isLoggedIn={isLoggedIn} isLoggedIn={isLoggedIn}
globalUrl={globalUrl} globalUrl={globalUrl}
{...props} {...props}
/> />
)} }
/> />
<Route <Route
exact exact
path="/apps" path="/apps"
render={(props) => ( element={
<Apps <Apps
isLoaded={isLoaded} isLoaded={isLoaded}
isLoggedIn={isLoggedIn} isLoggedIn={isLoggedIn}
globalUrl={globalUrl} globalUrl={globalUrl}
userdata={userdata} userdata={userdata}
{...props} {...props}
/> />
)} }
/> />
<Route <Route
exact exact
path="/apps/edit/:appid" path="/apps/edit/:appid"
render={(props) => ( element={
<AppCreator <AppCreator
isLoaded={isLoaded} isLoaded={isLoaded}
isLoggedIn={isLoggedIn} isLoggedIn={isLoggedIn}
globalUrl={globalUrl} globalUrl={globalUrl}
{...props} {...props}
/> />
)} }
/> />
<Route <Route
exact exact
path="/schedules/:key" path="/workflows"
render={(props) => <EditSchedule globalUrl={globalUrl} {...props} />} element={
/> <Workflows
<Route cookies={cookies}
exact removeCookie={removeCookie}
path="/workflows" isLoaded={isLoaded}
render={(props) => ( isLoggedIn={isLoggedIn}
<Workflows globalUrl={globalUrl}
cookies={cookies} cookies={cookies}
removeCookie={removeCookie} userdata={userdata}
isLoaded={isLoaded} {...props}
isLoggedIn={isLoggedIn} />
globalUrl={globalUrl} }
cookies={cookies} />
userdata={userdata} <Route
{...props} exact
/> path="/getting-started"
)} element={
/> <GettingStarted
<Route cookies={cookies}
exact removeCookie={removeCookie}
path="/workflows/:key" isLoaded={isLoaded}
render={(props) => ( isLoggedIn={isLoggedIn}
<AngularWorkflow globalUrl={globalUrl}
alert={alert} cookies={cookies}
userdata={userdata} userdata={userdata}
globalUrl={globalUrl} {...props}
isLoaded={isLoaded} />
isLoggedIn={isLoggedIn} }
{...props} />
/> <Route
)} exact
/> path="/workflows/:key"
<Route element={
exact <AngularWorkflow
path="/docs/:key" alert={alert}
render={(props) => ( userdata={userdata}
<Docs globalUrl={globalUrl}
isMobile={isMobile} isLoaded={isLoaded}
isLoaded={isLoaded} isLoggedIn={isLoggedIn}
globalUrl={globalUrl} {...props}
{...props} />
/> }
)} />
/> <Route
<Route exact
exact path="/docs/:key"
path="/docs" element={
render={(props) => { <Docs
window.location.pathname = "/docs/about"; isMobile={isMobile}
}} isLoaded={isLoaded}
/> globalUrl={globalUrl}
<Route {...props}
exact />
path="/introduction" }
render={(props) => ( />
<Introduction <Route
isLoaded={isLoaded} exact
globalUrl={globalUrl} path="/docs"
{...props} element={
/> //navigate(`/docs/about`)
)} <Docs
/> isMobile={isMobile}
<Route isLoaded={isLoaded}
exact globalUrl={globalUrl}
path="/introduction/:key" {...props}
render={(props) => ( />
<Introduction }
isLoaded={isLoaded} />
globalUrl={globalUrl} <Route
{...props} exact
/> path="/introduction"
)} element={
/> <Introduction
<Route isLoaded={isLoaded}
exact globalUrl={globalUrl}
path="/set_authentication" {...props}
render={(props) => ( />
<SetAuthentication }
userdata={userdata} />
isLoggedIn={isLoggedIn} <Route
setIsLoggedIn={setIsLoggedIn} exact
register={true} path="/introduction/:key"
isLoaded={isLoaded} element={
globalUrl={globalUrl} <Introduction
setCookie={setCookie} isLoaded={isLoaded}
cookies={cookies} globalUrl={globalUrl}
{...props} {...props}
/> />
)} }
/> />
<Route <Route
exact exact
path="/login_sso" path="/set_authentication"
render={(props) => ( element={
<SetAuthenticationSSO <SetAuthentication
userdata={userdata} userdata={userdata}
isLoggedIn={isLoggedIn} isLoggedIn={isLoggedIn}
setIsLoggedIn={setIsLoggedIn} setIsLoggedIn={setIsLoggedIn}
register={true} register={true}
isLoaded={isLoaded} isLoaded={isLoaded}
globalUrl={globalUrl} globalUrl={globalUrl}
setCookie={setCookie} setCookie={setCookie}
cookies={cookies} cookies={cookies}
{...props} {...props}
/> />
)} }
/> />
<Route <Route
exact exact
path="/" path="/login_sso"
render={(props) => ( element={
<LoginPage <SetAuthenticationSSO
isLoggedIn={isLoggedIn} userdata={userdata}
setIsLoggedIn={setIsLoggedIn} isLoggedIn={isLoggedIn}
register={true} setIsLoggedIn={setIsLoggedIn}
isLoaded={isLoaded} register={true}
globalUrl={globalUrl} isLoaded={isLoaded}
setCookie={setCookie} globalUrl={globalUrl}
cookies={cookies} setCookie={setCookie}
{...props} cookies={cookies}
/> {...props}
)} />
/> }
/>
<Route
exact
path="/"
element={
<LoginPage
isLoggedIn={isLoggedIn}
setIsLoggedIn={setIsLoggedIn}
register={true}
isLoaded={isLoaded}
globalUrl={globalUrl}
setCookie={setCookie}
cookies={cookies}
{...props}
/>
}
/>
</Routes>
</div> </div>
); );
+27 -2
View File
@@ -29,7 +29,12 @@ import {
Polymer as PolymerIcon, Polymer as PolymerIcon,
Apps as AppsIcon, Apps as AppsIcon,
Description as DescriptionIcon, Description as DescriptionIcon,
HelpOutline as HelpOutlineIcon,
} from "@material-ui/icons"; } from "@material-ui/icons";
import {
Analytics as AnalyticsIcon,
} from "@mui/icons-material";
//import LogoutIcon from '@mui/icons-material/Logout'; //import LogoutIcon from '@mui/icons-material/Logout';
import { useAlert } from "react-alert"; import { useAlert } from "react-alert";
@@ -440,6 +445,26 @@ const Header = (props) => {
handleClose(); handleClose();
}} }}
> >
<MenuItem
onClick={(event) => {
event.preventDefault();
handleClose();
}}
>
<Link to="/docs/about" style={hrefStyle}>
<HelpOutlineIcon style={{marginRight: 5 }}/> About
</Link>
</MenuItem>
<MenuItem
onClick={(event) => {
event.preventDefault();
handleClose();
}}
>
<Link to="/getting-started" style={hrefStyle}>
<AnalyticsIcon style={{marginRight: 5 }}/> Get Started
</Link>
</MenuItem>
<MenuItem <MenuItem
onClick={(event) => { onClick={(event) => {
event.preventDefault(); event.preventDefault();
@@ -447,7 +472,7 @@ const Header = (props) => {
}} }}
> >
<Link to="/settings" style={hrefStyle}> <Link to="/settings" style={hrefStyle}>
<SettingsIcon /> Settings <SettingsIcon style={{marginRight: 5 }}/> Settings
</Link> </Link>
</MenuItem> </MenuItem>
<MenuItem <MenuItem
@@ -458,7 +483,7 @@ const Header = (props) => {
handleClickLogout(); handleClickLogout();
}} }}
> >
<MeetingRoomIcon /> &nbsp;Logout <MeetingRoomIcon style={{marginRight: 5 }}/> &nbsp;Logout
</MenuItem> </MenuItem>
</Menu> </Menu>
</span> </span>
+21 -16
View File
@@ -1,25 +1,30 @@
import { useEffect } from "react"; import { useEffect } from "react";
import { withRouter } from "react-router-dom"; //import { withRouter } from "react-router-dom";
import { useLocation } from "react-router-dom";
function ScrollToTop({ getUserNotifications, setCurpath, history }) { function ScrollToTop({ getUserNotifications, setCurpath, history }) {
useEffect(() => { let location = useLocation();
const unlisten = history.listen(() => {
window.scroll({
top: 0,
left: 0,
behavior: "smooth",
});
setCurpath(window.location.pathname); useEffect(() => {
getUserNotifications(); //const unlisten = history.listen(() => {
}); window.scroll({
return () => { top: 0,
unlisten(); left: 0,
}; behavior: "smooth",
}, []); });
setCurpath(window.location.pathname);
getUserNotifications();
//});
//return () => {
// unlisten();
//};
}, [location]);
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
export default withRouter(ScrollToTop); //export default withRouter(ScrollToTop);
// https://v5.reactrouter.com/web/api/Hooks/uselocation
export default ScrollToTop;
+6 -2
View File
@@ -2,7 +2,7 @@ import React, { useState, useEffect } from "react";
import { makeStyles } from "@material-ui/styles"; import { makeStyles } from "@material-ui/styles";
import { useTheme } from "@material-ui/core/styles"; import { useTheme } from "@material-ui/core/styles";
import { Link } from "react-router-dom"; import { useNavigate, Link } from "react-router-dom";
import { import {
FormControl, FormControl,
@@ -92,6 +92,8 @@ const Admin = (props) => {
var to_be_copied = ""; var to_be_copied = "";
const theme = useTheme(); const theme = useTheme();
const classes = useStyles(); const classes = useStyles();
let navigate = useNavigate();
const [firstRequest, setFirstRequest] = React.useState(true); const [firstRequest, setFirstRequest] = React.useState(true);
const [orgRequest, setOrgRequest] = React.useState(true); const [orgRequest, setOrgRequest] = React.useState(true);
const [modalUser, setModalUser] = React.useState({}); const [modalUser, setModalUser] = React.useState({});
@@ -1395,7 +1397,9 @@ const Admin = (props) => {
console.log("Should get apps for categories."); console.log("Should get apps for categories.");
} }
props.history.push(`/admin?tab=${views[newValue]}`) console.log("PROPS: ", props)
navigate(`/admin?tab=${views[newValue]}`)
setModalUser({}); setModalUser({});
}; };
+13 -5
View File
@@ -3,8 +3,8 @@ import { useInterval } from "react-powerhooks";
import { makeStyles, useTheme } from "@material-ui/core/styles"; import { makeStyles, useTheme } from "@material-ui/core/styles";
import { v4 as uuidv4 } from "uuid"; import { v4 as uuidv4 } from "uuid";
import { Link } from "react-router-dom"; import { Link, useParams } from "react-router-dom";
import { Prompt } from "react-router"; // import { Prompt } from "react-router"; // FIXME
import { useBeforeunload } from "react-beforeunload"; import { useBeforeunload } from "react-beforeunload";
import ReactJson from "react-json-view"; import ReactJson from "react-json-view";
import NestedMenuItem from "material-ui-nested-menu-item"; import NestedMenuItem from "material-ui-nested-menu-item";
@@ -210,10 +210,16 @@ const svgSize = 24;
//const referenceUrl = "https://shuffler.io/functions/webhooks/" //const referenceUrl = "https://shuffler.io/functions/webhooks/"
//const referenceUrl = window.location.origin+"/api/v1/hooks/" //const referenceUrl = window.location.origin+"/api/v1/hooks/"
const AngularWorkflow = (props) => { const AngularWorkflow = (defaultprops) => {
const { globalUrl, isLoggedIn, isLoaded, userdata } = props; const { globalUrl, isLoggedIn, isLoaded, userdata } = defaultprops;
const referenceUrl = globalUrl + "/api/v1/hooks/"; const referenceUrl = globalUrl + "/api/v1/hooks/";
const alert = useAlert() const alert = useAlert()
const params = useParams();
var props = JSON.parse(JSON.stringify(defaultprops))
props.match = {}
props.match.params = params
const green = "#86c142"; const green = "#86c142";
const yellow = "#FECC00"; const yellow = "#FECC00";
//const theme = useTheme(); //const theme = useTheme();
@@ -12636,7 +12642,9 @@ const AngularWorkflow = (props) => {
return ( return (
<div> <div>
<Prompt when={!lastSaved} message={unloadText} /> {/* Removed due to missing react router features
<Prompt when={!lastSaved} message={unloadText} />
*/}
{loadedCheck} {loadedCheck}
</div> </div>
); );
+8 -3
View File
@@ -37,7 +37,7 @@ import {
} from "@material-ui/icons"; } from "@material-ui/icons";
import { v4 as uuidv4 } from "uuid"; import { v4 as uuidv4 } from "uuid";
import { Link } from "react-router-dom"; import { Link, useParams } from "react-router-dom";
import YAML from "yaml"; import YAML from "yaml";
import ChipInput from "material-ui-chip-input"; import ChipInput from "material-ui-chip-input";
import { useAlert } from "react-alert"; import { useAlert } from "react-alert";
@@ -220,12 +220,17 @@ const parseCurl = (s) => {
}; };
// Should be different if logged in :| // Should be different if logged in :|
const AppCreator = (props) => { const AppCreator = (defaultprops) => {
const { globalUrl, isLoaded } = props; const { globalUrl, isLoaded } = defaultprops;
const classes = useStyles(); const classes = useStyles();
const alert = useAlert(); const alert = useAlert();
const theme = useTheme(); const theme = useTheme();
const params = useParams();
var props = JSON.parse(JSON.stringify(defaultprops))
props.match = {}
props.match.params = params
var upload = ""; var upload = "";
const increaseAmount = 50; const increaseAmount = 50;
const actionNonBodyRequest = ["GET", "HEAD", "DELETE", "CONNECT"]; const actionNonBodyRequest = ["GET", "HEAD", "DELETE", "CONNECT"];
+30 -5
View File
@@ -1,9 +1,9 @@
import React, { useState } from "react"; import React, { useEffect, useState } from "react";
import { useTheme } from "@material-ui/core/styles"; import { useTheme } from "@material-ui/core/styles";
import ReactMarkdown from "react-markdown"; import ReactMarkdown from "react-markdown";
import { BrowserView, MobileView } from "react-device-detect"; import { BrowserView, MobileView } from "react-device-detect";
import { Link } from "react-router-dom"; import { useParams, useNavigate, Link } from "react-router-dom";
import { import {
Tooltip, Tooltip,
@@ -39,10 +39,26 @@ const innerHrefStyle = {
textDecoration: "none", textDecoration: "none",
}; };
const Docs = (props) => { const Docs = (defaultprops) => {
const { globalUrl, selectedDoc, serverside, isMobile } = props; const { globalUrl, selectedDoc, serverside, isMobile } = defaultprops;
let navigate = useNavigate();
const theme = useTheme(); const theme = useTheme();
// Quickfix for react router 5 -> 6
const params = useParams();
var props = JSON.parse(JSON.stringify(defaultprops))
props.match = {}
props.match.params = params
useEffect(() => {
if (params["key"] === undefined) {
navigate("/docs/about")
return
}
}, [])
//console.log("PARAMS: ", params)
const [mobile, setMobile] = useState(isMobile === true ? true : false); const [mobile, setMobile] = useState(isMobile === true ? true : false);
const [data, setData] = useState(""); const [data, setData] = useState("");
const [firstrequest, setFirstrequest] = useState(true); const [firstrequest, setFirstrequest] = useState(true);
@@ -201,7 +217,15 @@ const Docs = (props) => {
} else { } else {
if (!serverside) { if (!serverside) {
fetchDocList(); fetchDocList();
fetchDocs(props.match.params.key);
console.log("PROPS: ", props)
//const propkey = props.match.params.key
//if (propkey === undefined) {
// navigate("/docs/about")
// return null
//}
fetchDocs(props.match.params.key)
} }
} }
} }
@@ -410,6 +434,7 @@ const Docs = (props) => {
{selectedMeta.contributors.slice(0, 7).map((data, index) => { {selectedMeta.contributors.slice(0, 7).map((data, index) => {
return ( return (
<a <a
key={index}
rel="noopener noreferrer" rel="noopener noreferrer"
target="_blank" target="_blank"
href={data.url} href={data.url}
+9 -2
View File
@@ -1,5 +1,6 @@
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 { Link, useParams } from "react-router-dom";
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";
@@ -9,9 +10,15 @@ 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 = (defaultprops) => {
const { globalUrl, isLoggedIn, isLoaded } = props; const { globalUrl, isLoggedIn, isLoaded } = defaultprops;
const theme = useTheme(); const theme = useTheme();
const params = useParams();
var props = JSON.parse(JSON.stringify(defaultprops))
props.match = {}
props.match.params = params
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([]);
+8 -2
View File
@@ -1,4 +1,5 @@
import React, { useState, useEffect } from "react"; import React, { useState, useEffect } from "react";
import { useParams } from "react-router-dom";
import Paper from "@material-ui/core/Paper"; import Paper from "@material-ui/core/Paper";
@@ -21,8 +22,13 @@ const bodyDivStyle = {
// FIXME - add fetch for data fields // FIXME - add fetch for data fields
// FIXME - remove tmpdata // FIXME - remove tmpdata
// FIXME: Use isLoggedIn :) // FIXME: Use isLoggedIn :)
const Settings = (props) => { const Settings = (defaultprops) => {
const { globalUrl, isLoaded, surfaceColor } = props; const { globalUrl, isLoaded, surfaceColor } = defaultprops;
const params = useParams();
var props = JSON.parse(JSON.stringify(defaultprops))
props.match = {}
props.match.params = params
const [firstRequest, setFirstRequest] = useState(true); const [firstRequest, setFirstRequest] = useState(true);
const boxStyle = { const boxStyle = {
+13 -4
View File
@@ -1,6 +1,8 @@
import React, { useEffect, useContext } from "react"; import React, { useEffect, useContext } from "react";
import { makeStyles } from "@material-ui/core/styles"; import { makeStyles } from "@material-ui/core/styles";
import { useTheme } from "@material-ui/core/styles"; import { useTheme } from "@material-ui/core/styles";
import { Navigate } from "react-router-dom";
//import { Redirect } from "react-router-dom";
import SecurityFramework from '../components/SecurityFramework.jsx'; import SecurityFramework from '../components/SecurityFramework.jsx';
import { ShepherdTour, ShepherdTourContext } from 'react-shepherd' import { ShepherdTour, ShepherdTourContext } from 'react-shepherd'
@@ -2536,10 +2538,17 @@ const Workflows = (props) => {
); );
} }
//import { ShepherdTour, ShepherdTourContext } from 'react-shepherd'
const WorkflowView = () => { const WorkflowView = () => {
/*
if (workflows.length === 0) { if (workflows.length === 0) {
/*
console.log("USER: ", userdata)
console.log("PROPS: ", props)
if (userdata.tutorials !== undefined && userdata.tutorials !== null && !userdata.tutorials.includes("getting-started")) {
//return <Redirect to='/getting-started' />;
return <Navigate to="/getting-started" replace />;
}
*/
return ( return (
<div style={emptyWorkflowStyle}> <div style={emptyWorkflowStyle}>
<Paper style={boxStyle}> <Paper style={boxStyle}>
@@ -2585,9 +2594,9 @@ const Workflows = (props) => {
</div> </div>
</Paper> </Paper>
</div> </div>
); )
} }
*/
var workflowDelay = -150 var workflowDelay = -150
var appDelay = -75 var appDelay = -75
+21 -18
View File
@@ -926,21 +926,23 @@ func main() {
log.Printf("[INFO] Executionstatus issue: ", execution.Status) log.Printf("[INFO] Executionstatus issue: ", execution.Status)
} }
found := false /*
for _, executionId := range executionIds { found := false
if execution.ExecutionId == executionId { for _, executionId := range executionIds {
found = true if execution.ExecutionId == executionId {
break found = true
break
}
} }
}
// Doesn't work because of USER INPUT // Doesn't work because of USER INPUT
if found { if found {
log.Printf("[INFO] Skipping duplicate %s", execution.ExecutionId) log.Printf("[INFO] Skipping duplicate %s", execution.ExecutionId)
continue continue
} else { } else {
//log.Printf("[INFO] Adding to be ran %s", execution.ExecutionId) //log.Printf("[INFO] Adding to be ran %s", execution.ExecutionId)
} }
*/
// Now, how do I execute this one? // Now, how do I execute this one?
// FIXME - if error, check the status of the running one. If it's bad, send data back. // FIXME - if error, check the status of the running one. If it's bad, send data back.
@@ -1241,16 +1243,17 @@ func sendWorkerRequest(workflowExecution shuffle.ExecutionRequest) error {
return err return err
} }
if newresp.StatusCode != 200 {
log.Printf("[ERROR] Error running request - status code is %d, not 200", newresp.StatusCode)
return errors.New(fmt.Sprintf("Bad statuscode: %d - expecting 200", newresp.StatusCode))
}
body, err := ioutil.ReadAll(newresp.Body) body, err := ioutil.ReadAll(newresp.Body)
if err != nil { if err != nil {
log.Printf("[ERROR] Failed reading body in worker request body: %s", err) log.Printf("[ERROR] Failed reading body in worker request body: %s", err)
return err return err
} }
if newresp.StatusCode != 200 {
log.Printf("[ERROR] Error running request - status code is %d, not 200. Body: %s", newresp.StatusCode, string(body))
return errors.New(fmt.Sprintf("Bad statuscode: %d - expecting 200", newresp.StatusCode))
}
_ = body _ = body
log.Printf("[DEBUG] Ran worker from request with execution ID: %s. Worker URL: %s.\n\n DEBUGGING: docker service logs shuffle-workers | grep %s\n\n", workflowExecution.ExecutionId, streamUrl, workflowExecution.ExecutionId) log.Printf("[DEBUG] Ran worker from request with execution ID: %s. Worker URL: %s.\n\n DEBUGGING: docker service logs shuffle-workers | grep %s\n\n", workflowExecution.ExecutionId, streamUrl, workflowExecution.ExecutionId)