Просмотр исходного кода

Merge pull request #2087 from porter-dev/nico/disable-incidents-for-apps-on-system-namespaces

Disable incidents tab on apps that are deployed on system namespaces
Nicolas Frati 4 лет назад
Родитель
Сommit
b60e9aaecf

+ 8 - 1
dashboard/src/main/home/cluster-dashboard/expanded-chart/ExpandedChart.tsx

@@ -24,6 +24,7 @@ import TitleSection from "components/TitleSection";
 import DeploymentType from "./DeploymentType";
 import IncidentsTab from "./incidents/IncidentsTab";
 import BuildSettingsTab from "./BuildSettingsTab";
+import { DisabledNamespacesForIncidents } from "./incidents/DisabledNamespaces";
 
 type Props = {
   namespace: string;
@@ -406,6 +407,9 @@ const ExpandedChart: React.FC<Props> = (props) => {
       case "metrics":
         return <MetricsSection currentChart={chart} />;
       case "incidents":
+        if (DisabledNamespacesForIncidents.includes(currentChart.namespace)) {
+          return null;
+        }
         return (
           <IncidentsTab
             releaseName={chart?.name}
@@ -506,7 +510,10 @@ const ExpandedChart: React.FC<Props> = (props) => {
     let rightTabOptions = [] as any[];
     let leftTabOptions = [] as any[];
     leftTabOptions.push({ label: "Status", value: "status" });
-    leftTabOptions.push({ label: "Incidents", value: "incidents" });
+
+    if (!DisabledNamespacesForIncidents.includes(currentChart.namespace)) {
+      leftTabOptions.push({ label: "Incidents", value: "incidents" });
+    }
 
     if (props.isMetricsInstalled) {
       leftTabOptions.push({ label: "Metrics", value: "metrics" });

+ 9 - 0
dashboard/src/main/home/cluster-dashboard/expanded-chart/incidents/DisabledNamespaces.ts

@@ -0,0 +1,9 @@
+export const DisabledNamespacesForIncidents = [
+  "cert-manager",
+  "ingress-nginx",
+  "kube-node-lease",
+  "kube-public",
+  "kube-system",
+  "monitoring",
+  "porter-agent-system",
+];