Skip to content

Commit 8d61007

Browse files
committed
Merge branch 'master' into faster-user-curation-page
2 parents 2765ae8 + 97589bd commit 8d61007

88 files changed

Lines changed: 1871 additions & 447 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: Database migration tests
2+
on:
3+
push:
4+
paths:
5+
- 'db/migrate/**'
6+
pull_request:
7+
paths:
8+
- 'db/migrate/**'
9+
10+
jobs:
11+
migrate:
12+
runs-on: ubuntu-latest
13+
env:
14+
DB_HOST: localhost
15+
DB_NAME: tess
16+
DB_USER: tess
17+
DB_PASSWORD: password
18+
SECRET_BASE_KEY: test_key
19+
RAILS_ENV: test
20+
REDIS_TEST_URL: redis://localhost:6379/0
21+
PREV_SHA: ${{ github.event.pull_request.base.sha || github.event.before }}
22+
23+
services:
24+
postgres:
25+
image: postgres
26+
env:
27+
POSTGRES_DB: ${{ env.DB_NAME }}
28+
POSTGRES_USER: ${{ env.DB_USER }}
29+
POSTGRES_PASSWORD: ${{ env.DB_PASSWORD }}
30+
ports:
31+
- 5432:5432
32+
options: >-
33+
--health-cmd "pg_isready"
34+
--health-interval 10s
35+
--health-timeout 5s
36+
--health-retries 5
37+
redis:
38+
image: redis
39+
options: >-
40+
--health-cmd "redis-cli ping"
41+
--health-interval 10s
42+
--health-timeout 5s
43+
--health-retries 5
44+
ports:
45+
- 6379:6379
46+
steps:
47+
- name: Install system dependencies
48+
run: |
49+
sudo apt-get update
50+
sudo apt-get install imagemagick
51+
- name: Check out code
52+
uses: actions/checkout@v4
53+
- name: Install Ruby & gems
54+
uses: ruby/setup-ruby@v1
55+
with:
56+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
57+
- name: Configure
58+
run: |
59+
cp test/config/test_tess.yml config/tess.yml
60+
cp config/secrets.github.yml config/secrets.yml
61+
cp config/ingestion.example.yml config/ingestion.yml
62+
- name: Checkout previous schema
63+
# Checks out previous schema.rb and temporarily renames migrations
64+
if: env.PREV_SHA != '0000000000000000000000000000000000000000'
65+
run: |
66+
git fetch origin ${{ env.PREV_SHA }}
67+
git checkout ${{ env.PREV_SHA }} -- db/schema.rb
68+
mv db/migrate db/migrate.bkp
69+
git checkout ${{ env.PREV_SHA }} -- db/migrate
70+
- name: Load previous database schema
71+
run: bundle exec rake db:test:prepare
72+
- name: Restore migrations
73+
# Restore the renamed migrations
74+
if: env.PREV_SHA != '0000000000000000000000000000000000000000'
75+
run: |
76+
rm -rf db/migrate
77+
mv db/migrate.bkp db/migrate
78+
- name: Set up Node
79+
uses: actions/setup-node@v4
80+
with:
81+
node-version: '20.x'
82+
cache: 'yarn'
83+
- name: Install JS dependencies
84+
run: yarn install --frozen-lockfile --non-interactive
85+
- name: Run migrations
86+
run: bundle exec rails db:migrate

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ config/secrets.yml
1515
config/sunspot.yml
1616
config/tess.yml
1717
config/ingestion.yml
18+
config/initializers/local_hosts.rb
1819
tmp/
1920
solr/test/
2021
solr/pids/

Gemfile.lock

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
GIT
22
remote: https://github.com/ElixirTeSS/TeSS_RDF_Extractors
3-
revision: f9eee4621738c8fcaa9e0729e76a307fcd55650f
3+
revision: 135ce24ef909bf5f7c6e14ccb1e404b51478ab07
44
branch: master
55
specs:
6-
tess_rdf_extractors (1.1.0)
6+
tess_rdf_extractors (1.2.0)
77
linkeddata (~> 3.2.0)
88

