Multiple diff fixes for multi tenant workflows

This commit is contained in:
Frikky
2025-03-11 01:57:05 +01:00
parent 43e37ef14f
commit f0c2dfa3d2
11 changed files with 247 additions and 106 deletions
+45 -36
View File
@@ -77,6 +77,8 @@ const Billing = memo((props) => {
const [currentIndex, setCurrentIndex] = useState(0);
const [deleteAlertIndex, setDeleteAlertIndex] = useState(-1);
const [deleteAlertVerification, setDeleteAlertVerification] = useState(false);
const [isScale, setIsScale] = useState(false);
useEffect(() => {
if (userdata.app_execution_limit !== undefined && userdata.app_execution_usage !== undefined) {
const percentage = (userdata.app_execution_usage / userdata.app_execution_limit) * 100;
@@ -176,11 +178,10 @@ const Billing = memo((props) => {
padding: 20,
// maxWidth: 400,
width: 340,
height: 480,
height: 'auto',
// width: "100%",
backgroundColor: theme.palette.backgroundColor,
borderRadius: theme.palette?.borderRadius * 2,
border: "1px solid rgba(255,255,255,0.3)",
backgroundColor: "#1e1e1e",
borderRadius: 10,
marginRight: 10,
marginTop: 15,
}
@@ -361,7 +362,7 @@ const Billing = memo((props) => {
var showSupport = false
if (subscription.name.includes("default")) {
top_text = "Custom Contract"
newPaperstyle.border = "1px solid rgba(255,255,255,0.3)"
// newPaperstyle.border = "1px solid rgba(255,255,255,0.3)"
showSupport = true
}
@@ -377,16 +378,17 @@ const Billing = memo((props) => {
if (subscription.name.includes("Scale")) {
top_text = "Scale access"
setIsScale(true)
}
if (highlight === true) {
// Add an "Upgrade now" button
newPaperstyle.border = "1px solid rgba(255,255,255,0.3)"
// newPaperstyle.border = "1px solid rgba(255,255,255,0.3)"
}
if (hovered) {
newPaperstyle.backgroundColor = "#2b2b2b"
}
// if (hovered) {
// newPaperstyle.backgroundColor = "#2b2b2b"
// }
const handleClickOpen = () => {
setOpenChangeEmailBox(true);
@@ -556,6 +558,7 @@ const Billing = memo((props) => {
</div>
</DialogContent>
</Dialog>
<Button style={{ backgroundColor: '#2F2F2F', color: "white", textTransform: "capitalize", borderRadius: 200, boxShadow: 'none', width: 144, height: 40 }}>Current Plan</Button>
<div style={{ display: "flex", width: 340 }}>
{top_text === "Base Cloud Access" && userdata.has_card_available === true ?
<Chip
@@ -659,8 +662,8 @@ const Billing = memo((props) => {
<TextField
value={feature.split("Worker License: ")[1]}
style={{
backgroundColor: theme.palette.inputColor,
borderRadius: theme.palette?.borderRadius,
backgroundColor: theme.palette.textFieldStyle.backgroundColor,
borderRadius: theme.palette?.textFieldStyle.borderRadius,
}}
id={fieldId}
onClick={() => { }}
@@ -2013,7 +2016,33 @@ const Billing = memo((props) => {
</Typography>
: null}
<div style={{ display: "flex", width: clickedFromOrgTab ? "100%" : "auto", overflowX: 'auto', overflowY: 'hidden', scrollbarWidth: 'thin', scrollbarColor: '#494949 #2f2f2f', height: isChildOrg ? 0 : "100%", maxWidth: 860, marginTop: 20}} >
<div style={{ display: "flex", width: clickedFromOrgTab ? "100%" : "auto", overflowX: 'auto', overflowY: 'hidden', scrollbarWidth: 'thin', scrollbarColor: '#494949 #2f2f2f', height: isChildOrg ? 0 : "100%", marginTop: 20}} >
<div style={{ display: "flex", flexDirection: "column", width: "100%", }}>
{isCloud &&
selectedOrganization.subscriptions !== undefined &&
selectedOrganization.subscriptions !== null &&
selectedOrganization.subscriptions.length > 0 &&
!isChildOrg ?
selectedOrganization.subscriptions
.reverse()
.map((sub, index) => {
return (
<SubscriptionObject
index={index + 1}
globalUrl={globalUrl}
userdata={userdata}
serverside={serverside}
billingInfo={billingInfo}
stripeKey={stripeKey}
selectedOrganization={selectedOrganization}
subscription={sub}
highlight={true}
/>
)
})
: null}
<div style={{ display: "flex", flexDirection: "row", width: "100%", marginTop: 20, marginBottom: 20, maxWidth: 860, }}>
{isCloud && billingInfo.subscription !== undefined && billingInfo.subscription !== null ? isChildOrg ? null :
<LicencePopup
serverside={serverside}
@@ -2026,6 +2055,7 @@ const Billing = memo((props) => {
isCloud={isCloud}
userdata={userdata}
stripeKey={stripeKey}
isScale={isScale}
{...props}
/>
: !isCloud ?
@@ -2061,6 +2091,7 @@ const Billing = memo((props) => {
isCloud={isCloud}
userdata={userdata}
stripeKey={stripeKey}
isScale={isScale}
/>
{/* <SubscriptionObject
@@ -2084,30 +2115,9 @@ const Billing = memo((props) => {
/> */}
</span>
: null}
</div>
</div>
{isCloud &&
selectedOrganization.subscriptions !== undefined &&
selectedOrganization.subscriptions !== null &&
selectedOrganization.subscriptions.length > 0 &&
!isChildOrg ?
selectedOrganization.subscriptions
.reverse()
.map((sub, index) => {
return (
<SubscriptionObject
index={index + 1}
globalUrl={globalUrl}
userdata={userdata}
serverside={serverside}
billingInfo={billingInfo}
stripeKey={stripeKey}
selectedOrganization={selectedOrganization}
subscription={sub}
highlight={true}
/>
)
})
: null}
{/*
<Grid item key={index} xs={12/selectedOrganization.subscriptions.length}>
<Card
@@ -2153,7 +2163,6 @@ const Billing = memo((props) => {
*/}
</div>
{/*isCloud &&
selectedOrganization.partner_info !== undefined &&
selectedOrganization.partner_info.reseller === true ? (
+12 -3
View File
@@ -577,12 +577,20 @@ const EditWorkflow = (props) => {
<Typography variant="h4" style={{ marginTop: 50, }}>
Multi-Tenancy, Backups & Security
</Typography>
<Typography variant="body2" color="textSecondary" style={{ marginTop: 30, marginBottom: 10, }}>
Multi-Tenant Workflows. Make one workflow, and keep a separate, synced copy in all your tenants. Control distributed auth, runtime locations, files, datastore keys etc. (contact support@shuffler.io if you want a demo. Please try it!)
Control mechanisms for multi-tenancy, backups, and security.
</Typography>
{userdata !== undefined && userdata !== null && userdata.orgs !== undefined && userdata.orgs !== null && userdata.orgs.length > 0 ?
<Typography variant="h6" style={{ marginTop: 50, }}>
Multi-Tenant Workflows
</Typography>
<Typography variant="body2" color="textSecondary" style={{ marginTop: 10, marginBottom: 10, }}>
Make one workflow, and keep a separate, synced copy in your other tenants. Control distributed auth, runtime locations, files, datastore keys etc. Can only distribute from parent org to child org. Need help trying it? <a href="https://shuffler.io/contact" target="_blank" style={{color: "#f85a3e", textDecoration: "none",}}>Contact us for a demo</a>
</Typography>
{userdata !== undefined && userdata !== null && userdata.orgs !== undefined && userdata.orgs !== null && userdata.orgs.length > 0 ?
userdata.orgs.filter(org => org.creator_org === userdata.active_org.id).length === 0 ?
userdata.active_org.creator_org === undefined || userdata.active_org.creator_org === null || userdata.active_org.creator_org === "" ?
<Typography variant="body2" style={{ marginTop: 10, color: "rgba(255,255,255,0.7)" }}>
@@ -600,6 +608,7 @@ const EditWorkflow = (props) => {
multiple
style={{ marginTop: 10, }}
value={innerWorkflow.suborg_distribution === undefined || innerWorkflow.suborg_distribution === null ? ["none"] : innerWorkflow.suborg_distribution}
disabled={workflow?.parentorg_workflow !== undefined && workflow?.parentorg_workflow !== null && workflow?.parentorg_workflow.length > 0}
onChange={(e) => {
var newvalue = e.target.value
if (newvalue.length > 1 && newvalue[0] === "none") {
+56 -14
View File
@@ -46,7 +46,7 @@ import { handlePayasyougo } from "../views/HandlePaymentNew.jsx"
import Billing from "./Billing.jsx";
const LicencePopup = (props) => {
const { globalUrl, userdata, serverside, billingInfo, stripeKey, setModalOpen, isLoggedIn, isMobile, selectedOrganization, isCloud } = props;
const { globalUrl, userdata, serverside, billingInfo, stripeKey, setModalOpen, isScale, isLoggedIn, isMobile, selectedOrganization, isCloud } = props;
//const alert = useAlert();
let navigate = useNavigate();
const [selectedDealModalOpen, setSelectedDealModalOpen] = React.useState(false);
@@ -165,11 +165,25 @@ const LicencePopup = (props) => {
]
}
if (userdata?.app_execution_limit >= 300000) {
subscription.name = "Enterprise"
subscription.currency_text = "$"
subscription.price = typecost_single
subscription.limit = userdata?.app_execution_limit
subscription.interval = "app run / month"
subscription.features = [
"Includes " + (userdata?.app_execution_limit/1000) + "K app runs/month. ",
"Multi-Tenancy and Region-Selection",
"And all other features from /pricing",
]
}
var newPaperstyle = JSON.parse(JSON.stringify(paperStyle))
if (subscription.name === "Enterprise" && subscription.active === true) {
top_text = "Current Plan"
top_text = "Enterprise Plan"
newPaperstyle.border = "1px solid #f85a3e"
// newPaperstyle.border = "1px solid #f85a3e"
}
var showSupport = false
@@ -255,7 +269,7 @@ const LicencePopup = (props) => {
style={{ borderRadius: theme.palette?.borderRadius, }}
placement="bottom"
>
<div style={{}}>
<div style={{ backgroundColor: "#1e1e1e"}}>
<Paper
style={newPaperstyle}
// onMouseEnter={() => setHovered(true)}
@@ -343,9 +357,9 @@ const LicencePopup = (props) => {
</div>
</DialogContent>
</Dialog>
<Button style={{ backgroundColor: '#2F2F2F', color: "white", textTransform: "capitalize", borderRadius: 200, boxShadow: 'none', width: 144, height: 40 }}>Current Plan</Button>
{subscription.active === true && !isScale && <Button style={{ backgroundColor: '#2F2F2F', color: "white", textTransform: "capitalize", borderRadius: 200, boxShadow: 'none', width: 144, height: 40 }}>Current Plan</Button> }
<div style={{ display: "flex" }}>
{top_text === "Base Cloud Access" && userdata.has_card_available === true ?
{top_text === "Base Cloud Access" && userdata.has_card_available === true && !isScale ?
<Chip
style={{
backgroundColor: "#f86a3e",
@@ -511,7 +525,10 @@ const LicencePopup = (props) => {
"While you have a card attached to your account, Shuffle will no longer prevent workflows from running. Billing will occur at the start of each month."
:
isCloud ?
`You are not subscribed to any plan and are using the free plan with max 10,000 app runs per month. Upgrade to deactivate this limit.`
userdata?.app_execution_limit && userdata?.app_execution_limit >= 300000 ?
"You have subscribed to the Enterprise plan, which includes " + (userdata?.app_execution_limit/1000) + "K app runs/month. You can increase the limit by upgrading current plan. Contact support@shuffler.io for more information." :
`You are not subscribed to any plan and are using the free plan with max 10,000 app runs per month. Upgrade to deactivate this limit.`
:
`You are not subscribed to any plan and are using the free, open source plan. This plan has no enforced limits, but scale issues may occur due to CPU congestion.`
}
@@ -699,8 +716,33 @@ const LicencePopup = (props) => {
setCalculatedCost("$960")
setSelectedValue(8)
} else {
setCalculatedCost("$960")
setSelectedValue(300)
if (userdata && userdata?.app_execution_limit) {
if (userdata.app_execution_limit >= 300000 && userdata.app_execution_limit < 400000) {
setSelectedValue(400)
setCalculatedCost("$1280")
}else if (userdata?.app_execution_limit >= 400000 && userdata?.app_execution_limit < 500000) {
setSelectedValue(500)
setCalculatedCost("$1600")
} else if (userdata?.app_execution_limit >= 500000 && userdata?.app_execution_limit < 600000) {
setSelectedValue(600)
setCalculatedCost("$1920")
} else if (userdata?.app_execution_limit >= 600000 && userdata?.app_execution_limit < 700000) {
setSelectedValue(700)
setCalculatedCost("$2240")
} else if (userdata?.app_execution_limit >= 700000 && userdata?.app_execution_limit < 800000) {
setSelectedValue(800)
setCalculatedCost("$2560")
} else if (userdata?.app_execution_limit >= 800000 && userdata?.app_execution_limit < 900000) {
setSelectedValue(900)
setCalculatedCost("$2880")
}else {
setCalculatedCost("$960")
setSelectedValue(300)
}
}else {
setCalculatedCost("$960")
setSelectedValue(300)
}
}
}, [shuffleVariant])
@@ -977,7 +1019,7 @@ const LicencePopup = (props) => {
</span>
: null}
{isCloud &&
{/* {isCloud &&
selectedOrganization.subscriptions !== undefined &&
selectedOrganization.subscriptions !== null &&
selectedOrganization.subscriptions.length > 0 ?
@@ -998,7 +1040,7 @@ const LicencePopup = (props) => {
/>
)
})
: null}
: null} */}
</Grid>
<Grid item xs={8}>
<Grid style={{}}>
@@ -1006,12 +1048,12 @@ const LicencePopup = (props) => {
<Card style={{
padding: 20,
borderRadius: theme.palette?.borderRadius,
border: "1px solid #f85a3e",
border: !isScale ? "1px solid #f85a3e" : 'none',
}}>
<div>
<Button style={{ backgroundColor: 'rgba(255, 132, 68, 0.2)', color: "#FF8444", textTransform: "capitalize", borderRadius: 200, boxShadow: 'none', }}
{ !isScale && <Button style={{ backgroundColor: 'rgba(255, 132, 68, 0.2)', color: "#FF8444", textTransform: "capitalize", borderRadius: 200, boxShadow: 'none', }}
variant="contained"
color="primary">Recommended </Button>
color="primary">Recommended </Button> }
</div>
<Typography variant="h6" style={{ marginTop: 10, marginBottom: 10, flex: 5, }}>{shuffleVariant === 1 ? "Scale" : "Enterprise"}</Typography>
+1 -1
View File
@@ -47,7 +47,7 @@ const menuData = {
title: "Shuffle",
description:
"The most versatile automation engine with focus on security.",
icon: "images/logos/orange_logo.svg",
icon: "images/icons/shuffleLogo.svg",
path: "/docs/about",
gaData: {
category: "navbar",