Started creating introduction screen
This commit is contained in:
@@ -456,6 +456,40 @@ func generateYaml(swagger *openapi3.Swagger, newmd5 string) (*openapi3.Swagger,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Jesus what a clusterfuck.
|
||||||
|
// Handles parsing of categories from OpenApi3 custom field
|
||||||
|
if val, ok := swagger.Info.ExtensionProps.Extensions["x-categories"]; ok {
|
||||||
|
log.Printf("Categories: %#v", val)
|
||||||
|
j, err := json.Marshal(&val)
|
||||||
|
if err == nil {
|
||||||
|
if j[0] == 0x22 && j[len(j)-1] == 0x22 {
|
||||||
|
j = j[1 : len(j)-1]
|
||||||
|
}
|
||||||
|
|
||||||
|
parsedCategories := fmt.Sprintf(`{"categories": %s}`, string(j))
|
||||||
|
type parsed struct {
|
||||||
|
Categories []string `json:"categories"`
|
||||||
|
}
|
||||||
|
|
||||||
|
var parse parsed
|
||||||
|
err := json.Unmarshal([]byte(parsedCategories), &parse)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Failed unmarshaling categories", err)
|
||||||
|
} else {
|
||||||
|
api.Categories = parse.Categories
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(swagger.Tags) > 0 {
|
||||||
|
newTags := []string{}
|
||||||
|
for _, tag := range swagger.Tags {
|
||||||
|
newTags = append(newTags, tag.Name)
|
||||||
|
}
|
||||||
|
|
||||||
|
api.Tags = newTags
|
||||||
|
}
|
||||||
|
|
||||||
securitySchemes := swagger.Components.SecuritySchemes
|
securitySchemes := swagger.Components.SecuritySchemes
|
||||||
if securitySchemes != nil {
|
if securitySchemes != nil {
|
||||||
//log.Printf("%#v", securitySchemes)
|
//log.Printf("%#v", securitySchemes)
|
||||||
|
|||||||
@@ -1696,6 +1696,7 @@ func handleInfo(resp http.ResponseWriter, request *http.Request) {
|
|||||||
{
|
{
|
||||||
"success": true,
|
"success": true,
|
||||||
"admin": %s,
|
"admin": %s,
|
||||||
|
"tutorials": [],
|
||||||
"orgs": [{"name": "Shuffle", "id": "123", "role": "admin"}],
|
"orgs": [{"name": "Shuffle", "id": "123", "role": "admin"}],
|
||||||
"selected_org": {"name": "Shuffle", "id": "123", "role": "admin"},
|
"selected_org": {"name": "Shuffle", "id": "123", "role": "admin"},
|
||||||
"cookies": [{"key": "session_token", "value": "%s", "expiration": %d}]
|
"cookies": [{"key": "session_token", "value": "%s", "expiration": %d}]
|
||||||
@@ -3129,7 +3130,7 @@ func handleWebhookCallback(resp http.ResponseWriter, request *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, item := range hook.Workflows {
|
for _, item := range hook.Workflows {
|
||||||
log.Printf("Running for workflow %s with startnode %s", item, hook.Start)
|
log.Printf("Running webhook for workflow %s with startnode %s", item, hook.Start)
|
||||||
workflow := Workflow{
|
workflow := Workflow{
|
||||||
ID: "",
|
ID: "",
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ type WorkflowApp struct {
|
|||||||
Actions []WorkflowAppAction `json:"actions" yaml:"actions" required:true datastore:"actions,noindex"`
|
Actions []WorkflowAppAction `json:"actions" yaml:"actions" required:true datastore:"actions,noindex"`
|
||||||
Authentication Authentication `json:"authentication" yaml:"authentication" required:false datastore:"authentication"`
|
Authentication Authentication `json:"authentication" yaml:"authentication" required:false datastore:"authentication"`
|
||||||
Tags []string `json:"tags" yaml:"tags" required:false datastore:"activated"`
|
Tags []string `json:"tags" yaml:"tags" required:false datastore:"activated"`
|
||||||
Category []string `json:"category" yaml:"category" required:false datastore:"category"`
|
Categories []string `json:"categories" yaml:"categories" required:false datastore:"categories"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type WorkflowAppActionParameter struct {
|
type WorkflowAppActionParameter struct {
|
||||||
@@ -2308,10 +2308,10 @@ func handleExecution(id string, workflow Workflow, request *http.Request) (Workf
|
|||||||
|
|
||||||
//log.Println(string(mappedData))
|
//log.Println(string(mappedData))
|
||||||
|
|
||||||
log.Printf("STARTNODE: %s", workflowExecution.Start)
|
|
||||||
if len(workflowExecution.Start) == 0 {
|
if len(workflowExecution.Start) == 0 {
|
||||||
workflowExecution.Start = workflowExecution.Workflow.Start
|
workflowExecution.Start = workflowExecution.Workflow.Start
|
||||||
}
|
}
|
||||||
|
log.Printf("STARTNODE: %s", workflowExecution.Start)
|
||||||
|
|
||||||
childNodes := findChildNodes(workflowExecution, workflowExecution.Start)
|
childNodes := findChildNodes(workflowExecution, workflowExecution.Start)
|
||||||
|
|
||||||
@@ -2535,6 +2535,7 @@ func executeWorkflow(resp http.ResponseWriter, request *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.Printf("STARTING EXEC OF %s!", fileId)
|
||||||
workflowExecution, executionResp, err := handleExecution(fileId, *workflow, request)
|
workflowExecution, executionResp, err := handleExecution(fileId, *workflow, request)
|
||||||
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import Dashboard from "./views/Dashboard";
|
|||||||
import AdminSetup from "./views/AdminSetup";
|
import AdminSetup from "./views/AdminSetup";
|
||||||
import Admin from "./views/Admin";
|
import Admin from "./views/Admin";
|
||||||
import Docs from "./views/Docs";
|
import Docs from "./views/Docs";
|
||||||
|
import Introduction from "./views/Introduction";
|
||||||
|
|
||||||
import LandingPageNew from "./views/LandingpageNew";
|
import LandingPageNew from "./views/LandingpageNew";
|
||||||
import LoginPage from "./views/LoginPage";
|
import LoginPage from "./views/LoginPage";
|
||||||
@@ -95,6 +96,7 @@ const App = (message, props) => {
|
|||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(responseJson => {
|
.then(responseJson => {
|
||||||
if (responseJson.success === true) {
|
if (responseJson.success === true) {
|
||||||
|
//console.log(responseJson.success)
|
||||||
setUserData(responseJson)
|
setUserData(responseJson)
|
||||||
setIsLoggedIn(true)
|
setIsLoggedIn(true)
|
||||||
|
|
||||||
@@ -141,6 +143,8 @@ const App = (message, props) => {
|
|||||||
<Route exact path="/workflows/:key" render={props => <AngularWorkflow globalUrl={globalUrl} isLoaded={isLoaded} isLoggedIn={isLoggedIn} {...props} />} />
|
<Route exact path="/workflows/:key" render={props => <AngularWorkflow globalUrl={globalUrl} isLoaded={isLoaded} isLoggedIn={isLoggedIn} {...props} />} />
|
||||||
<Route exact path="/docs/:key" render={props => <Docs isLoaded={isLoaded} globalUrl={globalUrl} {...props} />} />
|
<Route exact path="/docs/:key" render={props => <Docs isLoaded={isLoaded} globalUrl={globalUrl} {...props} />} />
|
||||||
<Route exact path="/docs" render={props => { window.location.pathname = "/docs/about" }} />
|
<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="/" render={props => { window.location.pathname = "/login" }} />
|
<Route exact path="/" render={props => { window.location.pathname = "/login" }} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,9 @@ import Breadcrumbs from '@material-ui/core/Breadcrumbs';
|
|||||||
import AppsIcon from '@material-ui/icons/Apps';
|
import AppsIcon from '@material-ui/icons/Apps';
|
||||||
import CircularProgress from '@material-ui/core/CircularProgress';
|
import CircularProgress from '@material-ui/core/CircularProgress';
|
||||||
|
|
||||||
|
import Chip from '@material-ui/core/Chip';
|
||||||
|
import ChipInput from 'material-ui-chip-input'
|
||||||
|
|
||||||
import ErrorOutline from '@material-ui/icons/ErrorOutline';
|
import ErrorOutline from '@material-ui/icons/ErrorOutline';
|
||||||
import { useAlert } from "react-alert";
|
import { useAlert } from "react-alert";
|
||||||
import words from "shellwords"
|
import words from "shellwords"
|
||||||
@@ -201,11 +204,14 @@ const AppCreator = (props) => {
|
|||||||
const [actionsModalOpen, setActionsModalOpen] = useState(false);
|
const [actionsModalOpen, setActionsModalOpen] = useState(false);
|
||||||
const [authenticationRequired, setAuthenticationRequired] = useState(false);
|
const [authenticationRequired, setAuthenticationRequired] = useState(false);
|
||||||
const [authenticationOption, setAuthenticationOption] = useState(authenticationOptions[0]);
|
const [authenticationOption, setAuthenticationOption] = useState(authenticationOptions[0]);
|
||||||
|
const [newWorkflowTags, setNewWorkflowTags] = React.useState([]);
|
||||||
|
const [newWorkflowCategories, setNewWorkflowCategories] = React.useState([]);
|
||||||
const [parameterName, setParameterName] = useState("");
|
const [parameterName, setParameterName] = useState("");
|
||||||
const [parameterLocation, setParameterLocation] = useState(apikeySelection.length > 0 ? apikeySelection[0] : "");
|
const [parameterLocation, setParameterLocation] = useState(apikeySelection.length > 0 ? apikeySelection[0] : "");
|
||||||
const [urlPath, setUrlPath] = useState("");
|
const [urlPath, setUrlPath] = useState("");
|
||||||
//const [urlPathQueries, setUrlPathQueries] = useState([{"name": "test", "required": false}]);
|
//const [urlPathQueries, setUrlPathQueries] = useState([{"name": "test", "required": false}]);
|
||||||
const [urlPathQueries, setUrlPathQueries] = useState([]);
|
const [urlPathQueries, setUrlPathQueries] = useState([]);
|
||||||
|
const [update, setUpdate] = useState("")
|
||||||
const [urlPathParameters, ] = useState([]);
|
const [urlPathParameters, ] = useState([]);
|
||||||
const [firstrequest, setFirstrequest] = React.useState(true)
|
const [firstrequest, setFirstrequest] = React.useState(true)
|
||||||
const [, setBasedata] = React.useState({})
|
const [, setBasedata] = React.useState({})
|
||||||
@@ -355,14 +361,21 @@ const AppCreator = (props) => {
|
|||||||
setDescription(data.info.description)
|
setDescription(data.info.description)
|
||||||
document.title = "Apps - "+data.info.title
|
document.title = "Apps - "+data.info.title
|
||||||
|
|
||||||
if (data.info !== null && data.info !== undefined && data.info["x-logo"] !== undefined) {
|
if (data.info !== null && data.info !== undefined) {
|
||||||
|
if (data.info["x-logo"] !== undefined) {
|
||||||
setFileBase64(data.info["x-logo"])
|
setFileBase64(data.info["x-logo"])
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.info.contact != undefined) {
|
if (data.info.contact !== undefined) {
|
||||||
setContact(data.info.contact)
|
setContact(data.info.contact)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (data.info["x-categories"] !== undefined && data.info["x-categories"].length > 0) {
|
||||||
|
setNewWorkflowCategories(data.info["x-categories"])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (data.servers !== undefined && data.servers.length > 0) {
|
if (data.servers !== undefined && data.servers.length > 0) {
|
||||||
var firstUrl = data.servers[0].url
|
var firstUrl = data.servers[0].url
|
||||||
if (firstUrl.endsWith("/")) {
|
if (firstUrl.endsWith("/")) {
|
||||||
@@ -372,6 +385,16 @@ const AppCreator = (props) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (data.tags !== undefined && data.tags.length > 0) {
|
||||||
|
for (var key in data.tags) {
|
||||||
|
newWorkflowTags.push(data.tags[key].name)
|
||||||
|
}
|
||||||
|
|
||||||
|
setNewWorkflowTags(newWorkflowTags)
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(data.info)
|
||||||
|
|
||||||
// This is annoying (:
|
// This is annoying (:
|
||||||
var securitySchemes = data.components.securityDefinitions
|
var securitySchemes = data.components.securityDefinitions
|
||||||
if (securitySchemes === undefined) {
|
if (securitySchemes === undefined) {
|
||||||
@@ -553,7 +576,6 @@ const AppCreator = (props) => {
|
|||||||
"securitySchemes": {},
|
"securitySchemes": {},
|
||||||
},
|
},
|
||||||
"id": props.match.params.appid,
|
"id": props.match.params.appid,
|
||||||
"securityDefinitions": {},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (contact === "") {
|
if (contact === "") {
|
||||||
@@ -566,8 +588,20 @@ const AppCreator = (props) => {
|
|||||||
data.info["contact"] = contact
|
data.info["contact"] = contact
|
||||||
}
|
}
|
||||||
|
|
||||||
//console.log("LOADED IMAGE: ", data.image)
|
if (newWorkflowTags.length > 0) {
|
||||||
|
var newtags = []
|
||||||
|
for (var key in newWorkflowTags) {
|
||||||
|
newtags.push({"name": newWorkflowTags[key]})
|
||||||
|
}
|
||||||
|
|
||||||
|
data["tags"] = newtags
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newWorkflowCategories.length > 0) {
|
||||||
|
data["info"]["x-categories"] = newWorkflowCategories
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handles actions
|
||||||
for (var key in actions) {
|
for (var key in actions) {
|
||||||
const item = actions[key]
|
const item = actions[key]
|
||||||
if (item.errors.length > 0) {
|
if (item.errors.length > 0) {
|
||||||
@@ -594,7 +628,7 @@ const AppCreator = (props) => {
|
|||||||
"parameters": []
|
"parameters": []
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("ACTION: ", item)
|
//console.log("ACTION: ", item)
|
||||||
|
|
||||||
if (item.queries.length > 0) {
|
if (item.queries.length > 0) {
|
||||||
for (var querykey in item.queries) {
|
for (var querykey in item.queries) {
|
||||||
@@ -1455,6 +1489,55 @@ const AppCreator = (props) => {
|
|||||||
</FormControl>
|
</FormControl>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
|
|
||||||
|
const tagView =
|
||||||
|
<div style={{color: "white"}}>
|
||||||
|
<h2>Tags</h2>
|
||||||
|
<ChipInput
|
||||||
|
style={{marginTop: 10}}
|
||||||
|
InputProps={{
|
||||||
|
style:{
|
||||||
|
color: "white",
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
placeholder="Tags"
|
||||||
|
color="primary"
|
||||||
|
fullWidth
|
||||||
|
value={newWorkflowTags}
|
||||||
|
onAdd={(chip) => {
|
||||||
|
newWorkflowTags.push(chip)
|
||||||
|
setNewWorkflowTags(newWorkflowTags)
|
||||||
|
setUpdate("added"+chip)
|
||||||
|
}}
|
||||||
|
onDelete={(chip, index) => {
|
||||||
|
newWorkflowTags.splice(index, 1)
|
||||||
|
setNewWorkflowTags(newWorkflowTags)
|
||||||
|
setUpdate("delete "+chip)
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<ChipInput
|
||||||
|
style={{marginTop: 10}}
|
||||||
|
InputProps={{
|
||||||
|
style:{
|
||||||
|
color: "white",
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
placeholder="Categories"
|
||||||
|
color="primary"
|
||||||
|
fullWidth
|
||||||
|
value={newWorkflowCategories}
|
||||||
|
onAdd={(chip) => {
|
||||||
|
newWorkflowCategories.push(chip)
|
||||||
|
setNewWorkflowCategories(newWorkflowCategories)
|
||||||
|
setUpdate("added "+chip)
|
||||||
|
}}
|
||||||
|
onDelete={(chip, index) => {
|
||||||
|
newWorkflowCategories.splice(index, 1)
|
||||||
|
setNewWorkflowCategories(newWorkflowCategories)
|
||||||
|
setUpdate("delete "+chip)
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
const actionView =
|
const actionView =
|
||||||
<div style={{color: "white"}}>
|
<div style={{color: "white"}}>
|
||||||
<h2>Actions</h2>
|
<h2>Actions</h2>
|
||||||
@@ -1705,6 +1788,12 @@ const AppCreator = (props) => {
|
|||||||
<div style={{marginTop: "25px"}}>
|
<div style={{marginTop: "25px"}}>
|
||||||
{actionView}
|
{actionView}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<Divider style={{marginBottom: "10px", marginTop: "30px", height: "1px", width: "100%", backgroundColor: "grey"}}/>
|
||||||
|
<div style={{marginTop: "25px"}}>
|
||||||
|
{tagView}
|
||||||
|
</div>
|
||||||
|
{/*
|
||||||
{/*
|
{/*
|
||||||
<Divider style={{marginBottom: "10px", marginTop: "30px", height: "1px", width: "100%", backgroundColor: "grey"}}/>
|
<Divider style={{marginBottom: "10px", marginTop: "30px", height: "1px", width: "100%", backgroundColor: "grey"}}/>
|
||||||
{testView}
|
{testView}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import YAML from 'yaml'
|
|||||||
import {Link} from 'react-router-dom';
|
import {Link} from 'react-router-dom';
|
||||||
import Breadcrumbs from '@material-ui/core/Breadcrumbs';
|
import Breadcrumbs from '@material-ui/core/Breadcrumbs';
|
||||||
import ReactJson from 'react-json-view'
|
import ReactJson from 'react-json-view'
|
||||||
|
import Chip from '@material-ui/core/Chip';
|
||||||
|
|
||||||
import CachedIcon from '@material-ui/icons/Cached';
|
import CachedIcon from '@material-ui/icons/Cached';
|
||||||
import CloudDownloadIcon from '@material-ui/icons/CloudDownload';
|
import CloudDownloadIcon from '@material-ui/icons/CloudDownload';
|
||||||
@@ -484,6 +485,19 @@ const Apps = (props) => {
|
|||||||
{downloadButton}
|
{downloadButton}
|
||||||
{editButton}
|
{editButton}
|
||||||
{deleteButton}
|
{deleteButton}
|
||||||
|
{selectedApp.tags !== undefined && selectedApp.tags !== null ?
|
||||||
|
<div style={{display: "inline-block", marginLeft: 15, float: "right",}}>
|
||||||
|
{selectedApp.tags.map(tag => {
|
||||||
|
return (
|
||||||
|
<Chip
|
||||||
|
style={{marginRight: 5, marginTop: 7, cursor: "pointer",}}
|
||||||
|
label={tag}
|
||||||
|
color="primary"
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
: null}
|
||||||
<Divider style={{marginBottom: "10px", marginTop: "10px", backgroundColor: dividerColor}}/>
|
<Divider style={{marginBottom: "10px", marginTop: "10px", backgroundColor: dividerColor}}/>
|
||||||
{selectedApp.link.length > 0 ? <p><b>URL:</b> {selectedApp.link}</p> : null}
|
{selectedApp.link.length > 0 ? <p><b>URL:</b> {selectedApp.link}</p> : null}
|
||||||
<p><b>ID:</b> {selectedApp.id}</p>
|
<p><b>ID:</b> {selectedApp.id}</p>
|
||||||
@@ -549,7 +563,7 @@ const Apps = (props) => {
|
|||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
: null}
|
: null}
|
||||||
{selectedAction.description !== undefined && selectedAction.description !== null ?
|
{selectedAction.description !== undefined && selectedAction.description !== null && selectedAction.description.length > 0 ?
|
||||||
<div>
|
<div>
|
||||||
<b>Action Description</b><div/>
|
<b>Action Description</b><div/>
|
||||||
{selectedAction.description}
|
{selectedAction.description}
|
||||||
@@ -985,7 +999,7 @@ const Apps = (props) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const deleteModal = deleteModalOpen ?
|
const deleteModal = deleteModalOpen ?
|
||||||
<Dialog modal
|
<Dialog
|
||||||
open={deleteModalOpen}
|
open={deleteModalOpen}
|
||||||
onClose={() => {
|
onClose={() => {
|
||||||
setDeleteModalOpen(false)
|
setDeleteModalOpen(false)
|
||||||
@@ -1017,7 +1031,7 @@ const Apps = (props) => {
|
|||||||
|
|
||||||
const circularLoader = validation ? <CircularProgress color="primary" /> : null
|
const circularLoader = validation ? <CircularProgress color="primary" /> : null
|
||||||
const appsModalLoad = loadAppsModalOpen ?
|
const appsModalLoad = loadAppsModalOpen ?
|
||||||
<Dialog modal
|
<Dialog
|
||||||
open={loadAppsModalOpen}
|
open={loadAppsModalOpen}
|
||||||
onClose={() => {
|
onClose={() => {
|
||||||
setOpenApi("")
|
setOpenApi("")
|
||||||
@@ -1115,7 +1129,7 @@ const Apps = (props) => {
|
|||||||
|
|
||||||
const errorText = openApiError.length > 0 ? <div>Error: {openApiError}</div> : null
|
const errorText = openApiError.length > 0 ? <div>Error: {openApiError}</div> : null
|
||||||
const modalView = openApiModal ?
|
const modalView = openApiModal ?
|
||||||
<Dialog modal
|
<Dialog
|
||||||
open={openApiModal}
|
open={openApiModal}
|
||||||
onClose={() => {setOpenApiModal(false)}}
|
onClose={() => {setOpenApiModal(false)}}
|
||||||
PaperProps={{
|
PaperProps={{
|
||||||
|
|||||||
@@ -0,0 +1,217 @@
|
|||||||
|
import React, { useEffect, useState } from 'react';
|
||||||
|
import { useTheme } from '@material-ui/core/styles';
|
||||||
|
|
||||||
|
import Grid from '@material-ui/core/Grid';
|
||||||
|
import Card from '@material-ui/core/Card';
|
||||||
|
import CardActionArea from '@material-ui/core/CardActionArea';
|
||||||
|
import CardContent from '@material-ui/core/CardContent';
|
||||||
|
import CardHeader from '@material-ui/core/CardHeader';
|
||||||
|
import Typography from '@material-ui/core/Typography';
|
||||||
|
import Button from '@material-ui/core/Button';
|
||||||
|
|
||||||
|
const Workflows = (props) => {
|
||||||
|
const { globalUrl, isLoggedIn, isLoaded, } = props
|
||||||
|
const theme = useTheme();
|
||||||
|
const [curView, setCurView] = useState(0);
|
||||||
|
const [firstrequest, setFirstrequest] = useState(true)
|
||||||
|
const [selectedItems, setSelectedItems] = useState([])
|
||||||
|
|
||||||
|
const viewdata1 = [
|
||||||
|
{
|
||||||
|
"title": "General",
|
||||||
|
"content": "Learn about our ticketing solutions",
|
||||||
|
"subitems": [
|
||||||
|
{
|
||||||
|
"name": "Search",
|
||||||
|
"subtitle": "Search for anything, anywhere",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Message",
|
||||||
|
"subtitle": "Read and send messages",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Parse emails",
|
||||||
|
"subtitle": "what",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Ticketing",
|
||||||
|
"subitems": [
|
||||||
|
{
|
||||||
|
"name": "Search",
|
||||||
|
"subtitle": "Search for anything, anywhere",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Message",
|
||||||
|
"subtitle": "Read and send messages",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Parse emails",
|
||||||
|
"subtitle": "what",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Threat intel",
|
||||||
|
"subitems": [
|
||||||
|
{
|
||||||
|
"name": "Search",
|
||||||
|
"subtitle": "Search for anything, anywhere",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Message",
|
||||||
|
"subtitle": "Read and send messages",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Parse emails",
|
||||||
|
"subtitle": "what",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
if (firstrequest) {
|
||||||
|
setFirstrequest(false)
|
||||||
|
if (props.match.params.key) {
|
||||||
|
console.log("PROPS: ", props.match.params.key)
|
||||||
|
const viewitem = viewdata1.find(item => item.title.toLowerCase() === props.match.params.key.toLowerCase())
|
||||||
|
if (viewitem !== undefined && viewitem !== null) {
|
||||||
|
setCurView(1)
|
||||||
|
//setSelectedItem(viewitem)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const cardContentStyle = {
|
||||||
|
height: "100%",
|
||||||
|
width: "100%",
|
||||||
|
padding: 40,
|
||||||
|
}
|
||||||
|
|
||||||
|
const outerGridView = {
|
||||||
|
width: "100%",
|
||||||
|
marginTop: 15,
|
||||||
|
}
|
||||||
|
|
||||||
|
const paperStyle = {
|
||||||
|
height: 300,
|
||||||
|
color: "white",
|
||||||
|
backgroundColor: theme.palette.surfaceColor,
|
||||||
|
color: "white",
|
||||||
|
cursor: "pointer",
|
||||||
|
display: "flex",
|
||||||
|
textAlign: "center",
|
||||||
|
}
|
||||||
|
|
||||||
|
const HandleSelection = (data) => {
|
||||||
|
const [selected, setSelected] = useState(false);
|
||||||
|
|
||||||
|
var baseStyle = JSON.parse(JSON.stringify(paperStyle))
|
||||||
|
if (selected) {
|
||||||
|
baseStyle.backgroundColor = "white"
|
||||||
|
baseStyle.color = "black"
|
||||||
|
}
|
||||||
|
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
|
||||||
|
setSelected(!selected)
|
||||||
|
|
||||||
|
//setCurView(1)
|
||||||
|
//setSelectedItem(data)
|
||||||
|
//window.location.pathname += "/"+data.title.toLowerCase()
|
||||||
|
}}>
|
||||||
|
<Card style={baseStyle}>
|
||||||
|
<CardActionArea style={cardContentStyle}>
|
||||||
|
<CardContent>
|
||||||
|
<Typography variant="h4">
|
||||||
|
{data.title}
|
||||||
|
</Typography>
|
||||||
|
</CardContent>
|
||||||
|
</CardActionArea>
|
||||||
|
</Card>
|
||||||
|
</Grid>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
const view1 = curView === 0 ?
|
||||||
|
<div>
|
||||||
|
<Typography variant="h4">
|
||||||
|
What are you interested in?
|
||||||
|
</Typography>
|
||||||
|
<Grid container style={outerGridView} spacing={3}>
|
||||||
|
{viewdata1.map(data => {
|
||||||
|
return (
|
||||||
|
HandleSelection(data)
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</Grid>
|
||||||
|
{/*
|
||||||
|
<Button variant="contained" color="primary" style={{height: 50, width: 300, margin: "auto",}} onClick={() => {
|
||||||
|
setCurView(1)
|
||||||
|
}}>
|
||||||
|
Continue
|
||||||
|
</Button>
|
||||||
|
*/}
|
||||||
|
</div>
|
||||||
|
: null
|
||||||
|
|
||||||
|
const view2 = curView === 1 ?
|
||||||
|
<div>
|
||||||
|
<Typography variant="h4">
|
||||||
|
Step 2.
|
||||||
|
</Typography>
|
||||||
|
{/*
|
||||||
|
<Grid container style={outerGridView} spacing={3}>
|
||||||
|
{selectedItem.subitems === undefined ? null :
|
||||||
|
selectedItem.subitems.map(data => {
|
||||||
|
return (
|
||||||
|
<Grid item xs={4}>
|
||||||
|
<Card style={paperStyle}>
|
||||||
|
<CardActionArea style={cardContentStyle}>
|
||||||
|
<CardContent>
|
||||||
|
<Typography variant="h4">
|
||||||
|
{data.name}
|
||||||
|
</Typography>
|
||||||
|
<Typography variant="body1" style={{marginTop: 10}}>
|
||||||
|
{data.subtitle}
|
||||||
|
</Typography>
|
||||||
|
</CardContent>
|
||||||
|
</CardActionArea>
|
||||||
|
</Card>
|
||||||
|
</Grid>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</Grid>
|
||||||
|
*/}
|
||||||
|
</div>
|
||||||
|
: null
|
||||||
|
|
||||||
|
const baseView =
|
||||||
|
<div style={{maxWidth: 1024, margin: "auto", paddingTop: 50,}}>
|
||||||
|
{view1}
|
||||||
|
{view2}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
{baseView}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Workflows
|
||||||
@@ -81,7 +81,7 @@ const Workflows = (props) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const deleteModal = deleteModalOpen ?
|
const deleteModal = deleteModalOpen ?
|
||||||
<Dialog modal
|
<Dialog
|
||||||
open={deleteModalOpen}
|
open={deleteModalOpen}
|
||||||
onClose={() => {
|
onClose={() => {
|
||||||
setDeleteModalOpen(false)
|
setDeleteModalOpen(false)
|
||||||
@@ -102,8 +102,9 @@ const Workflows = (props) => {
|
|||||||
</DialogTitle>
|
</DialogTitle>
|
||||||
<DialogContent style={{color: "rgba(255,255,255,0.65)", textAlign: "center"}}>
|
<DialogContent style={{color: "rgba(255,255,255,0.65)", textAlign: "center"}}>
|
||||||
<Button style={{}} onClick={() => {
|
<Button style={{}} onClick={() => {
|
||||||
if (editingWorkflow.id.length > 0) {
|
console.log("Editing: ", editingWorkflow)
|
||||||
deleteWorkflow(editingWorkflow.id)
|
if (selectedWorkflowId) {
|
||||||
|
deleteWorkflow(selectedWorkflowId)
|
||||||
getAvailableWorkflows()
|
getAvailableWorkflows()
|
||||||
}
|
}
|
||||||
setDeleteModalOpen(false)
|
setDeleteModalOpen(false)
|
||||||
@@ -968,13 +969,11 @@ const Workflows = (props) => {
|
|||||||
value={newWorkflowTags}
|
value={newWorkflowTags}
|
||||||
onAdd={(chip) => {
|
onAdd={(chip) => {
|
||||||
newWorkflowTags.push(chip)
|
newWorkflowTags.push(chip)
|
||||||
console.log("Add: ", newWorkflowTags)
|
|
||||||
setNewWorkflowTags(newWorkflowTags)
|
setNewWorkflowTags(newWorkflowTags)
|
||||||
}}
|
}}
|
||||||
onDelete={(chip, index) => {
|
onDelete={(chip, index) => {
|
||||||
newWorkflowTags.splice(index, 1)
|
newWorkflowTags.splice(index, 1)
|
||||||
setNewWorkflowTags(newWorkflowTags)
|
setNewWorkflowTags(newWorkflowTags)
|
||||||
console.log("Delete: ", chip, index)
|
|
||||||
setUpdate("delete "+chip)
|
setUpdate("delete "+chip)
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user