Justin Rhee пре 3 година
родитељ
комит
baeae3f1e2

+ 7 - 5
dashboard/src/components/porter/Select.tsx

@@ -9,7 +9,8 @@ type Props = {
   error?: string;
   error?: string;
   children?: React.ReactNode;
   children?: React.ReactNode;
   disabled?: boolean;
   disabled?: boolean;
-  onChange?: (value: string) => void;
+  value?: string;
+  setValue?: (value: string) => void;
 };
 };
 
 
 const Select: React.FC<Props> = ({
 const Select: React.FC<Props> = ({
@@ -20,10 +21,9 @@ const Select: React.FC<Props> = ({
   error,
   error,
   children,
   children,
   disabled,
   disabled,
-  onChange,
+  value,
+  setValue,
 }) => {
 }) => {
-  const [value, setValue] = useState("");
-
   return (
   return (
     <Block width={width}>
     <Block width={width}>
       {
       {
@@ -36,7 +36,6 @@ const Select: React.FC<Props> = ({
         <StyledSelect
         <StyledSelect
           onChange={e => {
           onChange={e => {
             setValue(e.target.value);
             setValue(e.target.value);
-            onChange && onChange(e.target.value);
           }}
           }}
           width={width}
           width={width}
           height={height}
           height={height}
@@ -94,6 +93,8 @@ const SelectWrapper = styled.div`
   position: relative;
   position: relative;
   background: #26292e;
   background: #26292e;
   z-index: 0;
   z-index: 0;
+  border-radius: 5px;
+  overflow: hidden;
   > i {
   > i {
     font-size: 18px;
     font-size: 18px;
     position: absolute;
     position: absolute;
@@ -118,6 +119,7 @@ const StyledSelect = styled.select<{
   border-radius: 5px;
   border-radius: 5px;
   background: none;
   background: none;
   appearance: none;
   appearance: none;
+  overflow: hidden;
   z-index: 1;
   z-index: 1;
   border: 1px solid ${props => props.hasError ? "#ff3b62" : "#494b4f"};
   border: 1px solid ${props => props.hasError ? "#ff3b62" : "#494b4f"};
   :hover {
   :hover {

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

@@ -146,13 +146,13 @@ const NewAppFlow: React.FC<Props> = ({ ...props }) => {
               repository: "https://charts.getporter.dev"
               repository: "https://charts.getporter.dev"
             },
             },
             {
             {
-              name: "web",
+              name: "worker",
               alias: "daft-worker-1",
               alias: "daft-worker-1",
               version: "0.38",
               version: "0.38",
               repository: "https://charts.getporter.dev"
               repository: "https://charts.getporter.dev"
             },
             },
             {
             {
-              name: "web",
+              name: "worker",
               alias: "daft-worker-2",
               alias: "daft-worker-2",
               version: "0.38",
               version: "0.38",
               repository: "https://charts.getporter.dev"
               repository: "https://charts.getporter.dev"

+ 6 - 8
dashboard/src/main/home/app-dashboard/new-app-flow/Service.tsx

@@ -4,9 +4,11 @@ import AnimateHeight from "react-animate-height";
 import styled from "styled-components";
 import styled from "styled-components";
 import Text from "components/porter/Text";
 import Text from "components/porter/Text";
 import Spacer from "components/porter/Spacer";
 import Spacer from "components/porter/Spacer";
-import web from "assets/web.png";
 import TabSelector from "components/TabSelector";
 import TabSelector from "components/TabSelector";
 
 
+import web from "assets/web.png";
+import worker from "assets/worker.png";
+import job from "assets/job.png";
 
 
 interface ServiceProps {
 interface ServiceProps {
   serviceData: ServiceType;
   serviceData: ServiceType;
@@ -63,8 +65,10 @@ const Service: React.FC<ServiceProps> = ({
           <ActionButton >
           <ActionButton >
             <span className="material-icons dropdown">arrow_drop_down</span>
             <span className="material-icons dropdown">arrow_drop_down</span>
           </ActionButton>
           </ActionButton>
-          {serviceData.name !== DEFAULT_SERVICE.name && serviceData.name.trim().length > 0 ? serviceData.name : "New Service"}
           {serviceData.type === 'web' && <Icon src={web} />}
           {serviceData.type === 'web' && <Icon src={web} />}
+          {serviceData.type === 'worker' && <Icon src={worker} />}
+          {serviceData.type === 'job' && <Icon src={job} />}
+          {serviceData.name !== DEFAULT_SERVICE.name && serviceData.name.trim().length > 0 ? serviceData.name : "New Service"}
         </ServiceTitle>
         </ServiceTitle>
         <ActionButton onClick={(e) => {
         <ActionButton onClick={(e) => {
           deleteService();
           deleteService();
@@ -129,11 +133,6 @@ const ActionButton = styled.button`
   margin-right: 5px;
   margin-right: 5px;
 `;
 `;
 
 
-const SliderContainer = styled.div`
-    display: flex;
-    align-items: center;
-`;
-
 const ServiceHeader = styled.div`
 const ServiceHeader = styled.div`
   flex-direction: row;
   flex-direction: row;
   display: flex;
   display: flex;
@@ -175,7 +174,6 @@ const ServiceHeader = styled.div`
 const Icon = styled.img`
 const Icon = styled.img`
   height: 18px;
   height: 18px;
   margin-right: 15px;
   margin-right: 15px;
-  margin-left: 10px;
 
 
   animation: fadeIn 0.3s 0s;
   animation: fadeIn 0.3s 0s;
   @keyframes fadeIn {
   @keyframes fadeIn {

+ 31 - 7
dashboard/src/main/home/app-dashboard/new-app-flow/Services.tsx

@@ -24,6 +24,7 @@ const Services: React.FC<ServicesProps> = ({
 }) => {
 }) => {
   const [showAddServiceModal, setShowAddServiceModal] = useState<boolean>(false);
   const [showAddServiceModal, setShowAddServiceModal] = useState<boolean>(false);
   const [serviceName, setServiceName] = useState<string>('');
   const [serviceName, setServiceName] = useState<string>('');
+  const [serviceType, setServiceType] = useState<string>('web');
 
 
   return (
   return (
     <>
     <>
@@ -55,9 +56,13 @@ const Services: React.FC<ServicesProps> = ({
           <Spacer y={0.5} />
           <Spacer y={0.5} />
           <Container row>
           <Container row>
             <ServiceIcon>
             <ServiceIcon>
-              <img src={web} />
+              {serviceType === 'web' && <img src={web} />}
+              {serviceType === 'worker' && <img src={worker} />}
+              {serviceType === 'job' && <img src={job} />}
             </ServiceIcon>
             </ServiceIcon>
-            <Select 
+            <Select
+              value={serviceType}
+              setValue={setServiceType}
               options={[
               options={[
                 { label: 'Web', value: 'web' },
                 { label: 'Web', value: 'web' },
                 { label: 'Worker', value: 'worker' },
                 { label: 'Worker', value: 'worker' },
@@ -76,7 +81,10 @@ const Services: React.FC<ServicesProps> = ({
           />
           />
           <Spacer y={1} />
           <Spacer y={1} />
           <Button onClick={() => {
           <Button onClick={() => {
-             setServices([...services, DEFAULT_SERVICE])
+            setServices([...services, { ...DEFAULT_SERVICE, name: serviceName, type: serviceType }]);
+            setShowAddServiceModal(false);
+            setServiceName('');
+            setServiceType('web');
           }}>
           }}>
             <I className="material-icons">add</I> Add service
             <I className="material-icons">add</I> Add service
           </Button>
           </Button>
@@ -90,11 +98,27 @@ export default Services
 
 
 const ServiceIcon = styled.div`
 const ServiceIcon = styled.div`
   border: 1px solid #494b4f;
   border: 1px solid #494b4f;
-  height: 36px;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  height: 35px;
+  width: 35px;
+  margin-right: 10px;
+  overflow: hidden;
+  border-radius: 5px;
   > img {
   > img {
-    height: 20px;
-    margin-right: 15px;
-    padding-left: 10px;
+    height: 18px;
+    animation: floatIn 0.5s 0s;
+    @keyframes floatIn {
+      from {
+        opacity: 0;
+        transform: translateY(7px);
+      }
+      to {
+        opacity: 1;
+        transform: translateY(0px);
+      }
+    }
   }
   }
 `;
 `;