Completed
Last Updated: 05 Jan 2024 16:23 by ADMIN
Cruz
Created on: 02 Aug 2023 08:15
Category: FileManager
Type: Bug Report
2
Breadcrumb Path Not Displayed in FileManager with Hierarchical data

When using the FileManager and navigating through directories, the Breadcrumb does not show the path.

Reproduction: https://blazorrepl.telerik.com/GdOCYQki12iTAeWd34

 

7 comments
ADMIN
Hristian Stefanov
Posted on: 05 Jan 2024 16:23

Hi all,

I'm ready to share more news.

This item is now entirely completed. I'm sharing below the updated example with hierarchical data that will enter our live documentation very soon.

Also, it's important to note that there should be a constant root path as the topmost path segment so the Breadcrumb is shown correctly. If there's no root path given, we consider the first folder to be the root. However, this causes an issue because the Breadcrumb doesn't recognize it and shows the "Home" icon instead.

@using System.IO

<TelerikFileManager Data="@FileManagerData"
                    Height="400px"
                    @bind-Path="@DirectoryPath"
                    IdField="MyModelId"
                    NameField="Name"
                    SizeField="Size"
                    PathField="Path"
                    ExtensionField="Extension"
                    IsDirectoryField="IsDirectory"
                    HasDirectoriesField="HasDirectories"
                    DirectoriesField="MyDirectories"
                    ItemsField="Items"
                    DateCreatedField="DateCreated"
                    DateCreatedUtcField="DateCreatedUtc"
                    DateModifiedField="DateModified"
                    DateModifiedUtcField="DateModifiedUtc"
                    OnModelInit="@OnModelInitHandler">
</TelerikFileManager>

