浏览代码

Added map to show proper icon

jnfrati 4 年之前
父节点
当前提交
1cd9e03627
共有 1 个文件被更改,包括 9 次插入11 次删除
  1. 9 11
      dashboard/src/main/home/onboarding/steps/ConnectRegistry/components/Registry.tsx

+ 9 - 11
dashboard/src/main/home/onboarding/steps/ConnectRegistry/components/Registry.tsx

@@ -7,20 +7,18 @@ import { Context } from "shared/Context";
 import styled from "styled-components";
 import { useSnapshot } from "valtio";
 
-const fakePromise = (shouldThrow: boolean) =>
-  new Promise((resolve, reject) => {
-    setTimeout(() => {
-      if (shouldThrow) {
-        reject("error");
-      } else {
-        resolve("success");
-      }
-    }, 2000);
-  });
+const serviceToProvider: {
+  [key: string]: string;
+} = {
+  docr: "do",
+  ecr: "aws",
+  gcr: "gcp",
+};
 
 const Registry: React.FC<{ registry: any; onDelete: () => void }> = (props) => {
   const { registry, onDelete } = props;
-  const icon = integrationList[registry?.service]?.icon;
+  const service = serviceToProvider[registry?.service];
+  const icon = integrationList[service || registry?.service]?.icon;
   const subtitle = integrationList[registry?.service]?.label;
   const snap = useSnapshot(OFState);
   const { setCurrentError } = useContext(Context);