Skip to content

UAI Dashboard #2189

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

Merged
merged 18 commits into from
Apr 10, 2025
Merged

UAI Dashboard #2189

merged 18 commits into from
Apr 10, 2025

Conversation

ChristopherChudzicki
Copy link
Contributor

@ChristopherChudzicki ChristopherChudzicki commented Apr 9, 2025

What are the relevant tickets?

Closes https://github.com/mitodl/hq/issues/7004

Description (What does it do?)

This adds the Universal AI org-level dashboard.

It does NOT include:

Forthcoming APIs This PR makes some assumptions about forthcoming APIs, based on conversations with @jkachel. It would be good to document these assumptions somewhere. In particular, the assumptions are:

  1. https://api.learn.mit.edu/api/v0/users/me/ will include an array of organizations for each user, { id, name, logo }.
  2. http://mitxonline.mit.edu/api/v2/programs/ and http://mitxonline.mit.edu/api/enrollments will both have a new org_id filter. (Or orgId once camelized by our api client generator.)

Screenshots (if appropriate):

Screenshot 2025-04-08 at 8 40 57 PM

How can this be tested?

  1. With posthog feature flag mitlearn-organization-dashboard OFF:
    • you should see no changes to the dashboard, even if you have the enrollment-dashboard flag on
  2. With posthog feature flag mitlearn-organization-dashboard ON:
    • you should see two new tabs, one for Organization X and one for Organization Y
    • Orgs X and Y are static for now

Before Merging

Copy link

github-actions bot commented Apr 9, 2025

OpenAPI Changes

Show/hide No detectable change.

@ChristopherChudzicki ChristopherChudzicki added the Needs Review An open Pull Request that is ready for review label Apr 9, 2025
Copy link

github-actions bot commented Apr 9, 2025

OpenAPI Changes

Show/hide No detectable change.

@ChristopherChudzicki ChristopherChudzicki marked this pull request as ready for review April 9, 2025 01:06
Copy link

github-actions bot commented Apr 9, 2025

OpenAPI Changes

Show/hide No detectable change.

@ChristopherChudzicki ChristopherChudzicki changed the title Cc/uai dashboard UAI Dashboard Apr 9, 2025
Copy link

github-actions bot commented Apr 9, 2025

OpenAPI Changes

Show/hide No detectable change.

Copy link

github-actions bot commented Apr 9, 2025

OpenAPI Changes

Show/hide No detectable change.

<Stack
direction="row"
justifyContent="space-between"
alignItems="stretch"
flex={1}
width="100%"
>
<Stack direction="column" gap="8px">
<Stack direction="column" gap="8px" flex={1}>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is to address an odd issue i noticed on the mobile cards.

Before:

Screenshot 2025-04-09 at 3 58 41 PM

Now:

Screenshot 2025-04-09 at 3 58 55 PM

I don't entirely understand why the "Before" behavior was wrapping that way, though.

Comment on lines +265 to +270
<CardRoot
screenSize="desktop"
data-testid="enrollment-card-desktop"
as={Component}
className={className}
>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@gumaerc I moved the desktop-only / mobile-only behavior to CardRoot.

My motivation was:

  • I want Component to be the root component (So that if we nest cards in a list, we can specify Component="li"
  • Classname should similarly apply to the root component.

Alternatively, could have moved classname, testid, and Component onto DesktopOnly / MobileOnly. Not sure what's more preferable.

@@ -33,7 +33,7 @@ const someAncestor = (el: HTMLElement, cb: (el: HTMLElement) => boolean) => {
}

const setupApis = (
channelPatch?: Partial<Channel>,
channelPatch: Partial<Channel> = {},
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is related to the change to PartialFactory that I made. Since PartialFactory now accepts an array of overrides, explicitly passing undefined is no longer allowed. I.e.,

  • partialFactory() OK ✅
  • partialFactory(undefined) ❌ not ok

Comment on lines +43 to +46
describe.each([
{ display: "desktop", testId: "enrollment-card-desktop" },
{ display: "mobile", testId: "enrollment-card-mobile" },
])("EnrollmentCard $display", ({ testId }) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@gumaerc I did decide to parameterize the desktop vs mobile testing. I'm worried without this we'll forget to test both cases in the future.

(Not that the possibility of forgetting is gone now. You could still ignore the parameterized testId.)

*
* The query string is sorted by key.
*/
const queryify = (params: unknown, { explode = true } = {}) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This function is moved from api/src/test-utils/index.ts. The only change was addition of explode option, since mitxonline does not explode query parameters.

const mobileCards = await screen.findAllByTestId("enrollment-card-mobile")
expect(desktopCards.length).toBe(7)
expect(mobileCards.length).toBe(7)
const cards = await screen.findAllByTestId("enrollment-card-desktop")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed the desktop / mobile distinction, since that seems like an implementation detail of DashboardCard to me.

@gumaerc gumaerc self-assigned this Apr 9, 2025
Copy link
Contributor

@gumaerc gumaerc left a comment

Choose a reason for hiding this comment

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

👍 LGTM

I just noticed a few typos in some comments:

<ImageContainer>
<Image
width={72}
// NextJS Image component requires width and height to avoid loayout shift.
Copy link
Contributor

Choose a reason for hiding this comment

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

"layout shift"

// NextJS Image component requires width and height to avoid loayout shift.
// These are supposed to be the intrinsic sizes of the image file.
// That said, it's not particularly relevant here since the parent is
// reserving spae for the image anyway. Using next/image still gets us
Copy link
Contributor

Choose a reason for hiding this comment

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

"space"

Copy link

OpenAPI Changes

Show/hide No detectable change.

@ChristopherChudzicki ChristopherChudzicki merged commit fab0c32 into main Apr 10, 2025
12 checks passed
@ChristopherChudzicki ChristopherChudzicki deleted the cc/uai-dashboard branch April 10, 2025 17:30
This was referenced May 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Review An open Pull Request that is ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants