feat(app-deployments): add server-side sorting by created, activated, and last used#7700
feat(app-deployments): add server-side sorting by created, activated, and last used#7700adambenhassen wants to merge 13 commits intomainfrom
Conversation
Summary of ChangesHello @adambenhassen, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a crucial feature for managing app deployments: server-side sorting. Previously, deployments were only sortable by creation date. Now, users can efficiently sort deployments by their creation time, activation time, or last usage, which significantly improves the ability to locate and manage relevant deployments, especially in environments with numerous entries. The changes span across the GraphQL API, backend data retrieval logic, and the frontend user interface to provide a seamless sorting experience. Highlights
Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces server-side sorting for the app deployments table, allowing users to sort by creation date, activation date, and last used date. The backend changes are significant, especially the logic for sorting by 'last used' which involves querying both PostgreSQL and ClickHouse. I've identified a potential issue with how different sort fields are handled and suggested improvements for maintainability and type safety in the complex sorting logic. The frontend changes to support this new functionality look good.
packages/services/api/src/modules/app-deployments/providers/app-deployments-manager.ts
Outdated
Show resolved
Hide resolved
packages/services/api/src/modules/app-deployments/providers/app-deployments.ts
Show resolved
Hide resolved
packages/services/api/src/modules/app-deployments/providers/app-deployments.ts
Outdated
Show resolved
Hide resolved
💻 Website PreviewThe latest changes are available as preview in: https://pr-7700.hive-landing-page.pages.dev |
|
🐋 This PR was built and pushed to the following Docker images: Targets: Platforms: Image Tag: |
ece722d to
65687c3
Compare
| """ | ||
| appDeployments(first: Int, after: String): AppDeploymentConnection | ||
| appDeployments( | ||
| first: Int |
There was a problem hiding this comment.
| first: Int | |
| first: Int! = 20 |
Minor: I like to set the default in the SDL so that it's clearly visible to API consumer and so that although the argument doesnt need passed, youll always get a value in the resolver.
There was a problem hiding this comment.
I agree but, there's already a code check for this that clamps and sets it to 20 when null. If there's any needed change, it has to also change all fields that utilize the (nullable, no default) first parameter pattern and not just appDeployments. For consistency, this should be a codebase-wide decision, not a one-off on this field.
This is based on the project patterns document: https://www.notion.so/theguildoss/Hive-Console-GraphQL-API-Design-Patterns-18ab6b71848a80678939c669699fe8e6#18ab6b71848a80d5a1b1d16abd881d32
| const { sort, cursor, first } = args; | ||
|
|
||
| const pagePromise = | ||
| sort?.field === 'LAST_USED' |
There was a problem hiding this comment.
Do we have an exported enum from codegen we could use?
There was a problem hiding this comment.
Nope. codegen produces string union types, not typescript enums, so there's no enum member to reference
packages/services/api/src/modules/app-deployments/providers/app-deployments.ts
Show resolved
Hide resolved
packages/services/api/src/modules/app-deployments/providers/app-deployments.ts
Outdated
Show resolved
Hide resolved
65687c3 to
c355931
Compare
Background
The app deployments table has no sorting capability, deployments were always listed by creation date descending. Users need to sort by different columns (created, activated, last used) to find relevant deployments quickly, especially in targets with many deployments.
Description
Adds server-side sorting to the app deployments table.