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

[PM-1214] device management screen #12455

Open
wants to merge 32 commits into
base: main
Choose a base branch
from

Conversation

alec-livefront
Copy link
Collaborator

@alec-livefront alec-livefront commented Dec 17, 2024

🎟️ Tracking

https://bitwarden.atlassian.net/browse/PM-1214?atlOrigin=eyJpIjoiOGUyMGIwODJmODQwNDlkMjlhZmFhZDYxNmVjN2EyZGEiLCJwIjoiaiJ9

📔 Objective

Adds a device management tab under settings -> security. Allows a user to manage the devices of their account by approving them, logging them out or deleting them.

📸 Screenshots

GMT20241220-201106_Clip_Alec.Rippberger.s.Clip.12_20_2024.mp4

⏰ 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

Copy link
Contributor

github-actions bot commented Dec 17, 2024

Logo
Checkmarx One – Scan Summary & Detailsc2367472-8cd9-471f-abdf-8445686944ef

Fixed Issues

Severity Issue Source File / Package
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault-v2/vault-list-items-container/vault-list-items-container.component.html: 15

Copy link

codecov bot commented Dec 17, 2024

Codecov Report

Attention: Patch coverage is 7.50000% with 74 lines in your changes missing coverage. Please review.

Project coverage is 33.77%. Comparing base (6d65ce9) to head (59cae5b).

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...h/settings/security/device-management.component.ts 0.00% 60 Missing ⚠️
...services/devices/devices.service.implementation.ts 0.00% 6 Missing ⚠️
.../auth/settings/security/security-routing.module.ts 0.00% 3 Missing ⚠️
...c/app/auth/settings/security/security.component.ts 40.00% 2 Missing and 1 partial ⚠️
apps/browser/src/background/main.background.ts 0.00% 1 Missing ⚠️
...uth/services/devices-api.service.implementation.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #12455      +/-   ##
==========================================
- Coverage   33.78%   33.77%   -0.02%     
==========================================
  Files        2912     2913       +1     
  Lines       90731    90806      +75     
  Branches    17159    17175      +16     
==========================================
+ Hits        30654    30670      +16     
- Misses      57688    57747      +59     
  Partials     2389     2389              

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

@alec-livefront alec-livefront changed the title Auth/pm 1214/device management screen [PM-1214] device management screen Dec 18, 2024
@alec-livefront
Copy link
Collaborator Author

alec-livefront commented Dec 18, 2024

I could use help on a few things I'm unsure of on this PR:

  1. The ticket calls for virtual scroll on the table. However, when I try to implement bit-table-scroll I get Unhandled error in angular TypeError: Cannot read properties of undefined (reading 'template'). I looked at the vnext-clients component to see if I could spot what might be different here but came up empty.
  2. I'm not sure how to implement the removeDevice, approveDevice or logOutDevice functions (or if it is currently possible with the backend). I tried to flush out removeDevice using the devices/{id}/deactivate endpoint but I don't believe it is working. I could use some direction on what to do here.
  3. The Figma designs seem to show relative times for the last login (like "This week", "Last month". I'm wondering if there is existing logic to convert a date to a human readable time exists elsewhere in the app? I couldn't find anything. It shouldn't be hard to write but I wanted to be consistent. Another issue is I'm wondering how to get the last login date - it doesn't seem to be included in the device info from the backend.

@alec-livefront alec-livefront marked this pull request as ready for review December 20, 2024 16:09
@alec-livefront alec-livefront requested a review from a team as a code owner December 20, 2024 16:09
Comment on lines 360 to 365
getCurrentDevice$(): Observable<DeviceResponse> {
return defer(async () => {
const deviceIdentifier = await this.appIdService.getAppId();
return this.devicesApiService.getDeviceByIdentifier(deviceIdentifier);
});
}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ : I believe this new method better belongs on the DevicesService vs this service. This also allows you to undo the strict typing updates here so we don't have to re-test the device trust implementation for this change.

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.

This is looking great! I've got a few UI suggestions and some minor clean up items below:

Copy link
Contributor

Choose a reason for hiding this comment

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

💡 : upon watching the video, I think we should implement a loading state for the table which doesn't show the table until the data is loaded.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I've added a loading state for when the table is loading, and added the spinner for when async actions are waiting to complete: 0932e18

Comment on lines 2 to 5
<h2>
{{ "devices" | i18n }}
<i class="bwi bwi-question-circle tw-h-5 tw-w-5 bwi-color-primary" aria-hidden="true"></i>
</h2>
Copy link
Contributor

Choose a reason for hiding this comment

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

The figma calls for a loading icon here when async actions like remove device or log out are being taken

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

}

const category = this.i18nService.t(metadata.category);
return metadata.platform ? `${category} - ${metadata.platform}` : category;
Copy link
Contributor

Choose a reason for hiding this comment

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

❓ : Nice job building out this metadata out. Do you think we should translate "Unknown" as a platform?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Can you elaborate on that? Are you talking about the DeviceType.UnknownBrowser having a platform of "Unknown"?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I'm sorry that comment was not as clear as I meant for it to be. "Unknown" is the only non proper noun so we could translate it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah ok that makes sense! 4bb0459

Comment on lines 200 to 204
this.toastService.showToast({
title: "",
message: this.i18nService.t("errorOccurred"),
variant: "warning",
});
Copy link
Contributor

Choose a reason for hiding this comment

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

❓ : can we change this to be a call to this.validationService.showError(error); instead? As far as I know, that's the general recommendation for non-specific error handling.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Comment on lines 33 to 37
{
path: "device-management",
component: DeviceManagementComponent,
data: { titleId: "devices" },
},
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ : I believe this should be gated behind the feature flag guard for web app approvals, right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

🏅 Thank you for refactoring this to use abstract and actual methods instead of arrow functions.

Copy link
Contributor

Choose a reason for hiding this comment

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

Excellent docs throughout. Thank you!

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

🏅 Thank you for adding this missing test suite!

@rr-bw rr-bw self-requested a review December 20, 2024 19:56
@@ -0,0 +1,79 @@
<div class="tabbed-content">
Copy link
Contributor

Choose a reason for hiding this comment

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

Question: Why tabbed-content? Did you mean tabbed-header? And why not use Tailwind?

And a slight UI adjustment: The header for the Devices table isn't quite formatted according to Figma. There should be a bit more spacing between the heading and subheading/paragraph text. (It also doesn't look the same as the headers in the other tabs: Master Password, Two-step login).

Figma

Screenshot 2024-12-27 at 2 26 06 PM

Current Implementation

Screenshot 2024-12-27 at 2 26 16 PM

Comment on lines +4 to +7
<i
class="bwi bwi-question-circle tw-flex tw-items-center tw-h-4 tw-w-4 bwi-color-primary"
aria-hidden="true"
></i>
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a corresponding link/popover text for this question mark icon?

*ngFor="let col of columnConfig"
[class]="col.headerClass"
bitCell
[bitSortable]="col.sortable ? col.name : null"
Copy link
Contributor

Choose a reason for hiding this comment

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

For me, the "Current Session" is the second item. It should be the first (according to Jira task).

Screenshot 2024-12-27 at 2 32 06 PM

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.

3 participants