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

[WIP] customizable export UI for DistortableCollection #485

Merged
merged 18 commits into from
Jan 10, 2020

Conversation

jywarren
Copy link
Member

Fixes #478

cc @sashadev-sky @SidharthBansal this is very rough, but I'm making settable options params for all critical export UI and request/response handling; I'm seeing some issue with variable scope, however, so this needs a lot of debugging. I want to demo how setting a custom Exporter and Exporter UI work in the new examples/export.html file, too!

If we can get GCI folks engaged in this, that'd be amazing!

@@ -8,9 +8,88 @@ L.DistortableCollection.Edit = L.Handler.extend({

initialize: function(group, options) {
this._group = group;

// OK let's just refactor this to not use the closure scope, but to pass options into each function.

This comment was marked as resolved.

console.log(this, edit.options)
// explicitly send each option:
edit.startExport({
collection: edit.options.collection,
Copy link
Member Author

Choose a reason for hiding this comment

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

Here we can see all the settable options being passed into the export start command; there are a lot, allowing for some really detailed customization of both the Export process management and the UI.


// this is undefined at runtime but gets filled in later... is this an async issue?
// ok, wrapped this in a promise
console.log('options in startExport', opts, opts.exportUrl);
Copy link
Member Author

Choose a reason for hiding this comment

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

So, opts.exportUrl returns undefined but opts shows correct values, so we're seeing a timing or scope error here; this was the case also before adding the Promise code on line 16, which I had hoped would solve it. Could there be a scope collision with the opts parameter somehow?

Copy link
Member Author

Choose a reason for hiding this comment

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

Solved this in latest code i'm pushing!

collection: json,
// this needs to be a function run at the moment of pressing, not when initializing the collection
// scale: prompt("Choose a scale or use the default (cm per pixel):", 100),
exportUrl: 'http://34.74.118.242/api/v2/export/', // used to
Copy link
Member Author

Choose a reason for hiding this comment

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

Here I'm showing one reason WHY we want to be able to customize; we have alternative export servers with slightly different requirements, which we'd like to be able to connect to the Exporter in a simple standardized way.

@jywarren
Copy link
Member Author

@sashadev-sky any ideas on what I'm doing wrong here? My brain is a bit fried and I have a suspicion it's something pretty simple.

@SidharthBansal
Copy link
Member

@sashadev-sky can you please upload this task on the GCI dashboard by summarizing it. I am afraid I will not be able to properly summarise it as I don't have experience of LDI

@jywarren should it be a hard task for GCI?

@jywarren
Copy link
Member Author

Got this working! Now we need to handle the response!

@jywarren
Copy link
Member Author

jywarren commented Dec 24, 2019

OK, it's basically working now! We overrode the actual images using a JSON collection, which we don't have to do, but demonstrates how we can filter the actual images submitted. We could further refine this but the key parts we need to wrap up a first implementation and merge it are:

  • stopping the spinner, which i think is something we can do as of recently?

Anything else?

Then we should:

@jywarren
Copy link
Member Author

I passed the resolve() into options so it can be resolved from the customized export functions 😄 🎉

@jywarren
Copy link
Member Author

So perhaps the follow-ups could become GCI issues now?

@jywarren
Copy link
Member Author

Hmm, I tried resolving the linting errors with reordering but may have made some mistakes. They are pretty minor though, once we resolve them we can merge this.

@jywarren
Copy link
Member Author

All good here! @sashadev-sky can you give a final review after the holidays? 😄

@jywarren
Copy link
Member Author

We could also write a test against this by overriding the export functions and using a mock function to callback or something... interesting!

@jywarren
Copy link
Member Author

Let's circle back to publiclab/mapknitter#1128 once we're done here, too!

@jywarren
Copy link
Member Author

#501 adds tests on top of this but I wasn't able to get them to work... we can circle back later to finalize that!

@sashadev-sky
Copy link
Member

@jywarren there are a bunch of GCI PRs open right now for me to review! Let me know where this stands priority wise, assuming the others get precedence for now

@SidharthBansal
Copy link
Member

SidharthBansal commented Jan 10, 2020 via email

@sashadev-sky
Copy link
Member

Yes that I know for sure don’t worry! That’s not a prob

@jywarren
Copy link
Member Author

This is actually really high priority if you're at all able to take a look. We are pretty urgently trying to get MapKnitter off of it's internal exporter to reduce the cloud server charges we incur from it. I'd appreciate if you could take a look! Thank you!!

@jywarren
Copy link
Member Author

I think this is safe to merge and we can add the tests next.

@jywarren
Copy link
Member Author

I'm going to go ahead and merge this, actually! It's got some key fixes needed in publiclab/mapknitter#1191 -- thank you!!!

@jywarren
Copy link
Member Author

I'd still love a review however 😄

@SidharthBansal
Copy link
Member

SidharthBansal commented Jan 11, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow over-riding startExport on Collections, to enable different remote exporters to be attached
3 participants