2
0
Justin Rhee 3 жил өмнө
parent
commit
54b2eec569

+ 8 - 1
dashboard/src/components/porter/Button.tsx

@@ -8,6 +8,7 @@ type Props = {
   onClick: () => void;
   disabled?: boolean;
   status?: string;
+  helperText?: string;
   loadingText?: string;
   successText?: string;
 };
@@ -17,6 +18,7 @@ const Button: React.FC<Props> = ({
   onClick,
   disabled,
   status,
+  helperText,
   loadingText,
   successText,
 }) => {
@@ -36,6 +38,10 @@ const Button: React.FC<Props> = ({
             {loadingText || "Updating . . ."}
           </StatusWrapper>
         );
+      case "":
+        return helperText && (
+          <StatusWrapper success={false}>{helperText}</StatusWrapper>
+        )   
       default:
         return (
           <StatusWrapper success={false}>
@@ -54,7 +60,7 @@ const Button: React.FC<Props> = ({
       >
         <Text>{children}</Text>
       </StyledButton>
-      {status && renderStatus()}
+      {(helperText || status) && renderStatus()}
     </Wrapper>
   );
 };
@@ -83,6 +89,7 @@ const StatusWrapper = styled.div<{
   success?: boolean;
 }>`
   display: flex;
+  line-height: 1.5;
   align-items: center;
   font-family: "Work Sans", sans-serif;
   font-size: 13px;

+ 1 - 0
dashboard/src/main/home/cluster-dashboard/dashboard/ClusterSettingsModal.tsx

@@ -124,6 +124,7 @@ const ClusterSettingsModal: React.FC<Props> = ({
         onClick={renameCluster}
         disabled={clusterName === ""}
         status={status}
+        helperText="Note: The vanity name for your cluster will not change the cluster's name in your cloud provider."
       >
         Save
       </Button>

+ 1 - 1
dashboard/src/main/home/cluster-dashboard/dashboard/Dashboard.tsx

@@ -32,7 +32,7 @@ var tabOptions: {
 }[] = [{ label: "Additional settings", value: "settings" }];
 
 export const Dashboard: React.FunctionComponent = () => {
-  const [currentTab, setCurrentTab] = useState<TabEnum>("nodes");
+  const [currentTab, setCurrentTab] = useState<TabEnum>("settings");
   const [currentTabOptions, setCurrentTabOptions] = useState(tabOptions);
   const [isAuthorized] = useAuth();
   const location = useLocation();

+ 9 - 2
dashboard/src/main/home/cluster-dashboard/dashboard/ProvisionerStatus.tsx

@@ -25,7 +25,7 @@ const ProvisionerStatus: React.FC<Props> = ({
   // Continuously poll provisioning status
   const pollProvisioningStatus = async () => {
     try {
-      const res = await api.getClusterStatus(
+      const res = await api.getClusterState(
         "<token>",
         {},
         {
@@ -34,6 +34,7 @@ const ProvisionerStatus: React.FC<Props> = ({
         }
       );
       const { status } = res.data;
+      console.log("status", status);
       switch (status) {
         case status["BOOTSTRAP_READY"]:
           setProgress(2);
@@ -47,9 +48,15 @@ const ProvisionerStatus: React.FC<Props> = ({
         default:
           setProgress(1);
       }
-    } catch (error) {}
+    } catch (err) {
+      console.log("hello", err);
+    }
   };
 
+  useEffect(() => {
+    pollProvisioningStatus(); 
+  }, []);
+
   return (
     <StyledProvisionerStatus>
       <HeaderSection>

+ 0 - 1
dashboard/src/main/home/dashboard/ClusterList.tsx

@@ -27,7 +27,6 @@ const ClusterList: React.FC<Props> = ({}) => {
       { id: currentProject.id },
     )
       .then(({ data }) => {
-        console.log(data);
         setClusters(data);
         setIsLoading(false);
       })

+ 8 - 0
dashboard/src/shared/api.tsx

@@ -932,6 +932,13 @@ const deleteContract = baseApi<
   return `/api/projects/${project_id}/contracts/${revision_id}`;
 });
 
+const getClusterState = baseApi<
+  {},
+  { project_id: number, cluster_id: number }
+>("GET", ({ project_id, cluster_id }) => {
+  return `/api/projects/${project_id}/clusters/${cluster_id}/state`;
+});
+
 const provisionInfra = baseApi<
   {
     kind: string;
@@ -2490,6 +2497,7 @@ export default {
   getPodByName,
   getMatchingPods,
   getAllReleasePods,
+  getClusterState,
   getMetrics,
   getNamespaces,
   getNGINXIngresses,