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

feat: new-app-install-flow follow up #14699

Draft
wants to merge 9 commits into
base: app-install-flow-2
Choose a base branch
from

Conversation

SomayChauhan
Copy link
Member

@SomayChauhan SomayChauhan commented Apr 22, 2024

fixes CAL-3604

Screenshot 2024-04-22 at 6 38 18 PM

Screenshot 2024-05-11 at 1 31 02 PM

Copy link

vercel bot commented Apr 22, 2024

@SomayChauhan is attempting to deploy a commit to the cal Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

github-actions bot commented Apr 22, 2024

Thank you for following the naming conventions! 🙏 Feel free to join our discord and post your PR link.

Copy link
Contributor

github-actions bot commented Apr 22, 2024

📦 Next.js Bundle Analysis for @calcom/web

This analysis was generated by the Next.js Bundle Analysis action. 🤖

New Page Added

The following page was added to the bundle from the code in this PR:

Page Size (compressed) First Load % of Budget (350 KB)
/apps/installation/[[...step]] 167.32 KB 396.05 KB 113.16%

Seventy-five Pages Changed Size

The following pages changed size from the code in this PR compared to its base branch:

Page Size (compressed) First Load % of Budget (350 KB)
/apps 277.95 KB 506.69 KB 144.77% (🟡 +0.38%)
/apps/[slug] 295.78 KB 524.52 KB 149.86% (🟡 +0.42%)
/apps/[slug]/[...pages] 586.1 KB 814.84 KB 232.81% (🟡 +0.20%)
/apps/categories 255.76 KB 484.49 KB 138.43% (🟡 +0.34%)
/apps/categories/[category] 260.27 KB 489 KB 139.72% (🟡 +0.39%)
/apps/installed/[category] 279.51 KB 508.24 KB 145.21% (🟡 +0.43%)
/auth/setup 149.19 KB 377.93 KB 107.98% (🟡 +0.16%)
/availability 463.73 KB 692.46 KB 197.85% (🟡 +0.34%)
/availability/[schedule] 410.12 KB 638.85 KB 182.53% (🟡 +0.34%)
/bookings/[status] 323.51 KB 552.25 KB 157.78% (🟡 +0.35%)
/enterprise 255.81 KB 484.55 KB 138.44% (🟡 +0.34%)
/event-types 555.38 KB 784.11 KB 224.03% (🟡 +0.24%)
/event-types/[type] 434.33 KB 663.07 KB 189.45% (🟡 +0.20%)
/getting-started/[[...step]] 404.82 KB 633.55 KB 181.01% (🟡 +0.22%)
/insights 474.23 KB 702.97 KB 200.85% (🟡 +0.34%)
/more 255.32 KB 484.06 KB 138.30% (🟡 +0.34%)
/settings/admin 261.34 KB 490.07 KB 140.02% (🟡 +0.27%)
/settings/admin/apps 274.43 KB 503.16 KB 143.76% (🟡 +0.34%)
/settings/admin/apps/[category] 274.41 KB 503.14 KB 143.75% (🟡 +0.35%)
/settings/admin/flags 265.45 KB 494.18 KB 141.20% (🟡 +0.35%)
/settings/admin/impersonation 261.7 KB 490.44 KB 140.12% (🟡 +0.29%)
/settings/admin/oAuth 273.5 KB 502.23 KB 143.50% (🟡 +0.47%)
/settings/admin/orgMigrations/_OrgMigrationLayout 249.71 KB 478.44 KB 136.70% (🟡 +0.20%)
/settings/admin/orgMigrations/moveTeamToOrg 299.35 KB 528.08 KB 150.88% (🟡 +0.41%)
/settings/admin/orgMigrations/moveUserToOrg 318.6 KB 547.34 KB 156.38% (🟡 +0.41%)
/settings/admin/orgMigrations/removeTeamFromOrg 299.09 KB 527.83 KB 150.81% (🟡 +0.39%)
/settings/admin/orgMigrations/removeUserFromOrg 299.1 KB 527.84 KB 150.81% (🟡 +0.40%)
/settings/admin/organizations 262.9 KB 491.64 KB 140.47% (🟡 +0.17%)
/settings/admin/organizations/[id]/edit 261.72 KB 490.45 KB 140.13% (🟡 +0.22%)
/settings/admin/users 263.6 KB 492.33 KB 140.67% (🟡 +0.15%)
/settings/admin/users/[id]/edit 392.2 KB 620.94 KB 177.41% (🟡 +0.32%)
/settings/admin/users/add 391.94 KB 620.68 KB 177.34% (🟡 +0.32%)
/settings/billing 261.44 KB 490.18 KB 140.05% (🟡 +0.24%)
/settings/developer/api-keys 265.51 KB 494.25 KB 141.21% (🟡 +0.15%)
/settings/developer/webhooks/[id] 266.6 KB 495.34 KB 141.53% (🟡 +0.15%)
/settings/developer/webhooks/new 266.59 KB 495.33 KB 141.52% (🟡 +0.15%)
/settings/my-account/appearance 314.25 KB 542.99 KB 155.14% (🟡 +0.32%)
/settings/my-account/calendars 272.27 KB 501.01 KB 143.15% (🟡 +0.19%)
/settings/my-account/conferencing 273.5 KB 502.24 KB 143.50% (🟡 +0.29%)
/settings/my-account/general 379.39 KB 608.13 KB 173.75% (🟡 +0.32%)
/settings/my-account/out-of-office 266.1 KB 494.84 KB 141.38% (🟡 +0.15%)
/settings/my-account/profile 404.74 KB 633.47 KB 180.99% (🟡 +0.25%)
/settings/organizations/[id]/about 155.86 KB 384.59 KB 109.88% (🟡 +0.14%)
/settings/organizations/[id]/add-teams 155.85 KB 384.58 KB 109.88% (🟡 +0.14%)
/settings/organizations/[id]/onboard-members 171.87 KB 400.6 KB 114.46% (🟡 +0.14%)
/settings/organizations/appearance 285.36 KB 514.1 KB 146.89% (🟡 +0.32%)
/settings/organizations/billing 261.53 KB 490.26 KB 140.07% (🟡 +0.26%)
/settings/organizations/dsync 330.71 KB 559.44 KB 159.84% (🟡 +0.20%)
/settings/organizations/general 349.02 KB 577.75 KB 165.07% (🟡 +0.32%)
/settings/organizations/members 429.77 KB 658.5 KB 188.14% (🟡 +0.32%)
/settings/organizations/new 155.86 KB 384.6 KB 109.89% (🟡 +0.13%)
/settings/organizations/platform/oauth-clients 264.02 KB 492.76 KB 140.79% (🟡 +0.31%)
/settings/organizations/platform/oauth-clients/create 264.17 KB 492.9 KB 140.83% (🟡 +0.32%)
/settings/organizations/privacy 266.91 KB 495.65 KB 141.61% (🟡 +0.32%)
/settings/organizations/profile 397.51 KB 626.24 KB 178.93% (🟡 +0.32%)
/settings/organizations/sso 272.26 KB 500.99 KB 143.14% (🟡 +0.32%)
/settings/organizations/teams/other 262.1 KB 490.83 KB 140.24% (🟡 +0.18%)
/settings/organizations/teams/other/[id]/appearance 274.25 KB 502.98 KB 143.71% (🟡 +0.32%)
/settings/organizations/teams/other/[id]/members 269.07 KB 497.8 KB 142.23% (🟡 +0.32%)
/settings/organizations/teams/other/[id]/profile 467.94 KB 696.67 KB 199.05% (🟡 +0.21%)
/settings/security/impersonation 266.36 KB 495.09 KB 141.46% (🟡 +0.15%)
/settings/security/password 303.85 KB 532.59 KB 152.17% (🟡 +0.32%)
/settings/security/sso 271.51 KB 500.25 KB 142.93% (🟡 +0.32%)
/settings/security/two-factor-auth 269.79 KB 498.52 KB 142.44% (🟡 +0.14%)
/settings/teams 261 KB 489.74 KB 139.92% (🟡 +0.25%)
/settings/teams/[id]/appearance 274.23 KB 502.97 KB 143.70% (🟡 +0.33%)
/settings/teams/[id]/billing 261.52 KB 490.26 KB 140.07% (🟡 +0.25%)
/settings/teams/[id]/members 381.23 KB 609.97 KB 174.28% (🟡 +0.32%)
/settings/teams/[id]/onboard-members 171.04 KB 399.78 KB 114.22% (🟡 +0.14%)
/settings/teams/[id]/profile 468.77 KB 697.51 KB 199.29% (🟡 +0.20%)
/settings/teams/new 198.46 KB 427.2 KB 122.06% (🟡 +0.15%)
/teams 255.55 KB 484.28 KB 138.37% (🟡 +0.34%)
/upgrade 255.67 KB 484.4 KB 138.40% (🟡 +0.34%)
/workflows 286.89 KB 515.62 KB 147.32% (🟡 +0.34%)
/workflows/[workflow] 409.25 KB 637.99 KB 182.28% (🟡 +0.34%)
Details

Only the gzipped size is provided here based on an expert tip.

First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

The "Budget %" column shows what percentage of your performance budget the First Load total takes up. For example, if your budget was 100kb, and a given page's first load size was 10kb, it would be 10% of your budget. You can also see how much this has increased or decreased compared to the base branch of your PR. If this percentage has increased by 20% or more, there will be a red status indicator applied, indicating that special attention should be given to this. If you see "+/- <0.01%" it means that there was a change in bundle size, but it is a trivial enough amount that it can be ignored.

@SomayChauhan SomayChauhan changed the base branch from main to app-install-flow-2 April 23, 2024 06:28
Copy link
Contributor

@joeauyeung joeauyeung left a comment

Choose a reason for hiding this comment

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

To specify, on my comment. We should remove any instances of userAdminTeams now that we have the new install flow.

This is an expensive query since we're looking for all teams & orgs the user is an admin / owner of. This should live in the new app install flow.

@SomayChauhan
Copy link
Member Author

Got it!!, i'm looking into it

@keithwillcode keithwillcode added the core area: core, team members only label Apr 30, 2024
getParentInfo?: boolean;
includeCredentials?: boolean;
}): Promise<UserAdminTeams> => {
const teams = await prisma.team.findMany({
Copy link
Member Author

Choose a reason for hiding this comment

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

instead of querying all teams and then looking weather this team has current user as admin/owner (which is slow because we have to look at all the teams in db)

}): Promise<UserAdminTeams> => {
const teams = await prisma.team.findMany({
export const getUserAdminTeams = async (userId: number): Promise<number[]> => {
const user = await prisma.user.findFirst({
Copy link
Member Author

Choose a reason for hiding this comment

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

queried the user using userId got all his teams and then filter all the teams that have the current user as admin/owner
(this should be faster because user_id is the primary key for the table so getting all the teams of user should be fast)

},
select: {
teams: {
where: {
Copy link
Member Author

Choose a reason for hiding this comment

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

filter all the teams that have the current user as admin/owner

accepted: true,
role: { in: [MembershipRole.ADMIN, MembershipRole.OWNER] },
},
select: { id: true },
Copy link
Member Author

Choose a reason for hiding this comment

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

only select the required fields

@SomayChauhan SomayChauhan marked this pull request as ready for review May 1, 2024 06:03
@graphite-app graphite-app bot requested a review from a team May 1, 2024 06:03
@graphite-app graphite-app bot added the community Created by Linear-GitHub Sync label May 1, 2024
@graphite-app graphite-app bot requested a review from a team May 1, 2024 06:03
@dosubot dosubot bot added the ✨ feature New feature or request label May 1, 2024
Copy link

graphite-app bot commented May 1, 2024

Graphite Automations

"Add community label" took an action on this PR • (05/01/24)

1 label was added to this PR based on Keith Williams's automation.

"Add foundation team as reviewer" took an action on this PR • (05/01/24)

1 reviewer was added to this PR based on Keith Williams's automation.

"Add consumer team as reviewer" took an action on this PR • (05/01/24)

1 reviewer was added to this PR based on Keith Williams's automation.

@SomayChauhan SomayChauhan marked this pull request as draft May 1, 2024 06:50
teamId,
});

const res = await fetch(
Copy link
Member Author

Choose a reason for hiding this comment

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

decided to remove this api call and use useAddAppMutation instead

},
mutation.mutate(
{
isOmniInstall: true,
Copy link
Member Author

Choose a reason for hiding this comment

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

setting isOmniInstall to true so that we can be redirected back to /apps/installation/[step]?slug
if not set it redirects to apps/installed/[category] and the redirection can't be controlled

@@ -7,9 +7,6 @@ export function decodeOAuthState(req: NextApiRequest) {
return undefined;
}
const state: IntegrationOAuthCallbackState = JSON.parse(req.query.state);
if (state.appOnboardingRedirectUrl) {
Copy link
Member Author

Choose a reason for hiding this comment

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

no longer needed as we now use returnTo only

@@ -225,7 +225,6 @@ export const AppPage = ({
multiInstall
concurrentMeetings={concurrentMeetings}
paid={paid}
dirName={dirName}
Copy link
Contributor

Choose a reason for hiding this comment

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

If we're removing the use of the dirName, let's remove the prop from the component as well.

return (
<Dropdown>
Copy link
Contributor

Choose a reason for hiding this comment

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

I love to see this gone.

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's try and completely remove the need for userAdminTeams prop here. Ideally we should be using the new app install flow.

Copy link
Contributor

Choose a reason for hiding this comment

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

I would argue the aim of this PR should be to get rid of this function. The new app install flow handles this in better way. I see that this function is only used for apps so the rest of the web app doesn't rely on it.

Anything that relied on this should be handled in the new app install flow.

Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure if we can remove it completly
we need this function for -

  • fetching the credentials for an app for the current logged in user and all his teams LINK, for this we need the list of all the teams the user is admin/owner of

  • this credentials are used to check weather this app has been added or not (the green badge that says 2 installed)

  • weather to show the install button or not here for instance i have installed fathom on both my personal acc and the only team i have so we dont show the install button
    Screenshot 2024-05-02 at 1 30 39 PM

  • also getUserAdminTeams is also called in throwIfNotHaveAdminAccessToTeam which is a check that prevents non-admin/owner to install an app to a team

so we do need the list of teams the logged in user is admin/owner of
plus now that we are querying it using the primary key, it shouldnt be that bad!!

@SomayChauhan SomayChauhan changed the title feat: remove dropdown from app-store and redirect to new-app-install-flow feat: new-app-install-flow follow up May 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Created by Linear-GitHub Sync core area: core, team members only ✨ feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants