Giter VIP home page Giter VIP logo

aor-firebase-client's People

Contributors

bilalbudhani avatar grahamlyus avatar rwoverdijk avatar shrmnk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aor-firebase-client's Issues

Support React Admin ? (AOR 2.0)

Hi,

Admin-On-Rest was renamed to React Admin with its 2.0 upgrade.
Will you plan to support this version as well ?

Thank you!

Overwrites externally modified data

Right now we seem to be sending the entire record to Firebase's update function, instead of just the properties that have been updated in AOR. This could cause problems. To illustrate:

  1. I open up user foo in AOR.
  2. User foo joins a group bar in My app.
  3. My app creates a relation users/foo/groups/bar in Firebase DB.
  4. I edit user foo's name to "John Doe" in AOR.
  5. I hit save in AOR.
  6. users/foo/groups/bar will be deleted from Firebase DB by AOR.
  7. users/foo/name will be set to "John Doe" in Firebase DB by AOR.
  8. User foo is no longer a member of group bar in my app.

Could it be solved by a comparison of params.previousData vs params.data before posting to firebase, then posting only the fields that have been changed?

Typos in README

I spotted two errors in the README example.

  1. In the first example, the admin component should include firebaseConfig instead of trackedResources:

This:
<Admin restClient={RestClient(trackedResources, clientOptions)} >
should be:
<Admin restClient={RestClient(firebaseConfig, clientOptions)} >

  1. The name of the attribute passed to the clientOptions.trackedResources object should be isPublic:true instead of public: true, according to the source code.

Data are created but not with the correct path on firebase

Hi guys !

First of all, thanks for your library :) I have a issue when I want to insert data in firebase ! Data are inserted but not in the correct path on firebase !

This is my route when I want to create an event for example:
http://localhost:3000/admin/events/create

sans titre

I would to like that data are inserted into /events, but here data are saved in /admin/events.
This is normal because your library uses the basepath which corresponds to the location path:
restClient.js#L142

Maybe, it could be better to to get the firebase reference on the resource, not on the basepath, like you do

Thanks in advance !

Cannot read property 'then' of undefined

I'm having an issue with loading my data. I get a popup that says Cannot read property then of undefined and I'm assuming that means it can not load the data.

App.js

import React from 'react';
import UserIcon from 'material-ui/svg-icons/social/group';

import { Admin, Resource } from 'admin-on-rest';
import { UserList } from './Users';
import { RestClient, AuthClient } from 'aor-firebase-client';
import config from './app.json'  // IT PULLS IN MY CONFIG AS EXPECTED

const trackedResources = ['users, connections']

const App = () => (
    <Admin restClient={RestClient(trackedResources, config.firebaseConfig)} authClient={AuthClient}>
        <Resource name="users" list={UserList} icon={UserIcon} />
    </Admin>
);

export default App;

Users.js

import React from 'react';
import { List, Datagrid, EmailField, TextField } from 'admin-on-rest';

export const UserList = (props) => (
    <List title="All users" {...props}>
        <Datagrid>
            <TextField source="company" />
            <TextField source="name" />
            <TextField source="paymentId" />
            <EmailField source="email" />
        </Datagrid>
    </List>
);

schema

users
   id
     name
     company
     email
     paymentId

RestClient fetches data before Auth

When I try to add RestClient to admin like this:

 <Admin restClient={RestClient(trackedResources, firebaseConfig)} authClient={AuthClient}>
      <Resource name="users" list={UserList} edit={UserEdit} icon={UserIcon}/>
 </Admin>

And the resource "users" is guarded by firebase permission rules, and is not loaded. The login page is either hanged if access "/users" directly, or login successfully but then "users" is not loaded.

After debugging, it seems to me that the firebase client is binding to the resource "users" without checking for authentication status, the firebase web-socket frame returns "permission denied" and then hang then.

There might be 2 improvements needed:

  • Making sure firebase authentication status is checked before binding to resource.
  • Allow 'refresh' action to fetch the resource again, may be re-init the firebase connection is required.

User doesn't persist

I can't get the user to persist.

I can login fine, but upon browser refresh, firebase.auth().currentUser is null.
The token firebaseToken is set in localStorage.

Everything else is pretty similar to your demo.

And, how is data structured in firebase? E.g. from your demo?

Automatically refresh token

Firebase token seems to expire every 1 hour.

This causes problems when there are actions to be made, is there a way to automatically refresh the token in the background before the hour expires? Or some other solution?

