OpenFarm icon indicating copy to clipboard operation
OpenFarm copied to clipboard

When uploading an image it shouldn't be possible to save the guide before the image is uploaded.

Open simonv3 opened this issue 8 years ago • 8 comments

Steps to reproduce:

  1. When editing a guide.
  2. Uploading an image.
  3. You can click save guide.

But the image won't appear because it wasn't uploaded yet. This should be fixed.

How I would go about fixing this:

I would provide variable to the uploading directive (s3upload I believe it's called) (or one might already exist?) that indicates whether things are currently uploading. The uploading directive would then manipulate that variable based on whether something is uploading or not. Any controller that then uses the upload directive could block "save" or "continue" buttons until uploading is done.

Alternatively we could throw up a "uploading images" modal that blocks any interaction, but I would really rather not.

simonv3 avatar Apr 14 '16 01:04 simonv3

I like the first approach where we indicate the end-user that image is still uploading and you can't Save/Continue until it is done.

kuldeepaggarwal avatar Jul 23 '16 04:07 kuldeepaggarwal

Hey, @simonv3 the browser seems to give this error undefined: 500 whenever I try to upload an image while editing a crop guide. Any thoughts on why this is happening? Does it call for a separate ticket? Or is it related to this one?

TanSA05 avatar Aug 05 '16 10:08 TanSA05

@TanSA05 is this on your local environment or on the production site?

simonv3 avatar Aug 05 '16 14:08 simonv3

@simonv3 Local env

TanSA05 avatar Aug 05 '16 17:08 TanSA05

Cool, so that's probably because image uploading isn't set up properly on the local environment. Ideally that would be happening through paperclip's use of the default system, but it might be a bit broken because we use Amazon's AWS on production.

Is that upload error happening while you do the uploading? Is it in the JavaScript console?

simonv3 avatar Aug 05 '16 17:08 simonv3

It happens when I click on the upload button, select a picture from my machine, and then this error is thrown by the browser. This is what the JavaScript Console shows: Failed to load resource: the server responded with a status of 500 (Internal Server Error) angular.js?body=1:95 Error: Can't receive the needed options for S3 TypeError at``/api/aws/s3_access_token no implicit conversion of nil into String

app/controllers/api/aws_controller.rb, line 33

TanSA05 avatar Aug 05 '16 17:08 TanSA05

Yeah, it's because you don't have an AWS bucket set up.

That shouldn't be necessary to upload images just for test purposes, but I don't have the time to test why that's happening, and since it works on production that's a fairly low priority for me atm :/.

If you want to work on the s3 uploading you'll have to do this:

https://github.com/openfarmcc/OpenFarm/wiki/How-to-Set-Up-an-Amazon-S3-Bucket-for-Use-with-OpenFarm

Or maybe @RickCarlino will let you use his S3 bucket? Might be worth pinging him on the OpenFarm Slack if you don't want to go through the bucket creating process.

simonv3 avatar Aug 05 '16 18:08 simonv3

Okay. Well, #582 first! :D

TanSA05 avatar Aug 05 '16 18:08 TanSA05