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

Org page #800

Merged
merged 69 commits into from
Jun 14, 2024
Merged

Org page #800

merged 69 commits into from
Jun 14, 2024

Conversation

rmunn
Copy link
Contributor

@rmunn rmunn commented May 14, 2024

Fixes #779.

Add an org page, parallel to the project page (and reusing several of its components), but with a slightly different layout, using tabs for the main body of the page.

Work done:

  • Extracted common code from project page for header, details list (created date, description, etc.)
  • Extracted members list code into common component
    • Currently hard-coded to use ProjectRole
  • Edited MembersList component to use a generic role type that can be filled by either ProjectRole or OrgRole
  • Used MembersList component in org page
  • MembersList component now has a filter bar thanks to @myieye
  • MembersList component now can switch between badge list and table view
  • Separated MembersList component into project- and org-specific versions; org-specific one is now called OrgMemberTable
  • MembersList component is back to using just ProjectRole, simplifying its code again
  • Add "Add / Invite Member" button to table view so org page can use it

Deferred to other issues/PRs:

  • Add "Bulk add / invite" button to table view so org page can use it
  • Implement projects tab on org page (needs backend work so orgs can own projects)
  • Implement settings tab on org page (will be separate issue)
  • Implement history view on org page, or remove history tab if we're not implementing it anytime soon

Screenshot:

image

Previous screenshots:

  1. Click to view
  2. Click to view
  3. Members list view
  4. Members table view

Copy link

github-actions bot commented May 14, 2024

UI unit Tests

11 tests   11 ✅  0s ⏱️
 3 suites   0 💤
 1 files     0 ❌

Results for commit c9240d6.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented May 14, 2024

C# Unit Tests

52 tests  ±0   52 ✅ ±0   5s ⏱️ -1s
10 suites ±0    0 💤 ±0 
 1 files   ±0    0 ❌ ±0 

Results for commit c9240d6. ± Comparison against base commit eefe404.

♻️ This comment has been updated with latest results.

@rmunn rmunn self-assigned this May 15, 2024
@rmunn
Copy link
Contributor Author

rmunn commented May 15, 2024

@hahn-kev @myieye - I'd like feedback on the members list component I just extracted. See PR description for screenshot; currently it looks and functions just like the members list for projects, except that I haven't yet implemented the "Add / Invite Member" button. (Or the bulk-add button). My concern, though, is as follows.

Some orgs might be small ("Language Name Here dictionary team") while others might be large (SIL). For large orgs, I think we'd want a member list layout more similar to the users tab on the admin page, but the MembersList component is quite useful for small orgs. Perhaps we automatically switch between them based on member count, or perhaps we provide a UI toggle for org admins to choose which view we want.

@rmunn
Copy link
Contributor Author

rmunn commented May 17, 2024

@myieye - Commit 3d93f26 reintroduces using roletext.toLowerCase() in the popup notification, but the role name for orgs is currently "user" and I had set the translated text to "member". Now the notification doesn't match what's in the role select choices. Should I change the translated role name to "User" rather than "Member" for orgs?

@rmunn
Copy link
Contributor Author

rmunn commented May 17, 2024

I've now implemented an AddOrgMember button. Chose to copy the AddProjectMember button rather than refactor it to be in common, because the refactor would (IMHO) have added quite a lot of complexity to the button for not that much gain. But I can go back and refactor the two buttons to have common code if it turns out to be a good idea.

@rmunn
Copy link
Contributor Author

rmunn commented May 29, 2024

Org page now has a users table where you can add and remove members. Currently adding is done with a button in the table header, and removing is done via a dropdown:

image

It feels a little cramped: I think there needs to be a bit of vertical space between the tabs and the table, and maybe some space above the tabs. But this is shaping up to be a functional, if still very basic, page. It might be time to call this done and move to the next task: allowing admins to create orgs, and/or allowing orgs to own projects.

@rmunn rmunn marked this pull request as ready for review May 29, 2024 08:20
@rmunn
Copy link
Contributor Author

rmunn commented May 29, 2024

Lots of merge conflicts since I've been on this PR for a while, and the develop has gotten some major work merged recently. But the design work is finished. What's needed next is a bit of polishing of the UI (a bit more vertical space between the org details and the tab view, for example) and implementing any last-minute suggestions. But I'd say this is ready for a review from both the code and UI design perspectives.

