Skip to content

Add paging on jobs panel#2852

Merged
davidsharp7 merged 11 commits into
mainfrom
web/add_paging_to_jobs_runs_hist
Jul 23, 2024
Merged

Add paging on jobs panel#2852
davidsharp7 merged 11 commits into
mainfrom
web/add_paging_to_jobs_runs_hist

Conversation

@davidsharp7

@davidsharp7 davidsharp7 commented Jul 12, 2024

Copy link
Copy Markdown
Member

Problem

Currently we pull back the last 100 runs of a job. This PR is to allow for paging so that users can easily scroll through the
runs 10 at a time.

image

I've also added the total run count to the returned JSON payload on this end point

GET /api/v1/namespaces/my-namespace/jobs/test-job/runs
Screenshot 2024-07-13 at 07 26 46

I will do the PR for dataset versions in due course.

Closes: #2614

Solution

Implement paging similar to that on the sidebar datasets/jobs pages.

One-line summary:

Job level paging of runs.

Checklist

  • You've signed-off your work
  • Your changes are accompanied by tests (if relevant)
  • Your change contains a small diff and is self-contained
  • You've updated any relevant documentation (if relevant)
  • You've included a one-line summary of your change for the CHANGELOG.md (Depending on the change, this may not be necessary).
  • You've versioned your .sql database schema migration according to Flyway's naming convention (if relevant)
  • You've included a header in any source code files (if relevant)

Signed-off-by: sharpd <davidsharp7@gmail.com>
@boring-cyborg boring-cyborg Bot added api API layer changes web labels Jul 12, 2024
@netlify

netlify Bot commented Jul 12, 2024

Copy link
Copy Markdown

Deploy Preview for peppy-sprite-186812 canceled.

Name Link
🔨 Latest commit 65c0fbd
🔍 Latest deploy log https://app.netlify.com/sites/peppy-sprite-186812/deploys/669f50f73801e30008af9f3d

Signed-off-by: sharpd <davidsharp7@gmail.com>
@codecov

codecov Bot commented Jul 12, 2024

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.74%. Comparing base (f0b2195) to head (65c0fbd).

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #2852   +/-   ##
=========================================
  Coverage     84.74%   84.74%           
  Complexity     1456     1456           
=========================================
  Files           253      253           
  Lines          6562     6563    +1     
  Branches        305      305           
=========================================
+ Hits           5561     5562    +1     
  Misses          850      850           
  Partials        151      151           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@davidsharp7 davidsharp7 marked this pull request as ready for review July 12, 2024 19:30
@davidsharp7 davidsharp7 changed the title Initial commit of run pagination for jobs Add paging on jobs panel Jul 12, 2024
@phixMe

phixMe commented Jul 12, 2024

Copy link
Copy Markdown
Member

I think the duration should maybe be N/A in the event that the job is currently running.

@wslulciuc wslulciuc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@davidsharp7 davidsharp7 marked this pull request as draft July 13, 2024 00:12
Signed-off-by: sharpd <davidsharp7@gmail.com>
@davidsharp7

Copy link
Copy Markdown
Member Author

I think the duration should maybe be N/A in the event that the job is currently running.

Yeah agree - also added the 'New' state as well.

Comment on lines 90 to 93
useEffect(() => {
fetchRuns(job.name, job.namespace)
fetchRuns(job.name, job.namespace, 10, 0)
fetchJobTags(job.namespace, job.name)
}, [job.name])

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we be setting this to a variable unless I'm missing something to page on this?

@davidsharp7 davidsharp7 Jul 14, 2024

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's because the "runs" are used by the job detail page so the thinking being that you pull the latest 10 runs so that job details works and then control all the paging from "Runs". Think there is a similar thing with "Dataset Versions" as that's pulled in the top level component and pushed downwards.

But in terms of having the offset and limit as a var then sure no problem. I've moved some stuff around so all of the work happens in JobDetailsPage.

Signed-off-by: sharpd <davidsharp7@gmail.com>
Signed-off-by: sharpd <davidsharp7@gmail.com>

@phixMe phixMe left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pulled down your code and the one thing I'm seeing is that the loading state is wiping out the entire page for loading the runs instead of just the run table. Would it be possible to move the loading rendering detection up the chain and only display a loading indicator for this subsection?

@davidsharp7

Copy link
Copy Markdown
Member Author

Yeah funnily enough that's part of the reason I split the workload between Runs and JobDetailsPage but agree it's not the best user experience to refresh everything - I will test it on a larger workload as the toy dataset won't cover these kind of use cases.

Signed-off-by: sharpd <davidsharp7@gmail.com>
@davidsharp7 davidsharp7 marked this pull request as ready for review July 17, 2024 09:35

@phixMe phixMe left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the updates @davidsharp7

@davidsharp7 davidsharp7 merged commit 2015c39 into main Jul 23, 2024
@davidsharp7 davidsharp7 deleted the web/add_paging_to_jobs_runs_hist branch July 23, 2024 06:54
jonathanpmoraes referenced this pull request in nubank/NuMarquez Feb 6, 2025
* Initial commit of run pagination for jobs

Signed-off-by: sharpd <davidsharp7@gmail.com>

* added linted code

Signed-off-by: sharpd <davidsharp7@gmail.com>

* add pageInit to prevent multiple initial fetches

Signed-off-by: sharpd <davidsharp7@gmail.com>

* fix react error and add additional formatting for runs.

Signed-off-by: sharpd <davidsharp7@gmail.com>

* move paging to JobDetailPage to simplify

Signed-off-by: sharpd <davidsharp7@gmail.com>

* fix runs messaging

Signed-off-by: sharpd <davidsharp7@gmail.com>

* add new fetchLatestRuns and state

Signed-off-by: sharpd <davidsharp7@gmail.com>

* aligning action types

Signed-off-by: sharpd <davidsharp7@gmail.com>

---------

Signed-off-by: sharpd <davidsharp7@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api API layer changes web

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants