jusrhee 4 anni fa
parent
commit
4c8dcb4a49

+ 2 - 2
dashboard/src/components/values-form/FormWrapper.tsx

@@ -78,9 +78,9 @@ export default class FormWrapper extends Component<PropsType, StateType> {
       };
       if (tabs) {
         tabs.forEach((tab: any, i: number) => {
-
           // Exclude value if omitFromLaunch is set
-          let omit = tab.settings?.omitFromLaunch && this.props.externalValues?.isLaunch;
+          let omit =
+            tab.settings?.omitFromLaunch && this.props.externalValues?.isLaunch;
           if (tab?.name && tab.label && !omit) {
             // If a tab is valid, extract state
             tab.sections?.forEach((section: Section, i: number) => {

+ 10 - 8
dashboard/src/components/values-form/Heading.tsx

@@ -1,17 +1,19 @@
 import React from "react";
 import styled from "styled-components";
 
-export default function Heading(props: { isAtTop?: boolean; children: any; docs?: string }) {
+export default function Heading(props: {
+  isAtTop?: boolean;
+  children: any;
+  docs?: string;
+}) {
   return (
     <StyledHeading isAtTop={props.isAtTop}>
       {props.children}
-      {
-        props.docs && (
-          <a href={props.docs} target="_blank">
-            <i className="material-icons">help_outline</i>
-          </a>
-        )
-      }
+      {props.docs && (
+        <a href={props.docs} target="_blank">
+          <i className="material-icons">help_outline</i>
+        </a>
+      )}
     </StyledHeading>
   );
 }

+ 25 - 25
dashboard/src/components/values-form/ServiceRow.tsx

@@ -5,39 +5,40 @@ import { hardcodedNames, hardcodedIcons } from "shared/hardcodedNameDict";
 
 type PropsType = {
   service: {
-    clusterIP: string,
-    name: string,
-    release: string,
-    app: string,
-    namespace: string,
-    type?: string,
-  }
+    clusterIP: string;
+    name: string;
+    release: string;
+    app: string;
+    namespace: string;
+    type?: string;
+  };
 };
 
 type StateType = any;
 
-export default class ServiceRow extends Component<
-  PropsType,
-  StateType
-> {
+export default class ServiceRow extends Component<PropsType, StateType> {
   render() {
     let { clusterIP, name, namespace, type, app, release } = this.props.service;
     name = name || release;
     type = type || app;
     return (
       <>
-      { name && type && hardcodedNames[type] && hardcodedIcons[type] && namespace !== "kube-system" &&
-        <StyledServiceRow>
-          <Flex>
-            <Icon src={hardcodedIcons[type]} />
-            <Type>{hardcodedNames[type]}</Type>
-            <Name>{name}</Name> <Dash>-</Dash> <IP>{clusterIP}</IP>
-          </Flex>
-          <TagWrapper>
-            Namespace: <NamespaceTag>{namespace}</NamespaceTag>
-          </TagWrapper>
-        </StyledServiceRow>
-      }
+        {name &&
+          type &&
+          hardcodedNames[type] &&
+          hardcodedIcons[type] &&
+          namespace !== "kube-system" && (
+            <StyledServiceRow>
+              <Flex>
+                <Icon src={hardcodedIcons[type]} />
+                <Type>{hardcodedNames[type]}</Type>
+                <Name>{name}</Name> <Dash>-</Dash> <IP>{clusterIP}</IP>
+              </Flex>
+              <TagWrapper>
+                Namespace: <NamespaceTag>{namespace}</NamespaceTag>
+              </TagWrapper>
+            </StyledServiceRow>
+          )}
       </>
     );
   }
@@ -77,7 +78,6 @@ const NamespaceTag = styled.div`
   border-bottom-left-radius: 0px;
 `;
 
-
 const Dash = styled.div`
   margin-right: 10px;
 `;
@@ -111,4 +111,4 @@ const StyledServiceRow = styled.div`
   display: flex;
   align-items: center;
   justify-content: space-between;
-`;
+`;

+ 6 - 4
dashboard/src/components/values-form/ValuesForm.tsx

@@ -69,7 +69,11 @@ export default class ValuesForm extends Component<PropsType, StateType> {
 
       switch (item.type) {
         case "heading":
-          return <Heading key={i} docs={item.settings?.docs}>{item.label}</Heading>;
+          return (
+            <Heading key={i} docs={item.settings?.docs}>
+              {item.label}
+            </Heading>
+          );
         case "subtitle":
           return <Helper key={i}>{item.label}</Helper>;
         case "service-ip-list":
@@ -77,9 +81,7 @@ export default class ValuesForm extends Component<PropsType, StateType> {
             return (
               <ResourceList key={key}>
                 {item.value?.map((service: any, i: number) => {
-                  return (
-                    <ServiceRow service={service} key={i} />
-                  );
+                  return <ServiceRow service={service} key={i} />;
                 })}
               </ResourceList>
             );

+ 27 - 18
dashboard/src/shared/hardcodedNameDict.tsx

@@ -19,26 +19,35 @@ const hardcodedNames: { [key: string]: string } = {
 };
 
 const hardcodedIcons: { [key: string]: string } = {
-  "https-issuer": "https://cdn4.iconfinder.com/data/icons/macster-2/100/https__-512.png",
-  metabase: "https://pbs.twimg.com/profile_images/961380992727465985/4unoiuHt.jpg",
-  mongodb: "https://bitnami.com/assets/stacks/mongodb/img/mongodb-stack-220x234.png",
+  "https-issuer":
+    "https://cdn4.iconfinder.com/data/icons/macster-2/100/https__-512.png",
+  metabase:
+    "https://pbs.twimg.com/profile_images/961380992727465985/4unoiuHt.jpg",
+  mongodb:
+    "https://bitnami.com/assets/stacks/mongodb/img/mongodb-stack-220x234.png",
   mysql: "https://www.mysql.com/common/logos/logo-mysql-170x115.png",
-  postgresql: "https://bitnami.com/assets/stacks/postgresql/img/postgresql-stack-110x117.png",
-  redis: "https://cdn4.iconfinder.com/data/icons/redis-2/1451/Untitled-2-512.png",
+  postgresql:
+    "https://bitnami.com/assets/stacks/postgresql/img/postgresql-stack-110x117.png",
+  redis:
+    "https://cdn4.iconfinder.com/data/icons/redis-2/1451/Untitled-2-512.png",
   ubuntu: "Ubuntu",
-  web: "https://user-images.githubusercontent.com/65516095/111255214-07d3da80-85ed-11eb-99e2-fddcbdb99bdb.png",
-  worker: "https://user-images.githubusercontent.com/65516095/111255250-1b7f4100-85ed-11eb-8bd1-7b17be3e0e06.png",
-  job: "https://user-images.githubusercontent.com/65516095/111258413-4e2c3800-85f3-11eb-8a6a-88e03460f8fe.png",
-  "cert-manager": "https://raw.githubusercontent.com/jetstack/cert-manager/master/logo/logo.png",
-  elasticsearch: "https://ria.gallerycdn.vsassets.io/extensions/ria/elastic/0.13.3/1530754501320/Microsoft.VisualStudio.Services.Icons.Default",
-  prometheus: "https://raw.githubusercontent.com/prometheus/prometheus.github.io/master/assets/prometheus_logo-cb55bb5c346.png",
-  rabbitmq: "https://bitnami.com/assets/stacks/rabbitmq/img/rabbitmq-stack-220x234.png",
-  logdna: "https://user-images.githubusercontent.com/65516095/118185526-a2447480-b40a-11eb-9bdb-82aa0a306f26.png",
+  web:
+    "https://user-images.githubusercontent.com/65516095/111255214-07d3da80-85ed-11eb-99e2-fddcbdb99bdb.png",
+  worker:
+    "https://user-images.githubusercontent.com/65516095/111255250-1b7f4100-85ed-11eb-8bd1-7b17be3e0e06.png",
+  job:
+    "https://user-images.githubusercontent.com/65516095/111258413-4e2c3800-85f3-11eb-8a6a-88e03460f8fe.png",
+  "cert-manager":
+    "https://raw.githubusercontent.com/jetstack/cert-manager/master/logo/logo.png",
+  elasticsearch:
+    "https://ria.gallerycdn.vsassets.io/extensions/ria/elastic/0.13.3/1530754501320/Microsoft.VisualStudio.Services.Icons.Default",
+  prometheus:
+    "https://raw.githubusercontent.com/prometheus/prometheus.github.io/master/assets/prometheus_logo-cb55bb5c346.png",
+  rabbitmq:
+    "https://bitnami.com/assets/stacks/rabbitmq/img/rabbitmq-stack-220x234.png",
+  logdna:
+    "https://user-images.githubusercontent.com/65516095/118185526-a2447480-b40a-11eb-9bdb-82aa0a306f26.png",
   "tailscale-relay": "Tailscale",
 };
 
-
-export {
-  hardcodedNames,
-  hardcodedIcons
-};
+export { hardcodedNames, hardcodedIcons };