@rmunn rmunn requested review from myieye and hahn-kev and removed request for myieye May 29, 2024 08:23
@hahn-kev
Copy link
Collaborator

@rmunn can you merge develop into this branch before we review is since it's so far behind?

@rmunn
Copy link
Contributor Author

rmunn commented May 30, 2024

@rmunn can you merge develop into this branch before we review is since it's so far behind?

Actually that's a good idea. When I run git mergetool and it autoresolves conflicts, it's usually correct, but I've sometimes found that manual correction of its resolution is needed. So by merging develop in before review, there will be more eyes looking at it in case I miss some merge-resolution mistake. Working on that now.

@rmunn rmunn force-pushed the feat/org-page branch 2 times, most recently from aac0df9 to 1c65638 Compare May 30, 2024 06:28
@rmunn
Copy link
Contributor Author

rmunn commented May 30, 2024

My first attempt to merge develop into this branch went quite badly wrong as Git got confused by an earlier merge-and-revert I had done, and ended up choosing wrong branch resolutions all over the place. I've been able to rebase the branch to get rid of the merge-and-revert, and now Git is far less confused — and has only a single merge conflict, in the admin dashboard page. (I moved the users table to a separate component, while meanwhile Tim made a two-line change in the users table on the admin dashboard).

I should be able to resolve that merge conflict by hand, without having to merge develop into this branch.

rmunn added 12 commits May 30, 2024 13:32
DetailsPage, like HeaderPage, will end up combining the common concepts
between org and project pages: a title, a badge list, a description, a
list of properties (lex entry count / project count, and so on).

Currently it is an empty shell around HeaderPage which passes through
all slots unchanged, which means that rendering the placeholder org page
is unchanged when you swap out HeaderPage for DetailsPage.
This somewhat reduces the complexity of the project page layout.
Will allow sharing code with org members list
Needs role types (ProjectRole vs OrgRole) unified in some way before
this will work; currently the MembersList component still has
ProjectRole hardcoded because it was copied out of the project page.
Almost functional because the GraphQL query for SetOrgMemberRole takes
an email or username, rather than a user ID. I'll need to either change
the GQL query or else tweak the MembersList component to be able to
handle either one.
@rmunn
Copy link
Contributor Author

rmunn commented Jun 7, 2024

@myieye - Many comments addressed, but ran out of time to do all of them. Will finish Monday.

rmunn added 2 commits June 10, 2024 08:35
It's unnecessary friction when testing org creation & deletion, and we
have a confirm dialog that requires you to type something so there's
actual thought required, which is enough of a barrier to prevent
accidental clicking having massive effects. Plus, we'll eventually be
moving to a soft-delete for orgs just like we have for projects, which
will make this unnecessary as soft-deletes are undoable.
@rmunn
Copy link
Contributor Author

rmunn commented Jun 10, 2024

I started implementing the "invite org member by email" flow and realized that it's going to take a bit more effort than I thought it would: we can't simply reuse the existing invite project member by email without changes. We'll need to change the acceptInvitation page to look for a list of orgs to join as well as projects to join, we'll need to edit the invitation JWT to optionally include a list of orgs as well as a list of projects...

