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

v1.0.2, cannot upload firmware by GUI #843

Closed
pojiro opened this issue Jul 25, 2022 · 3 comments
Closed

v1.0.2, cannot upload firmware by GUI #843

pojiro opened this issue Jul 25, 2022 · 3 comments

Comments

@pojiro
Copy link
Contributor

pojiro commented Jul 25, 2022

Describe the bug

With v1.0.2, we cannot upload firmware by GUI, because HTML input tag type file doesn't work.
I think this is because joshjs's potential bug reveals in improvements up to v1.0.2.

The error message is following.

image

The error prevents to execute following jQuery.

new Josh()
$(function () {
$('.custom-upload-input').on('change', function () {
let fileName = $(this).val().split('\\').pop()
$(this)
.siblings('.custom-upload-label')
.removeClass('not-selected')
.addClass('selected')
.html("Selected File: <div class='file-name'>" + fileName + '</div>')
})
})

To Reproduce

  1. mix assets.setup && make iex-server
  2. Go to http://localhost:4000/org/NervesTeam/SmartRentHub/firmware/upload
  3. Click on 'Click to upload file'
  4. Then select some firmware you have. This ends with no action.

Expected behavior

can upload firmware

Desktop (please complete the following information):

  • OS: [Linux]
  • Browser [chrome, firefox]
  • Version [nerves_hub_web: v1.0.2]

Additional context

I made a PR to fix this joshjs's issue.

I also have an idea of what to do if the PR is not accepted. That is to stop using joshjs, currently joshjs is used only one place,

<a class="btn btn-primary btn-lg btn-home josh-js" data-josh-anim-name="pulse" href={Routes.account_path(@conn, :new)}>Get Started</a>

so I think we can choose to stop using joshjs. I already tried to uninstall joshjs on my self-hosted nerves-hub and confirmed uploadable and deployable.

@tonnenpinguin
Copy link
Contributor

I noticed the josh exceptions a while ago already and ended up dropping josh from our fork as well because I didn't see the benefit of it being there in the first place :)

By the way: Another fix is to just wrap the new Josh() call in a try catch block. That would also allow the jquery to be executed, although it might be worthwhile to figure out a way around using jquery in the first place 🙃

@pojiro
Copy link
Contributor Author

pojiro commented Jul 25, 2022

I already tried to uninstall joshjs on my self-hosted nerves-hub and confirmed uploadable and deployable.

#844 is the commit i tried.

@fhunleth
Copy link
Contributor

Thanks for looking into this and fixing!

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

No branches or pull requests

3 participants