Skip to content

[dashboard] misc dashboard improvements #3496

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 3 commits into from
Mar 19, 2021
Merged

Conversation

svenefftinge
Copy link
Member

@svenefftinge svenefftinge commented Mar 18, 2021

@svenefftinge svenefftinge requested review from AlexTugarev, gtsiolis and jankeromnes and removed request for AlexTugarev March 18, 2021 21:32
@@ -89,7 +89,7 @@ export class Workspaces extends React.Component<WorkspacesProps, WorkspacesState
<div className="w-3/12">Name</div>
<div className="w-4/12">Context</div>
<div className="w-2/12">Pending Changes</div>
<div className="w-2/12">Last Active</div>
<div className="w-2/12">Last Start</div>
Copy link
Member Author

@svenefftinge svenefftinge Mar 19, 2021

Choose a reason for hiding this comment

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

@gtsiolis I changed this to Last Start because that is what the time really shows. Last Active was confusing because for running workspaces it seems they should be active just now.

Copy link
Contributor

Choose a reason for hiding this comment

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

I was tempted to suggest to revert this but let's leave this as is for now. Seems more accurate indeed!

@gtsiolis gtsiolis self-assigned this Mar 19, 2021
@gtsiolis
Copy link
Contributor

gtsiolis commented Mar 19, 2021

/werft run

👍 started the job as gitpod-build-se-misc-dashboard.2

