geoblacklight_admin 0.5.1 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (139) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +18 -9
  3. data/Rakefile +83 -47
  4. data/app/assets/javascripts/geoblacklight_admin/chosen.js +1 -0
  5. data/app/assets/stylesheets/geoblacklight_admin/_core.scss +24 -0
  6. data/app/assets/stylesheets/geoblacklight_admin/modules/_nav.scss +0 -5
  7. data/app/assets/stylesheets/geoblacklight_admin/modules/_tables.scss +1 -1
  8. data/app/controllers/admin/admin_controller.rb +16 -0
  9. data/app/controllers/admin/advanced_search_controller.rb +1 -1
  10. data/app/controllers/admin/assets_controller.rb +41 -5
  11. data/app/controllers/admin/bookmarks_controller.rb +14 -2
  12. data/app/controllers/admin/bulk_actions_controller.rb +31 -0
  13. data/app/controllers/admin/document_accesses_controller.rb +38 -0
  14. data/app/controllers/admin/document_assets_controller.rb +46 -9
  15. data/app/controllers/admin/document_distributions_controller.rb +172 -0
  16. data/app/controllers/admin/documents_controller.rb +41 -55
  17. data/app/controllers/admin/elements_controller.rb +22 -0
  18. data/app/controllers/admin/form_elements_controller.rb +31 -0
  19. data/app/controllers/admin/import_documents_controller.rb +11 -1
  20. data/app/controllers/admin/imports_controller.rb +32 -2
  21. data/app/controllers/admin/mappings_controller.rb +15 -0
  22. data/app/controllers/admin/notifications_controller.rb +27 -0
  23. data/app/controllers/admin/reference_types_controller.rb +106 -0
  24. data/app/controllers/admin/search_controller.rb +7 -0
  25. data/app/controllers/admin/users_controller.rb +10 -0
  26. data/app/helpers/asset_helper.rb +6 -0
  27. data/app/helpers/bulk_actions_helper.rb +9 -0
  28. data/app/helpers/document_helper.rb +36 -0
  29. data/app/helpers/geoblacklight_admin_helper.rb +88 -8
  30. data/app/helpers/mappings_helper.rb +26 -0
  31. data/app/indexers/document_indexer.rb +22 -2
  32. data/app/javascript/channels/consumer.js +6 -0
  33. data/app/javascript/channels/export_channel.js +30 -0
  34. data/app/javascript/channels/index.js +3 -0
  35. data/app/javascript/controllers/results_controller.js +14 -0
  36. data/app/javascript/index.js +8 -2
  37. data/app/jobs/export_job.rb +35 -8
  38. data/app/jobs/geoblacklight_admin/delete_thumbnail_job.rb +19 -0
  39. data/app/jobs/geoblacklight_admin/remove_parent_dct_references_uri_job.rb +16 -0
  40. data/app/jobs/geoblacklight_admin/set_parent_dct_references_uri_job.rb +17 -0
  41. data/app/jobs/geoblacklight_admin/store_image_job.rb +22 -0
  42. data/app/models/asset.rb +20 -0
  43. data/app/models/bulk_action.rb +2 -1
  44. data/app/models/document/geom_validator.rb +8 -0
  45. data/app/models/document/reference.rb +65 -65
  46. data/app/models/document.rb +128 -71
  47. data/app/models/document_distribution.rb +145 -0
  48. data/app/models/element.rb +2 -0
  49. data/app/models/geoblacklight_admin/schema.rb +10 -2
  50. data/app/models/import_document_state_machine.rb +1 -0
  51. data/app/models/reference_type.rb +40 -0
  52. data/app/models/user.rb +4 -2
  53. data/app/services/export_csv_document_distributions_service.rb +61 -0
  54. data/app/services/geoblacklight_admin/image_service/tms.rb +0 -4
  55. data/app/services/geoblacklight_admin/image_service.rb +1 -1
  56. data/app/services/geoblacklight_admin/item_viewer.rb +4 -4
  57. data/app/views/admin/bulk_actions/show.html.erb +1 -1
  58. data/app/views/admin/document_accesses/import.html.erb +6 -2
  59. data/app/views/admin/document_assets/_assets_table.html.erb +49 -0
  60. data/app/views/admin/document_assets/_form.html.erb +2 -3
  61. data/app/views/admin/document_assets/index.html.erb +1 -47
  62. data/app/views/admin/document_distributions/_document_distribution.html.erb +39 -0
  63. data/app/views/admin/document_distributions/_document_distribution.json.jbuilder +2 -0
  64. data/app/views/admin/document_distributions/_form.html.erb +34 -0
  65. data/app/views/admin/document_distributions/destroy_all.html.erb +82 -0
  66. data/app/views/admin/document_distributions/edit.html.erb +12 -0
  67. data/app/views/admin/document_distributions/import.html.erb +80 -0
  68. data/app/views/admin/document_distributions/index.html.erb +143 -0
  69. data/app/views/admin/document_distributions/index.json.jbuilder +1 -0
  70. data/app/views/admin/document_distributions/new.html.erb +11 -0
  71. data/app/views/admin/document_distributions/show.html.erb +10 -0
  72. data/app/views/admin/document_distributions/show.json.jbuilder +1 -0
  73. data/app/views/admin/documents/_document.html.erb +1 -3
  74. data/app/views/admin/documents/_form.html.erb +2 -4
  75. data/app/views/admin/documents/_form_control.html.erb +5 -2
  76. data/app/views/admin/documents/_form_nav.html.erb +14 -5
  77. data/app/views/admin/documents/_form_nav_kithe.html.erb +4 -1
  78. data/app/views/admin/documents/_json_aardvark.jbuilder +1 -1
  79. data/app/views/admin/documents/_json_gbl_v1.jbuilder +1 -1
  80. data/app/views/admin/documents/_result_selected_options.html.erb +5 -2
  81. data/app/views/admin/documents/admin.html.erb +5 -5
  82. data/app/views/admin/documents/features/_document_references.html.erb +23 -0
  83. data/app/views/admin/documents/features/_multiple_download_links.html.erb +29 -26
  84. data/app/views/admin/ids/fetch.json.jbuilder +0 -2
  85. data/app/views/admin/ids/index.json.jbuilder +0 -2
  86. data/app/views/admin/imports/_form.html.erb +1 -1
  87. data/app/views/admin/imports/show.html.erb +1 -1
  88. data/app/views/admin/layouts/application.html.erb +4 -2
  89. data/app/views/admin/reference_types/_form.html.erb +25 -0
  90. data/app/views/admin/reference_types/_reference_type.html.erb +52 -0
  91. data/app/views/admin/reference_types/_reference_type.json.jbuilder +2 -0
  92. data/app/views/admin/reference_types/edit.html.erb +12 -0
  93. data/app/views/admin/reference_types/index.html.erb +52 -0
  94. data/app/views/admin/reference_types/index.json.jbuilder +1 -0
  95. data/app/views/admin/reference_types/new.html.erb +11 -0
  96. data/app/views/admin/reference_types/show.html.erb +3 -0
  97. data/app/views/admin/reference_types/show.json.jbuilder +1 -0
  98. data/app/views/admin/shared/_footer.html.erb +5 -2
  99. data/app/views/admin/shared/_js_behaviors.html.erb +2 -3
  100. data/app/views/admin/shared/_navbar.html.erb +9 -2
  101. data/app/views/admin/users/index.html.erb +0 -1
  102. data/app/views/catalog/_show_gbl_admin.html.erb +1 -1
  103. data/config/initializers/defaults.yml +310 -0
  104. data/config/initializers/rails_config.rb +8 -0
  105. data/config/locales/documents.en.yml +14 -0
  106. data/config/routes.rb +30 -5
  107. data/db/import_references_schema_support.numbers +0 -0
  108. data/db/migrate/20230316183001_add_geoblacklight_admin_gem.rb +0 -12
  109. data/db/migrate/20241009200524_create_admin_reference_types.rb +13 -0
  110. data/db/migrate/20241010161420_create_document_references.rb +14 -0
  111. data/db/migrate/20241120238823_rename_references_to_distributions.rb +5 -0
  112. data/db/seeds.rb +5 -0
  113. data/db/seeds_elements.csv +1 -1
  114. data/db/seeds_elements.numbers +0 -0
  115. data/db/seeds_reference_types.csv +29 -0
  116. data/db/seeds_reference_types.numbers +0 -0
  117. data/db/structure.sql +1 -38
  118. data/lib/compose.yml +31 -0
  119. data/lib/generators/geoblacklight_admin/config_generator.rb +48 -12
  120. data/lib/generators/geoblacklight_admin/install_generator.rb +8 -0
  121. data/lib/generators/geoblacklight_admin/templates/config/database.yml +1 -1
  122. data/lib/generators/geoblacklight_admin/templates/config/initializers/devise.rb +0 -2
  123. data/lib/generators/geoblacklight_admin/templates/config/initializers/mime_types.rb +1 -0
  124. data/lib/generators/geoblacklight_admin/templates/demo-app/Dockerfile +31 -0
  125. data/lib/generators/geoblacklight_admin/templates/demo-app/compose.yml +42 -0
  126. data/lib/generators/geoblacklight_admin/templates/demo-app/start-server.sh +21 -0
  127. data/lib/geoblacklight_admin/engine.rb +4 -0
  128. data/lib/geoblacklight_admin/tasks/distributions.rake +69 -0
  129. data/lib/geoblacklight_admin/tasks/images.rake +1 -0
  130. data/lib/geoblacklight_admin/tasks/solr.rake +31 -0
  131. data/lib/geoblacklight_admin/version.rb +1 -1
  132. data/lib/geoblacklight_admin.rb +4 -0
  133. metadata +78 -41
  134. data/app/javascript/entrypoints/engine.js +0 -8
  135. data/config/locales/devise_invitable.en.yml +0 -31
  136. data/lib/generators/geoblacklight_admin/templates/devise/invitations/edit.html.erb +0 -15
  137. data/lib/generators/geoblacklight_admin/templates/devise/invitations/new.html.erb +0 -15
  138. data/lib/generators/geoblacklight_admin/templates/devise/mailer/invitation_instructions.html.erb +0 -11
  139. data/lib/generators/geoblacklight_admin/templates/devise/mailer/invitation_instructions.text.erb +0 -11
