فهرست منبع

proper top-level add-on view

Justin Rhee 3 سال پیش
والد
کامیت
6e1548703f
1فایلهای تغییر یافته به همراه23 افزوده شده و 7 حذف شده
  1. 23 7
      dashboard/src/main/home/add-on-dashboard/AddOnDashboard.tsx

+ 23 - 7
dashboard/src/main/home/add-on-dashboard/AddOnDashboard.tsx

@@ -21,6 +21,7 @@ import Text from "components/porter/Text";
 import SearchBar from "components/porter/SearchBar";
 import SearchBar from "components/porter/SearchBar";
 import Toggle from "components/porter/Toggle";
 import Toggle from "components/porter/Toggle";
 import { readableDate } from "shared/string_utils";
 import { readableDate } from "shared/string_utils";
+import Loading from "components/Loading";
 
 
 type Props = {
 type Props = {
 };
 };
@@ -41,6 +42,12 @@ const namespaceBlacklist = [
   "monitoring",
   "monitoring",
 ];
 ];
 
 
+const templateBlacklist = [
+  "web",
+  "worker",
+  "job",
+];
+
 const AppDashboard: React.FC<Props> = ({
 const AppDashboard: React.FC<Props> = ({
 }) => {
 }) => {
   const { currentProject, currentCluster } = useContext(Context);
   const { currentProject, currentCluster } = useContext(Context);
@@ -54,7 +61,7 @@ const AppDashboard: React.FC<Props> = ({
       addOns ?? [],
       addOns ?? [],
       searchValue,
       searchValue,
       {
       {
-        keys: ["name"],
+        keys: ["name", "chart.metadata.name"],
         isCaseSensitive: false,
         isCaseSensitive: false,
       }
       }
     );
     );
@@ -88,20 +95,24 @@ const AppDashboard: React.FC<Props> = ({
           namespace: "all",
           namespace: "all",
         }
         }
       );
       );
+      setIsLoading(false);
       const charts = res.data || [];
       const charts = res.data || [];
       setAddOns(charts);
       setAddOns(charts);
-    } catch (err) {};
+    } catch (err) {
+      setIsLoading(false);
+    };
   };
   };
 
 
   useEffect(() => {
   useEffect(() => {
     getAddOns();
     getAddOns();
-  }, []);
+  }, [currentCluster, currentProject]);
 
 
   return (
   return (
     <StyledAppDashboard>
     <StyledAppDashboard>
       <DashboardHeader
       <DashboardHeader
         image={addOn}
         image={addOn}
         title="Add-ons"
         title="Add-ons"
+        capitalize={false}
         description="Add-ons and supporting workloads for this project."
         description="Add-ons and supporting workloads for this project."
         disableLineBreak
         disableLineBreak
       />
       />
@@ -127,11 +138,13 @@ const AppDashboard: React.FC<Props> = ({
         </Button>
         </Button>
       </Container>
       </Container>
       <Spacer y={1} />
       <Spacer y={1} />
-      {view === "grid" ? (
+      {isLoading ? <Loading offset="-150px" /> : view === "grid" ? (
         <GridList>
         <GridList>
           {(filteredAddOns ?? []).map((app: any, i: number) => {
           {(filteredAddOns ?? []).map((app: any, i: number) => {
-            console.log(app);
-            if (!namespaceBlacklist.includes(app.namespace)) {
+            if (
+              !namespaceBlacklist.includes(app.namespace) && 
+              !templateBlacklist.includes(app.chart.metadata.name)
+            ) {
               return (
               return (
                 <Block>
                 <Block>
                   <Text size={14}>
                   <Text size={14}>
@@ -151,7 +164,10 @@ const AppDashboard: React.FC<Props> = ({
       ) : (
       ) : (
         <List>
         <List>
           {(filteredAddOns ?? []).map((app: any, i: number) => {
           {(filteredAddOns ?? []).map((app: any, i: number) => {
-            if (!namespaceBlacklist.includes(app.namespace)) {
+            if (
+              !namespaceBlacklist.includes(app.namespace) &&
+              !templateBlacklist.includes(app.chart.metadata.name)
+            ) {
               return (
               return (
                 <Row>
                 <Row>
                   <Text size={14}>
                   <Text size={14}>