Kaynağa Gözat

Fix current overlay typing and add currentProject metadata

jnfrati 3 yıl önce
ebeveyn
işleme
21847b83ba

+ 4 - 7
dashboard/src/shared/Context.tsx

@@ -4,6 +4,7 @@ import {
   CapabilityType,
   ClusterType,
   ContextProps,
+  OverlayData,
   ProjectType,
   UsageData,
 } from "shared/types";
@@ -27,12 +28,8 @@ export interface GlobalContextType {
   currentModal: string;
   currentModalData: any;
   setCurrentModal: (currentModal: string, currentModalData?: any) => void;
-  currentOverlay: {
-    message: string;
-    onYes: any;
-    onNo: any;
-  };
-  setCurrentOverlay: (x: any) => void;
+  currentOverlay: OverlayData;
+  setCurrentOverlay: (x: OverlayData) => void;
   currentError: string | null;
   setCurrentError: (currentError: string) => void;
   currentCluster: ClusterType;
@@ -85,7 +82,7 @@ class ContextProvider extends Component<PropsType, StateType> {
       this.setState({ currentModal, currentModalData });
     },
     currentOverlay: null,
-    setCurrentOverlay: (x: any) => this.setState({ currentOverlay: x }),
+    setCurrentOverlay: (x: OverlayData) => this.setState({ currentOverlay: x }),
     currentError: null,
     setCurrentError: (currentError: string) => {
       this.setState({ currentError });

+ 9 - 6
dashboard/src/shared/types.tsx

@@ -260,6 +260,7 @@ export interface ProjectType {
   managed_infra_enabled: boolean;
   api_tokens_enabled: boolean;
   stacks_enabled: boolean;
+  advanced_rbac_enabled: boolean;
   roles: {
     id: number;
     kind: string;
@@ -324,16 +325,18 @@ export interface CapabilityType {
   provisioner: boolean;
 }
 
+export type OverlayData = {
+  message: string;
+  onYes: () => void;
+  onNo: () => void;
+};
+
 export interface ContextProps {
   currentModal?: string;
   currentModalData: any;
   setCurrentModal: (currentModal: string, currentModalData?: any) => void;
-  currentOverlay: {
-    message: string;
-    onYes: any;
-    onNo: any;
-  };
-  setCurrentOverlay: (x: any) => void;
+  currentOverlay: OverlayData;
+  setCurrentOverlay: (x: OverlayData) => void;
   currentError?: string;
   setCurrentError: (currentError: string) => void;
   currentCluster?: ClusterType;