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

GetAuthenticatedUser in Dashboard #19142

Merged
merged 13 commits into from
Dec 6, 2023
Merged

Conversation

AlexTugarev
Copy link
Member

@AlexTugarev AlexTugarev commented Nov 27, 2023

Description

This PR introduces UserService.GetAuthenticatedUser RPC in dashboard.

The scope of this PR:

  • enable the FE shim
  • refactor the dashboard components to work with gRPC User type for rendering

Out of scope, primarily to keep this PR reviewable at all:

  • NO migrating the mutations, the API proto is WIP
  • NO implementation on server yet
Summary generated by Copilot

🤖[deprecated] Generated by Copilot at 8e41547

This pull request adds a new way to fetch the current user data from the public API using a custom React Query hook and a new user service. It also updates the cache version and exports a workspace autostart option interface from the gitpod-protocol. These changes improve the dashboard data loading and user preferences management.

Related Issue(s)

Fixes #

How to test

  1. Ensure the FF is disabled (shim version only!)
  2. Sign in first time
    • Onboard
    • Update your profile details in Settings
  3. Start a workspace, but first change some settings
    • Try to start a workspace on the same repo in a new tab, verify you see the settings saved previously

Documentation

Preview status

Gitpod was successfully deployed to your preview environment.

Build Options

Build
  • /werft with-werft
    Run the build with werft instead of GHA
  • leeway-no-cache
  • /werft no-test
    Run Leeway with --dont-test
Publish
  • /werft publish-to-npm
  • /werft publish-to-jb-marketplace
Installer
  • analytics=segment
  • with-dedicated-emulation
  • workspace-feature-flags
    Add desired feature flags to the end of the line above, space separated
Preview Environment / Integration Tests
  • /werft with-local-preview
    If enabled this will build install/preview
  • /werft with-preview
  • /werft with-large-vm
  • /werft with-gce-vm
    If enabled this will create the environment on GCE infra
  • /werft preemptible
    Saves cost. Untick this only if you're really sure you need a non-preemtible machine.
  • with-integration-tests=all
    Valid options are all, workspace, webapp, ide, jetbrains, vscode, ssh. If enabled, with-preview and with-large-vm will be enabled.
  • with-monitoring

/hold

@AlexTugarev AlexTugarev force-pushed the at/user-getauthenticated-dashboard branch from 3c3480d to 21fd862 Compare November 27, 2023 11:23
@roboquat roboquat added size/XXL and removed size/L labels Nov 27, 2023
Base automatically changed from at/user.proto to main November 28, 2023 10:42
@AlexTugarev AlexTugarev force-pushed the at/user-getauthenticated-dashboard branch 4 times, most recently from e44ab89 to f3a1cc4 Compare November 29, 2023 09:01
@AlexTugarev AlexTugarev force-pushed the at/user-getauthenticated-dashboard branch from b0bfab8 to 0881a30 Compare November 29, 2023 10:40
@gitpod-io gitpod-io deleted a comment from github-actions bot Nov 29, 2023
@AlexTugarev AlexTugarev changed the title At/user-getauthenticated-dashboard GetAuthenticatedUser in Dashboard Nov 29, 2023
@AlexTugarev AlexTugarev force-pushed the at/user-getauthenticated-dashboard branch from c71ddd7 to 79b52fc Compare November 29, 2023 15:44
@AlexTugarev AlexTugarev force-pushed the at/user-getauthenticated-dashboard branch 3 times, most recently from 996e47a to 9155f4d Compare December 4, 2023 13:17
@AlexTugarev AlexTugarev marked this pull request as ready for review December 4, 2023 13:21
@AlexTugarev AlexTugarev requested a review from a team as a code owner December 4, 2023 13:21
@AlexTugarev
Copy link
Member Author

@akosyakov and @mustard-mh, I think everything is addressed now. Pray for another round of tests.

@@ -21,37 +20,24 @@ export default function SelectIDE(props: SelectIDEProps) {
const { user, setUser } = useContext(UserContext);
const updateUser = useUpdateCurrentUserMutation();

// Only exec once when we access this component
useEffect(() => {
Copy link
Member

Choose a reason for hiding this comment

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

it is not required anymore? cc @mustard-mh

@AlexTugarev AlexTugarev force-pushed the at/user-getauthenticated-dashboard branch 3 times, most recently from 2091f1f to 7664094 Compare December 5, 2023 16:23
@AlexTugarev
Copy link
Member Author

Updating the email address on Account page was broken. 5faa671 should fix and clean up more.

That said, I need another test round. Going to use the the recorded tests of @akosyakov for the first time 🎉

@@ -312,3 +313,53 @@ export class UserService {
log.info("User verified", { userId: user.id });
}
}

// TODO: refactor where this is referenced so it's more clearly tied to just analytics-tracking
// Let other places rely on the ProfileDetails type since that's what we store
Copy link
Member Author

Choose a reason for hiding this comment

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

need to remove this comment 🙈
but that describes exactly what was done here, the flat shape for analytics is not to be used on dashboard, as we already have ProfileDetails. especially, during the actual task of adapting new API this broke silently, as ProfileDetails and this one are not 100% compatible.

@AlexTugarev AlexTugarev force-pushed the at/user-getauthenticated-dashboard branch from 9afce3a to 6071bd0 Compare December 6, 2023 11:03
Copy link
Member

@akosyakov akosyakov left a comment

Choose a reason for hiding this comment

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

it works well, i reviewed code and tested usual flow, i did not test dedicated setup and then a user is owner of installation.

Also it would be good not introducing a dependency on API from db, only keep it in server.

@AlexTugarev
Copy link
Member Author

/unhold

@roboquat roboquat merged commit e4ccbf0 into main Dec 6, 2023
16 checks passed
@roboquat roboquat deleted the at/user-getauthenticated-dashboard branch December 6, 2023 15:42
@@ -101,7 +100,6 @@ export class TeamDBImpl extends TransactionalDBImpl<TeamDB> implements TeamDB {
return {
userId: u.id,
fullName: u.fullName || u.name,
primaryEmail: User.getPrimaryEmail(u),
Copy link
Contributor

Choose a reason for hiding this comment

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

@AlexTugarev spec.ts file not updated so main build was failed.

Is it safe to remove? Since there're lots of places will use findMembersByTeam function

Copy link
Member Author

Choose a reason for hiding this comment

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

lots of places will use findMembersByTeam

@mustard-mh, that's a problem actually. We're only using the full version of MemberInfos in one place, when listing members. All other places just need to know the user id of members.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed in #19207

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants