Skip to content

Commit

Permalink
Connect LDI exports downstream (#782)
Browse files Browse the repository at this point in the history
* update ldi and leaflt-toolbar dependencies

get collection group API working

custom export action working

clean up

more cleanup

* fix for some /this/ scope issues

* selection working

* LDI v0.5.2 with correct ordering, timestamp logging

* test

* removed package-lock.json

* completion alert

* JSON.parse(data) for returned status

* null as non-string

* response fix

* prompt for scale

* change status_url to export_url in test
  • Loading branch information
sashadev-sky authored and jywarren committed Jul 3, 2019
1 parent 3804937 commit 9299d74
Show file tree
Hide file tree
Showing 8 changed files with 565 additions and 195 deletions.
681 changes: 519 additions & 162 deletions app/assets/javascripts/mapknitter/Map.js

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions app/controllers/export_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,16 @@ def status
end
end

def create
# Saving in export_url column because assuming that is not being used in new Export API
# if it is, instead create a new col like 'status_url' and save the url there

# mySQL2 error ActiveRecord::StatementInvalid (Mysql2::Error: Field 'bands_string' doesn't have a default value: INSERT INTO `exports` (`export_url`, `created_at`, `updated_at`) VALUES ('//export.mapknitter.org/id/1562102960/status.json', '2019-07-02 21:29:20', '2019-07-02 21:29:20')):
# so adding a default value for now. I think this column will be deprecated?
export = Export.create!(export_url: params[:status_url], bands_string: 'default bands_string')
render json: export.to_json
end

# for demoing remote url functionality during testing
def external_url_test
render json: Export.last.to_json
Expand Down
1 change: 0 additions & 1 deletion app/views/layouts/knitter2.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAxlBXzYwdeaOMKZgx_UNBp2qBtdD0L_9g"></script>
<script src='https://unpkg.com/leaflet.gridlayer.googlemutant@0.7.0/Leaflet.GoogleMutant.js'></script>
<script src='/lib/image-sequencer/dist/image-sequencer.js'></script>

</head>
<body>

Expand Down
18 changes: 9 additions & 9 deletions app/views/map/leaflet.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,19 @@
})

<% @map.warpables.each do |warpable| %>
img = new L.DistortableImageOverlay(
img = L.distortableImageOverlay(
'<%= warpable.image.url(:medium) %>',
{
<% unless warpable.nodes == '' %>
latlng: [
new L.latLng(<%= @map.nodes[warpable.id.to_s][0][1] %>,
<%= @map.nodes[warpable.id.to_s][0][0] %>),
new L.latLng(<%= @map.nodes[warpable.id.to_s][1][1] %>,
<%= @map.nodes[warpable.id.to_s][1][0] %>),
new L.latLng(<%= @map.nodes[warpable.id.to_s][3][1] %>,
<%= @map.nodes[warpable.id.to_s][3][0] %>),
new L.latLng(<%= @map.nodes[warpable.id.to_s][2][1] %>,
<%= @map.nodes[warpable.id.to_s][2][0] %>)
L.latLng(<%= @map.nodes[warpable.id.to_s][0][1] %>,
<%= @map.nodes[warpable.id.to_s][0][0] %>),
L.latLng(<%= @map.nodes[warpable.id.to_s][1][1] %>,
<%= @map.nodes[warpable.id.to_s][1][0] %>),
L.latLng(<%= @map.nodes[warpable.id.to_s][3][1] %>,
<%= @map.nodes[warpable.id.to_s][3][0] %>),
L.latLng(<%= @map.nodes[warpable.id.to_s][2][1] %>,
<%= @map.nodes[warpable.id.to_s][2][0] %>)
],
<% end %>
locked: <%= warpable.locked %>
Expand Down
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
post 'maps/:map_id/warpables' => 'images#create' # deprecate this in favor of resourceful route below; this is just to override maps/:id
get 'export/progress/:id' => 'export#progress'
get 'export/status/:id' => 'export#status'
post 'export' => 'export#create'
get 'exports' => 'export#index'
get 'map/:id', to: redirect('/maps/%{id}')
get 'embed/:id' => 'maps#embed'
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"junction": "theleagueof/junction#*",
"leaflet": "Leaflet/Leaflet#^1.0.0",
"leaflet-dist": "vperron/leaflet-dist#0.7.x",
"leaflet-distortableimage": "publiclab/Leaflet.DistortableImage#^0.4.3",
"leaflet-distortableimage": "^0.5.2",
"leaflet-draw": "Leaflet/Leaflet.draw#0.2.4",
"leaflet-easybutton": "CliffCloud/Leaflet.EasyButton#1.0.0",
"leaflet-environmental-layers": "^1.3.1",
Expand All @@ -35,7 +35,6 @@
"leaflet-omnivore": "mapbox/leaflet-omnivore#~0.3.2",
"leaflet-providers": "leaflet-extras/leaflet-providers#1.0.6",
"leaflet-spin": "makinacorpus/Leaflet.Spin#1.1.0",
"leaflet-toolbar": "Leaflet/Leaflet.Toolbar#~0.3.0",
"modalbox": "okonet/modalbox#*",
"ol2": "openlayers/ol2#release-2.13.1",
"prototypejs-bower": "plynchnlm/prototypejs-bower#1.7.3",
Expand Down
6 changes: 6 additions & 0 deletions test/functional/export_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ def teardown
assert assigns[:week]
end

test 'create returns json' do
url = 'https://example.json/12345/status.json'
post :create, status_url: url
assert_equal url, Export.last.export_url
end

test 'should create jpg after export' do
map = maps(:cubbon)
system('mkdir -p public/warps/cubbon-park')
Expand Down
40 changes: 19 additions & 21 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1478,10 +1478,9 @@ lazy-cache@^1.0.3:
resolved "https://registry.yarnpkg.com/lazy-cache/-/lazy-cache-1.0.4.tgz#a1d78fc3a50474cb80845d3b3b6e1da49a446e8e"
integrity sha1-odePw6UEdMuAhF07O24dpJpEbo4=

"leaflet-blurred-location@git://github.com/publiclab/leaflet-blurred-location.git#main":
"leaflet-blurred-location@git://github.com/publiclab/leaflet-blurred-location#main":
version "1.3.0"
uid "1bff37cb96518bd87192277b14c290cba3c138ba"
resolved "git://github.com/publiclab/leaflet-blurred-location.git#1bff37cb96518bd87192277b14c290cba3c138ba"
resolved "git://github.com/publiclab/leaflet-blurred-location#1bff37cb96518bd87192277b14c290cba3c138ba"
dependencies:
haversine-distance "^1.1.4"
jquery "^3.2.1"
Expand All @@ -1491,24 +1490,26 @@ leaflet-dist@vperron/leaflet-dist#0.7.x:
version "0.0.0"
resolved "https://codeload.github.com/vperron/leaflet-dist/tar.gz/2ec7a0846eaecdce1321d92b3c45c74f4fd08dd3"

leaflet-distortableimage@publiclab/Leaflet.DistortableImage#^0.4.3:
version "0.4.3"
resolved "https://codeload.github.com/publiclab/Leaflet.DistortableImage/tar.gz/cb1ed3875f9ad07942903a9daa778076ce5d7fd1"
leaflet-distortableimage@^0.5.2:
version "0.5.2"
resolved "https://registry.yarnpkg.com/leaflet-distortableimage/-/leaflet-distortableimage-0.5.2.tgz#080a521cc72ceea676a38f5d2b8fc4b1b3bbb844"
integrity sha512-p93CDwoFy8kUECYYT/sh9swAbKvVWYjSZe2vsy5emMuvm5QxyJ1hfj64DAEoc2gLOu1qppy1DXKWPpUaV4cvEA==
dependencies:
grunt-cli "^1.2.0"
leaflet-toolbar "0.4.0-alpha.2"

leaflet-draw@Leaflet/Leaflet.draw#0.2.4:
version "0.2.3"
resolved "https://codeload.github.com/Leaflet/Leaflet.draw/tar.gz/07b1448f4eba33982f662398988f0337ee55cc02"

leaflet-environmental-layers@^1.3.1:
version "1.3.1"
resolved "https://registry.yarnpkg.com/leaflet-environmental-layers/-/leaflet-environmental-layers-1.3.1.tgz#85202b3071ddb1e0f44c8cb66fb7f82f41f82465"
integrity sha512-jcaN1vkmLr0v8RGDYXBjiJIsD8qZj+ZaDk2ovVmWHzSB8qZHhaMWhbrVtBHEkOQVBjquSv9Ddi092YhEhuyJqQ==
version "1.3.2"
resolved "https://registry.yarnpkg.com/leaflet-environmental-layers/-/leaflet-environmental-layers-1.3.2.tgz#fdaead0c7d472f5e10eb3306ecceb0d60779ac01"
integrity sha512-xMwLt0OexCV5rLI+iffZCnESczrgNimxV+KzWk4u96qT7qc9aOxzwOohTsZjBqygp/TAgBRCVmdGC3kzsYIUlA==
dependencies:
jquery "^3.3.1"
leaflet "^1.3.1"
leaflet-blurred-location "git://github.com/publiclab/leaflet-blurred-location.git#main"
leaflet-blurred-location "git://github.com/publiclab/leaflet-blurred-location#main"
leaflet-fullhash "github:sagarpreet-chadha/leaflet-fullHash"
leaflet-heatmap "1.0.0"
leaflet-providers "^1.1.17"
Expand All @@ -1517,7 +1518,6 @@ leaflet-environmental-layers@^1.3.1:

leaflet-fullhash@^1.0.0, "leaflet-fullhash@github:sagarpreet-chadha/leaflet-fullHash":
version "1.0.0"
uid "6c547255ef7842281c6af3d6b879a2e994e1c54d"
resolved "https://codeload.github.com/sagarpreet-chadha/leaflet-fullHash/tar.gz/6c547255ef7842281c6af3d6b879a2e994e1c54d"

leaflet-heatmap@1.0.0:
Expand Down Expand Up @@ -1566,21 +1566,21 @@ leaflet-spin@makinacorpus/Leaflet.Spin#1.1.0:
dependencies:
spin.js "^2.3.1"

leaflet-toolbar@Leaflet/Leaflet.Toolbar#~0.3.0:
version "0.3.0"
resolved "https://codeload.github.com/Leaflet/Leaflet.Toolbar/tar.gz/fb935befa99d753bdd0deb0ce2cad20335783459"
leaflet-toolbar@0.4.0-alpha.2:
version "0.4.0-alpha.2"
resolved "https://registry.yarnpkg.com/leaflet-toolbar/-/leaflet-toolbar-0.4.0-alpha.2.tgz#ab58092d65b3dd158fb874c3f7e36b7ebdb994f8"
integrity sha512-g1KeU3DYGUOwXTS0vKIgJ8KgY0h/2B0qENNQUSYMFtSY2yzwaHWMbDyhDbk+aO8LgJ1iOX4fUt2bh1sYZbpmmQ==

leaflet.blurred-location-display@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/leaflet.blurred-location-display/-/leaflet.blurred-location-display-1.1.0.tgz#43b95549ecb2e5051cbef5a4ed7dbdb91ff6dd42"
integrity sha512-l7vtPdwGbo6Xqeds37DstKNMANiI8g7EUvKrQ34CcBebyz1GcBBnWGn2wq44uqWxvKgt3okZDWdm4i6tWwjKpQ==
dependencies:
jquery "^3.3.1"
leaflet-blurred-location "git://github.com/publiclab/leaflet-blurred-location.git#main"
leaflet-blurred-location "git://github.com/publiclab/leaflet-blurred-location#main"

leaflet@*, leaflet@Leaflet/Leaflet#^1.0.0, leaflet@^1.3.1, leaflet@^1.3.3:
version "1.5.1"
uid "2e3e0ffbe87f246eb76d86d2633ddd59b262830b"
resolved "https://codeload.github.com/Leaflet/Leaflet/tar.gz/2e3e0ffbe87f246eb76d86d2633ddd59b262830b"

levn@~0.3.0:
Expand Down Expand Up @@ -2051,13 +2051,12 @@ process-nextick-args@~2.0.0:

prototypejs-bower@plynchnlm/prototypejs-bower#1.7.3:
version "0.0.0"
uid "5da3d86b77b94ec7eb5b92b8b5e0a7a241adae43"
resolved "https://codeload.github.com/plynchnlm/prototypejs-bower/tar.gz/5da3d86b77b94ec7eb5b92b8b5e0a7a241adae43"

psl@^1.1.24:
version "1.1.33"
resolved "https://registry.yarnpkg.com/psl/-/psl-1.1.33.tgz#5533d9384ca7aab86425198e10e8053ebfeab661"
integrity sha512-LTDP2uSrsc7XCb5lO7A8BI1qYxRe/8EqlRvMeEl6rsnYAqDOl8xHR+8lSAIVfrNaSAlTPTNOCgNjWcoUL3AZsw==
version "1.2.0"
resolved "https://registry.yarnpkg.com/psl/-/psl-1.2.0.tgz#df12b5b1b3a30f51c329eacbdef98f3a6e136dc6"
integrity sha512-GEn74ZffufCmkDDLNcl3uuyF/aSD6exEyh1v/ZSdAomB82t6G9hzJVRx0jBmLDW+VfZqks3aScmMw9DszwUalA==

punycode@^1.4.1:
version "1.4.1"
Expand Down Expand Up @@ -2383,7 +2382,6 @@ source-map@~0.6.1:

sparklines@mariusGundersen/sparkline#~1.2.0:
version "1.2.0"
uid ce62ca07d3b72a82eae1e51c60bcd07a1e631d41
resolved "https://codeload.github.com/mariusGundersen/sparkline/tar.gz/ce62ca07d3b72a82eae1e51c60bcd07a1e631d41"

spin.js@^2.3.1:
Expand Down

0 comments on commit 9299d74

Please sign in to comment.