We want the logged-in user to remain logged-in until they choose to logout.

Thanks.

P.S. Similar discussion here (for Android apps though):
https://stackoverflow.com/questions/38350843/how-to-handle-custom-firebase-token-expiry-in-firebase-3-x-x
P.S. Using react-admin v2.1.2 (please update for latest react-admin, thanks!)

Fetch Data from database on demand

Now, all data is fetched to the client and then all operations like filtering apply to these data in the client side. This approach is not ideal for huge data.

authClient causing errors

When using authClient I get the following error:

TypeError: __webpack_require__.i(...) is not a function
App
src/App.js:19
  16 | const trackedResources = ['configs'];
  17 | 
  18 | const App = () => (
> 19 |   <Admin restClient={RestClient(trackedResources, firebaseConfig)} authClient={AuthClient(firebaseConfig)}>
  20 |     <Resource name="Configs" list={ConfigList} edit={ConfigEdit} />
  21 |   </Admin>
  22 | );
View compiled

It works when removed. My code is really simple:

// in src/App.js
import React from 'react';
import {Admin, Resource} from 'admin-on-rest';
import {ConfigList, ConfigEdit} from './config';
import {RestClient, AuthClient} from 'aor-firebase-client';

const firebaseConfig = {
};

const trackedResources = ['configs'];

const App = () => (
  <Admin restClient={RestClient(trackedResources, firebaseConfig)} authClient={AuthClient(firebaseConfig)}>
    <Resource name="Configs" list={ConfigList} edit={ConfigEdit} />
  </Admin>
);

export default App;

Example Firebase schema?

Hi, starting up a new project with this client. I was wondering if there were a way to access the Firebase schema in the demo, or at least for you to provide an example. No problem getting the auth to work, but having issues loading resources as the loading circle just keeps spinning without any feedback on whether it's actually sending the firebase db query.

What the hell Sid?!?!?!

So, guys, I'm really sad that I'm not delivering the updates here as I want.
The fact is that I'm having a CRAZY amount of work since August.

So, in order to plan things a bit, I would like to know if you guys would like to help me on TESTING the new version.
Testing is BY FAR what takes most of the time. If you guys are up to helping on it, I can start working in a new version (react-admin based and include Firestore) if you guys accept to help me on it.

So, I would like to anyone who wants to help at least on testing to reply here.

@Kmaschta @photocat @nietzscheson @afilp @pelanmar1 @leomyth330 @erickvictor @georgerb @bvivek20 @jesster2k10 @matseriksen @roadev @jjjjjjjjjjjjjjjjjjjj @RWOverdijk @Hosnidokht

Important to mention that I'm not using it that much, so, I will need this help in order to help you.
I want to rewrite it from scratch, first for RealTime Database and later for Firestore, in a well structured way that allows you to override parts of the code and improve functionality.

ps: Anyone that wants helps CODING it will be welcome too :)

Firebase Storage

According to the recommended approach to save files and images in firebase, it is necessary to save these files in storage first (e.x, ) and then add file URL to realtime database with the other data. it needs to implement in CREATE, UPDATE and DELETE.

After creating model, all TextInputs are empty.

I tried with sample project and it works fine until creating the model. But after creating, it redirects to edit page and all inputs are empty.
It's filled again if I refresh the browser.
How can I fix this?

"Access denied" in demo

Im playing around with the demo and when I try to login with the user I created in firebase, the user is found, but says "access denied". In firebase auth it says I was logged in. Anybody know how to fix this?

Problem Code

'./reference' does not contain an export named 'AUTH_CHECK'.

import React from 'react';
import { Admin, Resource } from 'admin-on-rest';
import { RestClient } from 'aor-firebase-client';
import { PostList } from './posts';

const firebaseConfig = {
apiKey: "",
authDomain: "",
databaseURL: "",
storageBucket: "",
messagingSenderId: ""
};

const clientOptions = {
timestampFieldNames: {
createdAt: 'createdAt',
updatedAt: 'updatedAt'
},
trackedResources: {
name: 'posts', // The name reference to be used in all other places in AOR
path: 'blog', // The path in the database. If missing will use the name
public: true,
uploadFields: [] // The string name of the field
} // A single string assumes path and name as equal, non private and without upload fields
}

const App = () => (
< Admin restClient={RestClient(clientOptions)} >

< /Admin>
);

export default App;

Firestore storage

Is any way this can be used to connect with firestore instead of realtime database?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.