Minor fixes to bad app viewing

This commit is contained in:
frikky
2023-01-16 00:41:58 +01:00
parent b90a489d74
commit 79d68321e8
+69 -12
View File
@@ -134,6 +134,7 @@ import ParsedAction from "../components/ParsedAction.jsx";
import PaperComponent from "../components/PaperComponent.jsx" import PaperComponent from "../components/PaperComponent.jsx"
import ExtraApps from "../components/ExtraApps.jsx" import ExtraApps from "../components/ExtraApps.jsx"
import EditWorkflow from "../components/EditWorkflow.jsx" import EditWorkflow from "../components/EditWorkflow.jsx"
import AppStats from "../components/AppStats.jsx";
const surfaceColor = "#27292D"; const surfaceColor = "#27292D";
const inputColor = "#383B40"; const inputColor = "#383B40";
@@ -250,11 +251,10 @@ const svgSize = 24;
const searchClient = algoliasearch("JNSS5CFDZZ", "db08e40265e2941b9a7d8f644b6e5240") const searchClient = algoliasearch("JNSS5CFDZZ", "db08e40265e2941b9a7d8f644b6e5240")
const AngularWorkflow = (defaultprops) => { const AngularWorkflow = (defaultprops) => {
const { globalUrl, isLoggedIn, isLoaded, userdata } = defaultprops; const { globalUrl, isLoggedIn, isLoaded, userdata, data_id } = defaultprops;
const referenceUrl = globalUrl + "/api/v1/hooks/"; const referenceUrl = globalUrl + "/api/v1/hooks/";
const alert = useAlert() const alert = useAlert()
let navigate = useNavigate(); let navigate = useNavigate();
const params = useParams(); const params = useParams();
var props = JSON.parse(JSON.stringify(defaultprops)) var props = JSON.parse(JSON.stringify(defaultprops))
props.match = {} props.match = {}
@@ -383,6 +383,7 @@ const AngularWorkflow = (defaultprops) => {
const [userediting, setUserediting] = React.useState(false) const [userediting, setUserediting] = React.useState(false)
const [lastSaved, setLastSaved] = React.useState(true); const [lastSaved, setLastSaved] = React.useState(true);
const [selectionOpen, setSelectionOpen] = React.useState(false);
// eslint-disable-next-line no-unused-vars // eslint-disable-next-line no-unused-vars
const [_, setUpdate] = useState(""); // Used for rendring, don't remove const [_, setUpdate] = useState(""); // Used for rendring, don't remove
@@ -1748,9 +1749,11 @@ const AngularWorkflow = (defaultprops) => {
if (responseJson.files !== undefined && responseJson.files !== null) { if (responseJson.files !== undefined && responseJson.files !== null) {
setFiles(responseJson); setFiles(responseJson);
} else { } else {
setFiles({"namespaces": [ setFiles({
"namespaces": [
"default" "default"
]}); ]
});
} }
if ( if (
@@ -2917,7 +2920,7 @@ const AngularWorkflow = (defaultprops) => {
getAvailableWorkflows(trigger_index); getAvailableWorkflows(trigger_index);
getSettings(); getSettings();
} else if (data.app_name === "Webhook") { } else if (data.app_name === "Webhook") {
if (workflow.triggers[trigger_index].parameters !== undefined) { if (workflow.triggers[trigger_index].parameters !== undefined && workflow.triggers[trigger_index].parameters !== null && workflow.triggers[trigger_index].parameters.length > 0) {
workflow.triggers[trigger_index].parameters[0] = { workflow.triggers[trigger_index].parameters[0] = {
name: "url", name: "url",
value: referenceUrl + "webhook_" + workflow.triggers[trigger_index].id, value: referenceUrl + "webhook_" + workflow.triggers[trigger_index].id,
@@ -6140,6 +6143,11 @@ const AngularWorkflow = (defaultprops) => {
const app = props.app; const app = props.app;
const [hover, setHover] = React.useState(false); const [hover, setHover] = React.useState(false);
if (app.id === "" || app.name === "") {
console.log("Skipping app: ", app)
return null
}
const maxlen = 24; const maxlen = 24;
var newAppname = app.name; var newAppname = app.name;
newAppname = newAppname.charAt(0).toUpperCase() + newAppname.substring(1); newAppname = newAppname.charAt(0).toUpperCase() + newAppname.substring(1);
@@ -6149,6 +6157,10 @@ const AngularWorkflow = (defaultprops) => {
newAppname = newAppname.replaceAll("_", " "); newAppname = newAppname.replaceAll("_", " ");
if (app.large_image === undefined || app.large_image === null || app.large_image === "") {
app.large_image = theme.palette.defaultImage
}
const image = app.large_image; const image = app.large_image;
const newAppStyle = JSON.parse(JSON.stringify(paperAppStyle)); const newAppStyle = JSON.parse(JSON.stringify(paperAppStyle));
const pixelSize = !hover ? "2px" : "4px"; const pixelSize = !hover ? "2px" : "4px";
@@ -6590,7 +6602,8 @@ const AngularWorkflow = (defaultprops) => {
*/} */}
</ListItem> </ListItem>
</div> </div>
)}) )
})
} }
</List> </List>
</div> </div>
@@ -8228,7 +8241,7 @@ const AngularWorkflow = (defaultprops) => {
}; };
const getTriggerAuth = () => { const getTriggerAuth = () => {
fetch(globalUrl + "/api/v1/triggers/" + 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",
@@ -8309,7 +8322,7 @@ const AngularWorkflow = (defaultprops) => {
console.log("BRANCH: ", branch); console.log("BRANCH: ", branch);
const startnode = branch.destination_id; const startnode = branch.destination_id;
const scopes = "https://www.googleapis.com/auth/gmail.readonly"; const scopes = "https://www.googleapis.com/auth/gmail.readonly";
const url = `https://accounts.google.com/o/oauth2/v2/auth?access_type=offline&client_id=${client_id}&redirect_uri=${redirectUri}&response_type=code&scope=${scopes}&state=workflow_id%3D${props.match.params.key}%26trigger_id%3D${selectedTrigger.id}%26username%3D${username}%26type%3Dgmail%26start%3d${startnode}`; const url = `https://accounts.google.com/o/oauth2/v2/auth?access_type=offline&prompt=consent&client_id=${client_id}&redirect_uri=${redirectUri}&response_type=code&scope=${scopes}&state=workflow_id%3D${props.match.params.key}%26trigger_id%3D${selectedTrigger.id}%26username%3D${username}%26type%3Dgmail%26start%3d${startnode}`;
console.log("URL: ", url); console.log("URL: ", url);
var newwin = window.open(url, "", "width=800,height=600"); var newwin = window.open(url, "", "width=800,height=600");
@@ -8317,7 +8330,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/" + selectedTrigger.id, `${globalUrl}/api/v1/triggers/${selectedTrigger.id}`,
{ {
method: "GET", method: "GET",
headers: { "content-type": "application/json" }, headers: { "content-type": "application/json" },
@@ -8418,7 +8431,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/ " + selectedTrigger.id, `${globalUrl}/api/v1/triggers/${selectedTrigger.id}`,
{ {
method: "GET", method: "GET",
headers: { "content-type": "application/json" }, headers: { "content-type": "application/json" },
@@ -12209,7 +12222,8 @@ const AngularWorkflow = (defaultprops) => {
} }
{appGroup.length > 0 ? {appGroup.length > 0 ?
<div style={{display: "flex", marginTop: 10, }}> <div style={{ marginTop: 10, }}>
<div style={{ display: "flex" }}>
<Typography variant="body1"> <Typography variant="body1">
Apps Apps
</Typography> </Typography>
@@ -12223,6 +12237,7 @@ const AngularWorkflow = (defaultprops) => {
})} })}
</AvatarGroup> </AvatarGroup>
</div> </div>
</div>
: null} : null}
{triggerGroup.length > 0 ? {triggerGroup.length > 0 ?
@@ -12325,6 +12340,21 @@ const AngularWorkflow = (defaultprops) => {
</div> </div>
: null} : null}
{/*
<div style={{ display: "flex" }}>
<Button
color="primary"
variant="contained"
fullWidth
style={{ marginTop: 15, display: "flex" }}
onClick={() => {
setSelectionOpen(true)
}}
>
Statistics
</Button>
</div>
*/}
{userdata.avatar !== undefined && (userdata.avatar === creatorProfile.github_avatar || allowList.includes(userdata.public_username)) ? {userdata.avatar !== undefined && (userdata.avatar === creatorProfile.github_avatar || allowList.includes(userdata.public_username)) ?
<div style={{ marginTop: 50, }}> <div style={{ marginTop: 50, }}>
<Typography variant="body2" color="textSecondary"> <Typography variant="body2" color="textSecondary">
@@ -15093,7 +15123,6 @@ const AngularWorkflow = (defaultprops) => {
</div> </div>
</Dialog> </Dialog>
) : null; ) : null;
const loadedCheck = const loadedCheck =
isLoaded && workflowDone ? ( isLoaded && workflowDone ? (
<div> <div>
@@ -15118,6 +15147,34 @@ const AngularWorkflow = (defaultprops) => {
/> />
: null} : null}
{/*selectionOpen === true ?
<div style={{ borderRadius: theme.palette.borderRadius, backgroundColor: surfaceColor, zIndex: 12501,position:"fixed", left: 190, bottom: 20,top:70, width: 950, overflowY: "scroll"}}>
<div>
<IconButton
style={{
zIndex: 12502,
position: "absolute",
top: 6,
right: 6,
color: "white",
}}
onClick={() => {
setSelectionOpen(false)
}}
>
<CloseIcon />
</IconButton>
</div>
<div style={{marginTop: 60, marginLeft: 55}}>
<AppStats
globalUrl={globalUrl}
workflowId={workflow.id}
{...props}
/>
</div>
</div>
: null*/}
{showVideo !== undefined && showVideo.length > 0 ? {showVideo !== undefined && showVideo.length > 0 ?
<div style={{ borderRadius: theme.palette.borderRadius, zIndex: 12501, position: "fixed", left: 40, bottom: 150, width: 300, }}> <div style={{ borderRadius: theme.palette.borderRadius, zIndex: 12501, position: "fixed", left: 40, bottom: 150, width: 300, }}>
<IconButton <IconButton