BrightspaceUILabs / file-uploader

Polymer-based web component for D2L file uploader
Apache License 2.0
4 stars 6 forks source link

Ability for more generic feedback types #40

Closed dlockhart closed 7 years ago

dlockhart commented 7 years ago

The design calls for different types of feedback to displayed to the user -- errors and warnings. So this change removes the error boolean attribute and replaces it with feedback (string) and feedback-type ("error" or "warning") attributes.

This is a breaking change, so when I release it I'll make a major version number increase.

Also worth noting how you can use CSS attribute values to apply CSS to various elements. In this case, I'm using the presence of the feedback attribute to hide & show the message <div>, and the value from feedback-type to control the colour of the message.

dbatiste commented 7 years ago

Maybe rename to d2l-file-input before making the major bump?

dlockhart commented 7 years ago

I can... I'm just not sure we want to anymore or what to actually call it.

dbatiste commented 7 years ago

Hmmm... I think if this thing doesn't actually do the upload, then we shouldn't call it this.

Just spit-balling here: but I am sort of imagining a couple of things here.

  1. d2l-file-input - the visual component that just gets the file objects

  2. perhaps d2l-file-upload-behavior - JS that handles the XHR upload to some end-point, passes back progress info (as per XHR's progress event), passes back handle that can be used by consuming code to abort.

  3. perhaps d2l-file-upload or d2l-file-upload-status - a WC that interacts with d2l-file-upload-behavior and shows name of file, progress, and an [x] button to abort. One of these per file.

The part that's not super clear to me is - if the upload operation fails for some reason (ex. restricted file type, file too big, duplicate file name, network error, etc), how does this info get communicated back to d2l-file-uploader so it can update the message. In some ways, baking all of the above into d2l-file-uploader avoids putting too much thought into the API between such components (but I think the separation makes sense).

In the back of my mind I've been thinking about how we will update MVC file-input control to use this. I'm not sure if anyone has thought about how these things will hang together...

dlockhart commented 7 years ago

Can we move this discussion into the issue? #19

dbatiste commented 7 years ago

For sure. :)