Skip to content

Commit 8f2dcf5

Browse files
author
thirukumarangceb
committed
Readme content updated for the firebase file provider
1 parent 8d62bbf commit 8f2dcf5

File tree

3 files changed

+89
-26
lines changed

3 files changed

+89
-26
lines changed

CHANGELOG.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Changelog
22

3-
## [Unreleased]
3+
## 17.3.0.14 (2019-10-04)
44

5-
### Firebase realtime database File System Provider
5+
### Firebase realtime database file system provider
66

77
#### New Features
88

9-
- Added firebase realtime database filesystem provider support for ASP.NET Core.
9+
- Added Firebase realtime cloud storage database filesystem provider support for ASP.NET Core.

Models/FirebaseRealtimeDBFileProvider.cs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
namespace Syncfusion.EJ2.FileManager.FirebaseRealtimeFileProvider
1414
{
15-
public class FirebaseRealtimeDBFileProvider : FirebaseRealtimeDBFileProviderBase
15+
public class FirebaseRealtimeDBFileProvider : FirebaseRealtimeFileProviderBase
1616
{
1717
protected string filterPath = null;
1818
protected string filterId = null;
@@ -25,14 +25,14 @@ public class FirebaseRealtimeDBFileProvider : FirebaseRealtimeDBFileProviderBase
2525
List<FileManagerDirectoryContent> copyFiles = new List<FileManagerDirectoryContent>();
2626
protected string apiUrl;
2727
protected string rootNode;
28-
protected string accessTokenPath;
28+
protected string serviceAccountKeyPath;
2929

3030
// Registering the firebase realtime database storage
31-
public void RegisterFirebaseRealtimeDB(string apiUrl, string rootNode, string accessTokenPath)
31+
public void RegisterFirebaseRealtimeDB(string apiUrl, string rootNode, string serviceAccountKeyPath)
3232
{
3333
this.apiUrl = apiUrl;
3434
this.rootNode = rootNode;
35-
this.accessTokenPath = accessTokenPath;
35+
this.serviceAccountKeyPath = serviceAccountKeyPath;
3636
this.UpdateFirebaseJSONData();
3737
}
3838

@@ -42,7 +42,7 @@ public FirebaseRealtimeDBFileProvider()
4242
//updates the firebase realtime database json
4343
private void UpdateFirebaseJSONData()
4444
{
45-
this.firebaseAPI = new FirebaseOperations(this.apiUrl,this.accessTokenPath);
45+
this.firebaseAPI = new FirebaseOperations(this.apiUrl, this.serviceAccountKeyPath);
4646
this.getFirebaseRootNode = firebaseAPI.Node(this.rootNode);
4747
this.getResponse = getFirebaseRootNode.Get(this.apiUrl + "/" + this.rootNode + "/");
4848
dynamic obj = Newtonsoft.Json.JsonConvert.DeserializeObject(getResponse.JSONContent);
@@ -223,6 +223,12 @@ public FileManagerResponse Details(string path, string[] names, params FileManag
223223
else
224224
{
225225
List<string> NamesList = new List<string>();
226+
bool sameFolder = true;
227+
foreach (var location in data) {
228+
if (data[0].FilterPath != location.FilterPath) {
229+
sameFolder = false;
230+
}
231+
}
226232
for (int i = 0; i < names.Length; i++)
227233
{
228234
FileManagerDirectoryContent[] cwd = firebaseGetData.Where(x => x.Id == data[i].Id).Select(x => new FileManagerDirectoryContent()
@@ -241,7 +247,7 @@ public FileManagerResponse Details(string path, string[] names, params FileManag
241247
NamesList.Add(cwd[0].Name);
242248
}
243249
fileDetails.Name = string.Join(", ", NamesList.ToArray());
244-
fileDetails.Location = "Various folders";
250+
fileDetails.Location = sameFolder ? rootNode + data[0].FilterPath.TrimEnd('/') : "Various folders";
245251
fileDetails.Size = byteConversion(long.Parse("" + this.GetItemSize(data))).ToString();
246252
fileDetails.MultipleFiles = true;
247253
detailFiles = fileDetails;

README.md

Lines changed: 74 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,39 +4,42 @@ This repository contains the ASP.NET Core firebase real time database based file
44

55
## Key Features
66

7-
The following actions can be performed with firebase realtime database based file system provider.
8-
9-
- Read - Read the files from firebase real time database.
10-
- Details - Provides details about files Type, Size, Location and Modified date.
11-
- Download - Download the selected file or folder from the firebase real time database.
12-
- Upload - Upload a files to firebase real time database. It accepts uploaded media with the following characteristics:
13-
- Maximum file size: 30MB
14-
- Create - Create a new folder.
15-
- Delete - Remove a file from firebase real time database.
16-
- Copy - Copy the selected Files from target.
17-
- Move - Paste the copied files to the desired location
18-
- Rename - Rename a folder or file
19-
- Search - Search a file or folder in firebase real time database
7+
The following actions can be performed with firebase real time database based file system provider.
8+
9+
| **Actions** | **Description** |
10+
| --- | --- |
11+
| Read | Read the files from firebase real time database. |
12+
| Details | Provides details about files Type, Size, Location and Modified date. |
13+
| Download | Download the selected file or folder from the firebase real time database. |
14+
| Upload | Uploads a files to Firebase realtime database. It accepts uploaded media with the following characteristics: <ul><li>Maximum file size: 30MB<li>Accepted Media MIME types: `*/*` </li></ul> |
15+
| Create | Create a new folder. |
16+
| Delete | Remove a file from firebase real time database. |
17+
| Copy | Copy the selected Files from target. |
18+
| Move | Paste the copied files to the desired location. |
19+
| Rename | Rename a folder or file. |
20+
| Search | Search a file or folder in firebase real time database. |
2021

2122
## Prerequisites
2223

23-
To run the service, we need to create a [Firebase project](https://console.firebase.google.com/) to access firebase realtime database. Register the realtime database details like REST API link and the root node in the RegisterFirebaseRealtimeDB method of FilebaseRealtimeFileProvider in the controller part of the ASP.NET Core application.
24+
To run the service, we need to create a [Firebase project](https://console.firebase.google.com/) to access firebase realtime database. Register the realtime database details like firebase realtime database service link, root node and service account key path in the **RegisterFirebaseRealtimeDB** method of *FilebaseFileProvider* in the controller part of the ASP.NET Core application.
2425

2526
```
2627
27-
RegisterFirebaseRealtimeDB(string apiUrl, string rootNode)
28+
RegisterFirebaseRealtimeDB(string apiUrl, string rootNode, string serviceAccountKeyPath)
2829
2930
```
3031

3132
## How to run this application?
3233

33-
To run this application, clone the [`ej2-firebase-realtime-database-aspcore-file-provider`](https://github.com/ej2-firebase-realtime-database-aspcore-file-provider) repository and then navigate to its appropriate path where it has been located in your system.
34+
To run this application, clone the [`ej2-firebase-realtime-database-aspcore-file-provider`](https://github.com/SyncfusionExamples/ej2-firebase-realtime-database-aspcore-file-provider) repository and then navigate to its appropriate path where it has been located in your system.
3435

3536
To do so, open the command prompt and run the below commands one after the other.
3637

3738
```
3839
39-
git clone https://github.com/ej2-firebase-realtime-database-aspcore-file-provider ej2-firebase-realtime-database-aspcore-file-provider
40+
git clone https://github.com/SyncfusionExamples/ej2-firebase-realtime-database-aspcore-file-provider
41+
42+
4043
cd ej2-firebase-realtime-database-aspcore-file-provider
4144
4245
```
@@ -45,6 +48,60 @@ cd ej2-firebase-realtime-database-aspcore-file-provider
4548

4649
Once cloned, open solution file in visual studio.Then build the project after restoring the nuget packages and run it.
4750

51+
## File Manager AjaxSettings
52+
53+
To access the basic actions such as Read, Delete, Copy, Move, Rename, Search, and Get Details of File Manager using Firebase realtime database file system service, just map the following code snippet in the Ajaxsettings property of File Manager.
54+
55+
Here, the `hostUrl` will be your locally hosted port number.
56+
57+
```
58+
var hostUrl = http://localhost:62870/;
59+
ajaxSettings: {
60+
url: hostUrl + 'api/FirebaseProvider/FirebaseRealtimeFileOperations'
61+
}
62+
```
63+
64+
## File download AjaxSettings
65+
66+
To perform download operation, initialize the `downloadUrl` property in ajaxSettings of the File Manager component.
67+
68+
```
69+
var hostUrl = http://localhost:62870/;
70+
ajaxSettings: {
71+
url: hostUrl + 'api/FirebaseProvider/FirebaseRealtimeFileOperations',
72+
downloadUrl: hostUrl +'api/FirebaseProvider/FirebaseRealtimeDownload'
73+
}
74+
```
75+
76+
## File upload AjaxSettings
77+
78+
To perform upload operation, initialize the `uploadUrl` property in ajaxSettings of the File Manager component.
79+
80+
```
81+
var hostUrl = http://localhost:62870/;
82+
ajaxSettings: {
83+
url: hostUrl + 'api/FirebaseProvider/FirebaseRealtimeFileOperations',
84+
uploadUrl: hostUrl +'api/FirebaseProvider/FirebaseRealtimeUpload'
85+
}
86+
```
87+
88+
## File image preview AjaxSettings
89+
90+
To perform image preview support in the File Manager component, initialize the `getImageUrl` property in ajaxSettings of the File Manager component.
91+
92+
```
93+
var hostUrl = http://localhost:62870/;
94+
ajaxSettings: {
95+
url: hostUrl + 'api/FirebaseProvider/FirebaseRealtimeFileOperations',
96+
getImageUrl: hostUrl +'api/FirebaseProvider/FirebaseRealtimeGetImage'
97+
}
98+
```
99+
100+
The FileManager will be rendered as the following.
101+
102+
![File Manager](https://ej2.syncfusion.com/products/images/file-manager/readme.gif)
103+
104+
48105
## Support
49106

50107
Product support is available for through following mediums.

0 commit comments

Comments
 (0)