Browse Source

Merge pull request #1542 from porter-dev/nico/fix-job-status-not-updating

[BUGFIX] Fix job status not updating properly
Nicolas Frati 4 years ago
parent
commit
7db9f325d0

+ 1 - 1
dashboard/src/main/home/cluster-dashboard/ClusterDashboard.tsx

@@ -49,7 +49,7 @@ class ClusterDashboard extends Component<PropsType, StateType> {
     sortType: localStorage.getItem("SortType")
       ? localStorage.getItem("SortType")
       : "Newest",
-    lastRunStatus: null as null,
+    lastRunStatus: "all" as null,
     currentChart: null as ChartType | null,
     isMetricsInstalled: false,
   };

+ 1 - 1
dashboard/src/main/home/cluster-dashboard/LastRunStatusSelector.tsx

@@ -13,7 +13,7 @@ const LastRunStatusSelector = (props: PropsType) => {
   const options = [
     {
       label: "All",
-      value: null,
+      value: "all",
     },
   ].concat(
     Object.entries(JobStatusType).map((status) => ({

+ 4 - 3
dashboard/src/main/home/cluster-dashboard/chart/ChartList.tsx

@@ -19,7 +19,7 @@ import { useWebsockets } from "shared/hooks/useWebsockets";
 
 type Props = {
   currentCluster: ClusterType;
-  lastRunStatus?: JobStatusType | null;
+  lastRunStatus?: JobStatusType | null | "all";
   namespace: string;
   // TODO Convert to enum
   sortType: string;
@@ -242,7 +242,8 @@ const ChartList: React.FunctionComponent<Props> = ({
 
           if (
             !existingValue ||
-            newValue.resource_version > existingValue.resource_version
+            Number(newValue.resource_version) >
+              Number(existingValue.resource_version)
           ) {
             return {
               ...currentStatus,
@@ -330,7 +331,7 @@ const ChartList: React.FunctionComponent<Props> = ({
         if (currentView !== "jobs") {
           return true;
         }
-        if (lastRunStatus === null) {
+        if (lastRunStatus === null || lastRunStatus === "all") {
           return true;
         }
         const status: JobStatusWithTimeAndVersion = _.get(