-
Notifications
You must be signed in to change notification settings - Fork 206
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
Multiple-image-export #693
base: main
Are you sure you want to change the base?
Conversation
Code Climate has analyzed commit 19fcff78 and detected 2 issues on this pull request. Here's the issue category breakdown:
View more on Code Climate. |
Codecov Report
@@ Coverage Diff @@
## main #693 +/- ##
==========================================
- Coverage 73.15% 72.61% -0.55%
==========================================
Files 37 37
Lines 1356 1362 +6
==========================================
- Hits 992 989 -3
- Misses 364 373 +9
|
Hi @jywarren @sashadev-sky this is almost done. Please see if it is working for you! |
app/controllers/images_controller.rb
Outdated
@@ -96,6 +96,20 @@ def update | |||
render text: 'success' | |||
end | |||
|
|||
def export | |||
@warpable = Warpable.find params[:id] |
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.
Ah this is cool! I wonder though, if we could try redesigning it so that the export request has a list of warpable ids to export, rather than storing this status in the records here?
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.
So we'd make a change to this method to accept a warpables
parameter:
mapknitter/app/controllers/maps_controller.rb
Lines 127 to 135 in 5987398
# run the export | |
def export | |
@map = Map.find_by(id: params[:id]) | |
if logged_in? || Rails.env.development? || verify_recaptcha(model: @map, message: "ReCAPTCHA thinks you're not a human!") | |
render plain: @map.run_export(current_user, params[:resolution].to_f) | |
else | |
render plain: 'You must be logged in to export, unless the map is anonymous.' | |
end | |
end |
So then we'd pass in a new parameter to map.run_export
that's warpable_ids
, and then use it (with Warpable.find warpable_ids
) to start the export instead of relying on placed_warpables
.
However we could default back to placed_warpables
using:
warpables = Warpable.find(warpable_ids) || placed_warpables
What do you think of that?
The advantage here is that since @sashadev-sky is working on sending export requests off-server to a 3rd party service (which we're working on here https://github.com/publiclab/mapknitter-exporter-sinatra/), we can soon switch this to relying less and less on internal knowledge of our warpables, and just be sending coordinate and image URL data to an off-server system.
I hope this makes sense!!!
Hi @divyabaid16 this is really well thought through -- thanks! I am writing to suggest an alternative approach that makes some different modularity decisions. I hope it makes sense! |
5a029e9
to
d09798b
Compare
Looks like great progress here!!! 🎉 Ping me (and/or reviewers) once it's ready! Keep up the great work! |
@jywarren @publiclab/mapknitter-reviewers this is ready for the review. |
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.
Wow awesome work @divyabaid16 🎉 🎉
Also a suggestion(not related to this but affects this) , @publiclab/mapknitter-reviewers maybe we could remove the rubocop linter from travis since we have it in code climate? |
I agree with that too. Let's discuss it here #548 |
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 looks awesome, @divyabaid16 -- great work. You'll need these skills and this code familiarity once we start doing deeper integration with off-site exporting, so this is great to see!
I'm sorry it took a while to write back. Is this PR compatible with the "list vs. grid" view toggle PR? #738 i think?
Also, is there a way in the grid view to show which images have been placed on the map, versus have yet to be placed? (it's if the image has a nodes
property) -- maybe we show unplaced images in 50% opacity, and show a tooltip (https://getbootstrap.com/docs/4.1/components/tooltips/#examples) that says "this image has not yet been placed on the map" and doesn't allow it to be selected for export?
Let's also plan ahead a bit - eventually, we should have JS event handlers in both DistortableCollection (in https://github.com/publiclab/Leaflet.DistortableImage) and in this UI so that when we select an image in one, it gets selected in the other, and vice versa. This could be a way to unify the off-site export system, what do you think? Let's open a new issue and discuss! |
The export part only shows the grid view. I just wanted to show it in a compact form so I just got started with the grid view just like we select the images in the phone we would like to share. |
Great! Sasha had some great follow-up suggestions for labeling order from
that PR too. Thanks and thanks for your patience with these!
…On Tue, Jul 2, 2019, 5:45 PM Divya Baid ***@***.***> wrote:
The export part only shows the grid view. I just wanted to show it in a
compact form so I just got started with the grid view just like we select
the images in the phone we would like to share.
And #738 <#738> is
independent of export and is just for the image tab.
And I will surely distinguish between the images placed on the map and
otherwise.
Thanks!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#693?email_source=notifications&email_token=AAAF6J43NZM7DZMCTAYDHSLP5PD4ZA5CNFSM4HX5SWE2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZCULLI#issuecomment-507856301>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAAF6JY35OVHVTNFRWIAH63P5PD4ZANCNFSM4HX5SWEQ>
.
|
Hi, @jywarren I have looked into account the opacity of the unplaced images and disabled it for export. Now it is ready. |
Hm, what is failing in the Travis build? Thanks @divyabaid16 !!! |
it is just a rubocop linter problem! Testing it out right now :) |
@divyabaid16 not sure why but for me it is not allowing me to add a map locally. (The url does not autofill while title is entered or location for lat lng. Is this working for you? Perhaps you need a rebase? I see this is still using the old front page ui |
Ya, I will just rebase my PR then it would be ready. |
@divyabaid16 ok cool ping me when it is rebased if you'd like me to look again! |
28ecd36
to
ee62333
Compare
Hi @sashadev-sky it's done. But now it's showing the error
|
Oh huh - see how Sasha fixed that in #782 I think? Yes -- https://github.com/publiclab/mapknitter/pull/782/files#diff-0d9df75c86ab6387aa553c69b3e0033bR88 I'm also seeing the Rubocop linting error as well! It's very unfriendly, but:
Hope that helps! |
Hi @jywarren it is fixed. It's the error caused by Codecov here too. |
OK, awesome! Do you need a new review on this? Thanks! |
Can you update me on the status? And, after merging this shall we shift to #814 and #818 ? Thanks @divyabaid16 -- exciting! |
Ya, it was working for me. Thanks! |
And just to cross verify and be extra sure, can @jywarren or @sashadev-sky test or review this once? |
Hmm, @sashadev-sky is this what we're supposed to be storing the cloud
export status.json URL at? If so it'll only have a value if we're doing a
cloud export. If not, it'll be empty!
…On Thu, Jul 11, 2019 at 2:37 AM Divya Baid ***@***.***> wrote:
And regarding the status: currently, the export_url is shown as NULL
The url is not getting created.
[image: Selection_206]
<https://user-images.githubusercontent.com/32747809/61027644-55d61b00-a3d4-11e9-8b0e-e1d060121edc.png>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#693?email_source=notifications&email_token=AAAF6J22V74KUX7DY7NWXVTP63IH5A5CNFSM4HX5SWE2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZVVJWI#issuecomment-510350553>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAAF6JZK3ETHXR2V5WKBOGLP63IH5ANCNFSM4HX5SWEQ>
.
|
Hi, folks, can we check in here to get synced up, keeping #298 in mind? Shall we wrap this up, then begin adding an alternate interface for the cloud-based multiple image export? Thanks! |
08eac7e
to
e0f73c8
Compare
@jywarren @sashadev-sky I rebased my PR. |
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.
Just rebased and reviewed this - made some comments about it.
You need to rebase but the code is still relevant if you want to fix it!
Also one additional thing, I think this should be synced with if the image is selected via the regular interface (clicked, shift+drag) - then it will appear in the sidebar with a red border as if you had otherwise checked it there. Otherwise, this will cause confusion
var exp1 = 0; | ||
// //var arr = []; | ||
// var b = $('.export-warpable').length; | ||
// console.log(b); | ||
// var k = [0, 0, 0]; | ||
// console.log(k); | ||
$('.export-warpable').click(function() { | ||
var warpable_id = $(this).children('img').attr("data-warpable-id"); | ||
console.log(warpable_id); | ||
if(exp1==0){ | ||
$(this).css('border', "solid 2px red"); | ||
$(this).parent().addClass('export-image'); | ||
exp1 = 1; | ||
} | ||
else{ | ||
$(this).css('border', "none"); | ||
$(this).parent().removeClass('export-image'); | ||
exp1 = 0; | ||
} | ||
}); |
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.
Just got around to reviewing this! So this code assumes that you're only toggling the border on one image. If you select 1, and then select a 2nd, the 2nd won't get a border unless you click it twice. You could refactor maybe to something like this:
$('.export-warpable').click(function() {
if ($(this).css('border')[0] === '0') {
$(this).css('border', 'solid 2px red');
$(this).parent().addClass('export-image');
}
else {
$(this).css('border', 'none');
$(this).parent().removeClass('export-image');
}
});
- mind the double vs single quotes and
{
spacing - but better to move the css logic under the
export-image
class in css, and then all you have to do is toggle the class - remove console.logs and comments
function check_export(){ | ||
if($('.export-image').length > 0){ | ||
$('#begin-export').attr('disabled',false).attr('title','Start Export'); | ||
} | ||
else{ | ||
$('#begin-export').attr('disabled',true).attr('title','Select images to export'); | ||
} | ||
}; | ||
|
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 function is not being called anywhere, so doesn't work. Also disabled
would be a prop
and to change the text use html('text')
Fixes #659 (<=== Add issue number here)
Make sure these boxes are checked before your pull request (PR) is ready to be reviewed and merged. Thanks!
rake test
@publiclab/reviewers
for help, in a comment belowIf tests do fail, click on the red
X
to learn why by reading the logs.Please be sure you've reviewed our contribution guidelines at https://publiclab.org/contributing-to-public-lab-software
Thanks!