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

[CL-553] Migrate CL to Control Flow syntax #12390

Merged
merged 11 commits into from
Feb 3, 2025
Merged

[CL-553] Migrate CL to Control Flow syntax #12390

merged 11 commits into from
Feb 3, 2025

Conversation

Hinton
Copy link
Member

@Hinton Hinton commented Dec 13, 2024

🎟️ Tracking

https://bitwarden.atlassian.net/browse/CL-553

📔 Objective

Explore how the new control flow syntax looks and behaves in a limited scope (i.e. Component Library).

📸 Screenshots

⏰ Reminders before review

  • Contributor guidelines followed
  • All formatters and local linters executed and passed
  • Written new unit and / or integration tests where applicable
  • Protected functional changes with optionality (feature flags)
  • Used internationalization (i18n) for all UI strings
  • CI builds passed
  • Communicated to DevOps any deployment requirements
  • Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team

🦮 Reviewer guidelines

  • 👍 (:+1:) or similar for great changes
  • 📝 (:memo:) or ℹ️ (:information_source:) for notes or general info
  • ❓ (:question:) for questions
  • 🤔 (:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion
  • 🎨 (:art:) for suggestions / improvements
  • ❌ (:x:) or ⚠️ (:warning:) for more significant problems or concerns needing attention
  • 🌱 (:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt
  • ⛏ (:pick:) for minor or nitpick changes

@Hinton Hinton requested a review from a team as a code owner December 13, 2024 13:36
@Hinton Hinton requested a review from willmartian December 13, 2024 13:36
@Hinton Hinton marked this pull request as draft December 13, 2024 13:37
@willmartian willmartian requested a review from vleague2 December 13, 2024 13:39
Copy link
Contributor

github-actions bot commented Dec 13, 2024

Logo
Checkmarx One – Scan Summary & Details2360c81d-72d0-4bb2-a0ea-676b63fc1a19

New Issues (6)

Checkmarx found the following issues in this Pull Request

Severity Issue Source File / Package Checkmarx Insight
MEDIUM Angular_Improper_Type_Pipe_Usage /apps/browser/src/vault/popup/components/vault-v2/vault-header/vault-header-v2.component.html: 21
detailsThe value used in showBadge$ at /apps/browser/src/vault/popup/components/vault-v2/vault-header/vault-header-v2.component.html in line 21 may throw ...
Attack Vector
MEDIUM Angular_Improper_Type_Pipe_Usage /apps/browser/src/vault/popup/components/vault-v2/vault-header/vault-header-v2.component.html: 14
detailsThe value used in buttonSupportingText$ at /apps/browser/src/vault/popup/components/vault-v2/vault-header/vault-header-v2.component.html in line 14...
Attack Vector
MEDIUM Angular_Improper_Type_Pipe_Usage /apps/browser/src/vault/popup/components/vault-v2/vault-header/vault-header-v2.component.html: 14
detailsThe value used in buttonSupportingText$ at /apps/browser/src/vault/popup/components/vault-v2/vault-header/vault-header-v2.component.html in line 14...
Attack Vector
MEDIUM Angular_Improper_Type_Pipe_Usage /apps/browser/src/vault/popup/components/vault-v2/vault-header/vault-header-v2.component.html: 26
detailsThe value used in numberOfAppliedFilters$ at /apps/browser/src/vault/popup/components/vault-v2/vault-header/vault-header-v2.component.html in line ...
Attack Vector
MEDIUM Client_Privacy_Violation /apps/web/src/app/tools/reports/pages/weak-passwords-report.component.html: 19
detailsMethod weak_passwords_report_component at line 19 of /apps/web/src/app/tools/reports/pages/weak-passwords-report.component.html sends user informat...
Attack Vector
MEDIUM Missing_HSTS_Header /libs/common/src/services/api.service.ts: 243
detailsThe web-application does not define an HSTS header, leaving it vulnerable to attack.
Attack Vector
Fixed Issues (9)

Great job! The following issues were fixed in this Pull Request

Severity Issue Source File / Package
MEDIUM Angular_Improper_Type_Pipe_Usage /libs/components/src/navigation/nav-divider.component.html: 1
MEDIUM Client_Privacy_Violation /libs/tools/generator/components/src/username-generator.component.html: 3
MEDIUM Client_Privacy_Violation /libs/tools/generator/components/src/credential-generator-history.component.html: 3
MEDIUM Client_Privacy_Violation /libs/vault/src/components/password-history-view/password-history-view.component.html: 6
MEDIUM Client_Privacy_Violation /apps/web/src/app/tools/password-generator-history.component.html: 11
MEDIUM Client_Privacy_Violation /libs/vault/src/components/password-history-view/password-history-view.component.html: 6
MEDIUM Client_Privacy_Violation /apps/web/src/app/tools/password-generator-history.component.html: 11
MEDIUM Client_Privacy_Violation /libs/components/src/color-password/color-password.component.ts: 31
MEDIUM Client_Privacy_Violation /libs/components/src/color-password/color-password.component.ts: 17

Copy link

codecov bot commented Dec 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 35.30%. Comparing base (331c04a) to head (e9e3b66).
Report is 50 commits behind head on main.

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #12390      +/-   ##
==========================================
- Coverage   35.31%   35.30%   -0.02%     
==========================================
  Files        2998     2998              
  Lines       90950    90937      -13     
  Branches    16981    16981              
==========================================
- Hits        32123    32103      -20     
- Misses      56335    56342       +7     
  Partials     2492     2492              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Base automatically changed from arch/standalone-components to main December 17, 2024 22:29
@Hinton Hinton marked this pull request as ready for review January 7, 2025 17:15
@Hinton
Copy link
Member Author

Hinton commented Jan 7, 2025

@willmartian it seems the migration was unable to convert libs/components/src/navigation/nav-item.component.html and we will need to manually migrate it.

@Hinton Hinton changed the title Explore control flow syntax [CL-553] Migrate CL to Control Flow syntax Jan 7, 2025
@@ -44,6 +44,7 @@ export type ChipSelectOption<T> = Option<T> & {
multi: true,
},
],
preserveWhitespaces: false,
Copy link
Member Author

Choose a reason for hiding this comment

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

We needed to disable this on a few components. Platform is exploring disabling this globally.

willmartian
willmartian previously approved these changes Jan 10, 2025
Copy link
Contributor

@willmartian willmartian left a comment

Choose a reason for hiding this comment

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

I am really liking the new control flow. Really improves grok-ability of what is going on in a template. Also, gets rid of ng-container, which always felt a bit weird to me.

Gonna follow this PR up with enabling @angular-eslint/template/prefer-control-flow in libs/components (https://bitwarden.atlassian.net/browse/CL-559)

Copy link
Contributor

Choose a reason for hiding this comment

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

Cool that the migrator could link this if/else even though we were not already using NgIf's else syntax.

Copy link
Member Author

Choose a reason for hiding this comment

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

Nah, I manually migrated this. The migrator doesn't work in storybook.

@willmartian
Copy link
Contributor

@willmartian it seems the migration was unable to convert libs/components/src/navigation/nav-item.component.html and we will need to manually migrate it.

We can do that in a followup; created issue here: https://bitwarden.atlassian.net/browse/CL-558

@willmartian willmartian added the hold do not merge, do not approve yet label Jan 10, 2025
@willmartian
Copy link
Contributor

Holding until after next RC cut.

…-flow

# Conflicts:
#	libs/components/src/dialog/simple-dialog/simple-configurable-dialog/simple-configurable-dialog.service.stories.ts
@Hinton Hinton requested a review from willmartian January 27, 2025 13:58
@Hinton Hinton added needs-qa Marks a PR as requiring QA approval and removed hold do not merge, do not approve yet labels Jan 27, 2025
willmartian
willmartian previously approved these changes Jan 27, 2025
…-flow

# Conflicts:
#	libs/components/src/dialog/dialog/dialog.component.html
#	libs/components/src/form-field/form-field.component.html
#	libs/components/src/layout/layout.component.html
@Hinton Hinton removed the needs-qa Marks a PR as requiring QA approval label Feb 3, 2025
@Hinton
Copy link
Member Author

Hinton commented Feb 3, 2025

Merging, will be tested on main.

@Hinton Hinton merged commit e5ffc16 into main Feb 3, 2025
86 of 87 checks passed
@Hinton Hinton deleted the arch/control-flow branch February 3, 2025 19:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants