Add delay for 30 days in production status offf
This commit is contained in:
@@ -84,6 +84,7 @@ const LeftSideBar = ({ userdata, serverside, globalUrl, notifications, }) => {
|
|||||||
const tab = params.get("tab");
|
const tab = params.get("tab");
|
||||||
const currentPath = tab ? `${window.location.pathname}?tab=${tab}` : window.location.pathname;
|
const currentPath = tab ? `${window.location.pathname}?tab=${tab}` : window.location.pathname;
|
||||||
const [hoverOnAvatar, setHoverOnAvatar] = useState(false);
|
const [hoverOnAvatar, setHoverOnAvatar] = useState(false);
|
||||||
|
const [showProductionStatus, setShowProductionStatus] = useState(false);
|
||||||
const [orgOptions, setOrgOptions] = useState(
|
const [orgOptions, setOrgOptions] = useState(
|
||||||
userdata?.orgs?.map((org) => ({
|
userdata?.orgs?.map((org) => ({
|
||||||
id: org.id,
|
id: org.id,
|
||||||
@@ -127,6 +128,19 @@ const LeftSideBar = ({ userdata, serverside, globalUrl, notifications, }) => {
|
|||||||
setCurrentSelectedTheme(userdata?.theme);
|
setCurrentSelectedTheme(userdata?.theme);
|
||||||
}
|
}
|
||||||
}, [userdata]);
|
}, [userdata]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (activeOrgData?.id?.length > 0 && typeof activeOrgData.created === "number") {
|
||||||
|
const nowUnix = Math.floor(Date.now() / 1000);
|
||||||
|
|
||||||
|
const THIRTY_DAYS = 30 * 24 * 60 * 60;
|
||||||
|
const isAfter30Days = nowUnix >= activeOrgData.created + THIRTY_DAYS;
|
||||||
|
|
||||||
|
setShowProductionStatus(isAfter30Days);
|
||||||
|
}
|
||||||
|
}, [activeOrgData]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const CustomPopper = (props) => {
|
const CustomPopper = (props) => {
|
||||||
return (
|
return (
|
||||||
@@ -1949,7 +1963,7 @@ const LeftSideBar = ({ userdata, serverside, globalUrl, notifications, }) => {
|
|||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
{!isCloud ? (
|
{!isCloud && showProductionStatus? (
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
display: "flex",
|
display: "flex",
|
||||||
|
|||||||
@@ -812,6 +812,7 @@ const Workflows2 = (props) => {
|
|||||||
const [isLoadingWorkflow, setIsLoadingWorkflow] = useState(false);
|
const [isLoadingWorkflow, setIsLoadingWorkflow] = useState(false);
|
||||||
const [isLoadingPublicWorkflow, setIsLoadingPublicWorkflow] = useState(false);
|
const [isLoadingPublicWorkflow, setIsLoadingPublicWorkflow] = useState(false);
|
||||||
const [view, setView] = useState(localStorage?.getItem("workflowView") || "grid");
|
const [view, setView] = useState(localStorage?.getItem("workflowView") || "grid");
|
||||||
|
const [showProductionStatus, setShowProductionStatus] = useState(false);
|
||||||
|
|
||||||
const isCloud = window.location.host === "localhost:3002" || window.location.host === "shuffler.io";
|
const isCloud = window.location.host === "localhost:3002" || window.location.host === "shuffler.io";
|
||||||
const [showExecutionStats, setShowExecutionStats] = React.useState(localStorage?.getItem("showExecutionStats") === "true")
|
const [showExecutionStats, setShowExecutionStats] = React.useState(localStorage?.getItem("showExecutionStats") === "true")
|
||||||
@@ -970,6 +971,10 @@ const Workflows2 = (props) => {
|
|||||||
.then((response) => (response.ok ? response.json() : null))
|
.then((response) => (response.ok ? response.json() : null))
|
||||||
.then((org) => {
|
.then((org) => {
|
||||||
if (!fetched && org) {
|
if (!fetched && org) {
|
||||||
|
const nowUnix = Math.floor(Date.now() / 1000);
|
||||||
|
const THIRTY_DAYS = 30 * 24 * 60 * 60;
|
||||||
|
const isAfter30Days = nowUnix >= org.created + THIRTY_DAYS;
|
||||||
|
setShowProductionStatus(isAfter30Days);
|
||||||
if (!isCloud) {
|
if (!isCloud) {
|
||||||
if (org?.cloud_sync && org?.subscriptions[0]?.name?.toLowerCase().includes("enterprise") && org?.subscriptions[0]?.active) {
|
if (org?.cloud_sync && org?.subscriptions[0]?.name?.toLowerCase().includes("enterprise") && org?.subscriptions[0]?.active) {
|
||||||
setIsProdStatusOn(true);
|
setIsProdStatusOn(true);
|
||||||
@@ -5518,7 +5523,7 @@ const Workflows2 = (props) => {
|
|||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
{!isCloud ? (
|
{!isCloud && showProductionStatus ? (
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
display: "flex",
|
display: "flex",
|
||||||
|
|||||||
Reference in New Issue
Block a user