-
Notifications
You must be signed in to change notification settings - Fork 281
feat(accounts): add compact quota row display toggle #539
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
Closed
Closed
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
1859590
feat(accounts): show reset timing in list
cani1989 35f8597
feat(accounts): add quota display appearance toggle
cani1989 e78d384
fix(accounts): sort by visible reset rows
cani1989 79a02bf
feat(accounts): add account priority
cani1989 edb9fc5
fix(frontend): restore build for priority rollout
cani1989 b4c22ae
fix(accounts): keep selected account stable
cani1989 b86fd4b
fix(accounts): gate priorities behind appearance toggle
cani1989 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| from __future__ import annotations | ||
|
|
||
| from enum import Enum | ||
|
|
||
|
|
||
| class AccountPriority(str, Enum): | ||
| GOLD = "gold" | ||
| SILVER = "silver" | ||
| BRONZE = "bronze" | ||
|
|
||
|
|
||
| _PRIORITY_ORDER: dict[AccountPriority, int] = { | ||
| AccountPriority.GOLD: 0, | ||
| AccountPriority.SILVER: 1, | ||
| AccountPriority.BRONZE: 2, | ||
| } | ||
|
|
||
|
|
||
| def coerce_account_priority(value: str | AccountPriority | None) -> AccountPriority: | ||
| if isinstance(value, AccountPriority): | ||
| return value | ||
| normalized = (value or "").strip().lower() | ||
| if normalized == AccountPriority.GOLD.value: | ||
| return AccountPriority.GOLD | ||
| if normalized == AccountPriority.BRONZE.value: | ||
| return AccountPriority.BRONZE | ||
| return AccountPriority.SILVER | ||
|
|
||
|
|
||
| def account_priority_rank(value: str | AccountPriority | None) -> int: | ||
| return _PRIORITY_ORDER[coerce_account_priority(value)] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
app/db/alembic/versions/20260503_000000_add_accounts_priority.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| """add priority to accounts | ||
|
|
||
| Revision ID: 20260503_000000_add_accounts_priority | ||
| Revises: 20260424_000000_merge_dashboard_session_ttl_and_request_log_heads | ||
| Create Date: 2026-05-03 | ||
| """ | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import sqlalchemy as sa | ||
| from alembic import op | ||
| from sqlalchemy.engine import Connection | ||
|
|
||
| revision = "20260503_000000_add_accounts_priority" | ||
| down_revision = "20260424_000000_merge_dashboard_session_ttl_and_request_log_heads" | ||
| branch_labels = None | ||
| depends_on = None | ||
|
|
||
| _ACCOUNT_PRIORITY = sa.Enum( | ||
| "gold", | ||
| "silver", | ||
| "bronze", | ||
| name="account_priority", | ||
| ) | ||
|
|
||
|
|
||
| def _columns(connection: Connection, table_name: str) -> set[str]: | ||
| inspector = sa.inspect(connection) | ||
| if not inspector.has_table(table_name): | ||
| return set() | ||
| return {column["name"] for column in inspector.get_columns(table_name)} | ||
|
|
||
|
|
||
| def upgrade() -> None: | ||
| bind = op.get_bind() | ||
| columns = _columns(bind, "accounts") | ||
| if not columns or "priority" in columns: | ||
| return | ||
|
|
||
| with op.batch_alter_table("accounts") as batch_op: | ||
| batch_op.add_column( | ||
| sa.Column( | ||
| "priority", | ||
| _ACCOUNT_PRIORITY, | ||
| nullable=False, | ||
| server_default=sa.text("'silver'"), | ||
| ) | ||
| ) | ||
|
|
||
|
|
||
| def downgrade() -> None: | ||
| bind = op.get_bind() | ||
| columns = _columns(bind, "accounts") | ||
| if "priority" not in columns: | ||
| return | ||
|
|
||
| with op.batch_alter_table("accounts") as batch_op: | ||
| batch_op.drop_column("priority") | ||
|
|
||
| _ACCOUNT_PRIORITY.drop(bind, checkfirst=True) |
51 changes: 51 additions & 0 deletions
51
app/db/alembic/versions/20260503_000100_add_dashboard_priorities_enabled.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| """add priorities enabled to dashboard settings | ||
|
|
||
| Revision ID: 20260503_000100_add_dashboard_priorities_enabled | ||
| Revises: 20260503_000000_add_accounts_priority | ||
| Create Date: 2026-05-03 | ||
| """ | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import sqlalchemy as sa | ||
| from alembic import op | ||
| from sqlalchemy.engine import Connection | ||
|
|
||
| revision = "20260503_000100_add_dashboard_priorities_enabled" | ||
| down_revision = "20260503_000000_add_accounts_priority" | ||
| branch_labels = None | ||
| depends_on = None | ||
|
|
||
|
|
||
| def _columns(connection: Connection, table_name: str) -> set[str]: | ||
| inspector = sa.inspect(connection) | ||
| if not inspector.has_table(table_name): | ||
| return set() | ||
| return {column["name"] for column in inspector.get_columns(table_name)} | ||
|
|
||
|
|
||
| def upgrade() -> None: | ||
| bind = op.get_bind() | ||
| columns = _columns(bind, "dashboard_settings") | ||
| if not columns or "priorities_enabled" in columns: | ||
| return | ||
|
|
||
| with op.batch_alter_table("dashboard_settings") as batch_op: | ||
| batch_op.add_column( | ||
| sa.Column( | ||
| "priorities_enabled", | ||
| sa.Boolean(), | ||
| nullable=False, | ||
| server_default=sa.text("false"), | ||
| ) | ||
| ) | ||
|
|
||
|
|
||
| def downgrade() -> None: | ||
| bind = op.get_bind() | ||
| columns = _columns(bind, "dashboard_settings") | ||
| if "priorities_enabled" not in columns: | ||
| return | ||
|
|
||
| with op.batch_alter_table("dashboard_settings") as batch_op: | ||
| batch_op.drop_column("priorities_enabled") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updating an existing account via import or OAuth currently overwrites any manually assigned priority because
_apply_account_updatesalways copiessource.priorityinto the persisted row. BothAccountsService.import_accountandOauthServiceconstructsourceaccounts withpriority=AccountPriority.SILVER, so a user who sets an account to gold/bronze will lose that setting on the next re-import/reauth. This breaks priority routing behavior and makes priority updates non-durable.Useful? React with 👍 / 👎.