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

[BUG] In menudropdown we only see one level under the top-level. #4976

Open
beolafsen opened this issue Jan 10, 2025 · 14 comments
Open

[BUG] In menudropdown we only see one level under the top-level. #4976

beolafsen opened this issue Jan 10, 2025 · 14 comments

Comments

@beolafsen
Copy link
Contributor

Oqtane Info

Version - 6.0.1

In menudropdown we only see one level under the top-level.

image

After deleting the Pages TestLevel2 and TestLevel3 it still occour in the Parent combobox under Add Page.

image
image

@thabaum
Copy link
Contributor

thabaum commented Jan 10, 2025

@beolafsen Thanks for posting your issue. This issue is due to the design of the theme itself. You may test out other themes available in the marketplace to get this enhanced feature. This will probably not be considered a "bug" but more a feature enhancement request for the Oqtane Cyborg theme.

This was reported by myself a while back in #3280 as you can view this issue for the related responses for working with this issue.

@beolafsen
Copy link
Contributor Author

@thabaum Thanks for you response. I close it.

@beolafsen
Copy link
Contributor Author

Hi again!

I still believe that the second part of my error message is to be considered a mistake.

In PageManagement, the pages TestLevel2 and TestLevel3 appear in the combo box "Parent". These are marked as IsDeleted in the database and should not be displayed here.

image

image

public IEnumerable<Page> GetPages(int siteId)
{
    using var db = _dbContextFactory.CreateDbContext();
    var permissions = _permissions.GetPermissions(siteId, EntityNames.Page).ToList();
    var pages = db.Page.Where(item => item.SiteId == siteId && item.UserId == null).ToList();
    foreach (var page in pages)
    {
        page.PermissionList = permissions.Where(item => item.EntityId == page.PageId).ToList();
    }
    return GetPagesHierarchy(pages);
}

The stmt
var pages = db.Page.Where(item => item.SiteId == siteId && item.UserId == null).ToList();
should be changed to
var pages = db.Page.Where(item => item.SiteId == siteId && item.UserId == null && !item.IsDeleted).ToList();

@beolafsen
Copy link
Contributor Author

open Issue again

@beolafsen beolafsen reopened this Jan 11, 2025
zyhfish added a commit to zyhfish/oqtane.framework that referenced this issue Jan 13, 2025
@zyhfish
Copy link
Contributor

zyhfish commented Jan 13, 2025

submitted PR #4981 to handle this scenario, we can't change the code in PageRepository as sometimes we need to return the deleted pages such as the recycle bin.

@beolafsen
Copy link
Contributor Author

beolafsen commented Jan 13, 2025 via email

@sbwalker
Copy link
Member

sbwalker commented Jan 13, 2025

@beolafsen just to clarify... you are saying that the Page Management (Add/Edit) UI should not include deleted pages in the list of pages displayed in the Parent field. This sounds reasonable however there are some complications to consider due to the hierarchical nature of pages....

For example, if you add a "Child" page under the "Private" page... and then you delete the "Private" page, what would you expect to happen? Currently, the navigation menu will not display the "Private" page - which means the "Child" page will not be displayed either (even though it is not actually deleted) - which seems correct. If you browse directly to the Url of the Child page you can access it - which seems correct as it is not deleted. If you go to Page Management, the "Private" page is not displayed in the list, however the "Child" page is displayed (the display order will appear to be a bit strange because it is missing its parent). And if you choose to Edit the "Child" page the Parent: list currently shows the "Private" page as its parent (even though it is deleted)... which allows the UI to work properly upon Save. However if deleted items were filtered from the Parent: list it would cause problems as the only option it could realistically select is <Site Root> and the hierarchical position of the "Child" page would be lost.

One suggestion which has been raised previously is that if a page is deleted, then all of its descendant pages should also be deleted. This way you can never have active child pages which exist under a deleted parent. The Recycle Bin would also need to prevent users from restoring pages which have a deleted parent (ie. pages would need to be restored top-down). Overall there is a lot of complexity due to the hierarchical structure of pages which would need to be managed by the system.

@beolafsen
Copy link
Contributor Author

beolafsen commented Jan 13, 2025 via email

@sbwalker
Copy link
Member

@beolafsen if all descendant pages were deleted when a parent page was deleted, would you also expect all descendant pages to be undeleted when a parent page was restored from the recycle bin?

@beolafsen
Copy link
Contributor Author

@sbwalker To be honest, I was not aware of this possibility with Recycle bin, nor do I see that I will use it. All my data is based on sitedata (not module data) - although it can also be because I have both siteid and moduleid in all tables. For me, it will be just as quick to rebuild the pages if I was unlucky enough to delete something I shouldn't have deleted. I can see that this is not the case with the modules that have module data (becase of the moduleId in data), so other considerations must be taken into account.
Now I also see way you have this IsDeleted field in the Page and PageModule table.

Now to your question.
Yes - probably - I think that if I want to restore all the child pages, I would restore the parent page. If I only want to restore some of the child pages under a parent page, I would restore one child page at a time.

Best regads BEO

@beolafsen
Copy link
Contributor Author

An alternative could also be that when you select a page, everything that belongs to that page and any underlying pages will be displayed and you can choose what to install

@thabaum
Copy link
Contributor

thabaum commented Jan 16, 2025

Here is an idea how we can handle this secondary issue:

Enhanced Page Deletion and Restoration Workflow for Oqtane

Deleting Pages

  • Move to Recycle Bin:
    • Deleted pages are moved to a "Recycle Bin" under the site root.
    • Parent and child relationships are retained as references for context.

Restoring Pages

  • Restore Dialog Box:

    • Allows users to update settings (e.g., title, permissions, parent page) during restoration.
  • Parent Page Handling:

    • If parent exists: Default to the original parent during restoration.
    • If parent doesn’t exist: Default to the site root and prompt the user to assign a new parent.
  • Child Pages Handling:

    • If a parent page with child pages is restored:
      • Provide an option to restore child pages.
      • Allow users to select which child pages to restore via a checklist.
      • Child pages not selected remain in the Recycle Bin.

Benefits

  • Retains context (parent-child relationships) while providing user control.
  • Prevents undesired restoration of all child pages by allowing selective recovery.
  • Handles site structure changes gracefully, even for complex scenarios.

@beolafsen
Copy link
Contributor Author

beolafsen commented Jan 16, 2025 via email

@sbwalker
Copy link
Member

sbwalker commented Jan 16, 2025

@thabaum I am not in favor of the "Restore Dialog Box" concept as it does not follow UI separation of concern principles as it scatters page management functionality across the application rather than keeping it contained in one place

Note that the parent/child context for pages is already retained when they are deleted

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

No branches or pull requests

4 participants