data/config/routes.rb CHANGED
@@ -8,7 +8,7 @@ GeoblacklightAdmin::Engine.routes.draw do
8
8
  end
9
9
 
10
10
  # @TODO - Users
11
- # devise_for :users, controllers: {invitations: "devise/invitations"}, skip: [:registrations]
11
+ # devise_for :users, skip: [:registrations]
12
12
  # as :user do
13
13
  # get "/sign_in" => "devise/sessions#new" # custom path to login/sign_in
14
14
  # get "/sign_up" => "devise/registrations#new", :as => "new_user_registration" # custom path to sign_up/registration
@@ -38,6 +38,11 @@ GeoblacklightAdmin::Engine.routes.draw do
38
38
  post :sort, on: :collection
39
39
  end
40
40
 
41
+ # Reference Types
42
+ resources :reference_types do
43
+ post :sort, on: :collection
44
+ end
45
+
41
46
  # Form Elements
42
47
  resources :form_elements do
43
48
  post :sort, on: :collection
@@ -86,6 +91,16 @@ GeoblacklightAdmin::Engine.routes.draw do
86
91
  end
87
92
  end
88
93
 
94
+ resources :document_assets, path: "assets" do
95
+ collection do
96
+ get "display_attach_form"
97
+ post "attach_files"
98
+
99
+ get "destroy_all"
100
+ post "destroy_all"
101
+ end
102
+ end
103
+
89
104
  resources :document_downloads, path: "downloads" do
