Преглед изворни кода

dashboard load (#2979)

Co-authored-by: Justin Rhee <jusrhee@Justins-MacBook-Air.local>
jusrhee пре 3 година
родитељ
комит
3a617e5e29
1 измењених фајлова са 3 додато и 3 уклоњено
  1. 3 3
      dashboard/src/main/home/dashboard/Dashboard.tsx

+ 3 - 3
dashboard/src/main/home/dashboard/Dashboard.tsx

@@ -30,7 +30,7 @@ const Dashboard: React.FC<Props> = ({
   setRefreshClusters,
   ...props
 }) => {
-  const { currentProject, user, capabilities } = useContext(Context);
+  const { currentProject, user, capabilities, usage } = useContext(Context);
   const [infras, setInfras] = useState<InfraType[]>([]);
   const [pressingCtrl, setPressingCtrl] = useState(false);
   const [pressingK, setPressingK] = useState(false);
@@ -88,10 +88,10 @@ const Dashboard: React.FC<Props> = ({
     }
   }, [currentProject]);
 
-  const currentTab = () => new URLSearchParams(props.location.search).get("tab");
+  const currentTab = () => new URLSearchParams(props.location.search).get("tab") || "overview";
 
   useEffect(() => {
-    if (props.isAuthorized("cluster", "", ["get", "create"])) {
+    if (usage && usage?.current?.clusters < usage?.limit?.clusters) {
       tabOptions.push({ label: "Create a cluster", value: "create-cluster" });
     }