Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support generic sorting #3373

Merged
merged 3 commits into from
Apr 12, 2023
Merged

Conversation

dbutenhof
Copy link
Member

PBENCH-1126

With pagination, a client (e.g., the dashboard) can't rely on client-side column sorting. Instead, add generalized sorting to GET /datasets, allowing the returned datasets to be sorted by any column or metadata value, either ascending (default) or descending.

GET /api/v1/datasets?sort=user.dashboard.favorite:desc,dataset.uploaded will return all accessible datasets, sorted first by whether the authenticated user has marked the dataset "favorite" and second by the upload timestamp. (All "favorited" datasets will appear first, in upload order, followed by all "non- favorited" datasets in upload order.)

@dbutenhof dbutenhof added Server Dashboard Of and relating to the Dashboard GUI API Of and relating to application programming interfaces to services and functions labels Apr 7, 2023
@dbutenhof dbutenhof self-assigned this Apr 7, 2023
Copy link
Member

@webbnh webbnh left a comment

Choose a reason for hiding this comment

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

This looks great (I'm pleased that it was so easy, although some of the code looks familiar, which makes me wonder if there should be a refactoring somewhere), however, it could use some polishing.

lib/pbench/server/api/resources/datasets_list.py Outdated Show resolved Hide resolved
lib/pbench/server/api/resources/datasets_list.py Outdated Show resolved Hide resolved
lib/pbench/test/unit/server/conftest.py Outdated Show resolved Hide resolved
docs/API/V1/list.md Show resolved Hide resolved
lib/pbench/test/unit/server/test_datasets_list.py Outdated Show resolved Hide resolved
webbnh
webbnh previously approved these changes Apr 10, 2023
Copy link
Member

@webbnh webbnh left a comment

Choose a reason for hiding this comment

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

Looks good enough...unless you still want to change something.... 😉

lib/pbench/test/unit/server/test_datasets_list.py Outdated Show resolved Hide resolved
lib/pbench/test/unit/server/test_datasets_list.py Outdated Show resolved Hide resolved
PBENCH-1126

With pagination, a client (e.g., the dashboard) can't rely on client-side
column sorting. Instead, add generalize sorting to `GET /datasets`, allowing
the returned datasets to be sorted by any column or metadata value, either
ascending (default) or descending.

`GET /api/v1/datasets?sort=user.dashboard.favorite:desc,dataset.uploaded` will
return all accessible datasets, sorted first by whether the authenticated user
has marked the dataset "favorite" and second by the upload timestamp. (All
"favorited" datasets will appear first, in upload order, followed by all "non-
favorited" datasets in upload order.)
Copy link
Member

@webbnh webbnh left a comment

Choose a reason for hiding this comment

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

👍

Copy link
Member

@siddardh-ra siddardh-ra left a comment

Choose a reason for hiding this comment

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

Looks good 👍

@dbutenhof dbutenhof merged commit 677ae18 into distributed-system-analysis:main Apr 12, 2023
@dbutenhof dbutenhof deleted the sort branch April 12, 2023 12:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Of and relating to application programming interfaces to services and functions Dashboard Of and relating to the Dashboard GUI Server
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants