ソースを参照

use servicelist instead of deprecated services attribute on fe (#4312)

Feroze Mohideen 2 年 前
コミット
08e8e78222

+ 8 - 11
dashboard/src/main/home/app-dashboard/app-view/AppHeader.tsx

@@ -124,17 +124,14 @@ const AppHeader: React.FC = () => {
   };
 
   const displayDomain = useMemo(() => {
-    const domains = Object.values(latestProto.services).reduce(
-      (acc: string[], s) => {
-        if (s.config.case === "webConfig") {
-          const names = s.config.value.domains.map((d) => d.name);
-          return [...acc, ...names];
-        }
-
-        return acc;
-      },
-      []
-    );
+    const domains = latestProto.serviceList.reduce((acc: string[], s) => {
+      if (s.config.case === "webConfig") {
+        const names = s.config.value.domains.map((d) => d.name);
+        return [...acc, ...names];
+      }
+
+      return acc;
+    }, []);
 
     // we only show the custom domain if 1 exists; if no custom domain exists, we show the porter domain, if one exists
     const nonPorterDomains = domains.filter(

+ 18 - 14
dashboard/src/main/home/app-dashboard/app-view/tabs/JobsTab.tsx

@@ -1,23 +1,27 @@
 import React from "react";
-import { useLatestRevision } from "../LatestRevisionContext";
+
 import JobsSection from "../../validate-apply/jobs/JobsSection";
+import { useLatestRevision } from "../LatestRevisionContext";
 
 const JobsTab: React.FC = () => {
-    const { projectId, clusterId, latestProto, deploymentTarget } = useLatestRevision();
+  const { projectId, clusterId, latestProto, deploymentTarget } =
+    useLatestRevision();
 
-    const appName = latestProto.name
+  const appName = latestProto.name;
 
-    return (
-        <>
-            <JobsSection
-                projectId={projectId}
-                clusterId={clusterId}
-                deploymentTargetId={deploymentTarget.id}
-                appName={appName}
-                jobNames={Object.keys(latestProto.services).filter(name => latestProto.services[name].config.case === "jobConfig")}
-            />
-        </>
-    );
+  return (
+    <>
+      <JobsSection
+        projectId={projectId}
+        clusterId={clusterId}
+        deploymentTargetId={deploymentTarget.id}
+        appName={appName}
+        jobNames={latestProto.serviceList
+          .filter((svc) => svc.config.case === "jobConfig")
+          .map((svc) => svc.name)}
+      />
+    </>
+  );
 };
 
 export default JobsTab;

+ 1 - 1
dashboard/src/main/home/app-dashboard/app-view/tabs/LogsTab.tsx

@@ -8,7 +8,7 @@ const LogsTab: React.FC = () => {
     useLatestRevision();
 
   const appName = latestProto.name;
-  const serviceNames = Object.keys(latestProto.services);
+  const serviceNames = latestProto.serviceList.map((svc) => svc.name);
 
   return (
     <Logs