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

Feature: DESENG-443/UI implementation #2413

Merged
merged 30 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
7be03fc
Engagement Metadata Management - API changes
NatSquared Feb 9, 2024
f8bc363
DESENG-452 : Applying pending migrations (#2378)
ratheesh-aot Feb 9, 2024
f764cb1
DESENG-484: Adding max age for cors (#2379)
VineetBala-AOT Feb 12, 2024
6c946ba
Engagement Metadata Management - API changes
NatSquared Feb 9, 2024
21ba1e2
edit migration order to merge with migration changes
NatSquared Feb 13, 2024
4ff5307
Backend changes for DESENG-443
NatSquared Mar 7, 2024
9871f57
Frontend changes for deseng-443
NatSquared Mar 7, 2024
202ade8
Remove metadata references from frontend unit tests
NatSquared Mar 7, 2024
95b095c
Update Changelog
NatSquared Mar 7, 2024
85f7233
Update unit tests to handle metadata as an array
NatSquared Mar 7, 2024
3fd43ea
Clean up unused imports from frontend files
NatSquared Mar 7, 2024
942a009
Add ticket links to changelog
NatSquared Mar 8, 2024
c3c5041
Merge branch 'main' into feature/deseng-443/ui-implementation
NatSquared Mar 9, 2024
b933803
Adapt metadata to changes from main
NatSquared Mar 9, 2024
09462ed
Format and save date properly
NatSquared Mar 11, 2024
4e2bfcc
Save changes stably without re-renders
NatSquared Mar 11, 2024
abb99d1
Merge changes from main
NatSquared Mar 11, 2024
a2e6162
Python: fix lint errors
NatSquared Mar 11, 2024
331a540
Apply suggestions from JS linter; update migration file
NatSquared Mar 11, 2024
43127af
More lint errors fixed
NatSquared Mar 11, 2024
b649ae7
Hopefully the final lint errors fixed
NatSquared Mar 11, 2024
9c303f7
String conversion hotfix
NatSquared Mar 11, 2024
bcbdddb
Flake8 validation - attempt 1
NatSquared Mar 11, 2024
d9bc58b
Flake8 validation - attempt 2
NatSquared Mar 11, 2024
60cda11
Patch jest tests
NatSquared Mar 11, 2024
31bcd8b
Patch jest tests again (sorry)
NatSquared Mar 11, 2024
3fb3746
Fix lint warnings, remove commented code, enhance accessibility (PR r…
NatSquared Mar 13, 2024
3dfb1da
Merge branch 'main' into feature/deseng-443/ui-implementation... again
NatSquared Mar 13, 2024
bf6abb1
Fix sonarcloud linting; aria accessibility tweaks
NatSquared Mar 13, 2024
1db888f
Ensure proper sequence of flask migration files
NatSquared Mar 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 75 additions & 42 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
@@ -1,119 +1,151 @@
## March 08, 2024

- **Task**Multi-language - Create engagement translation table & API routes [DESENG-510](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-510)
- Added Engagement translation model.
- Added Engagement translation API.
- Added Unit tests.
- Added Engagement translation model.
- Added Engagement translation API.
- Added Unit tests.

## March 07, 2024

- **Task**: Remove "default_values" from metadata taxa.
Replace with "preset values", metadata entries that are not assigned to an engagement.
- **Task**: Update authorization documentation in the API blueprint. Update
metadata management to rely on normal authorization check functions.
- **Task**: Clean up metadata management code and tests.
- **Task**: Add endpoint for updating metadata by taxon in bulk
- **Feature**: Add editor for metadata taxa (admin only). [🎟️DESENG-443](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-443)
- **Feature**: Add editor for metadata entries (available to anyone who can
edit an engagement). [🎟️DESENG-443](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-443)

## March 06, 2024

- **Task**Multi-language - Create simple widget translation tables & API routes [DESENG-514](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-514)
- Added Widget translation model.
- Added Widget translation API.
- Added Unit tests.
- Added Widget translation model.
- Added Widget translation API.
- Added Unit tests.
- **Task**Multi-language - Create survey translation table & API routes [DESENG-511](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-511)
- Added Survey Translation model.
- Added Survey Translation API.
- Added Survey Translation tests.
- Added Survey Translation model.
- Added Survey Translation API.
- Added Survey Translation tests.

## March 04, 2024

- **Task**Engagement "save" enhancements [DESENG-507](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-507)
- The existing "Save" button in the floating bar has been split into two distinct actions: "Save and Continue" and "Save and Exit".
- Tabs are greyed out, and widgets are disabled until the engagement is successfully saved. A helpful tool-tip has been added to inform users that the engagement needs to be saved before accessing certain features.
- Independent save buttons previously present in tabs, such as "Additional Details", "Settings" have been removed. Now, the floating save bar is universally employed when editing an engagement.
- The existing "Save" button in the floating bar has been split into two distinct actions: "Save and Continue" and "Save and Exit".
- Tabs are greyed out, and widgets are disabled until the engagement is successfully saved. A helpful tool-tip has been added to inform users that the engagement needs to be saved before accessing certain features.
- Independent save buttons previously present in tabs, such as "Additional Details", "Settings" have been removed. Now, the floating save bar is universally employed when editing an engagement.
- **Task**Multi-language - Create language table & API [DESENG-509](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-509)
- Added Language model.
- Added Language API.
- Added Unit tests.
- Added Language model.
- Added Language API.
- Added Unit tests.

## February 27, 2024

- **Bug Fix**Comments cannot be approved while reviewing [DESENG-496](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-496)
- Fixed by adding a missing decorator for transactional methods.
- Fixed by adding a missing decorator for transactional methods.
- **Task**Enhance analytics api for Improved Readability and Maintainability [DESENG-492](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-492)
- Refactor analytics-api config to harmonize its structure and conventions with met-api.
- Ensure the sample.env file maintains consistent formatting.
- Adjusted the component_id column size in the comment table of the met-api to resolve an error encountered during user submissions.
- Refactor analytics-api config to harmonize its structure and conventions with met-api.
- Ensure the sample.env file maintains consistent formatting.
- Adjusted the component_id column size in the comment table of the met-api to resolve an error encountered during user submissions.

## February 26, 2024

- **Task**Models for dynamic engagement pages [DESENG-500](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-500)
- Implemented endpoints for dynamic engagement pages, including summary and custom sections.
- Default behavior ensures that each engagement has a dynamic summary page.
- Introduced logic to migrate existing content and rich content for engagements to the summary table.
- Implemented endpoints for dynamic engagement pages, including summary and custom sections.
- Default behavior ensures that each engagement has a dynamic summary page.
- Introduced logic to migrate existing content and rich content for engagements to the summary table.
- **Task**Add font awesome libraries [DESENG-490](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-490)
- Added related libraries to the frontend package.json.
- Added related libraries to the frontend package.json.
- **Task**Adding missing unit test [DESENG-483](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-483)
- Added missing unit test for components.
- Added missing unit test for components.

## February 20, 2024

- **Task**Upgrade the version of flask [DESENG-502](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-502)
- Performed a Flask version upgrade to version 2.2.5.
- Performed a Flask version upgrade to version 2.2.5.

## February 16, 2024

- **Task**Make a floating save/preview bar when editing engagements [DESENG-498](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-498)
- Implemented a floating behavior for the save/preview buttons during engagement editing. This feature persists across all tabs but exclusively saves data for the Engagement Content tab.
- Implemented a floating behavior for the save/preview buttons during engagement editing. This feature persists across all tabs but exclusively saves data for the Engagement Content tab.

## February 15, 2024

- **Task**Restore role assignment functionality to MET with the CSS API [DESENG-473](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-473)
- Utilize the CSS API for efficient management of composite roles. This involves the assignment, reassignment, or removal of users from the composite roles of TEAM_MEMBER, REVIEWER, IT_ADMIN, or IT_VIEWER.
- Utilize the CSS API for efficient management of composite roles. This involves the assignment, reassignment, or removal of users from the composite roles of TEAM_MEMBER, REVIEWER, IT_ADMIN, or IT_VIEWER.

## February 09, 2024

- **Task**Consolidate and re-write old migration files [DESENG-452](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-452)
- Deleted old migration files
- Created [ec0128056a33_table_until_feb_09_2024.py](met-api/migrations/versions/ec0128056a33_table_until_feb_09_2024.py) with all tables until feb 09 2024
- Created [37176ea4708d_data_until_feb_09_2024.py](met-api/migrations/versions/37176ea4708d_data_until_feb_09_2024.py) with all initial data until feb 09 2024
- Deleted old migration files
- Created [ec0128056a33_table_until_feb_09_2024.py](met-api/migrations/versions/ec0128056a33_table_until_feb_09_2024.py) with all tables until feb 09 2024
- Created [37176ea4708d_data_until_feb_09_2024.py](met-api/migrations/versions/37176ea4708d_data_until_feb_09_2024.py) with all initial data until feb 09 2024

## February 08, 2024

- **Task**Cache CORS preflight responses with the browser for a given period of time [DESENG-484](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-484)
- Introduces a new configuration variable to specify the maximum age for Cross-Origin Resource Sharing (CORS)
- Modified the CORS preflight method to utilize this newly introduced variable.
- Introduces a new configuration variable to specify the maximum age for Cross-Origin Resource Sharing (CORS)
- Modified the CORS preflight method to utilize this newly introduced variable.
- **Task**Consolidate and re-write old migration files [DESENG-452](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-452)
- Change some foreign key field to nullbale false in model files
- Change `rejected_reason_other` to nullable true in `submission` model
- Generated new migration file based on the pending model changes which confirmed to be valid
- Updated Unit test of email verfication to send type to the api
- Change some foreign key field to nullbale false in model files
- Change `rejected_reason_other` to nullable true in `submission` model
- Generated new migration file based on the pending model changes which confirmed to be valid
- Updated Unit test of email verfication to send type to the api

## February 06, 2024

- **Task**Convert keycloak groups to composite roles for permission levels [DESENG-447](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-447)
- Commented out unit test related to Keycloak groups
- Changed reference of Keycloak `groups` to `roles`
- Commented out code related to Keycloak groups
- Commented out unit test related to Keycloak groups
- Changed reference of Keycloak `groups` to `roles`
- Commented out code related to Keycloak groups

## February 06, 2024

- **Task** Streamline CRON jobs [DESENG-493](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-493)
- Aligned the CRON configuration and sample environment files with the structure used in the Met API.
- Eliminated the reliance on engagement metadata within CRON jobs.
- Implemented necessary code adjustments to seamlessly integrate with the updated CRON configuration.

## February 05, 2024

- **Task** Change "Superuser" to "Administrator" [DESENG-476](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-476)

## February 02, 2024

- **Task** Updated Timeline widget icons so that the circles are more consistent. [🎟️DESENG-488](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-488)

## February 01, 2024

- **Task** Change name from "Engagement Core" to "Engagement Content". [🎟️DESENG-489](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-489)

## January 29, 2024

- **Task** Updated Babel Traverse library. [🎟️DESENG-474](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-474)
- Run `npm audit fix` to update the vulnerable Babel traverse library.

## January 26, 2024

- **Task** Poll Widget: Front-end. [🎟️DESENG-464](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-464)
- Created UI for Poll Widget.
- Updated Poll widget API and unit tests.

## January 25, 2024

- **Task** Resolve issue preventing met-web from deploying on the Dev OpenShift environment. [🎟️DESENG-469](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-469)
- Remove Epic Engage-related links and update Keycloak link.
- Remove additional authentication method.

## January 24, 2024

- **Task** Update default project type to GDX for all deployments by default. [🎟️DESENG-472](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-472)
- Set the default project type to GDX on all continuous deployment (CD) files.
- Removed the option to deploy to EAO.

## January 22, 2024

- **Task** Poll Widget: Back-end [🎟️DESENG-463](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-463)
- Created Database models for Widget Poll, Poll Answers, Poll Response.
- Created API to manage Widget Poll, Poll Answers, Poll Response.
- Created API to manage Widget Poll, Poll Answers, Poll Response.
- Created Unit tests to test the code.
- **Task** Add missing unit tests for met api [🎟️DESENG-481](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-481)
- Added missing unit tests for met api
Expand Down Expand Up @@ -153,6 +185,7 @@
## January 9, 2024

- **Task** Improvements from Epic [🎟️DESENG-468](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-468)

- Improvements to Survey Result Tracking analytics
- New Rejection Email Template for Closed Engagements
- Export Format for Proponent updated to be in excel format
Expand Down Expand Up @@ -201,9 +234,10 @@
## November 6, 2023

- **Feature**: Switch MET to use Keycloak SSO service [🎟️DESENG-408](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-408)

- Switch all role-based checks on the API to use a single callback function (`current_app.config['JWT_ROLE_CALLBACK']`)
- Added a configurable path `JWT_ROLE_CLAIM` to indicate where your SSO instance places role information in the JWT token. If your access token looks like:
`{ ..., "realm_access": { "roles": [ "role1", "role2"]}}` you would set `JWT_ROLE_CLAIM=realm_access.roles`
`{ ..., "realm_access": { "roles": [ "role1", "role2"]}}` you would set `JWT_ROLE_CLAIM=realm_access.roles`
- Explicitly disable single tenant mode by default to ensure correct multi-tenancy behaviour
- Remove local Keycloak instances and configuration
- Default to the "standard" realm for Keycloak
Expand All @@ -224,7 +258,6 @@
- Remove one old production .env file with obsolete settings
- Changes to DEVELOPMENT.md to reflect the current state of the project


## v1.0.0 - 2023-10-01

- App handoff from EAO to GDX
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""create_engagement_translation_table

Revision ID: c4f7189494ed
Revises: 35124d2e41cb
Revises: dbe023373f4f
Create Date: 2024-03-07 16:38:26.958748

"""
Expand All @@ -11,36 +11,48 @@

# revision identifiers, used by Alembic.
revision = 'c4f7189494ed'
down_revision = '35124d2e41cb'
down_revision = 'dbe023373f4f'
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('engagement_translation',
sa.Column('created_date', sa.DateTime(), nullable=False),
sa.Column('updated_date', sa.DateTime(), nullable=True),
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
sa.Column('engagement_id', sa.Integer(), nullable=False),
sa.Column('language_id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=50), nullable=True),
sa.Column('description', sa.Text(), nullable=True),
sa.Column('rich_description', postgresql.JSON(astext_type=sa.Text()), nullable=True),
sa.Column('content', sa.Text(), nullable=True),
sa.Column('rich_content', postgresql.JSON(astext_type=sa.Text()), nullable=True),
sa.Column('consent_message', postgresql.JSON(astext_type=sa.Text()), nullable=True),
sa.Column('slug', sa.String(length=200), nullable=True),
sa.Column('upcoming_status_block_text', postgresql.JSON(astext_type=sa.Text()), nullable=True),
sa.Column('open_status_block_text', postgresql.JSON(astext_type=sa.Text()), nullable=True),
sa.Column('closed_status_block_text', postgresql.JSON(astext_type=sa.Text()), nullable=True),
sa.Column('created_by', sa.String(length=50), nullable=True),
sa.Column('updated_by', sa.String(length=50), nullable=True),
sa.ForeignKeyConstraint(['engagement_id'], ['engagement.id'], ondelete='CASCADE'),
sa.ForeignKeyConstraint(['language_id'], ['language.id'], ondelete='CASCADE'),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('engagement_id', 'language_id', name='_engagement_language_uc')
)
sa.Column('created_date', sa.DateTime(), nullable=False),
sa.Column('updated_date', sa.DateTime(), nullable=True),
sa.Column('id', sa.Integer(),
autoincrement=True, nullable=False),
sa.Column('engagement_id', sa.Integer(), nullable=False),
sa.Column('language_id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=50), nullable=True),
sa.Column('description', sa.Text(), nullable=True),
sa.Column('rich_description', postgresql.JSON(
astext_type=sa.Text()), nullable=True),
sa.Column('content', sa.Text(), nullable=True),
sa.Column('rich_content', postgresql.JSON(
astext_type=sa.Text()), nullable=True),
sa.Column('consent_message', postgresql.JSON(
astext_type=sa.Text()), nullable=True),
sa.Column('slug', sa.String(length=200), nullable=True),
sa.Column('upcoming_status_block_text', postgresql.JSON(
astext_type=sa.Text()), nullable=True),
sa.Column('open_status_block_text', postgresql.JSON(
astext_type=sa.Text()), nullable=True),
sa.Column('closed_status_block_text', postgresql.JSON(
astext_type=sa.Text()), nullable=True),
sa.Column('created_by', sa.String(
length=50), nullable=True),
sa.Column('updated_by', sa.String(
length=50), nullable=True),
sa.ForeignKeyConstraint(
['engagement_id'], ['engagement.id'], ondelete='CASCADE'),
sa.ForeignKeyConstraint(
['language_id'], ['language.id'], ondelete='CASCADE'),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('engagement_id', 'language_id',
name='_engagement_language_uc')
)
# ### end Alembic commands ###


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"""Remove default_value from engagement_metadata_taxa and add unique constraint

Revision ID: dbe023373f4f
Revises: 35124d2e41cb
Create Date: 2024-01-30 17:05:25.313222

"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql

# revision identifiers, used by Alembic.
revision = 'dbe023373f4f'
down_revision = '35124d2e41cb'
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_unique_constraint(None, 'engagement_metadata_taxa', ['id'])
op.drop_column('engagement_metadata_taxa', 'default_value')
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('engagement_metadata_taxa', sa.Column(
'default_value', sa.TEXT(), autoincrement=False, nullable=True))
op.drop_constraint(None, 'engagement_metadata_taxa', type_='unique')
# ### end Alembic commands ###
10 changes: 9 additions & 1 deletion met-api/src/met_api/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,18 @@
from flask_jwt_oidc import JwtManager
from flask_jwt_oidc.exceptions import AuthError

from met_api.utils.constants import TENANT_ID_HEADER

auth_methods = { # for swagger documentation
'apikey': {
'type': 'apiKey',
'in': 'header',
'name': 'Authorization'
},
'tenant': {
'type': 'apiKey',
'in': 'header',
'name': TENANT_ID_HEADER
}
}

Expand Down Expand Up @@ -53,7 +60,8 @@ def decorated(*args, **kwargs):
token = jwt.get_token_auth_header()
# pylint: disable=protected-access
jwt._validate_token(token)
g.authorization_header = request.headers.get('Authorization', None)
g.authorization_header = request.headers.get(
'Authorization', None)
g.token_info = g.jwt_oidc_token_info
except AuthError:
g.authorization_header = None
Expand Down
Loading
Loading