You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using Refine to implement control planes for certain middleware, and now I have multiple clusters to manage, each with similar middleware.
I want to add a cluster selection dropdown in the header, where selecting a cluster will make Refine query resources from the corresponding cluster. I'm wondering how to pass cluster parameters. I hope users can see the cluster parameters in the URI, so that copying and reopening the URI would still show the corresponding cluster.
1,I've tried passing them in meta, but this doesn't reflect in the URI
2. I'ver tied add a cluster prefix var in Refind resource like this
`
const cluster = Cookies.get("cluster") || "abc";
Refine has the multiTenancyProvider feature for this case, but it's available in the Enterprise Edition. I'd like to give 1-2 tips for the Community Edition.
First you can get the cluster from the route params, and you can tell Refine this as follows:
After that, you’ll need to update the paths of your pages, of course. This may vary depending on whether you’re using React Router or Next.js.
Then, you can use the <Link/> component to change the current cluster.
Simple example:
import{Link}from"react-router-dom";constClusterSwitcher=({ cluster })=>{return(<Linkto={`/dashboard/${cluster}`}>
Switch to {cluster}</Link>);};
About cookies
The cluster value is being read from cookies only once when the component renders. If the cookie changes, the component doesn't re-render automatically because React doesn't track cookie changes.
You can check various sources for information on how to sync the cookie with React's state.
I'm using Refine to implement control planes for certain middleware, and now I have multiple clusters to manage, each with similar middleware.
I want to add a cluster selection dropdown in the header, where selecting a cluster will make Refine query resources from the corresponding cluster. I'm wondering how to pass cluster parameters. I hope users can see the cluster parameters in the URI, so that copying and reopening the URI would still show the corresponding cluster.
1,I've tried passing them in meta, but this doesn't reflect in the URI
2. I'ver tied add a cluster prefix var in Refind resource like this
`
const cluster = Cookies.get("cluster") || "abc";
`
but this seems a bit awkward,and every times change cluster need reload page。
Does refine have any feature to solve this question?
The text was updated successfully, but these errors were encountered: