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

Adding firebase storage capability (w/ multiple files) #69

Merged
merged 34 commits into from
Jun 1, 2017
Merged

Adding firebase storage capability (w/ multiple files) #69

merged 34 commits into from
Jun 1, 2017

Conversation

tjmonsi
Copy link
Collaborator

@tjmonsi tjmonsi commented Jul 8, 2016

Following the patterns from <firebase-document>, I would like to ask for review for that addition of two components: Polymer.FirebaseStorageBehavior and <firebase-storage>

firebase-storage allows the uploading of a single or multiple files from a File object or an Array of File objects (FileList) fed to the file attribute. You can then call the .upload() method to upload the files manually or just add auto-upload attribute to automatically upload the files.

All files and their statuses are returned via the uploaded-files property, where each element inside will be updated via events inside.

Other methods:
destroy() to delete the file / folder in the path.
resume(i), pause(i), cancel(i): the methods found in the upload tasks. The i parameter is for accessing the file element in the array returned from uploaded-files

Example usage as follows:

<firebase-storage
        id="fs"
        path="/users/{{user.uid}}/files"
        files="[[files]]"
        uploaded-files="{{uploadedFiles}}"
        on-error="catchError"
        auto-upload>
</firebase-storage>

You can play with the demo here: https://practice-play-for-polymer-tjmonsi1.c9users.io/

This is an offshoot of the PR #30 and hopefully a fix for #10.

Some bugs:
cancel, resume, and pause sometimes doesn't respond even when wrapped around a promise. Will try to figure out why.

Would like to get some feedback

@tjmonsi
Copy link
Collaborator Author

tjmonsi commented Aug 19, 2016

@mbleigh Hi, would like to know any updates on this :)

@mbleigh
Copy link
Contributor

mbleigh commented Aug 19, 2016

Plan to take a closer look next week, thanks

On Fri, Aug 19, 2016, 9:02 AM Toni-Jan Keith Monserrat <
[email protected]> wrote:

@mbleigh https://github.com/mbleigh Hi, would like to know any updates
on this :)


You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub
#69 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAAD_u_Nns0SG6CdfbesS10DW6aMFNIoks5qhdOKgaJpZM4JIHKx
.

@sbeleidy
Copy link

sbeleidy commented Sep 17, 2016

We're trying to use this and we can upload files fine. We're having trouble understanding how to access files from firebase storage however. One way we imagine this working would be something like:

<firebase-storage
      id="fs"
      app-name="myapp"
      path="/path/to/image.png"
      files="[[files]]"
      on-error="catchError">
      </firebase-storage>

<img src="[[files]]" alt="my file">

I see that there's a function for getDownloadUrl() but not sure how this should be used.

Or is the intended use to getDownloadUrl() on upload and store that in the database instead?

Could you please clarify how this should be used for downloading ?

@tjmonsi
Copy link
Collaborator Author

tjmonsi commented Sep 17, 2016

Hi Saad,

Unfortunately, the current implementation does not behave the same firebase
document where it has a one to one correspondence with the path. It is only
used as of now as an uploader (that's why it uses getdownloadurl) But given
your idea, i think this can be done... Lemme check the code again and then
give a documentation.

On Sat, 17 Sep 2016 23:37 Saad Elbeleidy, [email protected] wrote:

We're trying to use this and we can upload files fine. We're having
trouble understanding how to access files from firebase storage however.
One way we imagine this working would be something like:


I see that there's a function for getDownloadUrl() but not sure how this
should be used.

Or is the intended use to getDownloadUrl() on upload and store that in the
database instead?

Could you please clarify how this should be used for downloading ?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#69 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AChe1sVp2fBvvyXTt37bjT_5MWTpGa4cks5qrAkcgaJpZM4JIHKx
.

@tjmonsi
Copy link
Collaborator Author

tjmonsi commented Sep 22, 2016

@mbleigh would like to follow this up. I like the idea of @sbeleidy though but would like to know what would be the thrust of the polymerfire team on this

@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request) and all commit authors, but as best as we can tell these commits were authored by someone else. If that's the case, please add them to this pull request and have them confirm that they're okay with these commits being contributed to Google. If we're mistaken and you did author these commits, just reply here to confirm.

@tjmonsi
Copy link
Collaborator Author

tjmonsi commented Oct 17, 2016

@googlebot The added parts are just from the messaging branch from the polymerfire.

@tjmonsi
Copy link
Collaborator Author

tjmonsi commented Oct 25, 2016

@mbleigh hi. would like to know if i should rewrite this or is this still a part of the plan of polymerfire

p {
margin: 32px 32px 0;
}
>>>>>>> upstream/master
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the latest commit brought in some merge conflicts that need to be resolved

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice catch there. thanks

@jorgecasar
Copy link

@tjmonsi, can you fix the commits? I would like to get this to update it with more features.

@JosefJezek
Copy link

@mbleigh @cdata @tjmonsi Please resolve this PR.

@tjmonsi
Copy link
Collaborator Author

tjmonsi commented Feb 12, 2017 via email

@googlebot
Copy link

So there's good news and bad news.

👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there.

😕 The bad news is that it appears that one or more commits were authored by someone other than the pull request submitter. We need to confirm that they're okay with their commits being contributed to this project. Please have them confirm that here in the pull request.

Note to project maintainer: This is a terminal state, meaning the cla/google commit status will not change from this state. It's up to you to confirm consent of the commit author(s) and merge this pull request when appropriate.

@tjmonsi
Copy link
Collaborator Author

tjmonsi commented Feb 14, 2017

@jorgecasar It is said that the branch has no conflicts with the base branch, so I am just waiting for them to merge. I don't know what @mbleigh 's plans on having a firebase-storage but then again... I am happy to help now that I am back (after my surgery). If there's anything I need to change, please help me and point it out so I can fix it easily. Thanks 😄

@locomuco
Copy link

@tjmonsi there are still some conflicts in the PR, have a quick look at the changed files, seems there went something wrong resolving merge conflicts

I hope that PR makes it into mainline after all 👍

@tjmonsi
Copy link
Collaborator Author

tjmonsi commented Feb 14, 2017

Hmmm... what I'm going to do is to check if I can still do a rebase. If not, I'll just open another PR and close this one. Thanks @locomuco

@tjmonsi
Copy link
Collaborator Author

tjmonsi commented Feb 14, 2017

@locomuco how about now? It's still saying that this branch has no conflicts with the base branch. I updated the dependencies though

@@ -45,10 +45,13 @@
main {
padding: 32px;
}
<<<<<<< HEAD

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are still wrongly resolved conflicts

@jorgecasar
Copy link

@tjmonsi there are 2 thins to solve:

@tjmonsi
Copy link
Collaborator Author

tjmonsi commented Feb 14, 2017

I guess I'll just have to create another PR then. I think the one i did before made the conflict

@googlebot
Copy link

CLAs look good, thanks!

@googlebot
Copy link

So there's good news and bad news.

👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there.

😕 The bad news is that it appears that one or more commits were authored by someone other than the pull request submitter. We need to confirm that they're okay with their commits being contributed to this project. Please have them confirm that here in the pull request.

Note to project maintainer: This is a terminal state, meaning the cla/google commit status will not change from this state. It's up to you to confirm consent of the commit author(s) and merge this pull request when appropriate.

@tjmonsi
Copy link
Collaborator Author

tjmonsi commented May 25, 2017

@FluorescentHallucinogen I think you need to sign the CLA now for this to work :)

@tjmonsi
Copy link
Collaborator Author

tjmonsi commented May 25, 2017

I've also found that toString method for some reason is not listed on API Reference page. If I rename it to e.g. toString2, all is ok…

@FluorescentHallucinogen what do you mean?

@FluorescentHallucinogen
Copy link
Contributor

@googlebot All is ok.

@FluorescentHallucinogen
Copy link
Contributor

@tjmonsi

@FluorescentHallucinogen what do you mean?

Run polymer serve and check "Methods" section on http://127.0.0.1:****/components/polymerfire/#firebase-storage-ref page.

bower.json Outdated
@@ -24,8 +24,11 @@
},
"devDependencies": {
"iron-component-page": "PolymerElements/iron-component-page#1 - 2",
"note-app-elements": "polymerlabs/note-app-elements#1 - 2",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove "note-app-elements" deps as demo was removed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removing

bower.json Outdated
@@ -36,8 +39,11 @@
},
"devDependencies": {
"iron-component-page": "PolymerElements/iron-component-page#^1.0",
"note-app-elements": "polymerlabs/note-app-elements",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove it too.

* There are two ways to do this. You can encapsulate `firebase-storage-upload-task` in another
* element to have a local scope of the upload task's state:
* ```
* //file-uploader
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove it, because looks like it breaks the markup.

* </template>
*
*
* // file-task
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove it too.




path from snapshot: {{item.snapshot.ref.fullPath}} <br/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about changing two-way data flow to one-way (double curly brackets — {{ }} to double square brackets — [[ ]]) around the all code where it is needed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'll do that.

Signed-off-by: Toni-Jan Keith Monserrat <[email protected]>
@googlebot
Copy link

So there's good news and bad news.

👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there.

😕 The bad news is that it appears that one or more commits were authored by someone other than the pull request submitter. We need to confirm that they're okay with their commits being contributed to this project. Please have them confirm that here in the pull request.

Note to project maintainer: This is a terminal state, meaning the cla/google commit status will not change from this state. It's up to you to confirm consent of the commit author(s) and merge this pull request when appropriate.

@tjmonsi
Copy link
Collaborator Author

tjmonsi commented May 26, 2017

@FluorescentHallucinogen I think CLA is not yet ok. Can you try again?

@FluorescentHallucinogen
Copy link
Contributor

@googlebot I signed it!

@FluorescentHallucinogen
Copy link
Contributor

@tjmonsi Looks like a @googlebot bug. I signed Google Individual CLA Mar 12, 2016 06:22 PST. The ID of my CLA is 108694818465100465718. What should I do?

@tjmonsi
Copy link
Collaborator Author

tjmonsi commented May 26, 2017

Should I try squashing the commit? guys?

@FluorescentHallucinogen
Copy link
Contributor

@mbleigh PTAL.

@tjmonsi
Copy link
Collaborator Author

tjmonsi commented May 26, 2017

@FluorescentHallucinogen can you try saying you confirm to submit to @googlebot ? It asks that "We need to confirm that they're okay with their commits being contributed to this project. Please have them confirm that here in the pull request."

@mbleigh
Copy link
Contributor

mbleigh commented May 26, 2017

I think the CLA is fine -- it's in a "terminal state" but it says I can merge on my discretion. I'm going to try to take another look through the code ASAP (probably not until next week) to see if we've got everything we need.

@tjmonsi
Copy link
Collaborator Author

tjmonsi commented May 27, 2017

@mbleigh thanks. :)

@JosefJezek
Copy link

@mbleigh I am waiting for firebase-storage. Thank you.

@FluorescentHallucinogen
Copy link
Contributor

@tjmonsi What about the problem with toString method that I reported earlier? Why toString method is not listed in "Methods" section on the API Reference page?

@tjmonsi
Copy link
Collaborator Author

tjmonsi commented May 31, 2017 via email

@FluorescentHallucinogen
Copy link
Contributor

@tjmonsi My question was "Why toString method is not listed in Methods section?". Why, e.g. putString and updateMetadata are listed, but toString is not?

@FluorescentHallucinogen
Copy link
Contributor

@tjmonsi
screenshot

@tjmonsi
Copy link
Collaborator Author

tjmonsi commented May 31, 2017 via email

@mbleigh mbleigh merged commit 58462a6 into FirebaseExtended:master Jun 1, 2017
@mbleigh
Copy link
Contributor

mbleigh commented Jun 1, 2017

Whoops! I just accidentally pushed this sucker to master based on a bad local git state. Hold on to your branch, please, I'm going to try to untangle this mess.

@mbleigh
Copy link
Contributor

mbleigh commented Jun 1, 2017

@tjmonsi can you please open a new pull request from the same branch? I've hard reset master back to where it was before.

@tjmonsi
Copy link
Collaborator Author

tjmonsi commented Jun 1, 2017 via email

@tjmonsi tjmonsi mentioned this pull request Jun 1, 2017
@eeerrrttty
Copy link

Please, im a noob, so, you pro guys... Can you make an EASY example of an image upload process? Including html, scripts in polymer and the API structure?

Can this be used with polymer 2?

Can i use the firebase/polymerfire api or should i use the tjmonsi fork???

@locomuco
Copy link

@eeerrrttty have a look here at this PR, the PR was moved

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

Successfully merging this pull request may close these issues.

10 participants