@code {
    private List<HierarchicalFileEntry> FileManagerData = new List<HierarchicalFileEntry>();

    private string RootPath { get; set; } = "root-folder-path";
    private string DirectoryPath { get; set; } = "directory-folder-path";

    // fetch the FileManager data
    protected override async Task OnInitializedAsync()
    {
        FileManagerData = await GetHierarchicalFileEntries();
    }

    //initialize the model to allow new folder creation
    private HierarchicalFileEntry OnModelInitHandler()
    {
        var item = new HierarchicalFileEntry();
        item.Name = $"New folder";
        item.Size = 0;
        item.Path = Path.Combine(DirectoryPath, item.Name);
        item.IsDirectory = true;
        item.HasDirectories = false;
        item.DateCreated = DateTime.Now;
        item.DateCreatedUtc = DateTime.Now;
        item.DateModified = DateTime.Now;
        item.DateModifiedUtc = DateTime.Now;

        return item;
    }

    // a model to bind the FileManager. Should usually be in its own separate location.
    public class HierarchicalFileEntry
    {
        public string MyModelId { get; set; }
        public string Name { get; set; }
        public long Size { get; set; }
        public string Path { get; set; }
        public string Extension { get; set; }
        public bool IsDirectory { get; set; }
        public bool HasDirectories { get; set; }
        public DateTime DateCreated { get; set; }
        public DateTime DateCreatedUtc { get; set; }
        public DateTime DateModified { get; set; }
        public DateTime DateModifiedUtc { get; set; }
        public List<HierarchicalFileEntry> MyDirectories { get; set; }
        public List<HierarchicalFileEntry> Items { get; set; }
    }

    // the next lines are hardcoded data generation so you can explore the FileManager freely
    private async Task<List<HierarchicalFileEntry>> GetHierarchicalFileEntries()
    {
        var root = new HierarchicalFileEntry()
        {
            MyModelId = "1",
            Name = "Work Files",
            IsDirectory = true,
            HasDirectories = true,
            DateCreated = new DateTime(2022, 1, 2),
            DateCreatedUtc = new DateTime(2022, 1, 2),
            DateModified = new DateTime(2022, 2, 3),
            DateModifiedUtc = new DateTime(2022, 2, 3),
            Path = Path.Combine(RootPath, "Work Files"),
            Size = 3 * 1024 * 1024,
        };

        var Documents = new HierarchicalFileEntry()
        {
            MyModelId = "2",
            Name = "Documents",
            IsDirectory = true,
            DateCreated = new DateTime(2022, 1, 2),
            DateCreatedUtc = new DateTime(2022, 1, 2),
            DateModified = new DateTime(2022, 2, 3),
            DateModifiedUtc = new DateTime(2022, 2, 3),
            Path = Path.Combine(root.Path, "Documents"),
            Size = 1024 * 1024
        };

        var specification = new HierarchicalFileEntry()
        {
            MyModelId = "3",
            Name = "Specification",
            IsDirectory = false,
            Extension = ".docx",
            DateCreated = new DateTime(2022, 1, 5),
            DateCreatedUtc = new DateTime(2022, 1, 5),
            DateModified = new DateTime(2022, 2, 3),
            DateModifiedUtc = new DateTime(2022, 2, 3),
            Path = Path.Combine(Documents.Path, "Specification.docx"),
            Size = 462 * 1024
        };

        var report = new HierarchicalFileEntry()
        {
            MyModelId = "4",
            Name = "Report",
            IsDirectory = false,
            Extension = ".xlsx",
            DateCreated = new DateTime(2022, 1, 20),
            DateCreatedUtc = new DateTime(2022, 1, 20),
            DateModified = new DateTime(2022, 1, 25),
            DateModifiedUtc = new DateTime(2022, 1, 25),
            Path = Path.Combine(Documents.Path, "Report.xlsx"),
            Size = 538 * 1024
        };

        var Images = new HierarchicalFileEntry()
        {
            MyModelId = "5",
            Name = "Images",
            IsDirectory = true,
            DateCreated = new DateTime(2022, 1, 2),
            DateCreatedUtc = new DateTime(2022, 1, 2),
            DateModified = new DateTime(2022, 2, 3),
            DateModifiedUtc = new DateTime(2022, 2, 3),
            Path = Path.Combine(root.Path, "Images"),
            Size = 2 * 1024 * 1024
        };

        var dashboardDesign = new HierarchicalFileEntry()
        {
            MyModelId = "6",
            Name = "Dashboard",
            IsDirectory = false,
            Extension = ".png",
            DateCreated = new DateTime(2022, 1, 10),
            DateCreatedUtc = new DateTime(2022, 1, 10),
            DateModified = new DateTime(2022, 2, 13),
            DateModifiedUtc = new DateTime(2022, 2, 13),
            Path = Path.Combine(Images.Path, "Dashboard.png"),
            Size = 1024
        };

        var gridDesign = new HierarchicalFileEntry()
        {
            MyModelId = "7",
            Name = "Design",
            IsDirectory = false,
            Extension = ".png",
            DateCreated = new DateTime(2022, 1, 12),
            DateCreatedUtc = new DateTime(2022, 1, 12),
            DateModified = new DateTime(2022, 2, 13),
            DateModifiedUtc = new DateTime(2022, 2, 13),
            Path = Path.Combine(Images.Path, "Design.png"),
            Size = 1024
        };

        Documents.Items = new List<HierarchicalFileEntry>() { specification, report };
        Images.Items = new List<HierarchicalFileEntry>() { dashboardDesign, gridDesign };
        root.MyDirectories = new List<HierarchicalFileEntry>() { Documents, Images };
        root.Items = new List<HierarchicalFileEntry>() { Documents, Images };

        List<HierarchicalFileEntry> files = new List<HierarchicalFileEntry>() { root };

        return await Task.FromResult(files);
    }
}

Regards,
Hristian Stefanov
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Telerik family, check out our getting started resources!
ADMIN
Hristian Stefanov
Posted on: 03 Jan 2024 18:11

Hi Chris,

After conducting a thorough investigation, I can confirm you are correct—the bug has indeed been partially addressed. Specifically, the fix applies to flat data scenarios, but regrettably, the issue persists with hierarchical data. Consequently, I am reverting the status of this item to "Unplanned."