90
105
  collection do
91
106
  get "import"
@@ -96,22 +111,31 @@ GeoblacklightAdmin::Engine.routes.draw do
96
111
  end
97
112
  end
98
113
 
99
- resources :document_assets, path: "assets" do
114
+ resources :document_references, path: "references" do
100
115
  collection do
101
116
  get "display_attach_form"
102
117
  post "attach_files"
103
118
 
119
+ get "import"
120
+ post "import"
121
+
104
122
  get "destroy_all"
105
123
  post "destroy_all"
106
124
  end
107
125
  end
126
+ end
108
127
 
128
+ resources :document_accesses, path: "access" do
109
129
  collection do
110
- get "fetch"
130
+ get "import"
131
+ post "import"
132
+
133
+ get "destroy_all"
134
+ post "destroy_all"
111
135
  end
112
136
  end
113
137
 
114
- resources :document_accesses, path: "access" do
138
+ resources :document_downloads, path: "downloads" do
115
139
  collection do
116
140
  get "import"
117
141
  post "import"
@@ -121,7 +145,8 @@ GeoblacklightAdmin::Engine.routes.draw do
121
145
  end
122
146
  end
123
147
 
124
- resources :document_downloads, path: "downloads" do
148
+ # Document References
149
+ resources :document_references, path: "references" do
125
150
  collection do
126
151
  get "import"
127
152
  post "import"
@@ -364,20 +364,8 @@ class AddGeoblacklightAdminGem < ActiveRecord::Migration[6.1]
364
364
  t.datetime 'remember_created_at'
365
365
  t.datetime 'created_at', precision: 6, null: false
366
366
  t.datetime 'updated_at', precision: 6, null: false
367
- t.string 'invitation_token'
368
- t.datetime 'invitation_created_at'
369
- t.datetime 'invitation_sent_at'
370
- t.datetime 'invitation_accepted_at'
371
- t.integer 'invitation_limit'
372
- t.string 'invited_by_type'
373
- t.bigint 'invited_by_id'
374
- t.integer 'invitations_count', default: 0
375
367
  t.boolean 'admin', default: false, null: false
376
368
  t.index ['email'], name: 'index_users_on_email', unique: true
377
- t.index ['invitation_token'], name: 'index_users_on_invitation_token', unique: true
378
- t.index ['invitations_count'], name: 'index_users_on_invitations_count'
379
- t.index ['invited_by_id'], name: 'index_users_on_invited_by_id'
380
- t.index %w[invited_by_type invited_by_id], name: 'index_users_on_invited_by_type_and_invited_by_id'
381
369
  t.index ['reset_password_token'], name: 'index_users_on_reset_password_token', unique: true
382
370
  end
383
371
 
