mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
1 parent
693385a0a0
commit
ae9afc2894
5 files changed
+24
-32
No files matched your search
@@ -1,30 +0,0 @@
|
||||
import React from "react";
|
||||
import { observer } from "mobx-react";
|
||||
import { ClusterId, clusterStore } from "../../../common/cluster-store";
|
||||
import { WorkspaceId, workspaceStore } from "../../../common/workspace-store";
|
||||
|
||||
export const clusterContext = React.createContext(getClusterContext());
|
||||
|
||||
export interface ClusterContextValue {
|
||||
workspaceId: WorkspaceId;
|
||||
clusterId?: ClusterId;
|
||||
}
|
||||
|
||||
export function getClusterContext(): ClusterContextValue {
|
||||
return {
|
||||
clusterId: clusterStore.activeClusterId,
|
||||
workspaceId: workspaceStore.currentWorkspaceId,
|
||||
}
|
||||
}
|
||||
|
||||
@observer
|
||||
export class ClusterContext extends React.Component {
|
||||
render() {
|
||||
const { Provider } = clusterContext;
|
||||
return (
|
||||
<Provider value={getClusterContext()}>
|
||||
{this.props.children}
|
||||
</Provider>
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user