opcodesio/log-viewer

Does not properly load its API inside Laravel Nova

dm-pf opened this issue · 3 comments

dm-pf commented

Hi, thanks for this awesome package ❤️ .

I've tried using it inside my Laravel Nova project - and the way Nova loads external-to-nova URIs is by loading them in a dialog window through an <iframe>. When that happens I get this window:

image

It seems that because the /log-viewer is loaded through an iframe - it loses track of the correct URI path to load its api/folders.

Hey @dm-pf can you share how you've added a link to the Log Viewer?

I'm not a Nova user, but I think what you're looking for is this:

use Laravel\Nova\Menu\MenuItem;

MenuItem::externalLink('Log Viewer', route('log-viewer.index'))

This is taken from Nova v4 docs btw:

https://nova.laravel.com/docs/4.0/customization/menus.html#menu-items

dm-pf commented

Hi @arukompas - using MenuItem::externalLink() (or MenuItem::path()->external() in my case) redirects to that URL which is exactly what I did after stumbling upon the above issue. Ideally, I would like to use it this way instead:

MenuSection::make('Log Viewer')
    ->path('/log-viewer')
    ->icon('lightning-bolt'),

Because that way I don't need to "get out" of my Dashboard and I can just load external tools in a dialog window. E.g. Laravel Horizon works fine this way.

Even though my use case is a bit particular (I doubt many people are using Nova) - I thought that reporting this would be a good idea because the issue itself could be triggered in other similar situations if not handled properly.

Thanks.

Screenshot 2023-06-12 at 17 33 35

how can i use log-viewer in laravel nova. v1.9.1 is working but 2.* is not working