InvenTree icon indicating copy to clipboard operation
InvenTree copied to clipboard

feat(PUI): Make header tabs links to simpilfy new tab behaviour

Open matmair opened this issue 11 months ago • 18 comments

This PR enables opening header tab items per right-click to new tabs.

matmair avatar Dec 27 '24 19:12 matmair

@sur5r 👀

matmair avatar Dec 27 '24 19:12 matmair

Deploy Preview for inventree-web-pui-preview ready!

Name Link
Latest commit cc21d0bfda2a368605279c68af805670ebd04b4e
Latest deploy log https://app.netlify.com/projects/inventree-web-pui-preview/deploys/685af4f6810d9e0008a1f3d8
Deploy Preview https://deploy-preview-8779--inventree-web-pui-preview.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

Lighthouse
1 paths audited
Performance: 80 (🔴 down 18 from production)
Accessibility: 81 (no change from production)
Best Practices: 100 (no change from production)
SEO: 78 (no change from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

netlify[bot] avatar Dec 27 '24 19:12 netlify[bot]

Codecov Report

:x: Patch coverage is 80.00000% with 1 line in your changes missing coverage. Please review. :white_check_mark: Project coverage is 86.36%. Comparing base (0b451dc) to head (cc21d0b). :warning: Report is 317 commits behind head on master.

Files with missing lines Patch % Lines
src/frontend/src/components/panels/PanelGroup.tsx 50.00% 1 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8779      +/-   ##
==========================================
- Coverage   86.56%   86.36%   -0.20%     
==========================================
  Files        1243     1235       -8     
  Lines       54696    54263     -433     
  Branches     2230     2234       +4     
==========================================
- Hits        47347    46865     -482     
- Misses       6783     6830      +47     
- Partials      566      568       +2     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Dec 28 '24 02:12 codecov[bot]

@matmair this is a nice addition. It would make sense to add it for the "Panel" nav tab links too?

SchrodingersGat avatar Dec 28 '24 05:12 SchrodingersGat

Propaply; should this be included in this patch?

matmair avatar Dec 28 '24 11:12 matmair

@matmair yes I think so, should be only very minimal diff

SchrodingersGat avatar Dec 28 '24 13:12 SchrodingersGat

@SchrodingersGat added

matmair avatar Dec 29 '24 20:12 matmair

@matmair I have noticed something here - the target link is different depending on how the click event is interpreted:

Starting Point

From this starting point, I will click the "Manufacturing" tab:

image

Left Mouse Button

Navigates to "Manufacturing" page in same tab

image

Left Mouse Button + Control Key

Opens "Manufacturing" page in new tab

image

Middle Mouse Button

Opens "Manufacturing" page (via demo site) in new tab:

image

Note that the URL in the address bar is different in this case!

The same behaviour hapens with the side panels too...

SchrodingersGat avatar Dec 30 '24 01:12 SchrodingersGat

@SchrodingersGat I am not familiar with middle button. Which control key is this?

matmair avatar Jan 02 '25 08:01 matmair

I am not familiar with middle button. Which control key is this?

No control key, just click on the link by pressing the scroll wheel on the mouse. Typically this just opens a link in a new tab (similar to ctrl+click).

However, it bypasses the browser onClick event system somehow so we can't catch it like a normal click. Somehow, this type of click uses a different baseUrl when generating the link target

SchrodingersGat avatar Jan 05 '25 02:01 SchrodingersGat

Not really sure what to do about the middle click, I can not find where it is getting it's link in that case and why it is diefferent

matmair avatar Feb 10 '25 20:02 matmair

Middle click doesn't work at all for me. It's not surprising given the main menu items are no links (a href) but buttons. I guess this is just a clash of worlds. This is no longer web browsing, so we can't expect it to behave as such.

sur5r avatar Feb 10 '25 21:02 sur5r

that is the thing - there should be/is an a element rendered - so it should work the same as "normal" html

matmair avatar Feb 11 '25 22:02 matmair

@matmair it looks like most of the effects of this PR have been reverted, not sure if that is intentional? But the <a> elements are no longer in play

SchrodingersGat avatar Feb 12 '25 12:02 SchrodingersGat

I have re-introduced the rendering as elements; seems to work but I do not have a middle click for debug would appreciate a review @sur5r @SchrodingersGat

matmair avatar Apr 18 '25 14:04 matmair

The links are there, but one doesn't end up on the correct view/subpage. It neither works with middle click nor with "copy link" and pasting the link into a new tab.

Example: Open a part and use the link from e.g. "Part pricing" to open an new tab. It opens the Part, but on "Part Details".

It seems to URLs are generated incorrectly, i.e. they point to /part/301/details/pricing instead of /part/301/pricing.

sur5r avatar Apr 18 '25 20:04 sur5r

Seems to work on my machine - are we talking about the same thing?

https://github.com/user-attachments/assets/cf33177d-bc33-44c2-b6df-1776a9d07fd7

matmair avatar Apr 20 '25 16:04 matmair

No, I'm talking about these links:

image

sur5r avatar Apr 20 '25 19:04 sur5r

@sur5r it now should also work on the panels - can you please confirm?

matmair avatar Jun 24 '25 18:06 matmair

Looks good, middle mouse button is working now! Thanks @matmair

SchrodingersGat avatar Jun 25 '25 15:06 SchrodingersGat