blacklight_heatmaps 1.1.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/blacklight_heatmaps/viewers/index.js +18 -21
- data/app/assets/javascripts/blacklight_heatmaps/viewers/show.js +6 -7
- data/app/components/blacklight_heatmaps/icons/heatmaps_component.rb +14 -0
- data/app/helpers/blacklight/maps_helper.rb +2 -1
- data/app/views/catalog/_document_heatmaps.html.erb +1 -1
- data/app/views/catalog/index.heatmaps.jbuilder +3 -2
- data/lib/blacklight_heatmaps/engine.rb +6 -0
- data/lib/blacklight_heatmaps/version.rb +1 -1
- data/lib/generators/blacklight_heatmaps/install_generator.rb +3 -9
- data/lib/tasks/blacklight_heatmaps_tasks.rake +0 -10
- data/spec/examples.txt +29 -29
- data/spec/features/index_page_map_spec.rb +6 -2
- data/spec/features/show_page_map_spec.rb +8 -2
- data/spec/helpers/blacklight/maps_helper_spec.rb +1 -0
- data/spec/spec_helper.rb +1 -1
- data/spec/test_app_templates/Gemfile.extra +0 -1
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +10 -1
- data/vendor/assets/javascripts/leaflet_solr_heatmap.js +27 -23
- metadata +23 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 24f086dfa95576ef614df42a0e330472852275e379efce3a10b018e22506c369
|
4
|
+
data.tar.gz: 3f17b5bf828fd918b39bc1fdcd2d41936b8d56083a25ca2d992d6bc75fa79e62
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 469bce42ba24493fd508fd413598106923b0eb0dc15f1a7bf4c71272a3fe4bbef4853e88a5cfbfbb3d5d5d60f891a118c1cb57a65d5c3dc6a6fe081d513aaa0a
|
7
|
+
data.tar.gz: fcc61b79be207c9fac704e5ad1c3db497928dbd5e7acc15eccc7018c56407df9c1f44670c0898384ce14f381994cb945c23a588034847e0d0ba99bfc65ea1c8c
|
@@ -1,8 +1,8 @@
|
|
1
1
|
Blacklight.onLoad(function () {
|
2
2
|
'use strict';
|
3
3
|
|
4
|
-
|
5
|
-
BlacklightHeatmaps.indexView(
|
4
|
+
document.querySelectorAll('[data-index-map]').forEach(function (el) {
|
5
|
+
BlacklightHeatmaps.indexView(el, {});
|
6
6
|
});
|
7
7
|
});
|
8
8
|
|
@@ -13,20 +13,22 @@ Blacklight.onLoad(function () {
|
|
13
13
|
options: {},
|
14
14
|
|
15
15
|
initialize: function (el, options) {
|
16
|
-
var
|
17
|
-
var
|
18
|
-
var
|
19
|
-
var
|
20
|
-
var template = $el.data().sidebarTemplate;
|
21
|
-
var colorRamp = $el.data().colorRamp;
|
16
|
+
var requestUrl = el.dataset.searchUrl + '&format=heatmaps';
|
17
|
+
var geometryField = el.dataset.geometryField;
|
18
|
+
var template = el.dataset.sidebarTemplate;
|
19
|
+
var colorRamp = JSON.parse(el.dataset.colorRamp);
|
22
20
|
|
23
21
|
// Blank out page link content first and disable pagination
|
24
|
-
|
25
|
-
|
22
|
+
document.querySelectorAll('#sortAndPerPage .page-links').forEach(function (links) {
|
23
|
+
links.innerHTML = '';
|
24
|
+
});
|
25
|
+
document.querySelectorAll('ul.pagination').forEach(function (links) {
|
26
|
+
links.classList.add('d-none');
|
27
|
+
});
|
26
28
|
|
27
|
-
var map = L.map(
|
29
|
+
var map = L.map(el.id).setView([0, 0], 1);
|
28
30
|
var basemap = BlacklightHeatmaps.selectBasemap(
|
29
|
-
|
31
|
+
el.dataset.basemapProvider
|
30
32
|
).addTo(map);
|
31
33
|
|
32
34
|
var solrLayer = L.solrHeatmap(requestUrl, {
|
@@ -57,7 +59,7 @@ Blacklight.onLoad(function () {
|
|
57
59
|
solrLayer.on('dataAdded', function (e) {
|
58
60
|
if (e.response && e.response.docs) {
|
59
61
|
var html = '';
|
60
|
-
|
62
|
+
e.response.docs.forEach(function (value) {
|
61
63
|
html += L.Util.template(template, value);
|
62
64
|
});
|
63
65
|
|
@@ -65,16 +67,11 @@ Blacklight.onLoad(function () {
|
|
65
67
|
|
66
68
|
var docCount = e.response.pages.total_count;
|
67
69
|
|
68
|
-
|
69
|
-
parseInt(docCount).toLocaleString() + ' ' +
|
70
|
-
|
71
|
-
);
|
70
|
+
document.querySelectorAll('#sortAndPerPage .page-links').forEach(function (links) {
|
71
|
+
links.innerHTML = parseInt(docCount).toLocaleString() + ' ' + (docCount == 1 ? 'item' : 'items') + ' found';
|
72
|
+
});
|
72
73
|
}
|
73
74
|
});
|
74
|
-
|
75
|
-
$(document).on('turbolinks:click', function (e) {
|
76
|
-
e.preventDefault();
|
77
|
-
});
|
78
75
|
},
|
79
76
|
|
80
77
|
pluralize: function (count, word) {
|
@@ -1,8 +1,8 @@
|
|
1
1
|
Blacklight.onLoad(function () {
|
2
2
|
'use strict';
|
3
3
|
|
4
|
-
|
5
|
-
BlacklightHeatmaps.showView(
|
4
|
+
document.querySelectorAll('[data-show-map]').forEach(function (el) {
|
5
|
+
BlacklightHeatmaps.showView(el);
|
6
6
|
});
|
7
7
|
});
|
8
8
|
|
@@ -13,15 +13,14 @@ Blacklight.onLoad(function () {
|
|
13
13
|
options: {},
|
14
14
|
|
15
15
|
initialize: function (el, options) {
|
16
|
-
var
|
17
|
-
var features = $el.data().features;
|
16
|
+
var json = JSON.parse(el.dataset.features);
|
18
17
|
|
19
|
-
var map = L.map(
|
18
|
+
var map = L.map(el.id).setView([0, 0], 1);
|
20
19
|
var basemap = BlacklightHeatmaps.selectBasemap(
|
21
|
-
|
20
|
+
el.dataset.basemapProvider
|
22
21
|
).addTo(map);
|
23
22
|
|
24
|
-
var features = L.geoJson(
|
23
|
+
var features = L.geoJson(json, {
|
25
24
|
pointToLayer: function(feature, latlng) {
|
26
25
|
return L.marker(latlng, {
|
27
26
|
icon: BlacklightHeatmaps.Icons.default
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BlacklightHeatmaps
|
4
|
+
module Icons
|
5
|
+
# This is the gallery icon for the view type button.
|
6
|
+
# You can override the default svg by setting:
|
7
|
+
# Blacklight::Gallery:Icons::SlideshowComponent.svg = '<svg>your SVG here</svg>'
|
8
|
+
class HeatmapsComponent < Blacklight::Icons::IconComponent
|
9
|
+
self.svg = <<~SVG
|
10
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path d="M16 10h-2v2h2v-2zm0 4h-2v2h2v-2zm-8-4H6v2h2v-2zm4 0h-2v2h2v-2zm8-6H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 14H4V6h16v12z"/></svg>
|
11
|
+
SVG
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -10,6 +10,7 @@ module Blacklight
|
|
10
10
|
class: 'blacklight-heatmaps-index-map',
|
11
11
|
id: 'index-map',
|
12
12
|
data: index_map_data_attributes,
|
13
|
+
role: 'region',
|
13
14
|
'aria-label': t('blacklight.heatmaps.aria-label')
|
14
15
|
)
|
15
16
|
end
|
@@ -24,7 +25,7 @@ module Blacklight
|
|
24
25
|
<div class='media'>
|
25
26
|
<div class='media-body'>
|
26
27
|
<h3 class='media-heading'>
|
27
|
-
<a href
|
28
|
+
<a href="{url}">
|
28
29
|
{title}
|
29
30
|
</a>
|
30
31
|
</h3>
|
@@ -2,8 +2,9 @@ presenter = Blacklight::JsonPresenter.new(@response, blacklight_config)
|
|
2
2
|
|
3
3
|
json.response do
|
4
4
|
json.docs(presenter.documents) do |document|
|
5
|
-
|
6
|
-
json.
|
5
|
+
document_presenter = document_presenter(document)
|
6
|
+
json.url url_for(search_state.url_for_document(document))
|
7
|
+
json.title document_presenter.heading
|
7
8
|
end
|
8
9
|
|
9
10
|
json.facet_heatmaps @response['facet_counts']['facet_heatmaps']
|
@@ -7,6 +7,12 @@ module BlacklightHeatmaps
|
|
7
7
|
end
|
8
8
|
|
9
9
|
Mime::Type.register 'application/vnd.heatmaps+json', :heatmaps
|
10
|
+
if Blacklight::VERSION > '8'
|
11
|
+
Blacklight::Configuration.default_configuration do
|
12
|
+
Blacklight::Configuration.default_values[:search_state_fields] ||= []
|
13
|
+
Blacklight::Configuration.default_values[:search_state_fields] += %i[bbox]
|
14
|
+
end
|
15
|
+
end
|
10
16
|
end
|
11
17
|
end
|
12
18
|
end
|
@@ -15,12 +15,6 @@ module BlacklightHeatmaps
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
-
def install_webpacker
|
19
|
-
return unless Rails.version.to_i == 6
|
20
|
-
|
21
|
-
rake 'webpacker:install'
|
22
|
-
end
|
23
|
-
|
24
18
|
def configuration
|
25
19
|
inject_into_file 'app/controllers/catalog_controller.rb', after: 'configure_blacklight do |config|' do
|
26
20
|
"\n # BlacklightHeatmaps configuration values" \
|
@@ -30,9 +24,9 @@ module BlacklightHeatmaps
|
|
30
24
|
"\n config.basemap_provider = 'positron'" \
|
31
25
|
"\n config.show.partials.insert(1, :show_leaflet_map)" \
|
32
26
|
"\n config.index.respond_to.heatmaps = true" \
|
33
|
-
"\n config.view.heatmaps
|
34
|
-
"\n
|
35
|
-
"\n
|
27
|
+
"\n config.view.heatmaps(partials: []," \
|
28
|
+
"\n color_ramp: ['#ffffcc', '#a1dab4', '#41b6c4', '#2c7fb8', '#253494']," \
|
29
|
+
"\n icon: BlacklightHeatmaps::Icons::HeatmapsComponent)" \
|
36
30
|
"\n"
|
37
31
|
end
|
38
32
|
end
|
@@ -11,15 +11,5 @@ namespace :blacklight_heatmaps do
|
|
11
11
|
conn.add docs
|
12
12
|
conn.commit
|
13
13
|
end
|
14
|
-
|
15
|
-
desc 'Fetch random data from WhosOnFirst gazetteer and index into Solr'
|
16
|
-
task :seed_random, [:n] => [:environment] do |_t, args|
|
17
|
-
args.with_defaults(n: 10)
|
18
|
-
puts "Indexing #{args[:n]} random data records"
|
19
|
-
docs = YAML.load(`bundle exec ruby #{File.join(BlacklightHeatmaps::Engine.root, 'scripts', 'sample_whosonfirst.rb')} #{args[:n]}`)
|
20
|
-
conn = Blacklight.default_index.connection
|
21
|
-
conn.add docs
|
22
|
-
conn.commit
|
23
|
-
end
|
24
14
|
end
|
25
15
|
end
|
data/spec/examples.txt
CHANGED
@@ -1,31 +1,31 @@
|
|
1
1
|
example_id | status | run_time |
|
2
2
|
--------------------------------------------------------------------------------------- | ------ | --------------- |
|
3
|
-
./spec/features/configurable_basemap_spec.rb[1:1] | passed | 0.
|
4
|
-
./spec/features/configurable_basemap_spec.rb[1:2:1] | passed | 0.
|
5
|
-
./spec/features/configurable_basemap_spec.rb[1:3:1] | passed | 0.
|
6
|
-
./spec/features/index_page_map_spec.rb[1:1] | passed |
|
7
|
-
./spec/features/show_page_map_spec.rb[1:1] | passed | 0.
|
8
|
-
./spec/features/show_page_map_spec.rb[1:2] | passed | 0.
|
9
|
-
./spec/helpers/blacklight/maps_helper_spec.rb[1:1:1] | passed | 0.
|
10
|
-
./spec/helpers/blacklight/maps_helper_spec.rb[1:2:1] | passed | 0.
|
11
|
-
./spec/models/concerns/blacklight_heatmaps/bounding_box_spec.rb[1:1:1] | passed | 0.
|
12
|
-
./spec/models/concerns/blacklight_heatmaps/bounding_box_spec.rb[1:2:1] | passed | 0.
|
13
|
-
./spec/models/concerns/blacklight_heatmaps/bounding_box_spec.rb[1:3:1] | passed | 0.
|
14
|
-
./spec/models/concerns/blacklight_heatmaps/bounding_box_spec.rb[1:4:1] | passed | 0.
|
15
|
-
./spec/models/concerns/blacklight_heatmaps/geometry_parser_spec.rb[1:1:1:1] | passed | 0.
|
16
|
-
./spec/models/concerns/blacklight_heatmaps/geometry_parser_spec.rb[1:1:2:1] | passed | 0.
|
17
|
-
./spec/models/concerns/blacklight_heatmaps/geometry_parser_spec.rb[1:1:3:1] | passed | 0.
|
18
|
-
./spec/models/concerns/blacklight_heatmaps/geometry_solr_document_spec.rb[1:1:1] | passed | 0.
|
19
|
-
./spec/models/concerns/blacklight_heatmaps/geometry_solr_document_spec.rb[1:2:1] | passed | 0.
|
20
|
-
./spec/models/concerns/blacklight_heatmaps/geometry_solr_document_spec.rb[1:3:1] | passed | 0.
|
21
|
-
./spec/models/concerns/blacklight_heatmaps/geometry_solr_document_spec.rb[1:4:1] | passed | 0.
|
22
|
-
./spec/models/concerns/blacklight_heatmaps/point_spec.rb[1:1:1] | passed | 0.
|
23
|
-
./spec/models/concerns/blacklight_heatmaps/point_spec.rb[1:2:1] | passed | 0.
|
24
|
-
./spec/models/concerns/blacklight_heatmaps/solr_facet_heatmap_behavior_spec.rb[1:1:1:1] | passed | 0.
|
25
|
-
./spec/models/concerns/blacklight_heatmaps/solr_facet_heatmap_behavior_spec.rb[1:1:2:1] | passed | 0.
|
26
|
-
./spec/models/concerns/blacklight_heatmaps/solr_facet_heatmap_behavior_spec.rb[1:2:1] | passed | 0.
|
27
|
-
./spec/models/concerns/blacklight_heatmaps/solr_facet_heatmap_behavior_spec.rb[1:3:1] | passed | 0.
|
28
|
-
./spec/models/concerns/blacklight_heatmaps/solr_facet_heatmap_behavior_spec.rb[1:4:1] | passed | 0.
|
29
|
-
./spec/views/catalog/_document_heatmaps.html.erb_spec.rb[1:1] | passed | 0.
|
30
|
-
./spec/views/catalog/_show_leaflet_map_default.html.erb_spec.rb[1:1:1] | passed | 0.
|
31
|
-
./spec/views/catalog/_show_leaflet_map_default.html.erb_spec.rb[1:2:1] | passed | 0.
|
3
|
+
./spec/features/configurable_basemap_spec.rb[1:1] | passed | 0.16395 seconds |
|
4
|
+
./spec/features/configurable_basemap_spec.rb[1:2:1] | passed | 0.13941 seconds |
|
5
|
+
./spec/features/configurable_basemap_spec.rb[1:3:1] | passed | 0.16693 seconds |
|
6
|
+
./spec/features/index_page_map_spec.rb[1:1] | passed | 10.89 seconds |
|
7
|
+
./spec/features/show_page_map_spec.rb[1:1] | passed | 0.1382 seconds |
|
8
|
+
./spec/features/show_page_map_spec.rb[1:2] | passed | 0.17365 seconds |
|
9
|
+
./spec/helpers/blacklight/maps_helper_spec.rb[1:1:1] | passed | 0.00406 seconds |
|
10
|
+
./spec/helpers/blacklight/maps_helper_spec.rb[1:2:1] | passed | 0.00331 seconds |
|
11
|
+
./spec/models/concerns/blacklight_heatmaps/bounding_box_spec.rb[1:1:1] | passed | 0.00006 seconds |
|
12
|
+
./spec/models/concerns/blacklight_heatmaps/bounding_box_spec.rb[1:2:1] | passed | 0.00006 seconds |
|
13
|
+
./spec/models/concerns/blacklight_heatmaps/bounding_box_spec.rb[1:3:1] | passed | 0.00008 seconds |
|
14
|
+
./spec/models/concerns/blacklight_heatmaps/bounding_box_spec.rb[1:4:1] | passed | 0.00006 seconds |
|
15
|
+
./spec/models/concerns/blacklight_heatmaps/geometry_parser_spec.rb[1:1:1:1] | passed | 0.00012 seconds |
|
16
|
+
./spec/models/concerns/blacklight_heatmaps/geometry_parser_spec.rb[1:1:2:1] | passed | 0.00077 seconds |
|
17
|
+
./spec/models/concerns/blacklight_heatmaps/geometry_parser_spec.rb[1:1:3:1] | passed | 0.00193 seconds |
|
18
|
+
./spec/models/concerns/blacklight_heatmaps/geometry_solr_document_spec.rb[1:1:1] | passed | 0.0006 seconds |
|
19
|
+
./spec/models/concerns/blacklight_heatmaps/geometry_solr_document_spec.rb[1:2:1] | passed | 0.00008 seconds |
|
20
|
+
./spec/models/concerns/blacklight_heatmaps/geometry_solr_document_spec.rb[1:3:1] | passed | 0.00028 seconds |
|
21
|
+
./spec/models/concerns/blacklight_heatmaps/geometry_solr_document_spec.rb[1:4:1] | passed | 0.00014 seconds |
|
22
|
+
./spec/models/concerns/blacklight_heatmaps/point_spec.rb[1:1:1] | passed | 0.00008 seconds |
|
23
|
+
./spec/models/concerns/blacklight_heatmaps/point_spec.rb[1:2:1] | passed | 0.00007 seconds |
|
24
|
+
./spec/models/concerns/blacklight_heatmaps/solr_facet_heatmap_behavior_spec.rb[1:1:1:1] | passed | 0.00163 seconds |
|
25
|
+
./spec/models/concerns/blacklight_heatmaps/solr_facet_heatmap_behavior_spec.rb[1:1:2:1] | passed | 0.00427 seconds |
|
26
|
+
./spec/models/concerns/blacklight_heatmaps/solr_facet_heatmap_behavior_spec.rb[1:2:1] | passed | 0.05584 seconds |
|
27
|
+
./spec/models/concerns/blacklight_heatmaps/solr_facet_heatmap_behavior_spec.rb[1:3:1] | passed | 0.00206 seconds |
|
28
|
+
./spec/models/concerns/blacklight_heatmaps/solr_facet_heatmap_behavior_spec.rb[1:4:1] | passed | 0.00917 seconds |
|
29
|
+
./spec/views/catalog/_document_heatmaps.html.erb_spec.rb[1:1] | passed | 0.0042 seconds |
|
30
|
+
./spec/views/catalog/_show_leaflet_map_default.html.erb_spec.rb[1:1:1] | passed | 0.00266 seconds |
|
31
|
+
./spec/views/catalog/_show_leaflet_map_default.html.erb_spec.rb[1:2:1] | passed | 0.00446 seconds |
|
@@ -5,8 +5,12 @@ feature 'Index page map', js: true do
|
|
5
5
|
visit search_catalog_path(q: ' ', view: 'heatmaps', search_field: 'all_fields')
|
6
6
|
expect(page).to have_css '.leaflet-map-pane'
|
7
7
|
|
8
|
-
#
|
9
|
-
|
8
|
+
# Conditionally check for the PNG only on GitHub CI
|
9
|
+
# Leaflet chooses tile zoom based on retina; this causes tests to fail locally
|
10
|
+
if ENV['GITHUB_ACTIONS']
|
11
|
+
# Zoomed to world
|
12
|
+
expect(page).to have_css 'img[src*="/light_all/1/0/0.png"]'
|
13
|
+
end
|
10
14
|
|
11
15
|
# Hides pagination
|
12
16
|
expect(page).to have_css 'ul.pagination', visible: false
|
@@ -4,8 +4,14 @@ feature 'Show map map', js: true do
|
|
4
4
|
it 'renders a leaflet map' do
|
5
5
|
visit solr_document_path '43037890'
|
6
6
|
expect(page).to have_css '.leaflet-map-pane'
|
7
|
-
|
8
|
-
|
7
|
+
|
8
|
+
# Conditionally check for the tile only on GitHub CI
|
9
|
+
# Leaflet chooses tile zoom based on retina; this causes tests to fail locally
|
10
|
+
if ENV['GITHUB_ACTIONS']
|
11
|
+
# Zoomed to Kazakhstan
|
12
|
+
expect(page).to have_css 'img[src*="light_all/4/11/5.png"]'
|
13
|
+
end
|
14
|
+
|
9
15
|
expect(page).to have_css 'svg g path'
|
10
16
|
end
|
11
17
|
it 'renders a point type and a polygon' do
|
@@ -26,6 +26,7 @@ describe Blacklight::MapsHelper do
|
|
26
26
|
.to have_css '[data-basemap-provider="positron"]'
|
27
27
|
expect(helper.index_map_div).to have_css '[data-sidebar-template]'
|
28
28
|
expect(helper.index_map_div).to have_css '[data-color-ramp]'
|
29
|
+
expect(helper.index_map_div).to have_css '[role="region"]'
|
29
30
|
expect(helper.index_map_div).to have_css '[aria-label="heatmap"]'
|
30
31
|
end
|
31
32
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1 +0,0 @@
|
|
1
|
-
gem 'sprockets', '< 4'
|
@@ -4,7 +4,7 @@ class TestAppGenerator < Rails::Generators::Base
|
|
4
4
|
source_root './spec/test_app_templates'
|
5
5
|
|
6
6
|
def add_gems
|
7
|
-
gem 'blacklight', '~> 7.0'
|
7
|
+
gem 'blacklight', ENV.fetch('BLACKLIGHT_VERSION', '~> 7.0')
|
8
8
|
|
9
9
|
Bundler.with_clean_env do
|
10
10
|
run 'bundle install'
|
@@ -24,4 +24,13 @@ class TestAppGenerator < Rails::Generators::Base
|
|
24
24
|
def install_engine
|
25
25
|
generate 'blacklight_heatmaps:install'
|
26
26
|
end
|
27
|
+
|
28
|
+
# Temporarily force js assets to fall back to sprockets
|
29
|
+
def clean_up_js_builds
|
30
|
+
return unless File.exist?('app/assets/builds')
|
31
|
+
|
32
|
+
append_to_file 'app/assets/config/manifest.js', "\n//= link application.js\n" if File.exist?('app/assets/config/manifest.js')
|
33
|
+
gsub_file 'app/assets/config/manifest.js', '//= link_tree ../builds', ''
|
34
|
+
remove_dir 'app/assets/builds'
|
35
|
+
end
|
27
36
|
end
|
@@ -55,12 +55,12 @@ L.SolrHeatmap = L.GeoJSON.extend({
|
|
55
55
|
geojson.type = 'FeatureCollection';
|
56
56
|
geojson.features = [];
|
57
57
|
|
58
|
-
|
58
|
+
_this.facetHeatmap.counts_ints2D.forEach(function(value, row) {
|
59
59
|
if (value === null) {
|
60
60
|
return;
|
61
61
|
}
|
62
62
|
|
63
|
-
|
63
|
+
value.forEach(function (val, column) {
|
64
64
|
if (val === 0) {
|
65
65
|
return;
|
66
66
|
}
|
@@ -105,12 +105,12 @@ L.SolrHeatmap = L.GeoJSON.extend({
|
|
105
105
|
var maxValue = classifications[classifications.length - 1];
|
106
106
|
var gradient = _this._getGradient(classifications);
|
107
107
|
|
108
|
-
|
108
|
+
_this.facetHeatmap.counts_ints2D.forEach(function(value, row) {
|
109
109
|
if (value === null) {
|
110
110
|
return;
|
111
111
|
}
|
112
112
|
|
113
|
-
|
113
|
+
value.forEach(function (val, column) {
|
114
114
|
if (val === 0) {
|
115
115
|
return;
|
116
116
|
}
|
@@ -172,12 +172,12 @@ L.SolrHeatmap = L.GeoJSON.extend({
|
|
172
172
|
maxClusterRadius: 140,
|
173
173
|
});
|
174
174
|
|
175
|
-
|
175
|
+
_this.facetHeatmap.counts_ints2D.forEach(function(value, row) {
|
176
176
|
if (value === null) {
|
177
177
|
return;
|
178
178
|
}
|
179
179
|
|
180
|
-
|
180
|
+
value.forEach(function (val, column) {
|
181
181
|
if (val === 0) {
|
182
182
|
return;
|
183
183
|
}
|
@@ -218,7 +218,7 @@ L.SolrHeatmap = L.GeoJSON.extend({
|
|
218
218
|
_getClassifications: function (howMany) {
|
219
219
|
var _this = this;
|
220
220
|
var oneDArray = [];
|
221
|
-
|
221
|
+
_this.facetHeatmap.counts_ints2D.forEach(function(value, row) {
|
222
222
|
if (value != null) {
|
223
223
|
oneDArray = oneDArray.concat(value);
|
224
224
|
}
|
@@ -244,7 +244,7 @@ L.SolrHeatmap = L.GeoJSON.extend({
|
|
244
244
|
|
245
245
|
_this.eachLayer(function (layer) {
|
246
246
|
var color;
|
247
|
-
|
247
|
+
classifications.forEach(function (val, i) {
|
248
248
|
if (layer.feature.properties.count >= val) {
|
249
249
|
color = scale[i];
|
250
250
|
}
|
@@ -296,22 +296,26 @@ L.SolrHeatmap = L.GeoJSON.extend({
|
|
296
296
|
_getData: function () {
|
297
297
|
var _this = this;
|
298
298
|
var startTime = Date.now();
|
299
|
-
$.getJSON({
|
300
|
-
url: _this._solrUrl,
|
301
|
-
data: {
|
302
|
-
bbox: _this._mapViewToBbox(),
|
303
|
-
},
|
304
|
-
success: function (data) {
|
305
|
-
var totalTime = 'Solr response time: ' + (Date.now() - startTime) + ' ms';
|
306
|
-
if (_this.options.logging) {
|
307
|
-
console.log(totalTime);
|
308
|
-
}
|
309
299
|
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
300
|
+
var url = new URL(_this._solrUrl);
|
301
|
+
url.searchParams.append('bbox', _this._mapViewToBbox());
|
302
|
+
|
303
|
+
fetch(url, {
|
304
|
+
headers: {
|
305
|
+
'Accept': 'application/json',
|
306
|
+
}
|
307
|
+
}).then(function (response) {
|
308
|
+
return response.json();
|
309
|
+
}).then(function (data) {
|
310
|
+
var totalTime = 'Solr response time: ' + (Date.now() - startTime) + ' ms';
|
311
|
+
if (_this.options.logging) {
|
312
|
+
console.log(totalTime);
|
313
|
+
}
|
314
|
+
|
315
|
+
_this.docsCount = data.response.numFound;
|
316
|
+
_this.renderStart = Date.now();
|
317
|
+
_this._computeHeatmapObject(data);
|
318
|
+
_this.fireEvent('dataAdded', data);
|
315
319
|
});
|
316
320
|
},
|
317
321
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blacklight_heatmaps
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jack Reed
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-11-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -16,7 +16,7 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 7.1.4
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: '8'
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
29
|
+
version: 7.1.4
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '8'
|
@@ -34,30 +34,36 @@ dependencies:
|
|
34
34
|
name: blacklight
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- - "
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: 7.17.1
|
40
|
+
- - "<"
|
38
41
|
- !ruby/object:Gem::Version
|
39
|
-
version: '
|
42
|
+
version: '9'
|
40
43
|
type: :runtime
|
41
44
|
prerelease: false
|
42
45
|
version_requirements: !ruby/object:Gem::Requirement
|
43
46
|
requirements:
|
44
|
-
- - "
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: 7.17.1
|
50
|
+
- - "<"
|
45
51
|
- !ruby/object:Gem::Version
|
46
|
-
version: '
|
52
|
+
version: '9'
|
47
53
|
- !ruby/object:Gem::Dependency
|
48
54
|
name: leaflet-rails
|
49
55
|
requirement: !ruby/object:Gem::Requirement
|
50
56
|
requirements:
|
51
57
|
- - "~>"
|
52
58
|
- !ruby/object:Gem::Version
|
53
|
-
version:
|
59
|
+
version: 1.3.0
|
54
60
|
type: :runtime
|
55
61
|
prerelease: false
|
56
62
|
version_requirements: !ruby/object:Gem::Requirement
|
57
63
|
requirements:
|
58
64
|
- - "~>"
|
59
65
|
- !ruby/object:Gem::Version
|
60
|
-
version:
|
66
|
+
version: 1.3.0
|
61
67
|
- !ruby/object:Gem::Dependency
|
62
68
|
name: leaflet-sidebar-rails
|
63
69
|
requirement: !ruby/object:Gem::Requirement
|
@@ -143,19 +149,19 @@ dependencies:
|
|
143
149
|
- !ruby/object:Gem::Version
|
144
150
|
version: '0'
|
145
151
|
- !ruby/object:Gem::Dependency
|
146
|
-
name:
|
152
|
+
name: selenium-webdriver
|
147
153
|
requirement: !ruby/object:Gem::Requirement
|
148
154
|
requirements:
|
149
|
-
- - "
|
155
|
+
- - "~>"
|
150
156
|
- !ruby/object:Gem::Version
|
151
|
-
version: '
|
157
|
+
version: '4.11'
|
152
158
|
type: :development
|
153
159
|
prerelease: false
|
154
160
|
version_requirements: !ruby/object:Gem::Requirement
|
155
161
|
requirements:
|
156
|
-
- - "
|
162
|
+
- - "~>"
|
157
163
|
- !ruby/object:Gem::Version
|
158
|
-
version: '
|
164
|
+
version: '4.11'
|
159
165
|
description: Search and view Blacklight resources on a map.
|
160
166
|
email:
|
161
167
|
- phillipjreed@gmail.com
|
@@ -174,6 +180,7 @@ files:
|
|
174
180
|
- app/assets/javascripts/blacklight_heatmaps/viewers/index.js
|
175
181
|
- app/assets/javascripts/blacklight_heatmaps/viewers/show.js
|
176
182
|
- app/assets/stylesheets/blacklight_heatmaps/default.scss
|
183
|
+
- app/components/blacklight_heatmaps/icons/heatmaps_component.rb
|
177
184
|
- app/controllers/blacklight_heatmaps/application_controller.rb
|
178
185
|
- app/helpers/blacklight/maps_helper.rb
|
179
186
|
- app/models/concerns/blacklight_heatmaps/bounding_box.rb
|
@@ -235,7 +242,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
235
242
|
- !ruby/object:Gem::Version
|
236
243
|
version: '0'
|
237
244
|
requirements: []
|
238
|
-
rubygems_version: 3.
|
245
|
+
rubygems_version: 3.5.23
|
239
246
|
signing_key:
|
240
247
|
specification_version: 4
|
241
248
|
summary: Search and view Blacklight resources on a map.
|