-
Notifications
You must be signed in to change notification settings - Fork 19
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
Feature/deseng623 Add language selector UI based roughly on ISO 639 codes #2540
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
8f09e10
DESENG-632 Add DB tables & API routes (#2533)
Baelx 32e8b23
Feature/deseng623 - Add frontend, update backend routes to use tenant…
Baelx ac8dda3
DESENG-623 Add frontend tests, trim api tests
7b6b61a
DESENG-623 Add frontend tests
fabe963
Merge branch 'main' into feature/deseng623
bfc6dfb
DESENG-623 Add new tests, fix broken ones, merge migrations
47a99b8
DESENG-623 Update changelog
a0d5e04
DESENG-623 fix linting and tests, clean up code further
d0c927f
DESENG-623 Merge main
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 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 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 |
---|---|---|
@@ -1 +1,11 @@ | ||
Generic single-database configuration. | ||
# Migrations | ||
|
||
Uses alembic, SQL Alchemy, and flask-migrate to perform DB migrations. | ||
|
||
To create a new revision: | ||
|
||
`alembic revision -m "description of revision"` | ||
|
||
## Languages | ||
|
||
The list of languages in `versions/c656f3f82334_add_languages_and_tenant_mapping.py` has been taken from [https://www.w3schools.com/tags/ref_language_codes.asp](https://www.w3schools.com/tags/ref_language_codes.asp) and modified slightly to remove duplicate or multiple language codes per language. | ||
This file contains 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
27 changes: 27 additions & 0 deletions
27
met-api/migrations/versions/22fb6b5b5aed_relax_language_table_constraints.py
This file contains 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,27 @@ | ||
""" | ||
Relax language table constraints. | ||
|
||
Revision ID: 22fb6b5b5aed | ||
Revises: ae232e299180 | ||
Create Date: 2024-05-27 15:56:23.549731 | ||
|
||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = '22fb6b5b5aed' | ||
down_revision = 'ae232e299180' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
def upgrade(): | ||
op.alter_column('language', 'right_to_left', nullable = True) | ||
op.alter_column('language', 'code', type_ = sa.String(length=20)) | ||
|
||
def downgrade(): | ||
op.alter_column('language', 'right_to_left', nullable = False) | ||
op.alter_column('language', 'code', type_ = sa.String(length=2)) | ||
|
||
|
||
|
26 changes: 26 additions & 0 deletions
26
met-api/migrations/versions/82ca95b4b7c1_add_edit_languages_to_admin_group.py
This file contains 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,26 @@ | ||
"""Add edit_languages to admin group | ||
|
||
Revision ID: 82ca95b4b7c1 | ||
Revises: c5dc2bb998ea | ||
Create Date: 2024-06-16 14:08:26.743948 | ||
|
||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = '82ca95b4b7c1' | ||
down_revision = 'c5dc2bb998ea' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
op.execute("INSERT INTO user_role (created_date, updated_date, id, name, description) VALUES ('{0}', '{0}', 40, 'edit_languages', 'Role to edit tenant languages.')".format(sa.func.now())) | ||
op.execute("INSERT INTO group_role_mapping (created_date, updated_date, id, role_id, group_id) VALUES ('{0}', '{0}', 62, 40, 1)".format(sa.func.now())) | ||
|
||
|
||
def downgrade(): | ||
op.execute("DELETE FROM group_role_mapping WHERE id = 62") | ||
op.execute("DELETE FROM user_role WHERE id = 40") |
This file contains 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,27 @@ | ||
""" | ||
Merge alembic revisions that: | ||
- Add sponsor_name and cta_message to engagement and engagement_translation | ||
- Add the list of supported languages and create a table to map them to tenants when selected | ||
|
||
Revision ID: c5dc2bb998ea | ||
Revises: 33ae368765fc, c656f3f82334 | ||
Create Date: 2024-06-16 13:40:10.729948 | ||
|
||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = 'c5dc2bb998ea' | ||
down_revision = ('33ae368765fc', 'c656f3f82334') | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
pass | ||
|
||
|
||
def downgrade(): | ||
pass |
Oops, something went wrong.
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.
Are you starting a pattern of documenting large data dumps with their migration IDs? I see promise in that approach!
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.
Yeah, I kinda thought it would be nice to have transparency with this migration anyway! Just to let future devs know we didn't pull this list out of nowhere