import React, { useState, useEffect, useLayoutEffect } from "react"; import theme from '../theme.jsx'; import { Chip, Typography, Paper, Avatar, Grid, Tooltip, } from "@mui/material"; import { AvatarGroup, } from "@mui/material" import { Restore as RestoreIcon, Edit as EditIcon, BubbleChart as BubbleChartIcon, MoreVert as MoreVertIcon, } from '@mui/icons-material'; import { useNavigate, Link, useParams } from "react-router-dom"; const workflowActionStyle = { display: "flex", width: 160, height: 44, justifyContent: "space-between", } const chipStyle = { backgroundColor: "#3d3f43", marginRight: 5, paddingLeft: 5, paddingRight: 5, height: 28, cursor: "pointer", borderColor: "#3d3f43", color: "white", } const WorkflowPaper = (props) => { const { data } = props; let navigate = useNavigate(); const [open, setOpen] = React.useState(false); const [anchorEl, setAnchorEl] = React.useState(null); const appGroup = data.action_references === undefined || data.action_references === null ? [] : data.action_references const isCloud = window.location.host === "localhost:3002" || window.location.host === "shuffler.io"; //console.log("Workflow: ", data) var boxColor = "#86c142"; const paperAppStyle = { minHeight: 130, maxHeight: 130, overflow: "hidden", width: "100%", color: "white", backgroundColor: theme.palette.surfaceColor, padding: "12px 12px 0px 15px", borderRadius: 5, display: "flex", boxSizing: "border-box", position: "relative", } var parsedName = data.name; if ( parsedName !== undefined && parsedName !== null && parsedName.length > 20 ) { parsedName = parsedName.slice(0, 21) + ".."; } const imageStyle = { width: 24, height: 24, marginRight: 10, border: "1px solid rgba(255,255,255,0.3)", } var image = data.creator_info !== undefined && data.creator_info !== null && data.creator_info.image !== undefined && data.creator_info.image !== null && data.creator_info.image.length > 0 ? : const creatorname = data.creator_info !== undefined && data.creator_info !== null && data.creator_info.username !== undefined && data.creator_info.username !== null && data.creator_info.username.length > 0 ? data.creator_info.username : "" var orgName = ""; var orgId = ""; if ((data.objectID === undefined || data.objectID === null) && data.id !== undefined && data.id !== null) { data.objectID = data.id } //console.log("IMG: ", data) var parsedUrl = `/workflows/${data.objectID}` if (data.__queryID !== undefined && data.__queryID !== null) { parsedUrl += `?queryID=${data.__queryID}` } if (!isCloud) { parsedUrl = `https://shuffler.io${parsedUrl}` } return (
{ if (data.creator_info !== undefined) { navigate("/creators/"+data.creator_info.username) } }} > {image}
{parsedName}
{appGroup.length > 0 ?
{appGroup.map((app, index) => { return (
{ navigate("/apps/"+app.id) }} >
) })}
: {data.actions === undefined || data.actions === null ? 1 : data.actions.length} } {data.triggers === undefined || data.triggers === null ? 1 : data.triggers.length} { }} > {0}
{data.tags !== undefined && data.tags !== null ? data.tags.map((tag, index) => { if (index >= 2) { return null; } return ( ); }) : null}
) } export default WorkflowPaper