-
Notifications
You must be signed in to change notification settings - Fork 283
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
FIX: Remove loading spinner after image export #477
FIX: Remove loading spinner after image export #477
Conversation
In the old UI, the spinner would continue spinning after the images have been exported. Resolves #470
Thanks for opening this pull request! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way to test this without waiting for the download to complete? It's been taking a very long time for me (over 15 minutes) for some reason.
|
||
L.IconUtil.toggleXlink(link, 'get_app', 'spinner'); | ||
L.IconUtil.toggleTitle(link, 'Export Images', 'Loading...'); | ||
L.DomUtil.removeClass(link.firstChild, 'loader'); | ||
} | ||
if (data.status === 'complete' && data.jpg !== null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could probably move the data.jpg !== null
condition inside the data.status === 'complete'
to make the code cleaner.
Something like
if (data.status === 'complete') {
L.IconUtil.toggleXlink(link, 'get_app', 'spinner');
L.IconUtil.toggleTitle(link, 'Export Images', 'Loading...');
L.DomUtil.removeClass(link.firstChild, 'loader');
if (data.jpg !== null) {
@chen-robert @VladimirMikulic SORRY should have mentioned this. The exporter never actually completes locally, it needs to be up on github pages. For my testing, I use https://sasha.mapknitter.org/examples/select.html. I added @VladimirMikulic work there and it works, you can check it out! The exporter is really the only thing you would need you own page for, but if you plan on helping out with it you might want to get one setup! You will need a custom domain which I think @jywarren can provide you guys with, and I'll walk you through how to do it. Let me know! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@VladimirMikulic This is really great! My one concern here is that a lot of people using this library use it without our toolbar, and bind the action methods to their own custom UI. So, we would want to keep all logic related to the toolbar outside of the export functionality, in ExportAction.js
. Also just promotes modularity.
Maybe by doing something like a Promise with startExport
and moving those lines into a then
?
Also @chen-robert your point is valid, but @VladimirMikulic didn't write the conditional, so refactoring them is technically outside the scope of this. But if he/ you wants to fix them -- all for it!
@sashadev-sky I wrapped |
@sashadev-sky I would be thankful if you could review this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is really impressive!! Thank you! It does work.
Our library actually doesn't support ES6 😣Meaning we don't have a module bundler like webpack to compile the code back to ES5 - and it might not run in some browsers
We could polyfill the Promise but then were still left with the arrow functions.
options would be to
- set the library up with the module bundler of your choice (this would be considered another
hard
task) - add a polyfill for the Promise and replace the arrow functions with ES5 syntax (not another task)
- accomplish this Promise idea using an ES5 compliant way (not sure what this would be exactly)
@sashadev-sky polyfill added! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@VladimirMikulic awesome thank you! So you're still using an arrow function here in the Promise so that needs to be updated. And then one more thing: run $ grunt concat:dist
to build the dist file with your changes and commit that. Typically I develop with $ grunt
running in the background in another terminal tab and it automatically builds changes (although occasionally it does not for some reason)
Change was necessary because arrow functions are not supported in ES5.
@sashadev-sky I missed it, sorry, but here is the improved version. |
@chen-robert @jywarren can you please review? |
This is great, can you share a gif of this working, or a link to it running in a GitHub pages branch? Thanks! |
The change was necessary because in the Promise the value of keyword this gets lost
@jywarren @sashadev-sky here is the showcase video: https://streamable.com/ye1oz |
This is wonderful! Thanks so much, great work! |
Congrats on merging your first pull request! 🙌🎉⚡️ |
@jywarren could you also approve the task on GCI, so I can move on? |
Pls give me link. I will approve it
…On Sat, 14 Dec 2019, 9:47 pm Vladimir Mikulic, ***@***.***> wrote:
@jywarren <https://github.com/jywarren> could you also approve the task
on GCI, so I can move on?
Thanks.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#477?email_source=notifications&email_token=AFAAEQZ3VXFGW2LKYSIDZRTQYUBJFA5CNFSM4JYBCPCKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEG4F5OY#issuecomment-565731003>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AFAAEQ44CGMOF6V6QE6J6ZDQYUBJFANCNFSM4JYBCPCA>
.
|
Thank you @SidharthBansal. |
In the old UI, the spinner would continue spinning after the images have been
exported. Now it's fixed.
Resolves #470
@sashadev-sky could you review this, please?