99
GEM
@@ -97,8 +97,8 @@ GEM
9797
minitest (>= 5.1)
9898
securerandom (>= 0.3)
9999
tzinfo (~> 2.0, >= 2.0.5)
100-
addressable (2.8.7)
101-
public_suffix (>= 2.0.2, < 7.0)
100+
addressable (2.8.9)
101+
public_suffix (>= 2.0.2, < 8.0)
102102
aes_key_wrap (1.1.0)
103103
ahoy_matey (4.2.1)
104104
activesupport (>= 5.2)
@@ -113,13 +113,13 @@ GEM
113113
execjs (~> 2)
114114
base64 (0.1.2)
115115
bcp47_spec (0.2.1)
116-
bcrypt (3.1.20)
116+
bcrypt (3.1.22)
117117
benchmark (0.4.1)
118118
better_errors (2.10.1)
119119
erubi (>= 1.0.0)
120120
rack (>= 0.9.0)
121121
rouge (>= 1.0.0)
122-
bigdecimal (3.2.3)
122+
bigdecimal (3.3.1)
123123
bindata (2.5.0)
124124
bindex (0.8.1)
125125
binding_of_caller (1.0.0)
@@ -147,8 +147,8 @@ GEM
147147
json_schema (~> 0.14, >= 0.14.3)
148148
openapi_parser (~> 1.0)
149149
rack (>= 1.5)
150-
concurrent-ruby (1.3.5)
151-
connection_pool (2.5.4)
150+
concurrent-ruby (1.3.6)
151+
connection_pool (3.0.2)
152152
countries (5.6.0)
153153
unaccent (~> 0.3)
154154
country_select (8.0.2)
@@ -157,7 +157,7 @@ GEM
157157
rexml
158158
crass (1.0.6)
159159
csv (3.3.2)
160-
date (3.4.1)
160+
date (3.5.1)
161161
debug_inspector (1.1.0)
162162
device_detector (1.1.1)
163163
devise (4.9.4)
@@ -206,7 +206,7 @@ GEM
206206
globalid (1.2.1)
207207
activesupport (>= 6.1)
208208
gravtastic (3.2.6)
209-
haml (6.3.0)
209+
haml (6.4.0)
210210
temple (>= 0.8.2)
211211
thor
212212
tilt
@@ -218,7 +218,7 @@ GEM
218218
tilt (>= 1.2)
219219
hashdiff (1.0.1)
220220
hashie (5.0.0)
221-
htmlentities (4.3.4)
221+
htmlentities (4.4.2)
222222
http-accept (1.7.0)
223223
http-cookie (1.0.5)
224224
domain_name (~> 0.5)
@@ -233,7 +233,7 @@ GEM
233233
icalendar (2.9.0)
234234
ice_cube (~> 0.16)
235235
ice_cube (0.16.4)
236-
io-console (0.8.1)
236+
io-console (0.8.2)
237237
irb (1.15.2)
238238
pp (>= 0.6.0)
239239
rdoc (>= 4.0.0)
@@ -252,7 +252,7 @@ GEM
252252
jquery-turbolinks (2.1.0)
253253
railties (>= 3.1.0)
254254
turbolinks
255-
json (2.18.1)
255+
json (2.19.2)
256256
json-canonicalization (1.0.0)
257257
json-jwt (1.16.6)
258258
activesupport (>= 4.2)
@@ -365,15 +365,15 @@ GEM
365365
money (~> 6.13)
366366
railties (>= 3.0)
367367
msgpack (1.7.2)
368-
multi_json (1.17.0)
368+
multi_json (1.19.1)
369369
multi_xml (0.8.0)
370370
bigdecimal (>= 3.1, < 5)
371371
multipart-post (2.4.1)
372372
nested_form (0.3.2)
373373
net-http (0.9.1)
374374
uri (>= 0.11.1)
375-
net-http-persistent (4.0.6)
376-
connection_pool (~> 2.2, >= 2.2.4)
375+
net-http-persistent (4.0.8)
376+
connection_pool (>= 2.2.4, < 4)
377377
net-imap (0.5.8)
378378
date
379379
net-protocol
@@ -436,15 +436,15 @@ GEM
436436
pry-byebug (3.10.1)
437437
byebug (~> 11.0)
438438
pry (>= 0.13, < 0.15)
439-
psych (5.2.6)
439+
psych (5.3.1)
440440
date
441441
stringio
442442
public_activity (3.0.1)
443443
actionpack (>= 6.1.0)
444444
activerecord (>= 6.1)
445445
i18n (>= 0.5.0)
446446
railties (>= 6.1.0)
447-
public_suffix (6.0.2)
447+
public_suffix (7.0.5)
448448
puma (6.5.0)
449449
nio4r (~> 2.0)
450450
pundit (2.3.1)
@@ -599,7 +599,7 @@ GEM
599599
redis-client (0.16.0)
600600
connection_pool
601601
regexp_parser (2.8.1)
602-
reline (0.6.2)
602+
reline (0.6.3)
603603
io-console (~> 0.5)
604604
responders (3.1.1)
605605
actionpack (>= 5.2)
@@ -611,7 +611,7 @@ GEM
611611
netrc (~> 0.8)
612612
reverse_markdown (2.1.1)
613613
nokogiri
614-
rexml (3.4.2)
614+
rexml (3.4.4)
615615
rouge (4.1.3)
616616
rsolr (2.6.0)
617617
builder (>= 2.1.2)
@@ -729,7 +729,7 @@ GEM
729729
actionpack (>= 5.2)
730730
activesupport (>= 5.2)
731731
sprockets (>= 3.0.0)
732-
stringio (3.1.7)
732+
stringio (3.2.0)
733733
sunspot (2.7.1)
734734
bigdecimal
735735
pr_geohash (~> 1.0)
@@ -750,8 +750,8 @@ GEM
750750
climate_control (>= 0.0.3, < 1.0)
751751
terser (1.1.17)
752752
execjs (>= 0.3.0, < 3)
753-
thor (1.4.0)
754-
tilt (2.6.1)
753+
thor (1.5.0)
754+
tilt (2.7.0)
755755
timeout (0.4.3)
756756
tsort (0.2.0)
757757
turbo-rails (2.0.11)
@@ -771,7 +771,7 @@ GEM
771771
unf_ext
772772
unf_ext (0.0.8.2)
773773
unicode-display_width (2.4.2)
774-
unicode-types (1.10.0)
774+
unicode-types (1.11.0)
775775
uri (1.1.1)
776776
useragent (0.16.11)
777777
validate_email (0.1.6)

