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

dash: adapt to richer child computer status #442

Merged
merged 1 commit into from
Jan 30, 2025
Merged

Conversation

jaredh159
Copy link
Collaborator

Copy link

cloudflare-workers-and-pages bot commented Jan 27, 2025

Deploying gertrude-parents with  Cloudflare Pages  Cloudflare Pages

Latest commit: 66700a5
Status: ✅  Deploy successful!
Preview URL: https://315439bb.parents.pages.dev
Branch Preview URL: https://richer-filter-status.parents.pages.dev

View logs

Copy link

argos-ci bot commented Jan 27, 2025

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
default (Inspect) ✅ No changes detected - Jan 29, 2025, 9:30 PM

Copy link

PR for changed screenshots: #443

Copy link

cloudflare-workers-and-pages bot commented Jan 27, 2025

Deploying gertrude-storybook with  Cloudflare Pages  Cloudflare Pages

Latest commit: 66700a5
Status: ✅  Deploy successful!
Preview URL: https://4b5d0418.gertrude-storybook.pages.dev
Branch Preview URL: https://richer-filter-status.gertrude-storybook.pages.dev

View logs

Copy link

cloudflare-workers-and-pages bot commented Jan 27, 2025

Deploying gertrude-site with  Cloudflare Pages  Cloudflare Pages

Latest commit: 66700a5
Status: ✅  Deploy successful!
Preview URL: https://520af767.gertrude-site.pages.dev
Branch Preview URL: https://richer-filter-status.gertrude-site.pages.dev

View logs

</Link>
);
const ComputerUser: React.FC<ComputerUserProps> = ({ name, id, status }) => {
const isOnline = status.case !== `offline`;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

we're getting much richer detail from the API now, but to leverage it well will take some UI design work, to show stuff like "Suspended, resuming in 30 minutes" in the various places where this data is surfaced. So, for now, what I've done is basically downcast the data back to a boolean of "offline/online" like we used to get. This preserves the current behavior, and allows us to release the Macapp Version 2.7.0 which will start sending the richer data, and then we can as soon as we're ready start surfacing it to the parents in the dashboard. Basically, whenever you're ready to do a little design/component work on it.

@@ -26,7 +26,7 @@ const ListComputers: React.FC<Props> = ({ devices }) => (
)}
<div className="mt-8 grid grid-cols-1 lg+:grid-cols-2 2xl:grid-cols-3 gap-8">
{devices.map((device) => {
const onlineUser = device.users.find((user) => user.isOnline);
const onlineUser = device.users.find((user) => user.status.case !== `offline`);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

another case where i simplify the new state back into the old boolean for now

<div className="flex justify-between items-center rounded-xl py-4 px-4 even:bg-slate-50/50">
<h3 className="font-medium text-slate-900">{name}</h3>
{isOnline ? (
{status.case !== `offline` ? (
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

another spot

@@ -42,7 +43,7 @@ const UserDevice: React.FC<Props> = ({
{name && <h4 className="text-sm text-slate-500 line-clamp-1">{modelTitle}</h4>}
</div>
</div>
{status === `online` && (
{status.case !== `offline` && (
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

the final spot

@@ -34,13 +34,21 @@ export interface BlockedApp {
schedule?: RuleSchedule;
}

export type ChildComputerStatus =
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this is the new enum that the API sends back. in a few months, when we push everyone past 2.7.0, the dates will no longer be optional. but for now we'll have to support both types of data, since < 2.7.0 macapps don't send the richer detaill.

@jaredh159 jaredh159 force-pushed the richer-filter-status branch from 796ebde to 66700a5 Compare January 29, 2025 21:28
@jaredh159 jaredh159 merged commit 8ddccfe into master Jan 30, 2025
10 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.

1 participant