fix minor ui issue
This commit is contained in:
@@ -4956,6 +4956,17 @@ func handleCloudSetup(resp http.ResponseWriter, request *http.Request) {
|
||||
|
||||
resp.Write(b)
|
||||
} else {
|
||||
|
||||
// Delete cache for the sync features
|
||||
cacheKey := fmt.Sprintf("org_sync_features_%s", org.Id)
|
||||
shuffle.DeleteCache(ctx, cacheKey)
|
||||
|
||||
subscriptionCacheKey := fmt.Sprintf("org_subscriptions_%s", org.Id)
|
||||
shuffle.DeleteCache(ctx, subscriptionCacheKey)
|
||||
|
||||
licenseCacheKey := fmt.Sprintf("org_licensed_%s", org.Id)
|
||||
shuffle.DeleteCache(ctx, licenseCacheKey)
|
||||
|
||||
resp.WriteHeader(200)
|
||||
resp.Write([]byte(fmt.Sprintf(`{"success": true, "reason": "Successfully disabled cloud sync for org."}`)))
|
||||
}
|
||||
@@ -5047,6 +5058,23 @@ func handleCloudSetup(resp http.ResponseWriter, request *http.Request) {
|
||||
shuffle.SetCache(ctx, cacheKey, featuresBytes, 1800)
|
||||
}
|
||||
|
||||
subscriptionCacheKey := fmt.Sprintf("org_subscriptions_%s", org.Id)
|
||||
subscriptionsBytes, err := json.Marshal(responseData.Subscriptions)
|
||||
if err != nil {
|
||||
log.Printf("[ERROR] Failed to marshal Subscriptions for cache: %s", err)
|
||||
} else {
|
||||
shuffle.SetCache(ctx, subscriptionCacheKey, subscriptionsBytes, 1800)
|
||||
}
|
||||
|
||||
licenseCacheKey := fmt.Sprintf("org_licensed_%s", org.Id)
|
||||
licensedBytes, err := json.Marshal(responseData.Licensed)
|
||||
if err != nil {
|
||||
log.Printf("[ERROR] Failed to marshal Licensed for cache: %s", err)
|
||||
} else {
|
||||
|
||||
shuffle.SetCache(ctx, licenseCacheKey, licensedBytes, 1800)
|
||||
}
|
||||
|
||||
org.SyncConfig = shuffle.SyncConfig{
|
||||
Apikey: responseData.SessionKey,
|
||||
Interval: responseData.IntervalSeconds,
|
||||
|
||||
@@ -49,7 +49,7 @@ const CloudSyncTab = (props) => {
|
||||
const itemColor = "white";
|
||||
const isCloud = window?.location?.host === "localhost:3002" || window?.location?.host === "shuffler.io";
|
||||
|
||||
const { themeMode, brandColor } = useContext(Context);
|
||||
const { themeMode, brandColor, setUpdateOrg } = useContext(Context);
|
||||
const theme = getTheme(themeMode, brandColor);
|
||||
|
||||
useEffect(() => { getSettings(); }, []);
|
||||
@@ -457,6 +457,8 @@ const CloudSyncTab = (props) => {
|
||||
setLoading(false);
|
||||
if (response.status === 200) {
|
||||
console.log("Cloud sync success?");
|
||||
handleGetOrg(userdata.active_org.id);
|
||||
setUpdateOrg(true);
|
||||
} else {
|
||||
console.log("Cloud sync fail?");
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ const ExpandMoreAndLessIcon = "/icons/expandMoreIcon.svg";
|
||||
const LeftSideBar = ({ userdata, serverside, globalUrl, notifications, }) => {
|
||||
|
||||
const navigate = useNavigate();
|
||||
const {setLeftSideBarOpenByClick, leftSideBarOpenByClick, setSearchBarModalOpen, searchBarModalOpen, logoutUrl, themeMode, handleThemeChange, isDocSearchModalOpen, setIsDocSearchModalOpen, supportEmail} = useContext(Context);
|
||||
const {setLeftSideBarOpenByClick, leftSideBarOpenByClick, updateOrg, setUpdateOrg, setSearchBarModalOpen, searchBarModalOpen, logoutUrl, themeMode, handleThemeChange, isDocSearchModalOpen, setIsDocSearchModalOpen, supportEmail} = useContext(Context);
|
||||
const [expandLeftNav, setExpandLeftNav] = useState(false);
|
||||
const [activeOrgName, setActiveOrgName] = useState(
|
||||
userdata?.active_org?.name || "Select Organziation"
|
||||
@@ -956,6 +956,7 @@ const LeftSideBar = ({ userdata, serverside, globalUrl, notifications, }) => {
|
||||
.then((org) => {
|
||||
if (!fetched && org) {
|
||||
setActiveOrgData(org);
|
||||
setUpdateOrg(false);
|
||||
if (!isCloud) {
|
||||
if (org?.cloud_sync && org?.subscriptions[0]?.name?.toLowerCase().includes("enterprise") && org?.subscriptions[0]?.active) {
|
||||
setIsProdStatusOn(true);
|
||||
@@ -972,7 +973,7 @@ const LeftSideBar = ({ userdata, serverside, globalUrl, notifications, }) => {
|
||||
return () => {
|
||||
fetched = true;
|
||||
};
|
||||
}, [userdata?.active_org?.id, globalUrl]);
|
||||
}, [userdata?.active_org?.id, globalUrl, updateOrg]);
|
||||
|
||||
return (
|
||||
<div
|
||||
|
||||
@@ -15,6 +15,7 @@ export const AppContext = (props) => {
|
||||
const [windowWidth, setWindowWidth] = useState(serverside === true ? 100 : window.innerWidth);
|
||||
const [brandColor, setBrandColor] = useState(() => localStorage.getItem("brandColor") || "#ff8544");
|
||||
const [brandName, setBrandName] = useState(()=> localStorage.getItem("brandName") || "Shuffle");
|
||||
const [updateOrg, setUpdateOrg] = useState(false);
|
||||
|
||||
const [themeMode, setThemeMode] = useState(
|
||||
() => localStorage.getItem("theme") || "dark"
|
||||
@@ -117,6 +118,8 @@ export const AppContext = (props) => {
|
||||
setBrandColor,
|
||||
brandName,
|
||||
setBrandName,
|
||||
updateOrg,
|
||||
setUpdateOrg,
|
||||
}}>
|
||||
{props.children}
|
||||
</Context.Provider>
|
||||
|
||||
@@ -5,14 +5,14 @@ import { Context } from '../context/ContextApi.jsx';
|
||||
|
||||
const Admin2 = (props) => {
|
||||
// Destructure props if needed
|
||||
const { userdata, globalUrl, serverside, checkLogin, notifications, setNotifications, stripeKey, isLoaded, isLoggedIn} = props;
|
||||
const { userdata, globalUrl, serverside, checkLogin, notifications, setNotifications, stripeKey, isLoaded, } = props;
|
||||
const [selectedTab, setSelectedTab] = useState('editdetails');
|
||||
const [selectedStatus, setSelectedStatus] = React.useState([]);
|
||||
const [selectedOrganization, setSelectedOrganization] = useState({});
|
||||
const [organizationFeatures, setOrganizationFeatures] = useState({});
|
||||
const [orgRequest, setOrgRequest] = React.useState(true);
|
||||
const [isOrgLoaded, setIsOrgLoaded] = React.useState(false);
|
||||
const {brandName} = useContext(Context)
|
||||
const {brandName, updateOrg, setUpdateOrg} = useContext(Context)
|
||||
const isCloud = window.location.host === "localhost:3002" || window.location.host === "shuffler.io";
|
||||
|
||||
if (document !== undefined) {
|
||||
@@ -47,6 +47,8 @@ const Admin2 = (props) => {
|
||||
window.location.href = "/workflows";
|
||||
}, 3000);
|
||||
} else {
|
||||
|
||||
setUpdateOrg(false);
|
||||
if (
|
||||
responseJson.sync_features === undefined ||
|
||||
responseJson.sync_features === null
|
||||
@@ -163,6 +165,13 @@ const Admin2 = (props) => {
|
||||
});
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (updateOrg && userdata?.active_org?.id !== undefined && userdata?.active_org?.id !== null && userdata?.active_org?.id.length > 0) {
|
||||
handleGetOrg(userdata.active_org.id);
|
||||
setUpdateOrg(false);
|
||||
}
|
||||
|
||||
}, [updateOrg]);
|
||||
|
||||
useEffect(() => {
|
||||
const urlSearchParams = new URLSearchParams(window.location.search);
|
||||
|
||||
Reference in New Issue
Block a user