@@ -0,0 +1,13 @@
1
+ class CreateAdminReferenceTypes < ActiveRecord::Migration[7.2]
2
+ def change
3
+ create_table :reference_types do |t|
4
+ t.string :name # short name, ex: "cog"
5
+ t.string :reference_type # human-readable name, ex: "Cloud Optimized GeoTIFF (COG)"
6
+ t.string :reference_uri # key name, ex: "https://github.com/cogeotiff/cog-spec"
7
+ t.boolean :label, default: false # optional download label
8
+ t.text :note # optional note
9
+ t.integer :position # position for sorting
10
+ t.timestamps
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,14 @@
1
+ class CreateDocumentReferences < ActiveRecord::Migration[7.2]
2
+ def change
3
+ create_table :document_references do |t|
4
+ t.string :friendlier_id, null: false
5
+ t.references :reference_type, null: false, foreign_key: true
6
+ t.string :url
7
+ t.string :label
8
+ t.integer :position
9
+ t.timestamps
10
+
11
+ t.index [:friendlier_id, :reference_type_id, :url], unique: true
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,5 @@
1
+ class RenameReferencesToDistributions < ActiveRecord::Migration[7.2]
2
+ def change
3
+ rename_table :document_references, :document_distributions
4
+ end
5
+ end
data/db/seeds.rb CHANGED
@@ -23,5 +23,10 @@ CSV.foreach(File.expand_path('seeds_form_elements.csv', File.dirname(__FILE__)),
23
23
  FormElement.create!(row.to_hash)
24
24
  end
25
25
 
26
+ # Reference Types
27
+ CSV.foreach(File.expand_path('seeds_reference_types.csv', File.dirname(__FILE__)), headers: true) do |row|
28
+ ReferenceType.create!(row.to_hash)
29
+ end
30
+
26
31
  # Users
27
32
  User.create(email: 'admin@geoblacklight.org', password: '123456', password_confirmation: '123456', admin: true)
@@ -37,7 +37,7 @@ License,dct_license_sm,https://opengeometadata.org/ogm-aardvark/#license,string,
37
37
  Access Rights,dct_accessRights_s,https://opengeometadata.org/ogm-aardvark/#access-rights,string,TRUE,FALSE,TRUE,,,access-rights1|access-rights2,access_rights,,,FALSE,TRUE,FALSE,,TRUE,,TRUE,,presence,36
38
38
  Format,dct_format_s,https://opengeometadata.org/ogm-aardvark/#format,string,FALSE,FALSE,TRUE,,,format,formats,autocomplete,,FALSE,TRUE,FALSE,,TRUE,,TRUE,,,37
39
39
  File Size,gbl_fileSize_s,https://opengeometadata.org/ogm-aardvark/#file-size,string,FALSE,FALSE,TRUE,,,60mb,,,,FALSE,TRUE,FALSE,,TRUE,,TRUE,,,38
40
- Reference,dct_references_s,https://opengeometadata.org/ogm-aardvark/#references,text,FALSE,TRUE,TRUE,,URIs and Values,,reference_values,,,FALSE,TRUE,FALSE,build_dct_references,TRUE,references_json,TRUE,references_json,,39
40
+ Reference,dct_references_s,https://opengeometadata.org/ogm-aardvark/#references,text,FALSE,TRUE,TRUE,,URIs and Values,,reference_values,,,FALSE,TRUE,FALSE,build_dct_references,TRUE,distributions_json,TRUE,distributions_json,,39
41
41
  WxS Identifier,gbl_wxsIdentifier_s,https://opengeometadata.org/ogm-aardvark/#wxs-identifier,string,FALSE,FALSE,TRUE,,,wxs-identifier,,,,FALSE,TRUE,FALSE,,TRUE,,TRUE,,,40
42
42
  B1G Image URL,b1g_image_ss,https://geobtaa.github.io/metadata/b1g-custom-elements/#image,string,FALSE,FALSE,TRUE,,,image,,,,FALSE,TRUE,FALSE,,TRUE,,TRUE,,,41
43
43
  ID,geomg_id_s,https://opengeometadata.org/ogm-aardvark/#id,string,TRUE,FALSE,TRUE,,,slug,,disable_if_persisted,,FALSE,TRUE,FALSE,,TRUE,,TRUE,,presence,42
Binary file
@@ -0,0 +1,29 @@
1
+ name,reference_type,reference_uri,label,note,position
2
+ arcgis_dynamic_map_layer,ArcGIS DynamicMapLayer,urn:x-esri:serviceType:ArcGIS#DynamicMapLayer,FALSE,-,1
3
+ arcgis_feature_layer,ArcGIS FeatureLayer,urn:x-esri:serviceType:ArcGIS#FeatureLayer,FALSE,-,2
4
+ arcgis_image_map_layer,ArcGIS ImageMapLayer,urn:x-esri:serviceType:ArcGIS#ImageMapLayer,FALSE,-,3
5
+ arcgis_tiled_map_layer,ArcGIS TiledMapLayer,urn:x-esri:serviceType:ArcGIS#TiledMapLayer,FALSE,-,4
6
+ cog,Cloud Optimized GeoTIFF (COG),https://github.com/cogeotiff/cog-spec,FALSE,-,5
7
+ documentation_download,Data Dictionary / documentation,http://lccn.loc.gov/sh85035852,FALSE,Functions as a link to download documentation (not a viewer),6
8
+ documentation_external,Documentation (External),http://schema.org/url,FALSE,-,7
9
+ download,Download,http://schema.org/downloadUrl,TRUE,Link to download file (for multiple files see the multiple downloads guidelines),8
10
+ geo_json,GeoJSON,http://geojson.org/geojson-spec.html,FALSE,-,9
11
+ full_layer_description,Full layer description,http://schema.org/url,FALSE,To view further descriptive information about the layer or a link to its landing page,10
12
+ iiif_image,International Image Interoperability Framework (IIIF) Image API,http://iiif.io/api/image,FALSE,Load the image viewer using Leaflet-IIIF,11
13
+ iiif_manifest,International Image Interoperability Framework (IIIF) Presentation API Manifest,http://iiif.io/api/presentation#manifest,FALSE,View the IIIF manifest - uses the Clover viewer by default https://samvera-labs.github.io/clover-iiif/docs,12
14
+ image,Image file,http://schema.org/image,TRUE,-,13
15
+ metadata_fgdc,Metadata in FGDC,http://www.opengis.net/cat/csw/csdgm,FALSE,Provides an HTML view of an XML file in the FGDC standard,14
16
+ metadata_html,Metadata in HTML,http://www.w3.org/1999/xhtml,FALSE,View structured metadata in any standard expressed as HTML,15
17
+ metadata_iso,Metadata in ISO 19139,http://www.isotc211.org/schemas/2005/gmd/,FALSE,Provides an HTML view of an XML file in the ISO 19139 standard,16
18
+ metadata_mods,Metadata in MODS,http://www.loc.gov/mods/v3,FALSE,Provides a raw XML view of metadata in the MODS format,17
19
+ oembed,oEmbed,https://oembed.com,FALSE,-,18
20
+ open_index_map,OpenIndexMap,https://openindexmaps.org,FALSE,Provides an interactive preview of a GeoJSON file formatted as an OpenIndexMap,19
21
+ pmtiles,PMTiles,https://github.com/protomaps/PMTiles,FALSE,-,20
22
+ thumbnail,Thumbnail file,http://schema.org/thumbnailUrl,TRUE,-,21
23
+ tile_map_service,Tile Mapping Service (TMS),https://wiki.osgeo.org/wiki/Tile_Map_Service_Specification,FALSE,-,22
24
+ tile_json,TileJSON,https://github.com/mapbox/tilejson-spec,FALSE,-,23
25
+ wcs,Web Coverage Service (WCS),http://www.opengis.net/def/serviceType/ogc/wcs,FALSE,-,24
26
+ wfs,Web Feature Service (WFS),http://www.opengis.net/def/serviceType/ogc/wfs,FALSE,"Provides a to download generated vector datasets (GeoJSON, shapefile)",25
27
+ wmts,Web Mapping Service (WMS),http://www.opengis.net/def/serviceType/ogc/wms,FALSE,Provides a service to visually preview a layer and inspect its features,26
28
+ wms,WMTS,http://www.opengis.net/def/serviceType/ogc/wmts,FALSE,-,27
29
+ xyz_tiles,XYZ tiles,https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames,FALSE,Link to an XYZ tile server,28
Binary file
data/db/structure.sql CHANGED
@@ -349,15 +349,7 @@ CREATE TABLE public.users (
349
349
  reset_password_sent_at timestamp without time zone,
350
350
  remember_created_at timestamp without time zone,
351
351
  created_at timestamp(6) without time zone NOT NULL,
352
- updated_at timestamp(6) without time zone NOT NULL,
353
- invitation_token character varying,
354
- invitation_created_at timestamp without time zone,
355
- invitation_sent_at timestamp without time zone,
356
- invitation_accepted_at timestamp without time zone,
357
- invitation_limit integer,
358
- invited_by_type character varying,
359
- invited_by_id bigint,
360
- invitations_count integer DEFAULT 0
352
+ updated_at timestamp(6) without time zone NOT NULL
361
353
  );
362
354
 
363
355
 
@@ -670,35 +662,6 @@ CREATE INDEX index_mappings_on_import_id ON public.mappings USING btree (import_
670
662
 
671
663
  CREATE UNIQUE INDEX index_users_on_email ON public.users USING btree (email);
672
664
 
673
-
674
- --
675
- -- Name: index_users_on_invitation_token; Type: INDEX; Schema: public; Owner: -
676
- --
677
-
678
- CREATE UNIQUE INDEX index_users_on_invitation_token ON public.users USING btree (invitation_token);
679
-
680
-
681
- --
682
- -- Name: index_users_on_invitations_count; Type: INDEX; Schema: public; Owner: -
683
- --
684
-
685
- CREATE INDEX index_users_on_invitations_count ON public.users USING btree (invitations_count);
686
-
687
-
688
- --
689
- -- Name: index_users_on_invited_by_id; Type: INDEX; Schema: public; Owner: -
690
- --
691
-
692
- CREATE INDEX index_users_on_invited_by_id ON public.users USING btree (invited_by_id);
693
-
694
-
695
- --
696
- -- Name: index_users_on_invited_by_type_and_invited_by_id; Type: INDEX; Schema: public; Owner: -
697
- --
698
-
699
- CREATE INDEX index_users_on_invited_by_type_and_invited_by_id ON public.users USING btree (invited_by_type, invited_by_id);
700
-
701
-
702
665
  --
703
666
  -- Name: index_users_on_reset_password_token; Type: INDEX; Schema: public; Owner: -
704
667
  --
data/lib/compose.yml ADDED
@@ -0,0 +1,31 @@
1
+ services:
2
+ solr:
3
+ image: solr:9.6.1
4
+ volumes:
5
+ - $PWD/solr/conf:/opt/solr/conf
6
+ ports:
7
+ - 8983:8983
8
+ entrypoint:
9
+ - docker-entrypoint.sh
10
+ - solr-precreate
11
+ - blacklight-core
12
+ - /opt/solr/conf
13
+ - "-Xms256m"
14
+ - "-Xmx512m"
15
+
16
+ postgres:
17
+ image: postgres:latest
18
+ env:
19
+ POSTGRES_HOST: 127.0.0.1
20
+ POSTGRES_PORT: 5432
21
+ POSTGRES_DB: geoblacklight_development
22
+ POSTGRES_USER: postgres
23
+ POSTGRES_PASSWORD: postgres
24
+ ports:
25
+ - 5432:5432
26
+ # Set health checks to wait until postgres has started
27
+ options:
28
+ --health-cmd pg_isready
29
+ --health-interval 10s
30
+ --health-timeout 5s
31
+ --health-retries 5
@@ -13,7 +13,7 @@ module GeoblacklightAdmin
13
13
  3. Copies sidekiq.yml connection to host config
14
14
  5. Copies .env.development and .env.test to host
15
15
  4. Copies settings.yml to host config
16
- create_solr_yml
16
+ 5. Copies .solr_wrapper.yml to host config
17
17
  6. Copies JSON Schema to host
18
18
  7. Copies solr/* to host
19
19
  8. Sets Routes
@@ -56,6 +56,10 @@ module GeoblacklightAdmin
56
56
  copy_file "config/sidekiq.yml", "config/sidekiq.yml", force: true
57
57
  end
58
58
 
59
+ def create_solr_wrapper_yml
60
+ copy_file ".solr_wrapper.yml", ".solr_wrapper.yml", force: true
61
+ end
62
+
59
63
  def create_dotenv
60
64
  copy_file ".env.development.example", ".env.development"
61
65
  copy_file ".env.development.example", ".env.test"
@@ -65,10 +69,6 @@ module GeoblacklightAdmin
65
69
  copy_file "config/settings.yml", "config/settings.yml", force: true
66
70
  end
67
71
 
68
- def create_solr_yml
69
- copy_file ".solr_wrapper.yml", ".solr_wrapper.yml", force: true
70
- end
71
-
72
72
  def copy_json_schema
73
73
  copy_file "config/geomg_aardvark_schema.json", "config/geomg_aardvark_schema.json"
74
74
  end
@@ -89,7 +89,7 @@ module GeoblacklightAdmin
89
89
  end
90
90
 
91
91
  # Users
92
- devise_for :users, controllers: {invitations: "devise/invitations"}, skip: [:registrations]
92
+ devise_for :users, skip: [:registrations]
93
93
  as :user do
94
94
  get "/sign_in" => "devise/sessions#new" # custom path to login/sign_in
95
95
  get "/sign_up" => "devise/registrations#new", :as => "new_user_registration" # custom path to sign_up/registration
@@ -143,6 +143,11 @@ module GeoblacklightAdmin
143
143
  resources :form_control, path: :form_elements, controller: :form_elements
144
144
  resources :form_feature, path: :form_elements, controller: :form_elements
145
145
 
146
+ # Reference Types
147
+ resources :reference_types do
148
+ post :sort, on: :collection
149
+ end
150
+
146
151
  # Notifications
147
152
  resources :notifications do
148
153
  put "batch", on: :collection
@@ -174,6 +179,10 @@ module GeoblacklightAdmin
174
179
  get "admin"
175
180
  get "versions"
176
181
 
182
+ collection do
183
+ get "fetch"
184
+ end
185
+
177
186
  # DocumentAccesses
178
187
  resources :document_accesses, path: "access" do
179
188
  collection do
@@ -185,6 +194,17 @@ module GeoblacklightAdmin
185
194
  end
186
195
  end
187
196
 
197
+ # Document Assets
198
+ resources :document_assets, path: "assets" do
199
+ collection do
200
+ get "display_attach_form"
201
+ post "attach_files"
202
+
203
+ get "destroy_all"
204
+ post "destroy_all"
205
+ end
206
+ end
207
+
188
208
  # DocumentDownloads
189
209
  resources :document_downloads, path: "downloads" do
190
210
  collection do
@@ -196,20 +216,19 @@ module GeoblacklightAdmin
196
216
  end
197
217
  end
198
218
 
199
- # Document Assets
200
- resources :document_assets, path: "assets" do
219
+ # Document References
220
+ resources :document_distributions, path: "distributions" do
201
221
  collection do
202
222
  get "display_attach_form"
203
223
  post "attach_files"
204
224
 
225
+ get "import"
226
+ post "import"
227
+
205
228
  get "destroy_all"
206
229
  post "destroy_all"
207
230
  end
208
231
  end
209
-
210
- collection do
211
- get "fetch"
212
- end
213
232
  end
214
233
 
215
234
  # Document Accesses
@@ -234,6 +253,17 @@ module GeoblacklightAdmin
234
253
  end
235
254
  end
236
255
 
256
+ # Document Distributions
257
+ resources :document_distributions, path: "distributions" do
258
+ collection do
259
+ get "import"
260
+ post "import"
261
+
262
+ get "destroy_all"
263
+ post "destroy_all"
264
+ end
265
+ end
266
+
237
267
  # Document Assets
238
268
  resources :document_assets, path: "assets" do
239
269
  collection do
@@ -374,6 +404,12 @@ module GeoblacklightAdmin
374
404
  end
375
405
  end
376
406
 
407
+ def add_application_config_for_psych_time_with_zone
408
+ inject_into_file "config/application.rb", after: "config.generators.system_tests = nil" do
409
+ "\n config.active_record.yaml_column_permitted_classes = [Symbol, Date, Time, ActiveSupport::TimeWithZone, ActiveSupport::TimeZone]"
410
+ end
411
+ end
412
+
377
413
  def add_vite_rails_config
378
414
  copy_file "base.html.erb", "app/views/layouts/blacklight/base.html.erb", force: true
379
415
  copy_file "vite.config.ts", "vite.config.ts", force: true
@@ -48,5 +48,13 @@ module GeoblacklightAdmin
48
48
  run "yarn add @geoblacklight/frontend@^4.4.6"
49
49
  run "yarn install"
50
50
  end
51
+
52
+ def add_rsolr_gem
53
+ gem "rsolr", ">= 1.0", "< 3"
54
+ end
55
+
56
+ def docker_compose
57
+ copy_file "../../../../compose.yml", "compose.yml"
58
+ end
51
59
  end
52
60
  end
@@ -2,7 +2,7 @@ default: &default
2
2
  adapter: postgresql
3
3
  encoding: unicode
4
4
  host: <%= ENV['POSTGRES_HOST'] || '127.0.0.1' %>
5
- port: <%= ENV['POSTGRES_PORT'] || '5432' %>
5
+ port: <%= ENV['POSTGRES_PORT'] || '5555' %>
6
6
  username: <%= ENV['POSTGRES_USER'] || 'postgres' %>
7
7
  password: <%= ENV['POSTGRES_PASSWORD'] || 'postgres' %>
8
8
  pool: 5
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "devise_invitable"
4
-
5
3
  # Assuming you have not yet modified this file, each configuration option below
6
4
  # is set to its default value. Note that some are commented out while others
7
5
  # are not: uncommented lines are intended to protect your configuration from
@@ -13,3 +13,4 @@ Mime::Type.register "application/json", :json
13
13
 
14
14
  Mime::Type.register "text/csv", :csv_document_downloads
15
15
  Mime::Type.register "text/csv", :csv_document_access_links
16
+ Mime::Type.register "text/csv", :csv_document_distributions
@@ -0,0 +1,31 @@
1
+ # syntax = docker/dockerfile:1
2
+
3
+ # Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile
4
+ ARG RUBY_VERSION=3.3.5
5
+ FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim AS base
6
+
7
+ RUN apt-get update -qq && \
8
+ apt-get install --no-install-recommends -y build-essential git pkg-config nodejs npm curl libsqlite3-0
9
+
10
+ RUN npm install --global yarn
11
+
12
+ ENV RAILS_ENV="development" \
13
+ BUNDLE_PATH="/usr/local/bundle"
14
+
15
+ # Rails app lives here
16
+ WORKDIR /rails
17
+
18
+ # Install gems and javascript packages
19
+ COPY Gemfile .
20
+ RUN bundle install
21
+ COPY package.json .
22
+ RUN yarn install
23
+
24
+ FROM ghcr.io/geobtaa/geoblacklight_admin:base AS app
25
+
26
+ # Add application code
27
+ COPY . .
28
+
29
+ # Run the server script by default, this can be overwritten at runtime
30
+ EXPOSE 3000
31
+ CMD ["sh", "start-server"]
@@ -0,0 +1,42 @@
1
+ services:
2
+ app:
3
+ image: ghcr.io/geobtaa/geoblacklight_admin:main
4
+ ports:
5
+ - "3001:3001"
6
+ links:
7
+ - "solr:solr"
8
+ environment:
9
+ SOLR_URL: "http://solr:8983/solr/blacklight-core"
10
+ RAILS_DEVELOPMENT_HOSTS: ".githubpreview.dev,.preview.app.github.dev,.app.github.dev,.csb.app"
11
+ depends_on:
12
+ - solr
13
+ command: sh start-server.sh
14
+ solr:
15
+ image: solr:9.6.1
16
+ volumes:
17
+ - $PWD/solr/conf:/opt/solr/conf
18
+ ports:
19
+ - 8984:8983
20
+ entrypoint:
21
+ - docker-entrypoint.sh
22
+ - solr-precreate
23
+ - blacklight-core
24
+ - /opt/solr/conf
25
+ - "-Xms256m"
26
+ - "-Xmx512m"
27
+ postgres:
28
+ image: postgres:latest
29
+ env:
30
+ POSTGRES_HOST: 127.0.0.1
31
+ POSTGRES_PORT: 5432
32
+ POSTGRES_DB: geoblacklight_development
33
+ POSTGRES_USER: postgres
34
+ POSTGRES_PASSWORD: postgres
35
+ ports:
36
+ - 5432:5432
37
+ # Set health checks to wait until postgres has started
38
+ options:
39
+ --health-cmd pg_isready
40
+ --health-interval 10s
41
+ --health-timeout 5s
42
+ --health-retries 5
@@ -0,0 +1,21 @@
1
+ #!/bin/sh
2
+
3
+ bundle install
4
+ yarn install
5
+
6
+ # Build and Install local copy of @geoblackligt/frontend
7
+ # These steps are included in the docker image instead if the image build script
8
+ # to reduce the size of the layers that docker compose has to pull with each new version.
9
+ gempath=$(bundle exec gem which geoblacklight_admin | sed 's/\/lib\/geoblacklight_admin.rb//')
10
+ if [ ! -d "$gempath/dist/" ]; then
11
+ cd $gempath
12
+ yarn install
13
+ yarn vite build
14
+ cd -
15
+ fi
16
+ yarn add file:$gempath
17
+
18
+ # Start the server
19
+ bundle exec rake db:prepare
20
+ bundle exec rake geoblacklight:index:seed
21
+ bundle exec rails server -b 0.0.0.0 -p 3001
@@ -1,5 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "devise"
4
+ require "blacklight"
5
+ require "geoblacklight"
6
+
3
7
  module GeoblacklightAdmin
4
8
  class Engine < ::Rails::Engine
5
9
  isolate_namespace GeoblacklightAdmin
@@ -0,0 +1,69 @@
1
+ require "rake"
2
+ require "csv"
3
+
4
+ namespace :geoblacklight_admin do
5
+ namespace :distributions do
6
+ desc "Migrate distributions into DocumentDistributions"
7
+ task migrate: :environment do
8
+ total_documents_processed = 0
9
+ puts "\n--- Migration Start ---"
10
+ Document.find_in_batches(batch_size: 1000) do |documents|
11
+ documents.each do |document|
12
+ # Moves AttrJson-based dct_references_s and Multiple Downloads into DocumentDistributions
13
+
14
+ document.distributions_csv.each do |distribution|
15
+ DocumentDistribution.find_or_create_by!(
16
+ friendlier_id: distribution[0],
17
+ reference_type_id: ReferenceType.find_by(name: distribution[1]).id,
18
+ url: distribution[2],
19
+ label: distribution[3]
20
+ )
21
+ end
22
+ rescue => e
23
+ puts "\nError processing distributions for document: #{document.friendlier_id} - #{e.inspect}\n"
24
+ end
25
+ total_documents_processed += documents.size
26
+ puts "Processed #{documents.size} documents in this batch, total processed: #{total_documents_processed}"
27
+ end
28
+ puts "--- Migration End ---\n"
29
+ end
30
+
31
+ desc "Audit the distributions migration"
32
+ task audit: :environment do
33
+ total_documents_processed = 0
34
+ puts "\n--- Audit Start ---"
35
+ Document.find_in_batches(batch_size: 1000) do |documents|
36
+ documents.each do |document|
37
+ # Document > Distributions as CSV
38
+ dr_csv = document.references_csv.sort
39
+
40
+ # document_distributions
41
+ doc_dists = document.document_distributions.collect { |dr| dr.to_csv }.sort
42
+
43
+ if dr_csv != doc_dists
44
+ puts "\nNO MATCH"
45
+ puts "Document: #{document.friendlier_id}"
46
+ puts "CSV Distributions Sorted: #{dr_csv.sort.inspect}"
47
+ puts "Document Distributions Sorted: #{doc_dists.sort.inspect}\n"
48
+ end
49
+ rescue => e
50
+ puts "\nError auditing distributions for document: #{document.friendlier_id} - #{e.inspect}\n"
51
+ end
52
+ total_documents_processed += documents.size
53
+ puts "Processed #{documents.size} documents in this batch, total processed: #{total_documents_processed}"
54
+ end
55
+ puts "--- Audit End ---\n"
56
+ end
57
+
58
+ task finalize: :environment do
59
+ # Step 1 - After migrate, flip the ENV var feature flag
60
+ # Done: Remove multiple download links from Documents
61
+ # Done: Remove multiple download links from FormElements (it's a feature there)
62
+ # Done: Remove multiple download links from FormNav (link)
63
+ # Done: Add DocumentDistributions to the FormElements (as a feature - manual)
64
+
65
+ # Step 2 - Finalize
66
+ # Remove AttrJson dct_references_s values from Documents (data is redundant and/or incorrect)
67
+ end
68
+ end
69
+ end
@@ -1,3 +1,4 @@
1
+ require "rake"
1
2
  require "csv"
2
3
 
3
4
  namespace :geoblacklight_admin do