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>
+97 -39
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) {
getTriggerAuth(); //console.log("Trigger: ", selectedTrigger)
setOutlookFolders(); //console.log("Triggername: ", selectedTrigger.name)
//if (selectedTrigger.name.toLowerCase() === "gmail") {
setGmailFolders(); setGmailFolders();
setOutlookFolders();
getTriggerAuth();
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,18 +8513,29 @@ 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>
{triggerFolders.length === 0 ?
<Typography variant="body2">
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>
:
<Select <Select
MenuProps={{ MenuProps={{
disableScrollLock: true, disableScrollLock: true,
sx: {
"&& .MuiMenuItem-root":{
backgroundColor: theme.palette.inputColor,
color: "white",
}
}
}} }}
multiple multiple={triggerAuthentication.type === "gmail"}
native native
rows="10" rows="10"
value={selectedTrigger.parameters[0].value.split(splitter)} value={selectedTrigger.parameters[0].value.split(splitter)}
style={{ backgroundColor: inputColor, color: "white" }} style={{ backgroundColor: theme.palette.inputColor, color: "white" }}
disabled={selectedTrigger.status === "running"} disabled={selectedTrigger.status === "running"}
SelectDisplayProps={{ SelectDisplayProps={{
style: { style: {
@@ -8528,7 +8546,7 @@ const AngularWorkflow = (defaultprops) => {
setTriggerFolderWrapperMulti(e) setTriggerFolderWrapperMulti(e)
}} }}
fullWidth fullWidth
input={<Input id="select-multiple-native" />} input={<Input id="select-multiple-native" style={{backgroundColor: theme.palette.inputColor, color: "white"}} />}
key={selectedTrigger} key={selectedTrigger}
> >
{triggerFolders.map((folder) => { {triggerFolders.map((folder) => {
@@ -8561,6 +8579,7 @@ const AngularWorkflow = (defaultprops) => {
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,7 +11871,7 @@ 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>
@@ -11853,7 +11885,15 @@ const AngularWorkflow = (defaultprops) => {
getWorkflowExecution(props.match.params.key, ""); getWorkflowExecution(props.match.params.key, "");
}} }}
> >
{/*<Badge
sx={{"& .MuiBadge-badge": {
right: `20px`,
bottom: `20px`,
}
}}
variant="outlined" badgeContent={workflowExecutions.length} color="primary" anchorOrigin={{vertical: "top", horizontal: "left", }}> */}
<DirectionsRunIcon /> <DirectionsRunIcon />
{/*</Badge>*/}
</Button> </Button>
</span> </span>
</Tooltip> </Tooltip>
@@ -12801,6 +12841,15 @@ const AngularWorkflow = (defaultprops) => {
) )
} }
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 = (
<Drawer <Drawer
@@ -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>