if (!props.visible) {
return null;
}
setTimeout(() => window.addEventListener('click', props.onClose, { once: true }), 0);
setTimeout(() => {
Copy link
Member

Choose a reason for hiding this comment

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

I'd suggest to use useEffect hook instead in order to guarantee that the event listeners are received by the visible modals only.

This is what I did in parallel.

     const handler = (e: MouseEvent) => {
         // ...
     }
    useEffect(() => {
        if (!props.visible) {
            window.removeEventListener("click", handler)
            return;
        }

        window.addEventListener("click", handler)

        // do something on unmount
        return () => {  };
    }, [props.visible]);

This hook's invocation depends on props.visible change, which gives us control of the event handlers.

OTOH, given the setTimeout solution, a <Modal visible={false}></Modal> would already register the event handler.

onClick: () => {
e.onClick && e.onClick();
onClick: (event: MouseEvent) => {
e.onClick && e.onClick(event);
Copy link
Member

Choose a reason for hiding this comment

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

👍🏻

return (
<div className="fixed top-0 left-0 bg-black bg-opacity-70 z-50 w-screen h-screen" >
<div className="fixed top-0 left-0 bg-black bg-opacity-70 z-50 w-screen h-screen" onClick={close}>
Copy link
Member

Choose a reason for hiding this comment

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

I believe, onClick={close} here will trigger close even if you click-select anything within the modal.

Copy link
Member Author

Choose a reason for hiding this comment

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

It does not, because I stop.propagation below

Copy link
Member

Choose a reason for hiding this comment

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

I see

Copy link
Contributor

@gtsiolis gtsiolis left a comment

Choose a reason for hiding this comment

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

Alright, this is shaping up! 🌟

Here're some more outstanding issues, feel free to resolve here or a new PR. Thanks @svenefftinge!

  1. When searching and focus is on the search text field, on ESC clear the search input.
  2. Change placeholder text Search Workspace to Search Workspaces.
  3. Clicking Open in the more actions dropdown for stopped workspaces does not work.
  4. When manually stopping a workspace redirect to dashboard.
  5. Persist top menu state on Workspaces and Settings
  6. Could we apply a subtle hover transition effect on everything? See also relevant discussion.
  7. When clicking on Workspaces the top menu always move to Active workspaces.
  8. What do you think of adding animate-pulse on kumquar workspaces status indicator for starting and stopping workspaces?
  9. Let's also change the font weight for more actions dropdown items to font-medium
  10. Let's change the width of the dropdown of the more actions to w-48. This will also use the same width as the side menu. Also, let's change the dropdown spacing from space-y-2 to space-y-1 and py-2 to py-1.
  11. What do you think of removing the responsive layout of the table? Is this easily turned off? If not, feel free to ignore for now.
  12. Can we also remove the responsive layout of the top menu and profile menu?
  13. The more actions dropdown is missing a top margin of 8px from the more action button.
  14. Workspace more actions button should be visible only on hover. See similar approach in [dashboard] Re-implement running workspace selector for new dashboard #3464 (comment).
  15. The filter prefix is nice but everything up there on the top right is a filter. I still think Status prefix is better. Feel free to leave this as is for now.

setTimeout(() => {
const keyHandler = (k: globalThis.KeyboardEvent) => {
if (!k.bubbles) {
if (k.key === 'Escape') {
Copy link
Contributor

Choose a reason for hiding this comment

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

issue: Modals do not close on ESC. 💭

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, the predicate for the capturing phase was wrong

@@ -89,7 +89,7 @@ export class Workspaces extends React.Component<WorkspacesProps, WorkspacesState
<div className="w-3/12">Name</div>
<div className="w-4/12">Context</div>
<div className="w-2/12">Pending Changes</div>
<div className="w-2/12">Last Active</div>
<div className="w-2/12">Last Start</div>
Copy link
Contributor

Choose a reason for hiding this comment

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

I was tempted to suggest to revert this but let's leave this as is for now. Seems more accurate indeed!

@@ -89,7 +89,7 @@ export class Workspaces extends React.Component<WorkspacesProps, WorkspacesState
<div className="w-3/12">Name</div>
<div className="w-4/12">Context</div>
<div className="w-2/12">Pending Changes</div>
<div className="w-2/12">Last Active</div>
<div className="w-2/12">Last Start</div>
Copy link
Contributor

Choose a reason for hiding this comment

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

question: If creation timestamp is still important, could we add a tooltip when hovering on the last start timestamp with the creation timestamp (e.g. Created 2 days ago)?

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 it is important

Copy link
Contributor

Choose a reason for hiding this comment

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

OK, let's drop it for now.

{props.closeable !== false && (
<div className="absolute right-9 top-8 cursor-pointer" onClick={props.onClose}>
<div className="absolute right-9 top-8 cursor-pointer" onClick={close}>
Copy link
Contributor

Choose a reason for hiding this comment

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

issue: The close (X) button is missing a hover state. ⛵

Default Hover
image image

{props.closeable !== false && (
<div className="absolute right-9 top-8 cursor-pointer" onClick={props.onClose}>
<div className="absolute right-9 top-8 cursor-pointer" onClick={close}>
Copy link
Contributor

Choose a reason for hiding this comment

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

thought: Regarding the icons, we could use them as SVGs or import the npm package for the icons library but it's not stable yet, see Usage. See icon assets in relevant discussion.

Copy link
Member Author

Choose a reason for hiding this comment

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

Agree, we should decide on how to deal with it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Added follow-up in #3508.

<p>Do you really want to delete this workspace?</p>
<h3>Delete Workspace</h3>
<div className="border-t border-gray-200 mt-2 -mx-6 px-6 py-2">
<p>Do you really want to delete the following workspace?</p>
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: Maybe make this less aggressive. 😇

Suggested change
<p>Do you really want to delete the following workspace?</p>
<p class="mt-1 mb-2 text-base">Are you sure you want to delete this workspace?</p>

<h3>Delete Workspace</h3>
<div className="border-t border-gray-200 mt-2 -mx-6 px-6 py-2">
<p>Do you really want to delete the following workspace?</p>
<div className="w-full p-3">
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick: Minor modal pixel lift. ⭐

Suggested change
<div className="w-full p-3">
<div className="w-full p-4 mb-2 bg-gray-100 rounded-xl group bg-gray-100">

</div>
<div className="flex">
<div className="flex-1"></div>
<div className="flex justify-end mt-4">
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick: Minor modal pixel lift.

Suggested change
<div className="flex justify-end mt-4">
<div className="flex justify-end mt-5">

<div className="py-4">
<p>Do you really want to delete this workspace?</p>
<h3>Delete Workspace</h3>
<div className="border-t border-gray-200 mt-2 -mx-6 px-6 py-2">
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick: Modal overhaul.

Suggested change
<div className="border-t border-gray-200 mt-2 -mx-6 px-6 py-2">
<div className="border-t border-b border-gray-200 mt-2 -mx-6 px-6 py-2">
BEFORE AFTER
image image

<button className="cursor-pointer px-3 py-2 text-white text-sm rounded-md border-2 border-red-800 bg-red-600 hover:bg-red-800"
onClick={()=>getGitpodService().server.deleteWorkspace(ws.id)}>
onClick={() => model.deleteWorkspace(ws.id)}>
Delete
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick: Let's make this more actionable and descriptive.

Suggested change
Delete
Delete Workspace

the modal dialog should
- close on ESC
- close on click outside modal but not within
- handle enter
@svenefftinge
Copy link
Member Author

filed #3507

@svenefftinge svenefftinge merged commit 4b92cdd into dashboard-v2 Mar 19, 2021
@svenefftinge svenefftinge deleted the se/misc-dashboard branch March 19, 2021 10:58
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.

3 participants