Added minor fix for creator grid

This commit is contained in:
frikky
2022-11-23 02:16:56 +01:00
parent 71e844b4e4
commit 98607e44d2
2 changed files with 156 additions and 99 deletions
-1
View File
@@ -134,7 +134,6 @@ const CreatorGrid = props => {
onChange={(event) => { onChange={(event) => {
refine(event.currentTarget.value) refine(event.currentTarget.value)
}} }}
limit={5}
/> />
{/*isSearchStalled ? 'My search is stalled' : ''*/} {/*isSearchStalled ? 'My search is stalled' : ''*/}
</form> </form>
+156 -98
View File
@@ -65,6 +65,7 @@ import {
ListItem, ListItem,
ListItemText, ListItemText,
ListItemAvatar, ListItemAvatar,
Badge,
} from "@material-ui/core"; } from "@material-ui/core";
import { import {
@@ -109,6 +110,7 @@ import {
import { import {
Preview as PreviewIcon, Preview as PreviewIcon,
ContentCopy as ContentCopyIcon,
} from '@mui/icons-material'; } from '@mui/icons-material';
import Autocomplete from "@material-ui/lab/Autocomplete"; import Autocomplete from "@material-ui/lab/Autocomplete";
@@ -367,8 +369,7 @@ const AngularWorkflow = (defaultprops) => {
const [selectedApp, setSelectedApp] = React.useState({}); const [selectedApp, setSelectedApp] = React.useState({});
const [selectedAction, setSelectedAction] = React.useState({}); const [selectedAction, setSelectedAction] = React.useState({});
const [selectedActionEnvironment, setSelectedActionEnvironment] = const [selectedActionEnvironment, setSelectedActionEnvironment] = React.useState({});
React.useState({});
const [executionRequest, setExecutionRequest] = React.useState({}); const [executionRequest, setExecutionRequest] = React.useState({});
@@ -2110,6 +2111,7 @@ const AngularWorkflow = (defaultprops) => {
setSelectedTriggerIndex(-1) setSelectedTriggerIndex(-1)
setTriggerFolders([]) setTriggerFolders([])
setSubworkflow({}) setSubworkflow({})
setLocalFirstrequest(true)
// Can be used for right side view // Can be used for right side view
setRightSideBarOpen(false); setRightSideBarOpen(false);
@@ -8194,6 +8196,7 @@ const AngularWorkflow = (defaultprops) => {
responseJson.success !== false && responseJson.success !== false &&
responseJson.length > 0 responseJson.length > 0
) { ) {
console.log("Got trigger folders: ", triggerFolders)
setTriggerFolders(responseJson); setTriggerFolders(responseJson);
} }
@@ -8207,7 +8210,7 @@ const AngularWorkflow = (defaultprops) => {
name: "outlookfolder", name: "outlookfolder",
id: responseJson[0].id, id: responseJson[0].id,
}, },
]; ]
selectedTrigger.parameters = [ selectedTrigger.parameters = [
{ {
value: responseJson[0].displayName, value: responseJson[0].displayName,
@@ -8225,7 +8228,7 @@ const AngularWorkflow = (defaultprops) => {
}; };
const getTriggerAuth = () => { const getTriggerAuth = () => {
fetch(globalUrl + "/api/v1/triggers/outlook/" + selectedTrigger.id, { fetch(globalUrl + "/api/v1/triggers/" + selectedTrigger.id, {
method: "GET", method: "GET",
headers: { "content-type": "application/json" }, headers: { "content-type": "application/json" },
credentials: "include", credentials: "include",
@@ -8238,20 +8241,24 @@ const AngularWorkflow = (defaultprops) => {
return response.json(); return response.json();
}) })
.then((responseJson) => { .then((responseJson) => {
setTriggerAuthentication(responseJson); setTriggerAuthentication(responseJson);
}) })
.catch((error) => { .catch((error) => {
//console.log(error.toString()); //console.log(error.toString());
console.log("Set outlook auth error: ", error.toString()); console.log("Set trigger auth error: ", error.toString());
}); });
}; };
// Getting the triggers and the folders if they exist // Getting the triggers and the folders if they exist
// This is horrible hahah
if (localFirstrequest) { if (localFirstrequest) {
//console.log("Trigger: ", selectedTrigger)
//console.log("Triggername: ", selectedTrigger.name)
//if (selectedTrigger.name.toLowerCase() === "gmail") {
setGmailFolders();
setOutlookFolders();
getTriggerAuth(); getTriggerAuth();
setOutlookFolders();
setGmailFolders();
setLocalFirstrequest(false); setLocalFirstrequest(false);
} }
@@ -8310,7 +8317,7 @@ const AngularWorkflow = (defaultprops) => {
// Check whether we got a callback somewhere // Check whether we got a callback somewhere
var id = setInterval(function () { var id = setInterval(function () {
fetch( fetch(
globalUrl + "/api/v1/triggers/gmail/" + selectedTrigger.id, globalUrl + "/api/v1/triggers/" + selectedTrigger.id,
{ {
method: "GET", method: "GET",
headers: { "content-type": "application/json" }, headers: { "content-type": "application/json" },
@@ -8411,7 +8418,7 @@ const AngularWorkflow = (defaultprops) => {
// Check whether we got a callback somewhere // Check whether we got a callback somewhere
var id = setInterval(function () { var id = setInterval(function () {
fetch( fetch(
globalUrl + "/api/v1/triggers/outlook/" + selectedTrigger.id, globalUrl + "/api/v1/triggers/ " + selectedTrigger.id,
{ {
method: "GET", method: "GET",
headers: { "content-type": "application/json" }, headers: { "content-type": "application/json" },
@@ -8506,61 +8513,73 @@ const AngularWorkflow = (defaultprops) => {
}} }}
/> />
<div style={{ flex: "10" }}> <div style={{ flex: "10" }}>
<b>Select {triggerAuthentication.type === "gmail" ? "labels" : "folders"} (CTRL+click)</b> <b>Select {triggerAuthentication.type === "gmail" ? "labels" : "a folder"}</b>
</div> </div>
</div> </div>
<Select {triggerFolders.length === 0 ?
MenuProps={{ <Typography variant="body2">
disableScrollLock: true, No folders found. Please authenticate and make sure the user has access folders available. If this persists, <a href="https://shuffler.io/contact" rel="noopener noreferrer" target="_blank" style={{ textDecoration: "none", color: "#f86a3e"}}>contact us</a>.
}} </Typography>
multiple :
native <Select
rows="10" MenuProps={{
value={selectedTrigger.parameters[0].value.split(splitter)} disableScrollLock: true,
style={{ backgroundColor: inputColor, color: "white" }} sx: {
disabled={selectedTrigger.status === "running"} "&& .MuiMenuItem-root":{
SelectDisplayProps={{ backgroundColor: theme.palette.inputColor,
style: { color: "white",
marginLeft: 10, }
}, }
}} }}
onChange={(e) => { multiple={triggerAuthentication.type === "gmail"}
setTriggerFolderWrapperMulti(e) native
}} rows="10"
fullWidth value={selectedTrigger.parameters[0].value.split(splitter)}
input={<Input id="select-multiple-native" />} style={{ backgroundColor: theme.palette.inputColor, color: "white" }}
key={selectedTrigger} disabled={selectedTrigger.status === "running"}
> SelectDisplayProps={{
{triggerFolders.map((folder) => { style: {
var folderItem = ( marginLeft: 10,
<option },
key={folder.displayName} }}
style={{ onChange={(e) => {
backgroundColor: inputColor, setTriggerFolderWrapperMulti(e)
fontSize: "1.2em", }}
}} fullWidth
value={folder.displayName} input={<Input id="select-multiple-native" style={{backgroundColor: theme.palette.inputColor, color: "white"}} />}
> key={selectedTrigger}
{folder.displayName} >
</option> {triggerFolders.map((folder) => {
); var folderItem = (
<option
key={folder.displayName}
style={{
backgroundColor: inputColor,
fontSize: "1.2em",
}}
value={folder.displayName}
>
{folder.displayName}
</option>
);
if (folder.childFolderCount > 0) { if (folder.childFolderCount > 0) {
// Here to handle subfolders sometime later // Here to handle subfolders sometime later
folderItem = ( folderItem = (
<option <option
key={folder.displayName} key={folder.displayName}
value={folder.displayName} value={folder.displayName}
style={{ marginLeft: "10px" }} style={{ marginLeft: "10px" }}
> >
{folder.displayName} {folder.displayName}
</option> </option>
); );
} }
return folderItem; return folderItem;
})} })}
</Select> </Select>
}
</span> </span>
)} )}
</div> </div>
@@ -10233,28 +10252,6 @@ const AngularWorkflow = (defaultprops) => {
}} }}
id="webhook_uri_field" id="webhook_uri_field"
onClick={() => { onClick={() => {
var copyText = document.getElementById("webhook_uri_field");
if (copyText !== undefined && copyText !== null) {
console.log("NAVIGATOR: ", navigator);
const clipboard = navigator.clipboard;
if (clipboard === undefined) {
alert.error("Can only copy over HTTPS (port 3443)");
return;
}
navigator.clipboard.writeText(copyText.value);
copyText.select();
copyText.setSelectionRange(
0,
99999
); /* For mobile devices */
/* Copy the text inside the text field */
document.execCommand("copy");
alert.success("Copied Webhook URL");
} else {
console.log("Couldn't find webhook URI field: ", copyText);
}
}} }}
helperText={ helperText={
workflow.triggers[selectedTriggerIndex].parameters[0].value !== undefined && workflow.triggers[selectedTriggerIndex].parameters[0].value !== undefined &&
@@ -10281,6 +10278,39 @@ const AngularWorkflow = (defaultprops) => {
maxWidth: "95%", maxWidth: "95%",
fontSize: "1em", fontSize: "1em",
}, },
endAdornment:
<InputAdornment position="end">
<IconButton
aria-label="Copy webhook"
onClick={() => {
var copyText = document.getElementById("webhook_uri_field");
if (copyText !== undefined && copyText !== null) {
console.log("NAVIGATOR: ", navigator);
const clipboard = navigator.clipboard;
if (clipboard === undefined) {
alert.error("Can only copy over HTTPS (port 3443)");
return;
}
navigator.clipboard.writeText(copyText.value);
copyText.select();
copyText.setSelectionRange(
0,
99999
); /* For mobile devices */
/* Copy the text inside the text field */
document.execCommand("copy");
alert.success("Copied Webhook URL");
} else {
console.log("Couldn't find webhook URI field: ", copyText);
}
}}
edge="end"
>
<ContentCopyIcon />
</IconButton>
</InputAdornment>
}} }}
fullWidth fullWidth
disabled disabled
@@ -10509,7 +10539,9 @@ const AngularWorkflow = (defaultprops) => {
const splitItem = const splitItem =
workflow.triggers[selectedTriggerIndex].parameters[0].value.split( workflow.triggers[selectedTriggerIndex].parameters[0].value.split(
splitter splitter
); )
console.log("Starting mail sub: ", workflow.triggers[selectedTriggerIndex].parameters[0].value, splitItem);
for (var key in splitItem) { for (var key in splitItem) {
const item = splitItem[key]; const item = splitItem[key];
const curfolder = triggerFolders.find((a) => a.displayName === item); const curfolder = triggerFolders.find((a) => a.displayName === item);
@@ -11839,22 +11871,30 @@ const AngularWorkflow = (defaultprops) => {
</Tooltip> </Tooltip>
<Tooltip <Tooltip
color="secondary" color="secondary"
title="Show executions" title={`Show executions ${workflowExecutions.length}`}
placement="top-start" placement="top-start"
> >
<span> <span>
<Button <Button
disabled={workflow.public} disabled={workflow.public}
color="primary" color="primary"
style={{ height: 50, marginLeft: 10 }} style={{ height: 50, marginLeft: 10 }}
variant="outlined" variant="outlined"
onClick={() => { onClick={() => {
setExecutionModalOpen(true); setExecutionModalOpen(true);
getWorkflowExecution(props.match.params.key, ""); getWorkflowExecution(props.match.params.key, "");
}} }}
> >
<DirectionsRunIcon /> {/*<Badge
</Button> sx={{"& .MuiBadge-badge": {
right: `20px`,
bottom: `20px`,
}
}}
variant="outlined" badgeContent={workflowExecutions.length} color="primary" anchorOrigin={{vertical: "top", horizontal: "left", }}> */}
<DirectionsRunIcon />
{/*</Badge>*/}
</Button>
</span> </span>
</Tooltip> </Tooltip>
<Tooltip color="secondary" title="Add comment" placement="top-start"> <Tooltip color="secondary" title="Add comment" placement="top-start">
@@ -12800,6 +12840,15 @@ const AngularWorkflow = (defaultprops) => {
</Tooltip> </Tooltip>
) )
} }
var nonskippedResults = []
if (executionData.results !== undefined) {
const newSkipped = executionData.results.find((result) => result.status !== "SKIPPED")
if (newSkipped !== undefined) {
nonskippedResults = newSkipped
}
}
var executionDelay = -75 var executionDelay = -75
const executionModal = ( const executionModal = (
@@ -13280,7 +13329,16 @@ const AngularWorkflow = (defaultprops) => {
(executionData.results.length === 0 && // probably ment to be around the or's (executionData.results.length === 0 && // probably ment to be around the or's
executionData.status === "EXECUTING") executionData.status === "EXECUTING")
) ? ( ) ? (
<CircularProgress style={{ marginLeft: 20 }} /> <div style={{display: "flex"}}>
<CircularProgress style={{ height: 45, width: 45, marginLeft: 20, marginRight: 20, }} />
{!isCloud && environments.length > 0 && defaultEnvironmentIndex < environments.length && nonskippedResults.length === 0 ?
<Typography variant="body2" color="textSecondary" style={{}}>
No results yet. Is Orborus running for the "{environments[defaultEnvironmentIndex].Name}" environment? <a href="/admin?tab=environments" rel="noopener noreferrer" target="_blank" style={{ textDecoration: "none", color: "#f86a3e"}}>Learn more</a>
</Typography>
: null}
</div>
) : null} ) : null}
</div> </div>
</div> </div>