On a positive note, I want to assure you that a dedicated developer has been assigned to address this matter and is actively working towards a comprehensive fix. There is a very high probability that the issue will be entirely resolved in the upcoming release scheduled for the end of January. Please continue to monitor the status here for further updates.

Regards,
Hristian Stefanov
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Telerik family, check out our getting started resources!
ADMIN
Hristian Stefanov
Posted on: 26 Dec 2023 14:08

Hi Chris,

Thank you for sharing your insights on this matter. In response, we are actively revising the item, and I am conducting different tests with the hierarchical data binding within the component.

Rest assured, I will reach out to you promptly with additional information as soon as I gather insights from our development team.

Your patience during this interim period is greatly appreciated.

Regards,
Hristian Stefanov
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Telerik family, check out our getting started resources!
Chris
Posted on: 20 Dec 2023 22:02

By the way, this demo is still broken six months later:

 

https://docs.telerik.com/blazor-ui/components/filemanager/data-binding/hierarchical-data

Chris
Posted on: 20 Dec 2023 22:01

Can you provide an example for hierarchical data? Based on your provided reason for not supporting this feature, I would think this would work, but it does not. The path of the nested item does indeed include the parent path/name ("Test1").

 

  {
        "path": "Test1",
        "name": "Test1",
        "type": "d",
        "extension": "",
        "size": 0,
        "isDirectory": true,
        "hasDirectories": false,
        "created": "0001-01-01T00:00:00",
        "createdUtc": "0001-01-01T00:00:00",
        "modified": "0001-01-01T00:00:00",
        "modifiedUtc": "0001-01-01T00:00:00",
        "items": [
            {
                "path": "Test1/testie.png",
                "name": "testie",
                "type": "f",
                "extension": ".png",
                "size": 19015,
                "isDirectory": false,
                "hasDirectories": false,
                "created": "2021-07-08T16:53:40",
                "createdUtc": "2021-07-08T16:53:40",
                "modified": "2021-07-08T16:53:40",
                "modifiedUtc": "2021-07-08T16:53:40",
                "items": [],
                "directories": []
            }
        ],
        "directories": []
    },

 

ADMIN
Yanislav
Posted on: 04 Sep 2023 11:07

Hello,

After further investigation, we have decided to close this item since the problem is due to an invalid configuration.

We will promptly update our documentation with additional information about this case, but essentially, the breadcrumb items are not displayed because the logic behind relies on the condition that the name of the item will be part of its path.

In general, the component is designed to work with data from an actual file system, and in file systems, it is not valid to have an item with a path that does not end with the name of the item (directory or file).

In other words, the FileManager Items from the provided REPL example: 

        var workFiles = new FlatFileEntry()
            {
                Id = "1",
                ParentId = null,
                Name = "Work Files",
                IsDirectory = true,
                HasDirectories = true,
                DateCreated = new DateTime(2022, 1, 2),
                DateCreatedUtc = new DateTime(2022, 1, 2),
                DateModified = new DateTime(2022, 2, 3),
                DateModifiedUtc = new DateTime(2022, 2, 3),
                Path = Path.Combine("files"),
                Size = 3 * 1024 * 1024
            };

        var Documents = new FlatFileEntry()
            {
                Id = "2",
                ParentId = workFiles.Id,
                Name = "Documents",
                IsDirectory = true,
                HasDirectories = false,
                DateCreated = new DateTime(2022, 1, 2),
                DateCreatedUtc = new DateTime(2022, 1, 2),
                DateModified = new DateTime(2022, 2, 3),
                DateModifiedUtc = new DateTime(2022, 2, 3),
                Path = Path.Combine(workFiles.Path, "documents"),
                Size = 1024 * 1024
            };

are invalid because the Name of the item is not included in the Path.

Here is a modified version of the example that works correctly: https://blazorrepl.telerik.com/wnYtYIbl04TnujVq21

 

 


Regards,
Yanislav
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Telerik family, check out our getting started resources!
Chris
Posted on: 16 Aug 2023 14:44

Yes you can see this here as well:

https://docs.telerik.com/blazor-ui/components/filemanager/data-binding/hierarchical-data