Bladeren bron

[POR-1928] fix job history page (#3811)

Feroze Mohideen 2 jaren geleden
bovenliggende
commit
0b0139e06e

+ 1 - 1
dashboard/src/components/OldTable.tsx

@@ -247,7 +247,7 @@ const Table: React.FC<TableProps> = ({
               {"<"}
             </PaginationAction>
             <PageCounter>
-              {currentPageIndex + 1} of {pageCount}
+              {currentPageIndex + 1} of {pageCount ? pageCount : pageCount + 1}
             </PageCounter>
             <PaginationAction disabled={!canNextPage} onClick={() => {
               nextPage();

+ 6 - 2
dashboard/src/lib/hooks/useJobs.ts

@@ -44,12 +44,15 @@ export const useJobs = (
         deploymentTargetId: string,
         selectedJobName: string,
     }
-) => {
+): {
+    jobRuns: JobRun[],
+    isLoadingJobRuns: boolean,
+} => {
     const [jobRuns, setJobRuns] = useState<JobRun[]>([]);
 
     const { revisionIdToNumber } = useRevisionList({ appName, deploymentTargetId, projectId, clusterId });
 
-    const { data } = useQuery(
+    const { data, isLoading: isLoadingJobRuns } = useQuery(
         ["jobRuns", appName, deploymentTargetId, revisionIdToNumber, selectedJobName],
         async () => {
             const res = await api.appJobs(
@@ -90,5 +93,6 @@ export const useJobs = (
 
     return {
         jobRuns,
+        isLoadingJobRuns,
     };
 };

+ 2 - 2
dashboard/src/main/home/app-dashboard/validate-apply/jobs/JobsSection.tsx

@@ -47,7 +47,7 @@ const JobsSection: React.FC<Props> = ({
     })];
   }, [jobNames]);
 
-  const { jobRuns } = useJobs({
+  const { jobRuns, isLoadingJobRuns } = useJobs({
     appName,
     projectId,
     clusterId,
@@ -167,7 +167,7 @@ const JobsSection: React.FC<Props> = ({
                 ? -1
                 : 1;
             })}
-            isLoading={jobRuns.length === 0}
+            isLoading={isLoadingJobRuns}
             enablePagination
           />
         </StyledExpandedApp>