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: adds menu for actions on containers #804

Merged
merged 4 commits into from
Nov 21, 2022
Merged

Conversation

cdrage
Copy link
Contributor

@cdrage cdrage commented Nov 9, 2022

feat: adds menu for actions on containers

What does this PR do?

  • This PR adds a "kebab" menu for the actions on containers

Screenshot/screencast of this PR

Screen Shot 2022-11-09 at 3 43 18 PM

What issues does this PR fix or reference?

This menu was implemented while testing out #506

How to test this PR?

yarn watch and press the action button

Signed-off-by: Charlie Drage charlie@charliedrage.com

@cdrage
Copy link
Contributor Author

cdrage commented Nov 9, 2022

Pushed this functionality in a new PR!

@benoitf

I've updated the code from your advice and implemented:

  • Updated UI for the menu
  • ESC now closes the menu
  • Clicking outside closes the menu

@vzhukovs

I tried implementing #800 but decided to use the tutorial from svelte here instead: https://svelte.dev/tutorial/actions

@cdrage cdrage force-pushed the kebab branch 2 times, most recently from e8c8fa1 to 37425d9 Compare November 9, 2022 20:51
@cdrage
Copy link
Contributor Author

cdrage commented Nov 9, 2022

TODO:

  • Fix issue with kebab menu showing on container details
  • Fix issue with "toggle" not working when pressing the button again

@cdrage cdrage force-pushed the kebab branch 3 times, most recently from 0140dca to 8a7be98 Compare November 14, 2022 20:18
Copy link
Contributor

@vzhukovs vzhukovs left a comment

Choose a reason for hiding this comment

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

Looks good to me

Copy link
Collaborator

@benoitf benoitf left a comment

Choose a reason for hiding this comment

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

it looks like the kebab menu will be specific to ContainerActions and can't be used elsewhere ?

Probably we need instead of

{#if showMenu}
    <div id="dropdown"
<KebabMenu>
   <KebabMenuItem title="" onClick="" hidden=>

https://svelte.dev/repl/8e68120858e5322272dc9136c4bb79cc?version=3.5.1

@cdrage
Copy link
Contributor Author

cdrage commented Nov 15, 2022

it looks like the kebab menu will be specific to ContainerActions and can't be used elsewhere ?

Probably we need instead of

{#if showMenu}
    <div id="dropdown"
<KebabMenu>
   <KebabMenuItem title="" onClick="" hidden=>

https://svelte.dev/repl/8e68120858e5322272dc9136c4bb79cc?version=3.5.1

Yes you're right! I'll make it modular so we can use this somewhere else. Makes it easier to implement the kebab menu on pod list, future sections, etc.

@cdrage
Copy link
Contributor Author

cdrage commented Nov 15, 2022

@benoitf @vzhukovs Updated the PR and it's ready for review!

I've completed:

  • Not showing the kebab when viewing details
  • Made it as a component so we can re use this with Pods list, etc.

Please note the dropdownMenu=true and menu=true portions of the code.

Hopefully this is good Svelte code, and if it's not I'm open ears to any form of criticism as I'm still learning 💯

Copy link
Collaborator

@benoitf benoitf left a comment

Choose a reason for hiding this comment

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

Hello,

I still do believe the trash icon should be visible as it's a primary action I'm using as often as start/stop

Comment on lines 46 to 53
<!-- Dropdown menu for all other actions -->
{#if showMenu}
<div
id="dropdown"
class="origin-top-right absolute right-0 z-10 m-2 rounded-md shadow-lg bg-zinc-700 ring-1 ring-black ring-opacity-5 divide-y divide-gray-600 focus:outline-none">
<slot />
</div>
{/if}
Copy link
Collaborator

Choose a reason for hiding this comment

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

really good improvement over the previous version
esc key works, display is not collapsed on the right

mVnFNJbq3K.mp4

but the drop down should be displayed before the pointer when we click on elements at the bottom because while it works fine for upper rows, clicking on the rows near the bottom, the menu is displayed at the bottom and then we need another scroll. It should be displayed in that case at the opposite side

image

<!-- Dropdown menu for all other actions -->
{#if showMenu}
<div
id="dropdown"
Copy link
Collaborator

Choose a reason for hiding this comment

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

id should not be hardcoded as we've multiple dropdown on the page

{#if showMenu}
<div
id="dropdown"
class="origin-top-right absolute right-0 z-10 m-2 rounded-md shadow-lg bg-zinc-700 ring-1 ring-black ring-opacity-5 divide-y divide-gray-600 focus:outline-none">
Copy link
Collaborator

Choose a reason for hiding this comment

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

divide-violet-600 ?

it looks like also that the dark theme is not following the same state than on the navbar or on the container list
display: dark item, hovering = lighter

here we have a light gray

I noticed a small issue: rounded corner seems to be off when hovering the element

F13LWtAAfy.1.mp4

Copy link
Collaborator

@benoitf benoitf left a comment

Choose a reason for hiding this comment

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

the menu doesn't disappear when I click on an item

so for example clicking again will do an action on the next row which is not an expected behaviour

A4Kwhg3WRz.mp4

@cdrage
Copy link
Contributor Author

cdrage commented Nov 16, 2022

I've updated the PR with the following:

  • Fix round / radius on border on buttons
  • Made the entire div an "on click" for the menu buttons, as there were "blindspots" where you can click on blank space
  • Changed colour of the menu to black to coincide with the general UI
  • On hover, show purple colour / change text, similar to the current button functionality
  • Close menu after clicking a button

@benoitf I've been having troubles implementing the dropdown menu to go either UP or DOWN, any ideas?

I was thinking if cursor is on tophalf of the screen when clicking, drop down, if the cursor is bottom half, drop up? Would that be a good way to implement it?

@benoitf
Copy link
Collaborator

benoitf commented Nov 17, 2022

I created a PR against your branch:
cdrage#1

@cdrage
Copy link
Contributor Author

cdrage commented Nov 17, 2022

@benoitf Merged. Thank you so much for the help / insight! 🎉

@cdrage cdrage force-pushed the kebab branch 4 times, most recently from bf67680 to 60b637b Compare November 18, 2022 14:10
cdrage and others added 3 commits November 18, 2022 09:10
### What does this PR do?

* This PR adds a "kebab" menu for the actions on containers

### Screenshot/screencast of this PR

<!-- Please include a screenshot or a screencast explaining what is doing this PR -->

### What issues does this PR fix or reference?

<!-- Please include any related issue from Podman Desktop repository (or from another issue tracker).
-->

This  menu was implemented while testing out containers#506

### How to test this PR?

`yarn watch` and press the action button

<!-- Please explain steps to reproduce -->

Signed-off-by: Charlie Drage <charlie@charliedrage.com>
Signed-off-by: Charlie Drage <charlie@charliedrage.com>
…er click

Change-Id: I36b990a88546119180b39464f038ee7fb8d97499
Signed-off-by: Florent Benoit <fbenoit@redhat.com>
Signed-off-by: Charlie Drage <charlie@charliedrage.com>
Copy link
Collaborator

@benoitf benoitf left a comment

Choose a reason for hiding this comment

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

tested again and works as expected. 🎉

maybe we need to use a 'purple' color divider but it's not a 'request for changes'
image

if possible, merge it on Monday, better than on Friday :-)

@benoitf benoitf merged commit 7a440df into containers:main Nov 21, 2022
@podman-desktop-bot podman-desktop-bot added this to the 0.10.0 milestone Nov 21, 2022
@cdrage cdrage mentioned this pull request Nov 21, 2022
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.

None yet

4 participants