I think it's best if I push that work off to a separate PR, so that the org page work can be completed. So for now, I'll leave the "TODO: Implement inviting user" comment in OrgMutations.cs, as a reminder for us to do that work. (I'll also create an issue for it).

We'll add that text back in once invitations are implemented for orgs
@rmunn
Copy link
Contributor Author

rmunn commented Jun 10, 2024

I looked into Scribe, and it requires either a Chrome or Edge extension. I uninstalled Chrome from my Linux computer ages ago because it's getting increasingly privacy-hostile (I use Chromium if I need to test something in Chrome), so I really don't want to reinstall it just for this. @myieye, could I ask you to create an Add_Org_Member scribe similar to the Add_Project_Member one?

rmunn added 4 commits June 10, 2024 10:29
This was left over from when ChangeMemberRoleModal handled both project
and org memberships, and needed to adjust its schema based on the
now-removed roleType prop.
@rmunn rmunn requested review from myieye and hahn-kev June 10, 2024 03:48
@rmunn
Copy link
Contributor Author

rmunn commented Jun 10, 2024

Only problem remaining is the Typescript errors that result from differing definitions of User/TableUser/etc. I don't have a good idea for how to fix them (my earlier attempts have led to much confusion), but perhaps I'm simply missing something obvious. @myieye, could I ask you to take a look and see if you spot something I missed? Run cd frontend; pnpm check and you'll get several errors along the lines of "Argument of type 'Pick<User, "id" | "name" | "email" | "username" | "isAdmin" | "emailVerified" | "locked">' is not assignable to parameter of type 'User'".

@rmunn
Copy link
Contributor Author

rmunn commented Jun 10, 2024

It looks to me like the TableUser type in frontend/src/lib/components/Users/UserTable.svelte is at the center of the Typescript issues I'm running into. If I simply define it as User then some of the errors go away, but I still get things like:

/home/rmunn/code/lexbox/frontend/src/routes/(authenticated)/admin/+page.svelte:159:12
Error: Type '{ id: string; name: string; email?: string | null | undefined; username?: string | null | undefined; isAdmin: boolean; emailVerified: boolean; createdDate: string | Date; locked: boolean; ... 4 more ...; projects: { ...; }[]; }[]' is not assignable to type 'User[]'.
  Type '{ id: string; name: string; email?: string | null | undefined; username?: string | null | undefined; isAdmin: boolean; emailVerified: boolean; createdDate: string | Date; locked: boolean; ... 4 more ...; projects: { ...; }[]; }' is missing the following properties from type 'User': organizations, usersICreated (ts)

I'm too close to the problem to be able to see it clearly any more. I think I need input from someone who hasn't been staring at this code for a month. :-)

Copy link
Contributor

@myieye myieye left a comment

Choose a reason for hiding this comment

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

@rmunn I just made a decently sized push:

  • 461b789 Fixed the TypeScript errors
  • 11cf0b9 maybe shouldn't be in this PR, but I was having lots of bizarre problems with SK and updating fixed them 🙃
  • 4faa6df is the big one. I did several things:
    • I realized that some components were still generalized for handling org or project roles or verbose vs non-verbose texts, but that the generalisations weren't needed anymore
    • I moved a handfull of components back to the page that their page.ts/.svelte is in, because it makes them easier to find and in some cases there were still imports going back to the page files, so this cleaned them up
    • I've adaopted the practice of exporting some types from page.ts that the svelte page and components can share (e.g. a page-specific User type or OrgUser type etc.)
    • I made your Org role display name component work the same way as the project role display name component
    • I standardized some texts on the org page to be more similar to the project page

Since ChangeOrgMemberRole is called directly from GraphQL, it's possible
it could be passed a userId that isn't in our database. Ensure that it
can't accidentally create an invalid OrgMember entry in that case.
@rmunn
Copy link
Contributor Author

rmunn commented Jun 12, 2024

@rmunn I just made a decently sized push:

  • 461b789 Fixed the TypeScript errors

🎉 I knew there would be an easy solution that I was just too close to the code to see. Thanks!

I've done a self-review and found one bug, so I pushed commit c9240d6 to fix it. Everything else looks good to me. I think this is finally ready.

@hahn-kev, you have the last remaining "Changes requested" review. Do you want to give this another look?

Copy link
Collaborator

@hahn-kev hahn-kev left a comment

Choose a reason for hiding this comment

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

a couple minor things, then this can be merged in. I also noticed a bit of a permissions issue so I created #879 to track that.

@myieye myieye mentioned this pull request Jun 13, 2024
2 tasks
@myieye
Copy link
Contributor

myieye commented Jun 13, 2024

I propose you merge this PR right now and finish the TODOs in the scope of this new issue I created:
#881

@rmunn
Copy link
Contributor Author

rmunn commented Jun 14, 2024

I propose you merge this PR right now and finish the TODOs in the scope of this new issue I created: #881

I'd already implemented the settings tag change before you said that, but I hadn't committed it yet. I was thinking of pushing that commit then asking for thoughts, but instead I'll go ahead and make that commit part of the new branch for #881.

I'll dismiss Kevin's review since you've created the issue to track those remaining tasks, and merge this.

@rmunn rmunn dismissed hahn-kev’s stale review June 14, 2024 01:59

Dismissing as per Tim and Chris's suggestion; remaining work tracked at #881

@rmunn rmunn merged commit f802d74 into develop Jun 14, 2024
14 checks passed
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.

Org page
4 participants