app/assets/javascripts/application.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,8 @@ document.addEventListener("turbolinks:load", function(e) {
279279

280280
LearningPaths.init();
281281

282+
People.init();
283+
282284
$('.tess-expandable').each(function () {
283285
if (this.dataset.origHeight) {
284286
return;

app/assets/javascripts/people.js

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
const People = {
2+
add: function (template, list) {
3+
let newForm = template.clone().html();
4+
// Ensure the index of the new form is 1 greater than the current highest index, to prevent collisions
5+
let index = 0;
6+
$('.person-form', list).each(function () {
7+
var newIndex = parseInt($(this).data('index'));
8+
if (newIndex > index) {
9+
index = newIndex;
10+
}
11+
});
12+
13+
// Replace the placeholder index with the actual index
14+
newForm = $(newForm.replace(/replace-me/g, index + 1));
15+
newForm.appendTo(list);
16+
const nameInput = newForm.find('.person-name');
17+
const orcidInput = newForm.find('.person-orcid');
18+
const opts = {
19+
orientation: 'top',
20+
triggerSelectOnValidInput: false,
21+
onSelect: function (suggestion) {
22+
orcidInput.val(suggestion.data.orcid);
23+
},
24+
transformResult: function(response) {
25+
return {
26+
suggestions: $.map(response.suggestions, function(item) {
27+
item.data.hint = item.data.orcid;
28+
return item;
29+
})
30+
};
31+
},
32+
formatResult: Autocompleters.formatResultWithHint
33+
}
34+
35+
opts.serviceUrl = list.parents('[data-role="people-form"]').data('autocompleteUrl');
36+
opts.dataType = 'json';
37+
opts.deferRequestBy = 100;
38+
39+
nameInput.autocomplete(opts);
40+
41+
return newForm;
42+
},
43+
44+
delete: function () {
45+
$(this).parents('.person-form').fadeOut('fast', function() {
46+
$(this).remove();
47+
});
48+
},
49+
50+
init: function () {
51+
$('[data-role="people-form"]').each(function () {
52+
const form = $(this);
53+
const template = form.find('[data-role="people-form-template"]');
54+
const list = form.find('[data-role="people-form-list"]');
55+
56+
form.find('[data-role="people-form-add"]').click(function (e) {
57+
e.preventDefault();
58+
const nextItem = People.add(template, list);
59+
nextItem.find('input.form-control:first').focus();
60+
});
61+
62+
// Add new person if enter is pressed on final person, otherwise focus the next person in the list.
63+
$(form).on('keyup', 'input', function (e) {
64+
if (e.which === 13) {
65+
e.preventDefault();
66+
let nextItem = $(e.target).parents('.person-form').next('.person-form');
67+
if (!nextItem.length) {
68+
nextItem = People.add(template, list);
69+
}
70+
nextItem.find('input.form-control:first').focus();
71+
}
72+
});
73+
});
74+
75+
$('.delete-person-btn input.destroy-attribute').change(People.delete);
76+
}
77+
};

app/assets/stylesheets/application.scss

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -808,6 +808,11 @@ input[type=checkbox].field-lock + label:before,
808808
margin: 15px;
809809
}
810810

811+
.masonry-brick .space-logo {
812+
padding: .5em;
813+
border-radius: 4px;
814+
}
815+
811816
.list-card {
812817
@include floating-card;
813818
border-radius: 8px;
@@ -1111,3 +1116,7 @@ td.day .calendar-text {
11111116
display: flex;
11121117
justify-content: center;
11131118
}
1119+
1120+
.tag-topic, .tag-operation {
1121+
text-decoration: none;
1122+
}

app/assets/stylesheets/external-resources.scss

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,3 @@
1-
.external-resource-form {
2-
padding-bottom: 10px;
3-
margin-bottom: 10px;
4-
5-
&.deleted {
6-
color: $brand-danger;
7-
text-decoration: line-through;
8-
}
9-
}
10-
111
.associate-resource {
122
cursor: pointer;
133
}

0 commit comments

Comments
 (0)