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-106] use CL's DialogService in Desktop & Browser #5875

Merged
merged 22 commits into from
Aug 16, 2023

Conversation

willmartian
Copy link
Contributor

@willmartian willmartian commented Jul 22, 2023

Type of change

- [ ] Bug fix
- [ ] New feature development
- [x] Tech debt (refactoring, code cleanup, dependency upgrades, etc)
- [ ] Build/deploy pipeline (DevOps)
- [ ] Other

Relies on: #5890

Objective

  • Desktop and Browser will now use the CL's DialogService
    • The DialogServiceAbstraction was deleted, and all imports of it were updated to the CL's DialogService.
    • DialogService.open is now available in Desktop and Browser, meaning the ModalService can be fully deprecated.
    • The BrowserDialogService and ElectronDialogService were deleted. SimpleDialogs in all clients will now use the CL implementation.
  • Resolve circular dependency between libs/angular and libs/components
    • SimpleDialogComponent and related files were moved to libs/components.
    • libs/angular is now a restricted import in the CL
  • SimpleDialogType and SimpleDialogCloseType are now types instead of enum
    • After moving the enums to the CL, I was running into an issue where they were undefined at runtime in test files. This looks like an issue with ts-jest and re-exporting enums in multiple files: [Bug]: Exported enums not working on tests kulshekhar/ts-jest#3397
    • (I also dislike TS enums in general, and since I am diffing all of these files anyways, might as well use this as my chance to get rid of the enum. 😈)

Code changes

  • .eslintrc.json: Added restricted imports
  • libs/angular/src/services/modal.service.ts: Added deprecation note
  • libs/components/src/dialog/dialog.service.ts: Updated imports; removed DialogServiceAbstraction; added translate method that is called by SimpleDialogComponent
  • libs/components/src/dialog/simple-dialog/types.ts: Colocated SimpleDialog types
  • libs/shared/tsconfig.libs.json: Added @bitwarden/components import alias
  • libs/angular/src/services/dialog/*: deleted
  • Everything else: Updated imports to DialogServiceAbstraction; removed SimpleDialog enums

Screenshots

DialogService.open with bit-dialog in browser extension:

Screen.Recording.2023-07-24.at.10.19.33.AM.mov

DialogService.open with bit-dialog on desktop:

Screen.Recording.2023-07-24.at.10.36.56.AM.mov

Before you submit

  • Please add unit tests where it makes sense to do so (encouraged but not required)
  • If this change requires a documentation update - notify the documentation team
  • If this change has particular deployment requirements - notify the DevOps team
  • Ensure that all UI additions follow WCAG AA requirements

@github-actions github-actions bot added the needs-qa Marks a PR as requiring QA approval label Jul 22, 2023
@bitwarden-bot
Copy link

bitwarden-bot commented Jul 22, 2023

Logo
Checkmarx One – Scan Summary & Details7ea08dac-58dd-4f86-8c0a-4b50c01491f2

Fixed Issues

Severity Issue Source File / Package Checkmarx Insight
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/keepass2-xml-importer.ts: 60 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 132 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 132 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 132 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 132 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 132 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 132 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 132 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 132 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 132 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 132 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 132 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 132 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 132 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 132 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 132 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 132 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 132 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 132 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 132 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 132 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 132 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 132 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 132 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 132 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 132 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 132 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 132 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 132 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 132 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 132 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/passwordsafe-xml-importer.ts: 35 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/passworddragon-xml-importer.ts: 28 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/keepass2-xml-importer.ts: 114 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/keepass2-xml-importer.ts: 67 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/keepass2-xml-importer.ts: 71 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/keepass2-xml-importer.ts: 72 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 132 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/passwordsafe-xml-importer.ts: 35 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/passworddragon-xml-importer.ts: 28 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 56 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 53 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 52 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 51 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 50 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 49 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 48 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 47 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 46 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 45 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 44 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 43 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 42 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 41 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 40 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 39 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 38 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 37 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 36 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 35 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 34 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 33 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 32 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 31 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 30 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 29 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 28 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 27 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 26 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 56 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 53 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 52 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 51 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 50 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 49 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 48 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 47 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 46 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 45 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 44 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 43 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 42 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 41 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 40 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 39 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 38 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 37 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 36 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 35 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 34 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 33 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 32 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 31 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 30 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 29 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 28 Attack Vector
LOW Use_Of_Hardcoded_Password /libs/importer/src/importers/base-importer.ts: 27 Attack Vector
LOW Use_Of_Hardcoded_Password

More results are available on AST platform

@willmartian willmartian changed the title [CL-106] dialog service desktop browser [CL-106] use CL's DialogService in Desktop & Browser Jul 24, 2023
@willmartian willmartian marked this pull request as ready for review August 8, 2023 03:49
@willmartian willmartian requested review from a team as code owners August 8, 2023 03:49
@willmartian willmartian requested a review from a team as a code owner August 8, 2023 03:49
.eslintrc.json Show resolved Hide resolved
libs/components/src/dialog/simple-dialog/types.ts Outdated Show resolved Hide resolved
apps/desktop/src/app/tools/export/export.component.ts Outdated Show resolved Hide resolved
@willmartian willmartian requested a review from Hinton August 8, 2023 16:29
Hinton
Hinton previously approved these changes Aug 15, 2023
djsmith85
djsmith85 previously approved these changes Aug 15, 2023
Copy link
Contributor

@djsmith85 djsmith85 left a comment

Choose a reason for hiding this comment

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

Changes are looking great! Nice work on this 🚀

Copy link
Member

@shane-melton shane-melton left a comment

Choose a reason for hiding this comment

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

Changes related to AC look good!

Copy link
Contributor

@Thomas-Avery Thomas-Avery left a comment

Choose a reason for hiding this comment

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

SM changes look good, thank you.

Copy link
Member

@jlf0dev jlf0dev left a comment

Choose a reason for hiding this comment

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

Looks good! I feel the same about enums so nice to see the unions. Not importing makes it slightly more difficult to refactor/rename, but seems like everyone else is good with that so 👍

Copy link
Contributor

@JaredSnider-Bitwarden JaredSnider-Bitwarden left a comment

Choose a reason for hiding this comment

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

LGTM!

Only a single non blocking question.

@@ -21,6 +21,9 @@ export class ModalConfig<D = any> {
replaceTopModal?: boolean;
}

/**
* @deprecated Use the Component Library's `DialogService` instead.
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor question (non-blocking): should we include a target date + tech debt item for cleaning up and removing this service?

Copy link
Member

@gbubemismith gbubemismith left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@cyprain-okeke cyprain-okeke left a comment

Choose a reason for hiding this comment

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

LGTM!

@willmartian willmartian removed the needs-qa Marks a PR as requiring QA approval label Aug 16, 2023
@willmartian willmartian merged commit a4fcd62 into master Aug 16, 2023
55 of 56 checks passed
@willmartian willmartian deleted the pm/CL-106-dialog-service-desktop-browser branch August 16, 2023 12:26
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.

10 participants