Prechádzať zdrojové kódy

Small fixes with services (#3466)

Feroze Mohideen 2 rokov pred
rodič
commit
b0e626dcfe

+ 3 - 2
dashboard/src/main/home/app-dashboard/new-app-flow/ServiceContainer.tsx

@@ -23,7 +23,7 @@ interface ServiceProps {
   chart?: any;
   editService: (service: Service) => void;
   deleteService: () => void;
-  setExpandedJob: (x: string) => void;
+  setExpandedJob?: (x: string) => void;
 }
 
 const ServiceContainer: React.FC<ServiceProps> = ({
@@ -80,7 +80,8 @@ const ServiceContainer: React.FC<ServiceProps> = ({
               RAM: 4,
             };
 
-            data.forEach(node => {
+            // TODO: type this response
+            data.forEach((node: any) => {
               if (node.labels['porter.run/workload-kind'] == "application") {
                 var instanceType: string = node.labels['beta.kubernetes.io/instance-type'];
                 const [instanceClass, instanceSize] = instanceType.split('.');

+ 9 - 6
dashboard/src/main/home/app-dashboard/new-app-flow/Services.tsx

@@ -124,7 +124,14 @@ const Services: React.FC<ServicesProps> = ({
       )}
       {maybeRenderAddServicesButton()}
       {showAddServiceModal && (
-        <Modal closeModal={() => setShowAddServiceModal(false)} width="500px">
+        <Modal
+          closeModal={() => {
+            setShowAddServiceModal(false)
+            setServiceName("")
+            setServiceType("web")
+          }}
+          width="500px"
+        >
           <Text size={16}>{addNewText}</Text>
           <Spacer y={1} />
           <Text color="helper">Select a service type:</Text>
@@ -168,11 +175,7 @@ const Services: React.FC<ServicesProps> = ({
               setServiceName("");
               setServiceType("web");
             }}
-            disabled={
-              !isServiceNameValid(serviceName) ||
-              isServiceNameDuplicate(serviceName) ||
-              serviceName?.length > 61
-            }
+            disabled={maybeGetError() != null}
           >
             <I className="material-icons">add</I> Add service
           </Button>