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

Virtual File System Explorer #1609

Closed
vnetonline opened this issue Aug 9, 2019 · 11 comments · Fixed by #3971
Closed

Virtual File System Explorer #1609

vnetonline opened this issue Aug 9, 2019 · 11 comments · Fixed by #3971
Assignees
Labels
Milestone

Comments

@vnetonline
Copy link
Contributor

@hikalkan I want to create a Virtual File System browser as a module

Can you let me know what your approach would be? It would be good to see what is in the Virtual File System when developing to override views and pages etc etc

Once developed happy for you to include it as a module in the repository.

@hikalkan
Copy link
Member

That is a good idea! It can be useful in development.

Inject IVirtualFileProvider and use GetDirectoryContents("/") to get the root folder contents. It will return file and folders. Then you can reuse it to enter another folder and so on...

@hikalkan hikalkan added this to the Backlog milestone Aug 11, 2019
@vnetonline
Copy link
Contributor Author

@hikalkan GetDirectoryContents Is not a Async function, how do I use it in the ApplicationService

Also it seems it only returns physical files should it return files and directors from all three file providers memory, physical and dynamic ?

@hikalkan
Copy link
Member

It should return all, not only physical files.

A sync method can directly usable inside an async method. Do you have any problem of that?

@vnetonline
Copy link
Contributor Author

No problem I thought that a ApplicationService should always return Async because the UI layer will call it using HttpAPI and whenever calling a HttpApi it should be done Async way as best practice ?? Is my understanding wrong ?

@hikalkan
Copy link
Member

You are true. However, not possible (or meaningfull) to make all methods async.
Calling an async code from a sync method may cause problems. But vise verse does not.

BTW, this method is defined by Microsoft: https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.fileproviders.ifileprovider?view=aspnetcore-2.2
So, I can't make it async :)

@vnetonline
Copy link
Contributor Author

But the method I write in my application project should be Async right ?

Should I just put a task.delay ??

@hikalkan
Copy link
Member

hikalkan commented Aug 20, 2019

But the method I write in my application project should be Async right ?

No, not required. However, I suggest it. Never do task.delay :) Remove async keyword and return Task.CompletedTask; (for void methods) or Task.FromResult(...) (for method returns a value).

@vnetonline
Copy link
Contributor Author

@hikalkan

thanks for your help that makes sense, I am not getting anything when I try and call GetDirectoryContents("/")

Screen Shot 2019-08-21 at 12 11 39 pm

I have changed the launchSetting.json as follows to simulate Production mode

{
  "iisSettings": {
    "windowsAuthentication": false,
    "anonymousAuthentication": true,
    "iisExpress": {
      "applicationUrl": "https://localhost:44329",
      "sslPort": 44329 
    }
  },
  "profiles": {
    "IIS Express": {
      "commandName": "IISExpress",
      "launchBrowser": true,
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Production"
      }
    },
    "Amazing.Software.VirtualFileExplorer.DemoApp": {
      "commandName": "Project",
      "launchBrowser": true,
      "applicationUrl": "https://localhost:44329",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    }
  }
}

@hikalkan
Copy link
Member

@vnetonline can you create an issue for that so we check it. Thanks.

@realLiangshiwei
Copy link
Member

Hi @vnetonline,
Are you still working for this? If not, I can create this module.

@realLiangshiwei realLiangshiwei self-assigned this May 15, 2020
@realLiangshiwei
Copy link
Member

Working in https://github.com/abpframework/abp/tree/liangshiwei/virtualfilesystem-explorer-module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants