Added integration framework properly

This commit is contained in:
Frikky
2024-05-21 16:53:37 +02:00
parent d52b024716
commit b5ee9863e2
12 changed files with 1000 additions and 872 deletions
+165 -161
View File
@@ -202,12 +202,12 @@ const Header = (props) => {
removeCookie("__session", { path: "/" });
window.location.pathname = "/";
localStorage.setItem("globalUrl", "")
localStorage.setItem("globalUrl", "")
// Delete userinfo from localstorage
localStorage.removeItem("apps")
localStorage.removeItem("workflows")
localStorage.removeItem("userinfo")
// Delete userinfo from localstorage
localStorage.removeItem("apps")
localStorage.removeItem("workflows")
localStorage.removeItem("userinfo")
})
.catch((error) => {
console.log(error);
@@ -374,13 +374,13 @@ const Header = (props) => {
setAnchorEl(event.currentTarget);
}}
>
{/*<Badge badgeContent={notifications.filter((n) => n.read === false).length} color="primary">*/}
<NotificationsIcon
color="secondary"
style={{ height: 30, width: 30 }}
alt="Your username here"
src=""
/>
{/*<Badge badgeContent={notifications.filter((n) => n.read === false).length} color="primary">*/}
<NotificationsIcon
color="secondary"
style={{ height: 30, width: 30 }}
alt="Your username here"
src=""
/>
</IconButton>
<Menu
id="simple-menu"
@@ -411,32 +411,32 @@ const Header = (props) => {
}}
>
<div style={{ display: "flex", marginBottom: 5 }}>
<Typography variant="body1" style={{flex: 1, }}>
<Typography variant="body1" style={{ flex: 1, }}>
Notifications ({notifications.filter((data) => !data.read).length})
</Typography>
<ButtonGroup style={{height: 40, flex: 1, }}>
{notifications.length > 1 ? (
<Button
color="primary"
variant="outlined"
disabled={notifications.filter((data) => !data.read).length === 0}
onClick={() => {
clearNotifications();
}}
>
Flush
</Button>
) : null}
<Button
color="primary"
variant="contained"
onClick={() => {
navigate("/admin?tab=organization&admin_tab=priorities")
}}
>
Explore
</Button>
</ButtonGroup>
<ButtonGroup style={{ height: 40, flex: 1, }}>
{notifications.length > 1 ? (
<Button
color="primary"
variant="outlined"
disabled={notifications.filter((data) => !data.read).length === 0}
onClick={() => {
clearNotifications();
}}
>
Flush
</Button>
) : null}
<Button
color="primary"
variant="contained"
onClick={() => {
navigate("/admin?tab=organization&admin_tab=priorities")
}}
>
Explore
</Button>
</ButtonGroup>
</div>
<Typography variant="body2" color="textSecondary" style={{ marginTop: 5, }}>
Notifications generated made by Shuffle to help you discover issues or
@@ -481,10 +481,10 @@ const Header = (props) => {
if (response.status !== 200) {
console.log("Error in response");
} else {
localStorage.removeItem("apps")
localStorage.removeItem("workflows")
localStorage.removeItem("userinfo")
}
localStorage.removeItem("apps")
localStorage.removeItem("workflows")
localStorage.removeItem("userinfo")
}
return response.json();
})
@@ -496,6 +496,10 @@ const Header = (props) => {
localStorage.setItem("globalUrl", responseJson.region_url);
//globalUrl = responseJson.region_url
}
if (responseJson["reason"] === "SSO_REDIRECT") {
window.location.href = responseJson["url"]
return
}
setTimeout(() => {
window.location.reload();
@@ -567,7 +571,7 @@ const Header = (props) => {
alt="Your username here"
src={parsedAvatar}
/>
<ExpandMoreIcon style={{color: "rgba(255,255,255,0.4)", }}/>
<ExpandMoreIcon style={{ color: "rgba(255,255,255,0.4)", }} />
</IconButton>
<Menu
id="simple-menu"
@@ -604,11 +608,11 @@ const Header = (props) => {
handleClose();
}}
>
<NotificationsIcon style={{ marginRight: 5 }} /> Notifications
<NotificationsIcon style={{ marginRight: 5 }} /> Notifications
</MenuItem>
</Link>
{/*notificationMenu*/}
{/*notificationMenu*/}
<Divider style={{ marginTop: 10, marginBottom: 10, }} />
<Link to="/docs" style={hrefStyle}>
<MenuItem
@@ -985,9 +989,9 @@ const Header = (props) => {
</span>
{userdata === undefined ||
userdata.orgs === undefined ||
userdata.orgs === null ||
userdata.orgs.length <= 0 ? null : (
userdata.orgs === undefined ||
userdata.orgs === null ||
userdata.orgs.length <= 0 ? null : (
<span style={{ paddingTop: 5 }}>
<Select
disableUnderline
@@ -1014,9 +1018,9 @@ const Header = (props) => {
value={userdata.active_org.id}
fullWidth
onChange={(e) => {
if (e.target.value === undefined || e.target.value === "create_new_suborgs") {
return
}
if (e.target.value === undefined || e.target.value === "create_new_suborgs") {
return
}
handleClickChangeOrg(e.target.value);
}}
@@ -1148,32 +1152,32 @@ const Header = (props) => {
</MenuItem>
);
})}
<Divider />
<Link to="/admin?tab=suborgs" style={hrefStyle}>
<MenuItem
key={"add suborgs"}
style={{
backgroundColor: theme.palette.inputColor,
color: "white",
height: 40,
zIndex: 10003,
}}
value={"create_new_suborgs"}
>
<Tooltip
color="primary"
title={""}
placement="left"
>
<div style={{ display: "flex", marginLeft: 85, }}>
<AddIcon />
<span style={{ marginLeft: 8 }}>
Add suborgs
</span>
</div>
</Tooltip>
</MenuItem>
</Link>
<Divider />
<Link to="/admin?tab=suborgs" style={hrefStyle}>
<MenuItem
key={"add suborgs"}
style={{
backgroundColor: theme.palette.inputColor,
color: "white",
height: 40,
zIndex: 10003,
}}
value={"create_new_suborgs"}
>
<Tooltip
color="primary"
title={""}
placement="left"
>
<div style={{ display: "flex", marginLeft: 85, }}>
<AddIcon />
<span style={{ marginLeft: 8 }}>
Add suborgs
</span>
</div>
</Tooltip>
</MenuItem>
</Link>
</Select>
</span>
)}
@@ -1444,100 +1448,100 @@ const Header = (props) => {
:
*/
const topbarHeight = showTopbar ? 40 : 0
const topbar = !showTopbar ? null :
curpath === "/" || curpath.includes("/docs/") || curpath === "/pricing" || curpath === "/contact" || curpath === "/search" ?
<span style={{ zIndex: 50001, }}>
<div style={{ position: "relative", height: topbarHeight, backgroundImage: "linear-gradient(to right, #f86a3e, #f34079)", overflow: "hidden", }}>
<Typography variant="body1" style={{ paddingTop: 7, margin: "auto", textAlign: "center", color: "white", }}>
Shuffle 1.4 is out! Read more about&nbsp;
<u>
<a href="https://github.com/Shuffle/Shuffle" style={{ color: "inherit", }} onClick={() => {
ReactGA.event({
category: "landingpage",
action: "click_header_features",
label: "",
})
const topbarHeight = showTopbar ? 40 : 0
const topbar = !showTopbar ? null :
curpath === "/" || curpath.includes("/docs/") || curpath === "/pricing" || curpath === "/contact" || curpath === "/search" ?
<span style={{ zIndex: 50001, }}>
<div style={{ position: "relative", height: topbarHeight, backgroundImage: "linear-gradient(to right, #f86a3e, #f34079)", overflow: "hidden", }}>
<Typography variant="body1" style={{ paddingTop: 7, margin: "auto", textAlign: "center", color: "white", }}>
Shuffle 1.4 is out! Read more about&nbsp;
<u>
<a href="https://github.com/Shuffle/Shuffle" style={{ color: "inherit", }} onClick={() => {
ReactGA.event({
category: "landingpage",
action: "click_header_features",
label: "",
})
//if (window.drift !== undefined) {
// window.drift.api.startInteraction({ interactionId: 341911 })
//} else {
// console.log("Couldn't find drift in window.drift and not .drift-open-chat with querySelector: ", window.drift)
//}
}} style={{ cursor: "pointer", textDecoration: "none", color: "rgba(255,255,255,0.8)" }}>
Features
</a>
</u>
,&nbsp;
<u>
<span onClick={() => {
ReactGA.event({
category: "landingpage",
action: "click_header_pricing",
label: "",
})
//if (window.drift !== undefined) {
// window.drift.api.startInteraction({ interactionId: 341911 })
//} else {
// console.log("Couldn't find drift in window.drift and not .drift-open-chat with querySelector: ", window.drift)
//}
}} style={{ cursor: "pointer", textDecoration: "none", color: "rgba(255,255,255,0.8)" }}>
Features
</a>
</u>
,&nbsp;
<u>
<span onClick={() => {
ReactGA.event({
category: "landingpage",
action: "click_header_pricing",
label: "",
})
navigate("/pricing")
navigate("/pricing")
//if (window.drift !== undefined) {
// window.drift.api.startInteraction({ interactionId: 341911 })
//} else {
// console.log("Couldn't find drift in window.drift and not .drift-open-chat with querySelector: ", window.drift)
//}
}} style={{ cursor: "pointer", textDecoration: "none", color: "rgba(255,255,255,0.8)" }}>
Pricing
</span>
</u>
&nbsp;and&nbsp;
<u>
<span onClick={() => {
ReactGA.event({
category: "landingpage",
action: "click_header_creators",
label: "",
})
//if (window.drift !== undefined) {
// window.drift.api.startInteraction({ interactionId: 341911 })
//} else {
// console.log("Couldn't find drift in window.drift and not .drift-open-chat with querySelector: ", window.drift)
//}
}} style={{ cursor: "pointer", textDecoration: "none", color: "rgba(255,255,255,0.8)" }}>
Pricing
</span>
</u>
&nbsp;and&nbsp;
<u>
<span onClick={() => {
ReactGA.event({
category: "landingpage",
action: "click_header_creators",
label: "",
})
navigate("/creators")
navigate("/creators")
//if (window.drift !== undefined) {
// window.drift.api.startInteraction({ interactionId: 341911 })
//} else {
// console.log("Couldn't find drift in window.drift and not .drift-open-chat with querySelector: ", window.drift)
//}
}} style={{ cursor: "pointer", textDecoration: "none", color: "rgba(255,255,255,0.8)" }}>
Earning as a Creator
</span>
</u>
</Typography>
<IconButton color="secondary" style={{ position: "absolute", top: -3, right: 20, }} onClick={(event) => { setShowTopbar(false) }}>
<CloseIcon />
</IconButton>
</div>
</span>
:
null
//if (window.drift !== undefined) {
// window.drift.api.startInteraction({ interactionId: 341911 })
//} else {
// console.log("Couldn't find drift in window.drift and not .drift-open-chat with querySelector: ", window.drift)
//}
}} style={{ cursor: "pointer", textDecoration: "none", color: "rgba(255,255,255,0.8)" }}>
Earning as a Creator
</span>
</u>
</Typography>
<IconButton color="secondary" style={{ position: "absolute", top: -3, right: 20, }} onClick={(event) => { setShowTopbar(false) }}>
<CloseIcon />
</IconButton>
</div>
</span>
:
null
return !isMobile ?
<div style={{marginTop: 0, }}>
<AppBar
color="transparent"
elevation={0}
style={{
backgroundColor: "transparent",
boxShadow: "none",
minHeight: 68,
maxHeight: 68,
backgroundColor: theme.palette.backgroundColor,
}}
>
<div style={{ marginTop: 0, }}>
<AppBar
color="transparent"
elevation={0}
style={{
backgroundColor: "transparent",
boxShadow: "none",
minHeight: 68,
maxHeight: 68,
backgroundColor: theme.palette.backgroundColor,
}}
>
{topbar}
{topbar}
<div style={{position: "sticky", top: 0, }}>
{loginTextBrowser}
</div>
</AppBar>
</div>
<div style={{ position: "sticky", top: 0, }}>
{loginTextBrowser}
</div>
</AppBar>
</div>
:
<MobileView>{loginTextMobile}</MobileView>
};