geoblacklight_admin 0.0.1 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +59 -36
- data/Rakefile +47 -14
- data/app/assets/javascripts/geoblacklight_admin.js +2 -1
- data/app/assets/stylesheets/geoblacklight_admin/_core.scss +5 -0
- data/app/assets/stylesheets/geoblacklight_admin/modules/_chosen.scss +425 -0
- data/app/assets/stylesheets/geoblacklight_admin/modules/_forms.scss +108 -0
- data/app/controllers/admin/admin_controller.rb +4 -2
- data/app/controllers/admin/advanced_search_controller.rb +123 -103
- data/app/controllers/admin/api_controller.rb +123 -108
- data/app/controllers/admin/bookmarks_controller.rb +4 -4
- data/app/controllers/admin/bulk_actions_controller.rb +9 -4
- data/app/controllers/admin/concerns/upload_util.rb +2 -0
- data/app/controllers/admin/document_accesses_controller.rb +10 -4
- data/app/controllers/admin/document_assets_controller.rb +14 -11
- data/app/controllers/admin/document_downloads_controller.rb +12 -10
- data/app/controllers/admin/documents_controller.rb +32 -15
- data/app/controllers/admin/elements_controller.rb +6 -5
- data/app/controllers/admin/form_elements_controller.rb +4 -4
- data/app/controllers/admin/ids_controller.rb +107 -87
- data/app/controllers/admin/import_documents_controller.rb +1 -1
- data/app/controllers/admin/imports_controller.rb +7 -3
- data/app/controllers/admin/mappings_controller.rb +6 -4
- data/app/controllers/admin/notifications_controller.rb +1 -1
- data/app/controllers/admin/search_controller.rb +3 -2
- data/app/controllers/admin/users_controller.rb +2 -2
- data/app/helpers/form_input_helper.rb +4 -4
- data/app/helpers/geoblacklight_admin_helper.rb +1 -1
- data/app/indexers/document_indexer.rb +1 -1
- data/app/jobs/export_job.rb +9 -6
- data/app/jobs/export_json_bulk_job.rb +95 -0
- data/app/jobs/export_json_job.rb +14 -12
- data/app/models/admin/bookmark.rb +18 -0
- data/app/models/api_search_builder.rb +3 -1
- data/app/models/blacklight_api.rb +6 -6
- data/app/models/blacklight_api_facets.rb +7 -2
- data/app/models/blacklight_api_ids.rb +3 -4
- data/app/models/bulk_action.rb +1 -1
- data/app/models/document/bbox_validator.rb +9 -5
- data/app/models/document/date_range_validator.rb +13 -10
- data/app/models/document/geom_validator.rb +4 -2
- data/app/models/document.rb +15 -7
- data/app/models/element.rb +9 -7
- data/app/models/form_control.rb +2 -0
- data/app/models/form_element.rb +2 -0
- data/app/models/form_feature.rb +2 -0
- data/app/models/form_group.rb +2 -0
- data/app/models/form_header.rb +2 -0
- data/app/models/geoblacklight_admin/schema.rb +5 -2
- data/app/models/geoblacklight_admin.rb +2 -0
- data/app/models/import/csv_duplicates_validator.rb +2 -1
- data/app/models/import/csv_header_validator.rb +2 -1
- data/app/models/import.rb +4 -7
- data/app/models/user.rb +1 -1
- data/app/services/export_csv_service.rb +5 -1
- data/app/views/admin/advanced_search/facets.json.jbuilder +9 -8
- data/app/views/admin/advanced_search/index.json.jbuilder +8 -7
- data/app/views/admin/api/_field.json.jbuilder +1 -1
- data/app/views/admin/api/fetch.json.jbuilder +8 -7
- data/app/views/admin/api/index.json.jbuilder +8 -7
- data/app/views/admin/bookmarks/index.html.erb +2 -2
- data/app/views/admin/bulk_actions/index.html.erb +3 -3
- data/app/views/admin/bulk_actions/show.html.erb +1 -1
- data/app/views/admin/document_accesses/_form.html.erb +1 -1
- data/app/views/admin/document_accesses/destroy_all.html.erb +3 -3
- data/app/views/admin/document_accesses/edit.html.erb +1 -1
- data/app/views/admin/document_accesses/import.html.erb +2 -2
- data/app/views/admin/document_accesses/index.html.erb +9 -9
- data/app/views/admin/document_accesses/new.html.erb +1 -1
- data/app/views/admin/document_downloads/_form.html.erb +1 -1
- data/app/views/admin/document_downloads/destroy_all.html.erb +2 -2
- data/app/views/admin/document_downloads/edit.html.erb +2 -3
- data/app/views/admin/document_downloads/import.html.erb +1 -1
- data/app/views/admin/document_downloads/index.html.erb +9 -9
- data/app/views/admin/document_downloads/new.html.erb +1 -1
- data/app/views/admin/document_downloads/show.html.erb +2 -2
- data/app/views/admin/documents/_document_bookmark.html.erb +1 -1
- data/app/views/admin/documents/_form_nav.html.erb +3 -1
- data/app/views/admin/documents/_json_btaa_aardvark.jbuilder +1 -3
- data/app/views/admin/documents/_json_file.jbuilder +14 -0
- data/app/views/admin/documents/_result_selected_options.html.erb +3 -1
- data/app/views/admin/documents/edit.html.erb +1 -1
- data/app/views/admin/documents/features/_multiple_download_links.html.erb +2 -2
- data/app/views/admin/documents/fetch.json_file.jbuilder +9 -0
- data/app/views/admin/documents/index.html.erb +2 -4
- data/app/views/admin/documents/index.json_file.jbuilder +9 -0
- data/app/views/admin/documents/versions.html.erb +1 -1
- data/app/views/admin/elements/_element.json.jbuilder +4 -1
- data/app/views/admin/elements/_form.html.erb +1 -1
- data/app/views/admin/elements/edit.html.erb +2 -2
- data/app/views/admin/elements/index.html.erb +4 -4
- data/app/views/admin/elements/index.json.jbuilder +2 -0
- data/app/views/admin/elements/new.html.erb +1 -1
- data/app/views/admin/elements/show.html.erb +6 -6
- data/app/views/admin/elements/show.json.jbuilder +2 -0
- data/app/views/admin/form_elements/_form.html.erb +1 -1
- data/app/views/admin/form_elements/_form_element.json.jbuilder +2 -0
- data/app/views/admin/form_elements/edit.html.erb +2 -2
- data/app/views/admin/form_elements/index.html.erb +2 -2
- data/app/views/admin/form_elements/index.json.jbuilder +2 -0
- data/app/views/admin/form_elements/new.html.erb +1 -1
- data/app/views/admin/form_elements/show.html.erb +2 -2
- data/app/views/admin/form_elements/show.json.jbuilder +2 -0
- data/app/views/admin/ids/fetch.json.jbuilder +8 -7
- data/app/views/admin/ids/index.json.jbuilder +3 -2
- data/app/views/admin/import_documents/show.html.haml +1 -1
- data/app/views/admin/imports/_import.json.jbuilder +2 -1
- data/app/views/admin/imports/_show_failed_tab.html.erb +2 -2
- data/app/views/admin/imports/_show_success_tab.html.erb +1 -1
- data/app/views/admin/imports/edit.html.erb +3 -3
- data/app/views/admin/imports/index.html.erb +3 -3
- data/app/views/admin/layouts/application.html.erb +4 -4
- data/app/views/admin/mappings/_form.html.erb +1 -1
- data/app/views/admin/mappings/_mapping.json.jbuilder +2 -1
- data/app/views/admin/mappings/edit.html.erb +2 -2
- data/app/views/admin/mappings/new.html.erb +1 -1
- data/app/views/admin/mappings/show.html.erb +2 -2
- data/app/views/admin/notifications/index.html.erb +3 -3
- data/app/views/admin/search/index.html.erb +2 -2
- data/app/views/admin/shared/_navbar.html.erb +11 -6
- data/app/views/admin/shared/_toast.html.erb +1 -1
- data/app/views/admin/users/index.html.erb +1 -1
- data/app/views/catalog/_show_gbl_admin.html.erb +3 -0
- data/config/locales/documents.en.yml +3 -0
- data/config/routes.rb +37 -33
- data/db/migrate/20230316183001_add_geoblacklight_admin_gem.rb +409 -0
- data/db/seeds.rb +7 -6
- data/db/seeds_elements.csv +56 -55
- data/db/seeds_elements.numbers +0 -0
- data/db/seeds_form_elements.csv +65 -64
- data/db/seeds_form_elements.numbers +0 -0
- data/lib/generators/geoblacklight_admin/config_generator.rb +61 -94
- data/lib/generators/geoblacklight_admin/install_generator.rb +3 -12
- data/lib/generators/geoblacklight_admin/jobs_generator.rb +3 -2
- data/lib/generators/geoblacklight_admin/models_generator.rb +0 -1
- data/lib/generators/geoblacklight_admin/templates/_show_sidebar.html.erb +19 -0
- data/lib/generators/geoblacklight_admin/templates/_user_util_links.html.erb +1 -1
- data/lib/generators/geoblacklight_admin/templates/config/database.yml +9 -5
- data/lib/generators/geoblacklight_admin/templates/config/geomg_aardvark_schema.json +12 -6
- data/lib/generators/geoblacklight_admin/templates/config/initializers/devise.rb +315 -0
- data/lib/generators/geoblacklight_admin/templates/config/initializers/geoblacklight_admin.rb +1 -2
- data/lib/generators/geoblacklight_admin/templates/config/initializers/kithe.rb +2 -0
- data/lib/generators/geoblacklight_admin/templates/config/initializers/mime_types.rb +15 -0
- data/lib/generators/geoblacklight_admin/templates/config/initializers/pagy.rb +152 -68
- data/lib/generators/geoblacklight_admin/templates/config/initializers/simple_form.rb +178 -0
- data/lib/generators/geoblacklight_admin/templates/config/initializers/simple_form_bootstrap.rb +365 -0
- data/lib/generators/geoblacklight_admin/templates/config/settings.yml +293 -0
- data/lib/generators/geoblacklight_admin/templates/javascript/controllers/results_controller.js +10 -0
- data/lib/generators/geoblacklight_admin/templates/package.json +3 -0
- data/lib/generators/geoblacklight_admin/templates/solr/conf/schema.xml +3 -3
- data/lib/generators/geoblacklight_admin/views_generator.rb +2 -3
- data/lib/geoblacklight_admin/engine.rb +5 -6
- data/lib/geoblacklight_admin/version.rb +1 -1
- data/lib/geoblacklight_admin.rb +1 -1
- data/lib/tasks/geoblacklight_admin.rake +15 -11
- metadata +101 -63
- data/.editorconfig +0 -18
- data/.gitignore +0 -75
- data/.standard.yml +0 -4
- data/Gemfile +0 -59
- data/LICENSE +0 -21
- data/app/assets/images/.keep +0 -0
- data/app/controllers/admin/concerns/.keep +0 -0
- data/app/models/bookmark.rb +0 -17
- data/app/models/concerns/.keep +0 -0
- data/db/migrate/20230316183001_add_geoblacklight_admin.rb +0 -399
- data/geoblacklight_admin.gemspec +0 -67
- data/lib/generators/geoblacklight_admin/example_docs_generator.rb +0 -18
- data/lib/generators/geoblacklight_admin/templates/.env.development.example +0 -28
- data/lib/generators/geoblacklight_admin/templates/.solr_wrapper.yml +0 -7
- data/lib/generators/geoblacklight_admin/templates/solr/snapshots/.keep +0 -0
- data/lib/tasks/.keep +0 -0
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +0 -35
- data/template.rb +0 -16
- /data/{app/views/admin → lib/generators/geoblacklight_admin/templates}/devise/confirmations/new.html.erb +0 -0
- /data/{app/views/admin → lib/generators/geoblacklight_admin/templates}/devise/invitations/edit.html.erb +0 -0
- /data/{app/views/admin → lib/generators/geoblacklight_admin/templates}/devise/invitations/new.html.erb +0 -0
- /data/{app/views/admin → lib/generators/geoblacklight_admin/templates}/devise/mailer/invitation_instructions.html.erb +0 -0
- /data/{app/views/admin → lib/generators/geoblacklight_admin/templates}/devise/mailer/invitation_instructions.text.erb +0 -0
- /data/{app/views/admin → lib/generators/geoblacklight_admin/templates}/devise/passwords/edit.html.erb +0 -0
- /data/{app/views/admin → lib/generators/geoblacklight_admin/templates}/devise/passwords/new.html.erb +0 -0
- /data/{app/views/admin → lib/generators/geoblacklight_admin/templates}/devise/registrations/edit.html.erb +0 -0
- /data/{app/views/admin → lib/generators/geoblacklight_admin/templates}/devise/registrations/new.html.erb +0 -0
- /data/{app/views/admin → lib/generators/geoblacklight_admin/templates}/devise/sessions/new.html.erb +0 -0
- /data/{app/views/admin → lib/generators/geoblacklight_admin/templates}/devise/shared/_links.html.erb +0 -0
- /data/{app/views/admin → lib/generators/geoblacklight_admin/templates}/devise/unlocks/new.html.erb +0 -0
data/config/routes.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
GeoblacklightAdmin::Engine.routes.draw do
|
2
4
|
# GBL‡ADMIN
|
3
5
|
resources :bulk_actions do
|
@@ -23,14 +25,14 @@ GeoblacklightAdmin::Engine.routes.draw do
|
|
23
25
|
patch :run, on: :member
|
24
26
|
patch :revert, on: :member
|
25
27
|
end
|
26
|
-
|
28
|
+
|
27
29
|
# Imports
|
28
30
|
resources :imports do
|
29
31
|
resources :mappings
|
30
32
|
resources :import_documents, only: [:show]
|
31
33
|
patch :run, on: :member
|
32
34
|
end
|
33
|
-
|
35
|
+
|
34
36
|
# Elements
|
35
37
|
resources :elements do
|
36
38
|
post :sort, on: :collection
|
@@ -44,7 +46,7 @@ GeoblacklightAdmin::Engine.routes.draw do
|
|
44
46
|
resources :form_group, path: :form_elements, controller: :form_elements
|
45
47
|
resources :form_control, path: :form_elements, controller: :form_elements
|
46
48
|
resources :form_feature, path: :form_elements, controller: :form_elements
|
47
|
-
|
49
|
+
|
48
50
|
# Notifications
|
49
51
|
resources :notifications do
|
50
52
|
put "batch", on: :collection
|
@@ -56,107 +58,109 @@ GeoblacklightAdmin::Engine.routes.draw do
|
|
56
58
|
# Bookmarks
|
57
59
|
resources :bookmarks
|
58
60
|
delete "/bookmarks", to: "bookmarks#destroy", as: :bookmarks_destroy_by_fkeys
|
59
|
-
|
61
|
+
|
60
62
|
# AdvancedSearch controller
|
61
|
-
get
|
62
|
-
get
|
63
|
-
get
|
63
|
+
get "/advanced_search" => "advanced_search#index", :constraints => ->(req) { req.format == :json }
|
64
|
+
get "/advanced_search/facets" => "advanced_search#facets", :constraints => ->(req) { req.format == :json }
|
65
|
+
get "/advanced_search/facet/:id" => "advanced_search#facet", :constraints => lambda { |req|
|
66
|
+
req.format == :json
|
67
|
+
}, :as => "advanced_search_facet"
|
64
68
|
|
65
69
|
# Ids controller
|
66
|
-
get
|
67
|
-
get
|
68
|
-
get
|
69
|
-
get
|
70
|
+
get "/api/ids" => "ids#index", :constraints => ->(req) { req.format == :json }
|
71
|
+
get "/api" => "api#index", :constraints => ->(req) { req.format == :json }
|
72
|
+
get "/api/fetch" => "api#fetch", :constraints => ->(req) { req.format == :json }
|
73
|
+
get "/api/facet/:id" => "api#facet", :constraints => ->(req) { req.format == :json }
|
70
74
|
|
71
75
|
resources :documents do
|
72
76
|
get "versions"
|
73
|
-
|
77
|
+
|
74
78
|
resources :document_accesses, path: "access" do
|
75
79
|
collection do
|
76
80
|
get "import"
|
77
81
|
post "import"
|
78
|
-
|
82
|
+
|
79
83
|
get "destroy_all"
|
80
84
|
post "destroy_all"
|
81
85
|
end
|
82
86
|
end
|
83
|
-
|
87
|
+
|
84
88
|
resources :document_downloads, path: "downloads" do
|
85
89
|
collection do
|
86
90
|
get "import"
|
87
91
|
post "import"
|
88
|
-
|
92
|
+
|
89
93
|
get "destroy_all"
|
90
94
|
post "destroy_all"
|
91
95
|
end
|
92
96
|
end
|
93
|
-
|
97
|
+
|
94
98
|
resources :document_assets, path: "assets" do
|
95
99
|
collection do
|
96
100
|
get "display_attach_form"
|
97
101
|
post "attach_files"
|
98
|
-
|
102
|
+
|
99
103
|
get "destroy_all"
|
100
104
|
post "destroy_all"
|
101
105
|
end
|
102
106
|
end
|
103
|
-
|
107
|
+
|
104
108
|
collection do
|
105
109
|
get "fetch"
|
106
110
|
end
|
107
111
|
end
|
108
|
-
|
112
|
+
|
109
113
|
resources :document_accesses, path: "access" do
|
110
114
|
collection do
|
111
115
|
get "import"
|
112
116
|
post "import"
|
113
|
-
|
117
|
+
|
114
118
|
get "destroy_all"
|
115
119
|
post "destroy_all"
|
116
120
|
end
|
117
121
|
end
|
118
|
-
|
122
|
+
|
119
123
|
resources :document_downloads, path: "downloads" do
|
120
124
|
collection do
|
121
125
|
get "import"
|
122
126
|
post "import"
|
123
|
-
|
127
|
+
|
124
128
|
get "destroy_all"
|
125
129
|
post "destroy_all"
|
126
130
|
end
|
127
131
|
end
|
128
|
-
|
132
|
+
|
129
133
|
resources :document_assets, path: "assets" do
|
130
134
|
collection do
|
131
135
|
get "display_attach_form"
|
132
136
|
post "attach_files"
|
133
|
-
|
137
|
+
|
134
138
|
get "destroy_all"
|
135
139
|
post "destroy_all"
|
136
140
|
end
|
137
141
|
end
|
138
|
-
|
142
|
+
|
139
143
|
get "/documents/:id/ingest", to: "document_assets#display_attach_form", as: "asset_ingest"
|
140
144
|
post "/documents/:id/ingest", to: "document_assets#attach_files"
|
141
|
-
#mount Kithe::AssetUploader.upload_endpoint(:cache) => "/direct_upload", :as => :direct_app_upload
|
142
|
-
|
145
|
+
# mount Kithe::AssetUploader.upload_endpoint(:cache) => "/direct_upload", :as => :direct_app_upload
|
146
|
+
|
143
147
|
resources :collections, except: [:show]
|
144
|
-
|
148
|
+
|
145
149
|
# Note "assets" is Rails reserved word for routing, oops. So we use
|
146
150
|
# asset_files.
|
147
|
-
resources :assets, path: "asset_files", except: [
|
151
|
+
resources :assets, path: "asset_files", except: %i[new create] do
|
148
152
|
member do
|
149
153
|
put "convert_to_child_work"
|
150
154
|
end
|
151
155
|
end
|
152
|
-
|
156
|
+
|
153
157
|
# @TODO
|
154
158
|
# mount Qa::Engine => "/authorities"
|
155
159
|
mount ActionCable.server => "/cable"
|
156
|
-
|
160
|
+
|
157
161
|
# @TODO
|
158
162
|
# authenticate :user, ->(user) { user } do
|
159
|
-
|
163
|
+
# mount Blazer::Engine, at: "blazer"
|
160
164
|
# end
|
161
165
|
end
|
162
|
-
end
|
166
|
+
end
|
@@ -0,0 +1,409 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class AddGeoblacklightAdminGem < ActiveRecord::Migration[6.1]
|
4
|
+
def change
|
5
|
+
# These are extensions that must be enabled in order to support this database
|
6
|
+
enable_extension 'pgcrypto'
|
7
|
+
enable_extension 'plpgsql'
|
8
|
+
|
9
|
+
create_function :kithe_models_friendlier_id_gen, sql_definition: <<-'SQL'
|
10
|
+
CREATE OR REPLACE FUNCTION public.kithe_models_friendlier_id_gen(min_value bigint, max_value bigint)
|
11
|
+
RETURNS text
|
12
|
+
LANGUAGE plpgsql
|
13
|
+
AS $function$
|
14
|
+
DECLARE
|
15
|
+
new_id_int bigint;
|
16
|
+
new_id_str character varying := '';
|
17
|
+
done bool;
|
18
|
+
tries integer;
|
19
|
+
alphabet char[] := ARRAY['0','1','2','3','4','5','6','7','8','9',
|
20
|
+
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
|
21
|
+
'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'];
|
22
|
+
alphabet_length integer := array_length(alphabet, 1);
|
23
|
+
|
24
|
+
BEGIN
|
25
|
+
done := false;
|
26
|
+
tries := 0;
|
27
|
+
WHILE (NOT done) LOOP
|
28
|
+
tries := tries + 1;
|
29
|
+
IF (tries > 3) THEN
|
30
|
+
RAISE 'Could not find non-conflicting friendlier_id in 3 tries';
|
31
|
+
END IF;
|
32
|
+
|
33
|
+
new_id_int := trunc(random() * (max_value - min_value) + min_value);
|
34
|
+
|
35
|
+
-- convert bigint to a Base-36 alphanumeric string
|
36
|
+
-- see https://web.archive.org/web/20130420084605/http://www.jamiebegin.com/base36-conversion-in-postgresql/
|
37
|
+
-- https://gist.github.com/btbytes/7159902
|
38
|
+
WHILE new_id_int != 0 LOOP
|
39
|
+
new_id_str := alphabet[(new_id_int % alphabet_length)+1] || new_id_str;
|
40
|
+
new_id_int := new_id_int / alphabet_length;
|
41
|
+
END LOOP;
|
42
|
+
|
43
|
+
done := NOT exists(SELECT 1 FROM kithe_models WHERE friendlier_id=new_id_str);
|
44
|
+
END LOOP;
|
45
|
+
RETURN new_id_str;
|
46
|
+
END;
|
47
|
+
$function$
|
48
|
+
SQL
|
49
|
+
|
50
|
+
create_table 'blazer_audits', force: :cascade do |t|
|
51
|
+
t.bigint 'user_id'
|
52
|
+
t.bigint 'query_id'
|
53
|
+
t.text 'statement'
|
54
|
+
t.string 'data_source'
|
55
|
+
t.datetime 'created_at'
|
56
|
+
t.index ['query_id'], name: 'index_blazer_audits_on_query_id'
|
57
|
+
t.index ['user_id'], name: 'index_blazer_audits_on_user_id'
|
58
|
+
end
|
59
|
+
|
60
|
+
create_table 'blazer_checks', force: :cascade do |t|
|
61
|
+
t.bigint 'creator_id'
|
62
|
+
t.bigint 'query_id'
|
63
|
+
t.string 'state'
|
64
|
+
t.string 'schedule'
|
65
|
+
t.text 'emails'
|
66
|
+
t.text 'slack_channels'
|
67
|
+
t.string 'check_type'
|
68
|
+
t.text 'message'
|
69
|
+
t.datetime 'last_run_at'
|
70
|
+
t.datetime 'created_at', precision: 6, null: false
|
71
|
+
t.datetime 'updated_at', precision: 6, null: false
|
72
|
+
t.index ['creator_id'], name: 'index_blazer_checks_on_creator_id'
|
73
|
+
t.index ['query_id'], name: 'index_blazer_checks_on_query_id'
|
74
|
+
end
|
75
|
+
|
76
|
+
create_table 'blazer_dashboard_queries', force: :cascade do |t|
|
77
|
+
t.bigint 'dashboard_id'
|
78
|
+
t.bigint 'query_id'
|
79
|
+
t.integer 'position'
|
80
|
+
t.datetime 'created_at', precision: 6, null: false
|
81
|
+
t.datetime 'updated_at', precision: 6, null: false
|
82
|
+
t.index ['dashboard_id'], name: 'index_blazer_dashboard_queries_on_dashboard_id'
|
83
|
+
t.index ['query_id'], name: 'index_blazer_dashboard_queries_on_query_id'
|
84
|
+
end
|
85
|
+
|
86
|
+
create_table 'blazer_dashboards', force: :cascade do |t|
|
87
|
+
t.bigint 'creator_id'
|
88
|
+
t.string 'name'
|
89
|
+
t.datetime 'created_at', precision: 6, null: false
|
90
|
+
t.datetime 'updated_at', precision: 6, null: false
|
91
|
+
t.index ['creator_id'], name: 'index_blazer_dashboards_on_creator_id'
|
92
|
+
end
|
93
|
+
|
94
|
+
create_table 'blazer_queries', force: :cascade do |t|
|
95
|
+
t.bigint 'creator_id'
|
96
|
+
t.string 'name'
|
97
|
+
t.text 'description'
|
98
|
+
t.text 'statement'
|
99
|
+
t.string 'data_source'
|
100
|
+
t.string 'status'
|
101
|
+
t.datetime 'created_at', precision: 6, null: false
|
102
|
+
t.datetime 'updated_at', precision: 6, null: false
|
103
|
+
t.index ['creator_id'], name: 'index_blazer_queries_on_creator_id'
|
104
|
+
end
|
105
|
+
|
106
|
+
create_table 'blazer_uploads', force: :cascade do |t|
|
107
|
+
t.bigint 'creator_id'
|
108
|
+
t.string 'table'
|
109
|
+
t.text 'description'
|
110
|
+
t.datetime 'created_at', precision: 6, null: false
|
111
|
+
t.datetime 'updated_at', precision: 6, null: false
|
112
|
+
t.index ['creator_id'], name: 'index_blazer_uploads_on_creator_id'
|
113
|
+
end
|
114
|
+
|
115
|
+
create_table 'bookmarks', force: :cascade do |t|
|
116
|
+
t.integer 'user_id', null: false
|
117
|
+
t.string 'user_type'
|
118
|
+
t.string 'document_id'
|
119
|
+
t.string 'document_type'
|
120
|
+
t.binary 'title'
|
121
|
+
t.datetime 'created_at', precision: 6, null: false
|
122
|
+
t.datetime 'updated_at', precision: 6, null: false
|
123
|
+
t.index ['document_id'], name: 'index_bookmarks_on_document_id'
|
124
|
+
t.index ['user_id'], name: 'index_bookmarks_on_user_id'
|
125
|
+
end
|
126
|
+
|
127
|
+
create_table 'bulk_action_document_transitions', force: :cascade do |t|
|
128
|
+
t.string 'to_state', null: false
|
129
|
+
t.text 'metadata', default: '{}'
|
130
|
+
t.integer 'sort_key', null: false
|
131
|
+
t.integer 'bulk_action_document_id', null: false
|
132
|
+
t.boolean 'most_recent', null: false
|
133
|
+
t.datetime 'created_at', precision: 6, null: false
|
134
|
+
t.datetime 'updated_at', precision: 6, null: false
|
135
|
+
t.index %w[bulk_action_document_id most_recent],
|
136
|
+
name: 'index_bulk_action_document_transitions_parent_most_recent', unique: true, where: 'most_recent'
|
137
|
+
t.index %w[bulk_action_document_id sort_key], name: 'index_bulk_action_document_transitions_parent_sort',
|
138
|
+
unique: true
|
139
|
+
end
|
140
|
+
|
141
|
+
create_table 'bulk_action_documents', force: :cascade do |t|
|
142
|
+
t.string 'friendlier_id', null: false
|
143
|
+
t.integer 'version', null: false
|
144
|
+
t.bigint 'bulk_action_id', null: false
|
145
|
+
t.datetime 'created_at', precision: 6, null: false
|
146
|
+
t.datetime 'updated_at', precision: 6, null: false
|
147
|
+
t.uuid 'document_id'
|
148
|
+
t.index ['bulk_action_id'], name: 'index_bulk_action_documents_on_bulk_action_id'
|
149
|
+
end
|
150
|
+
|
151
|
+
create_table 'bulk_action_transitions', force: :cascade do |t|
|
152
|
+
t.string 'to_state', null: false
|
153
|
+
t.text 'metadata', default: '{}'
|
154
|
+
t.integer 'sort_key', null: false
|
155
|
+
t.integer 'bulk_action_id', null: false
|
156
|
+
t.boolean 'most_recent', null: false
|
157
|
+
t.datetime 'created_at', precision: 6, null: false
|
158
|
+
t.datetime 'updated_at', precision: 6, null: false
|
159
|
+
t.index %w[bulk_action_id most_recent], name: 'index_bulk_action_transitions_parent_most_recent',
|
160
|
+
unique: true, where: 'most_recent'
|
161
|
+
t.index %w[bulk_action_id sort_key], name: 'index_bulk_action_transitions_parent_sort', unique: true
|
162
|
+
end
|
163
|
+
|
164
|
+
create_table 'bulk_actions', force: :cascade do |t|
|
165
|
+
t.string 'name'
|
166
|
+
t.string 'request', null: false
|
167
|
+
t.string 'scope', null: false
|
168
|
+
t.string 'field_name', null: false
|
169
|
+
t.string 'field_value', null: false
|
170
|
+
t.text 'notes'
|
171
|
+
t.datetime 'created_at', precision: 6, null: false
|
172
|
+
t.datetime 'updated_at', precision: 6, null: false
|
173
|
+
end
|
174
|
+
|
175
|
+
create_table 'document_accesses', force: :cascade do |t|
|
176
|
+
t.string 'friendlier_id', null: false
|
177
|
+
t.string 'institution_code', null: false
|
178
|
+
t.text 'access_url', null: false
|
179
|
+
t.datetime 'created_at', precision: 6, null: false
|
180
|
+
t.datetime 'updated_at', precision: 6, null: false
|
181
|
+
end
|
182
|
+
|
183
|
+
create_table 'document_downloads', force: :cascade do |t|
|
184
|
+
t.string 'friendlier_id'
|
185
|
+
t.string 'label'
|
186
|
+
t.string 'value'
|
187
|
+
t.integer 'position'
|
188
|
+
t.datetime 'created_at', precision: 6, null: false
|
189
|
+
t.datetime 'updated_at', precision: 6, null: false
|
190
|
+
end
|
191
|
+
|
192
|
+
create_table 'document_transitions', force: :cascade do |t|
|
193
|
+
t.string 'to_state', null: false
|
194
|
+
t.text 'metadata', default: '{}'
|
195
|
+
t.integer 'sort_key', null: false
|
196
|
+
t.uuid 'kithe_model_id', null: false
|
197
|
+
t.boolean 'most_recent', null: false
|
198
|
+
t.datetime 'created_at', precision: 6, null: false
|
199
|
+
t.datetime 'updated_at', precision: 6, null: false
|
200
|
+
t.index %w[kithe_model_id most_recent], name: 'index_document_transitions_parent_most_recent', unique: true,
|
201
|
+
where: 'most_recent'
|
202
|
+
t.index %w[kithe_model_id sort_key], name: 'index_document_transitions_parent_sort', unique: true
|
203
|
+
end
|
204
|
+
|
205
|
+
create_table 'elements', force: :cascade do |t|
|
206
|
+
t.string 'label', null: false
|
207
|
+
t.string 'solr_field', null: false
|
208
|
+
t.string 'field_definition'
|
209
|
+
t.string 'field_type', null: false
|
210
|
+
t.boolean 'required', default: false, null: false
|
211
|
+
t.boolean 'repeatable', default: false, null: false
|
212
|
+
t.boolean 'formable', default: true, null: false
|
213
|
+
t.string 'placeholder_text'
|
214
|
+
t.string 'data_entry_hint'
|
215
|
+
t.string 'test_fixture_example'
|
216
|
+
t.string 'controlled_vocabulary'
|
217
|
+
t.string 'js_behaviors'
|
218
|
+
t.text 'html_attributes'
|
219
|
+
t.boolean 'display_only_on_persisted', default: false, null: false
|
220
|
+
t.boolean 'importable', default: true, null: false
|
221
|
+
t.boolean 'import_deliminated', default: false, null: false
|
222
|
+
t.string 'import_transformation_method'
|
223
|
+
t.boolean 'exportable', default: true, null: false
|
224
|
+
t.string 'export_transformation_method'
|
225
|
+
t.boolean 'indexable', default: true, null: false
|
226
|
+
t.string 'index_transformation_method'
|
227
|
+
t.string 'validation_method'
|
228
|
+
t.datetime 'created_at', precision: 6, null: false
|
229
|
+
t.datetime 'updated_at', precision: 6, null: false
|
230
|
+
t.integer 'position'
|
231
|
+
end
|
232
|
+
|
233
|
+
create_table 'form_elements', force: :cascade do |t|
|
234
|
+
t.string 'type', null: false
|
235
|
+
t.string 'label'
|
236
|
+
t.string 'element_solr_field'
|
237
|
+
t.integer 'position'
|
238
|
+
t.datetime 'created_at', precision: 6, null: false
|
239
|
+
t.datetime 'updated_at', precision: 6, null: false
|
240
|
+
end
|
241
|
+
|
242
|
+
create_table 'import_document_transitions', force: :cascade do |t|
|
243
|
+
t.string 'to_state', null: false
|
244
|
+
t.text 'metadata', default: '{}'
|
245
|
+
t.integer 'sort_key', null: false
|
246
|
+
t.integer 'import_document_id', null: false
|
247
|
+
t.boolean 'most_recent', null: false
|
248
|
+
t.datetime 'created_at', precision: 6, null: false
|
249
|
+
t.datetime 'updated_at', precision: 6, null: false
|
250
|
+
t.index %w[import_document_id most_recent], name: 'index_import_document_transitions_parent_most_recent',
|
251
|
+
unique: true, where: 'most_recent'
|
252
|
+
t.index %w[import_document_id sort_key], name: 'index_import_document_transitions_parent_sort', unique: true
|
253
|
+
end
|
254
|
+
|
255
|
+
create_table 'import_documents', force: :cascade do |t|
|
256
|
+
t.string 'friendlier_id', null: false
|
257
|
+
t.string 'title', null: false
|
258
|
+
t.json 'json_attributes', default: '{}'
|
259
|
+
t.bigint 'import_id', null: false
|
260
|
+
t.datetime 'created_at', precision: 6, null: false
|
261
|
+
t.datetime 'updated_at', precision: 6, null: false
|
262
|
+
t.index ['import_id'], name: 'index_import_documents_on_import_id'
|
263
|
+
end
|
264
|
+
|
265
|
+
create_table 'import_transitions', force: :cascade do |t|
|
266
|
+
t.string 'to_state', null: false
|
267
|
+
t.text 'metadata', default: '{}'
|
268
|
+
t.integer 'sort_key', null: false
|
269
|
+
t.integer 'import_id', null: false
|
270
|
+
t.boolean 'most_recent', null: false
|
271
|
+
t.datetime 'created_at', precision: 6, null: false
|
272
|
+
t.datetime 'updated_at', precision: 6, null: false
|
273
|
+
t.index %w[import_id most_recent], name: 'index_import_transitions_parent_most_recent', unique: true,
|
274
|
+
where: 'most_recent'
|
275
|
+
t.index %w[import_id sort_key], name: 'index_import_transitions_parent_sort', unique: true
|
276
|
+
end
|
277
|
+
|
278
|
+
create_table 'imports', force: :cascade do |t|
|
279
|
+
t.string 'name', null: false
|
280
|
+
t.string 'source'
|
281
|
+
t.text 'description'
|
282
|
+
t.string 'filename'
|
283
|
+
t.integer 'row_count'
|
284
|
+
t.text 'headers', default: [], array: true
|
285
|
+
t.string 'encoding'
|
286
|
+
t.string 'content_type'
|
287
|
+
t.string 'extension'
|
288
|
+
t.boolean 'validity', default: false, null: false
|
289
|
+
t.text 'validation_result'
|
290
|
+
t.datetime 'created_at', precision: 6, null: false
|
291
|
+
t.datetime 'updated_at', precision: 6, null: false
|
292
|
+
t.string 'type'
|
293
|
+
end
|
294
|
+
|
295
|
+
create_table 'kithe_derivatives', force: :cascade do |t|
|
296
|
+
t.string 'key', null: false
|
297
|
+
t.jsonb 'file_data'
|
298
|
+
t.uuid 'asset_id', null: false
|
299
|
+
t.datetime 'created_at', null: false
|
300
|
+
t.datetime 'updated_at', null: false
|
301
|
+
t.index %w[asset_id key], name: 'index_kithe_derivatives_on_asset_id_and_key', unique: true
|
302
|
+
t.index ['asset_id'], name: 'index_kithe_derivatives_on_asset_id'
|
303
|
+
end
|
304
|
+
|
305
|
+
create_table 'kithe_model_contains', id: false, force: :cascade do |t|
|
306
|
+
t.uuid 'containee_id'
|
307
|
+
t.uuid 'container_id'
|
308
|
+
t.index ['containee_id'], name: 'index_kithe_model_contains_on_containee_id'
|
309
|
+
t.index ['container_id'], name: 'index_kithe_model_contains_on_container_id'
|
310
|
+
end
|
311
|
+
|
312
|
+
create_table 'kithe_models', id: :uuid, default: -> { 'public.gen_random_uuid()' }, force: :cascade do |t|
|
313
|
+
t.string 'title', null: false
|
314
|
+
t.string 'type', null: false
|
315
|
+
t.integer 'position'
|
316
|
+
t.jsonb 'json_attributes'
|
317
|
+
t.datetime 'created_at', null: false
|
318
|
+
t.datetime 'updated_at', null: false
|
319
|
+
t.uuid 'parent_id'
|
320
|
+
t.string 'friendlier_id', default: lambda {
|
321
|
+
"kithe_models_friendlier_id_gen('2821109907456'::bigint, '101559956668415'::bigint)"
|
322
|
+
}, null: false
|
323
|
+
t.jsonb 'file_data'
|
324
|
+
t.uuid 'representative_id'
|
325
|
+
t.uuid 'leaf_representative_id'
|
326
|
+
t.integer 'kithe_model_type', null: false
|
327
|
+
t.bigint 'import_id'
|
328
|
+
t.string 'publication_state', default: 'draft'
|
329
|
+
t.index ['friendlier_id'], name: 'index_kithe_models_on_friendlier_id', unique: true
|
330
|
+
t.index ['import_id'], name: 'index_kithe_models_on_import_id'
|
331
|
+
t.index ['leaf_representative_id'], name: 'index_kithe_models_on_leaf_representative_id'
|
332
|
+
t.index ['parent_id'], name: 'index_kithe_models_on_parent_id'
|
333
|
+
t.index ['representative_id'], name: 'index_kithe_models_on_representative_id'
|
334
|
+
end
|
335
|
+
|
336
|
+
create_table 'mappings', force: :cascade do |t|
|
337
|
+
t.string 'source_header'
|
338
|
+
t.string 'destination_field'
|
339
|
+
t.boolean 'delimited'
|
340
|
+
t.string 'transformation_method'
|
341
|
+
t.bigint 'import_id', null: false
|
342
|
+
t.datetime 'created_at', precision: 6, null: false
|
343
|
+
t.datetime 'updated_at', precision: 6, null: false
|
344
|
+
t.index ['import_id'], name: 'index_mappings_on_import_id'
|
345
|
+
end
|
346
|
+
|
347
|
+
create_table 'notifications', force: :cascade do |t|
|
348
|
+
t.string 'recipient_type', null: false
|
349
|
+
t.bigint 'recipient_id', null: false
|
350
|
+
t.string 'type', null: false
|
351
|
+
t.jsonb 'params'
|
352
|
+
t.datetime 'read_at'
|
353
|
+
t.datetime 'created_at', precision: 6, null: false
|
354
|
+
t.datetime 'updated_at', precision: 6, null: false
|
355
|
+
t.index ['read_at'], name: 'index_notifications_on_read_at'
|
356
|
+
t.index %w[recipient_type recipient_id], name: 'index_notifications_on_recipient'
|
357
|
+
end
|
358
|
+
|
359
|
+
create_table 'users', force: :cascade do |t|
|
360
|
+
t.string 'email', default: '', null: false
|
361
|
+
t.string 'encrypted_password', default: '', null: false
|
362
|
+
t.string 'reset_password_token'
|
363
|
+
t.datetime 'reset_password_sent_at'
|
364
|
+
t.datetime 'remember_created_at'
|
365
|
+
t.datetime 'created_at', precision: 6, null: false
|
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
|
+
t.boolean 'admin', default: false, null: false
|
376
|
+
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
|
+
t.index ['reset_password_token'], name: 'index_users_on_reset_password_token', unique: true
|
382
|
+
end
|
383
|
+
|
384
|
+
create_table 'versions', force: :cascade do |t|
|
385
|
+
t.string 'item_type', null: false
|
386
|
+
t.uuid 'item_id', null: false
|
387
|
+
t.string 'event', null: false
|
388
|
+
t.string 'whodunnit'
|
389
|
+
t.text 'object'
|
390
|
+
t.datetime 'created_at'
|
391
|
+
t.text 'object_changes'
|
392
|
+
t.index %w[item_type item_id], name: 'index_versions_on_item_type_and_item_id'
|
393
|
+
end
|
394
|
+
|
395
|
+
add_foreign_key 'bulk_action_document_transitions', 'bulk_action_documents'
|
396
|
+
add_foreign_key 'bulk_action_documents', 'bulk_actions'
|
397
|
+
add_foreign_key 'bulk_action_transitions', 'bulk_actions'
|
398
|
+
add_foreign_key 'import_document_transitions', 'import_documents'
|
399
|
+
add_foreign_key 'import_documents', 'imports'
|
400
|
+
add_foreign_key 'import_transitions', 'imports'
|
401
|
+
add_foreign_key 'kithe_derivatives', 'kithe_models', column: 'asset_id'
|
402
|
+
add_foreign_key 'kithe_model_contains', 'kithe_models', column: 'containee_id'
|
403
|
+
add_foreign_key 'kithe_model_contains', 'kithe_models', column: 'container_id'
|
404
|
+
add_foreign_key 'kithe_models', 'kithe_models', column: 'leaf_representative_id'
|
405
|
+
add_foreign_key 'kithe_models', 'kithe_models', column: 'parent_id'
|
406
|
+
add_foreign_key 'kithe_models', 'kithe_models', column: 'representative_id'
|
407
|
+
add_foreign_key 'mappings', 'imports'
|
408
|
+
end
|
409
|
+
end
|
data/db/seeds.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
-
require "csv"
|
2
|
-
|
3
1
|
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'csv'
|
4
|
+
|
4
5
|
# This file should contain all the record creation needed to seed the database with its default values.
|
5
6
|
# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
|
6
7
|
#
|
@@ -10,17 +11,17 @@ require "csv"
|
|
10
11
|
# Character.create(name: 'Luke', movie: movies.first)
|
11
12
|
|
12
13
|
# Elements
|
13
|
-
CSV.foreach(File.expand_path(
|
14
|
+
CSV.foreach(File.expand_path('seeds_elements.csv', File.dirname(__FILE__)), headers: true) do |row|
|
14
15
|
hash = row.to_hash
|
15
16
|
# YES, I'm calling eval - It's hard to seed a serialized field via a CSV file
|
16
|
-
hash[
|
17
|
+
hash['html_attributes'] = eval(hash['html_attributes']) if hash['html_attributes'].present?
|
17
18
|
Element.create!(hash)
|
18
19
|
end
|
19
20
|
|
20
21
|
# FormElements
|
21
|
-
CSV.foreach(File.expand_path(
|
22
|
+
CSV.foreach(File.expand_path('seeds_form_elements.csv', File.dirname(__FILE__)), headers: true) do |row|
|
22
23
|
FormElement.create!(row.to_hash)
|
23
24
|
end
|
24
25
|
|
25
26
|
# Users
|
26
|
-
User.create(email:
|
27
|
+
User.create(email: 'admin@geoblacklight.org', password: '123456', password_confirmation: '123456', admin: true)
|