Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #1314

Closed
wants to merge 109 commits into from
Closed

Dev #1314

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
109 commits
Select commit Hold shift + click to select a range
bb385ae
Cypress: added tests for issue #1227
verheyenkoen Sep 22, 2023
38ca7af
Merge branch 'dev' into issue-1227
verheyenkoen Sep 22, 2023
60b198a
Merge branch 'dev' into issue-1227
verheyenkoen Sep 25, 2023
ebd5505
more boilerplate
nics Oct 9, 2023
f5d0093
port layout to templ
nics Oct 10, 2023
8be412d
new home page skeleton
nics Oct 10, 2023
ddfbf27
remove old home handler
nics Oct 10, 2023
7a48dcd
rename
nics Oct 10, 2023
dbc360a
lazy load action required card
nics Oct 10, 2023
07a67f5
action required card title
nics Oct 10, 2023
b293d36
drafts to complete card
nics Oct 10, 2023
190bb87
show drafts to complete task
nics Oct 10, 2023
44540ab
add url
nics Oct 10, 2023
13526bf
finish drafts to complete;action required boilerplate
nics Oct 11, 2023
84cbb70
give each handler own file
nics Oct 11, 2023
bdcd5d2
recent activity boilerplate
nics Oct 11, 2023
0e21f8f
Adapt action required page to show withdrawn publications and datasets
mietcls Oct 12, 2023
9d6345a
Fix copy
mietcls Oct 12, 2023
7664e0c
fix action required filters
nics Oct 12, 2023
89f1fe5
home recent activity component
nics Oct 12, 2023
e277b48
remove deletes from recent activity
nics Oct 12, 2023
b19306d
add message activity
nics Oct 12, 2023
bb008bd
Merge branch 'dev' of github.com:ugent-library/biblio-backoffice into…
mietcls Oct 12, 2023
ba6db57
Merge branch 'feature/ctx-templ' of github.com:ugent-library/biblio-b…
mietcls Oct 12, 2023
4595e58
use templ children directive;add error handlers
nics Oct 13, 2023
6b1061f
Merge branch 'feature/ctx-templ' of github.com:ugent-library/biblio-b…
nics Oct 13, 2023
b53b7da
use new style not found handler
nics Oct 13, 2023
9efc279
bump required version of templ
nics Oct 16, 2023
f41885e
fix issue 914, part 1
nicolasfranck Oct 16, 2023
80391a2
Merge branch 'dev' into fix_issue_914
nicolasfranck Oct 16, 2023
d3f0899
add sample overlay
nicolasfranck Oct 16, 2023
44cb325
Merge branch 'feature/ctx-templ' into dev
nics Oct 17, 2023
4dd505f
Cypress: added closeModal command
verheyenkoen Oct 17, 2023
4397af6
map everything mods 3.6 we can at the moment
nics Oct 17, 2023
5e2587b
Merge branch 'dev' of github.com:ugent-library/biblio-backoffice into…
nics Oct 17, 2023
1a3c6d7
Merge branch 'main' into dev
nicolasfranck Oct 17, 2023
4593799
Merge branch 'main' into dev
nics Oct 17, 2023
eb3b0aa
add missing fields for frontoffice record
nicolasfranck Oct 18, 2023
e000774
Merge pull request #1268 from ugent-library/frontoffice_add_project_eu
nics Oct 18, 2023
9efa534
Add css for spinner and compile assets
mietcls Oct 18, 2023
3c54367
Add spinner card backdrop and spinner on card level
mietcls Oct 18, 2023
26b73cc
Remove superfluous comment
mietcls Oct 18, 2023
a1e6b9b
Cypress: tests for issue #1247 (implemented on other branch feature/f…
verheyenkoen Oct 18, 2023
9fe0b78
Merge branch 'main' into dev
nics Oct 18, 2023
a3df1b9
Merge pull request #1269 from ugent-library/fix_issue_1247
nics Oct 18, 2023
dfc17ad
Cypress: added search command
verheyenkoen Oct 18, 2023
cf4ef93
handle home page logged out state (see #1264)
nics Oct 18, 2023
cebfe3d
Merge branch 'dev' of github.com:ugent-library/biblio-backoffice into…
nics Oct 18, 2023
20964e7
Merge branch 'dev' into issue-1227
verheyenkoen Oct 18, 2023
c75a259
Cypress: improvements for issue #1227 tests, implementing recently ad…
verheyenkoen Oct 18, 2023
7336c62
Start creating logged-out landing page
mietcls Oct 18, 2023
8f41ea2
resolve conflicts
nics Oct 19, 2023
6c62a4e
Merge pull request #1270 from ugent-library/issue-1227
nics Oct 19, 2023
9ff9c43
resolve merge conflicts
nics Oct 19, 2023
a8e4b21
Merge branch 'dev' of github.com:ugent-library/biblio-backoffice into…
mietcls Oct 19, 2023
ccebe2c
merge
nics Oct 19, 2023
ddeba82
Align copy and links
mietcls Oct 19, 2023
8cda2a7
Merge branch 'dev' of github.com:ugent-library/biblio-backoffice into…
mietcls Oct 19, 2023
859a1ac
Fix indentation
mietcls Oct 19, 2023
461cd37
fix filter for list A publication years
nicolasfranck Oct 19, 2023
bf82174
no hits needed when fetching facets
nicolasfranck Oct 19, 2023
953f29d
Updat templ
mietcls Oct 19, 2023
ee587cf
Merge pull request #1274 from ugent-library/feature/logged-out-landin…
nics Oct 19, 2023
5733d9c
Cypress: adapted home tests for new anonymous home page
verheyenkoen Oct 19, 2023
d60d00c
Merge branch 'main' of github.com:ugent-library/biblio-backoffice int…
mietcls Oct 19, 2023
e3dd6cb
Make untitled records clickable and remove view all link
mietcls Oct 20, 2023
964502c
Create more legible sentences
mietcls Oct 20, 2023
98e070b
Make it clear when you yourself have edited a record
mietcls Oct 20, 2023
7ae68c6
Merge pull request #1283 from ugent-library/feature/recent-activity-u…
nics Oct 20, 2023
6dbc9ed
fix merge conflict
nicolasfranck Oct 23, 2023
1d1c0ce
Merge pull request #1261 from ugent-library/fix_issue_914
nics Oct 23, 2023
f21d5ca
Merge branch 'main' into dev
nics Oct 23, 2023
dcb67e4
Merge branch 'main' into dev
nics Oct 25, 2023
475971d
add ecoom and jcr data to mods encoder
nics Oct 25, 2023
3c74399
OpenAire 2.0 compliance
nics Oct 25, 2023
166a0fa
Changed: automating db migrations via docker/nomad
netsensei Oct 27, 2023
3c5e339
Refine copy for blank states for actions and activity
mietcls Nov 6, 2023
2ade5c7
Make activity blank state more subtle
mietcls Nov 6, 2023
49d4a42
use PathValue helper
nics Nov 6, 2023
9628ce1
remove builtin bind package
nics Nov 6, 2023
4fb4ede
Merge branch 'main' into dev
nics Nov 6, 2023
2455033
always show locked facet (resolves #1302); action required only shows…
nics Nov 7, 2023
bf9ad2b
set dashboard as landing page when logged in (resolves #1193);fix cur…
nics Nov 7, 2023
f313693
bump templ version
nics Nov 8, 2023
fa83e33
show pending tasks notification (resolves #1224)
nics Nov 8, 2023
fe850e8
show pending tasks notification (resolves #1224)
nics Nov 8, 2023
5bf55b0
Upgraded cypress
verheyenkoen Nov 9, 2023
ac1b4c4
set active nav in middleware
nics Nov 9, 2023
4fd0469
Cypress: improved test for issue #1140
verheyenkoen Nov 9, 2023
8923ca8
Upgraded Typescript version
verheyenkoen Nov 9, 2023
85604bc
Upgraded Typescript version (2)
verheyenkoen Nov 9, 2023
62b6cc0
Cypress: fixed sidebar menu item tests
verheyenkoen Nov 9, 2023
871a0fe
Merge branch 'dev' of github.com:ugent-library/biblio-backoffice into…
mietcls Nov 9, 2023
38d9c08
Merge branch 'main' into dev
nics Nov 9, 2023
1043b26
also apply #1305 to templ layout
nics Nov 9, 2023
a6b90c5
fix #1306
nics Nov 9, 2023
fabed64
Add temporary blank state to make use of white space
mietcls Nov 9, 2023
e110ad6
Aligned letter casing for 'Conference details' title and 'Add link' b…
verheyenkoen Nov 9, 2023
55ccaf0
Merge pull request #1307 from ugent-library/hotfix/small-typos
nics Nov 9, 2023
6791061
show pending tasks notification in old layout
nics Nov 9, 2023
cdb8aee
fix sidebar color switch (replaces pr #1308)
nics Nov 9, 2023
7cf75ae
fix sidebar color switch (replaces pr #1308)
nics Nov 9, 2023
262a205
Cypress: Added test for return from impersonation button bug #1309
verheyenkoen Nov 14, 2023
a807854
Merge branch '1309-cannot-return-to-profile-after-using-view-as' into…
nics Nov 14, 2023
b8064c7
fix csrf token field name config (resolves #1309)
nics Nov 14, 2023
ebd781e
Cypress: fixed some tests after textual changes
verheyenkoen Nov 14, 2023
570a280
Merge pull request #1300 from ugent-library/feature/dashboard-blankst…
nics Nov 14, 2023
4d2184e
Merge branch 'main' into dev
nics Nov 15, 2023
2355d6f
Cypress: updated workflow cypress-tests.yml
verheyenkoen Nov 15, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/cypress-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ jobs:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
CYPRESS_RESEARCHER_USER_NAME: ${{ secrets.CYPRESS_RESEARCHER_USER_NAME }}
CYPRESS_RESEARCHER_USER_PASSWORD: ${{ secrets.CYPRESS_RESEARCHER_USER_PASSWORD }}
CYPRESS_RESEARCHER_NAME: ${{ vars.CYPRESS_RESEARCHER_NAME }}
CYPRESS_LIBRARIAN_USER_NAME: ${{ secrets.CYPRESS_LIBRARIAN_USER_NAME }}
CYPRESS_LIBRARIAN_USER_PASSWORD: ${{ secrets.CYPRESS_LIBRARIAN_USER_PASSWORD }}
CYPRESS_LIBRARIAN_NAME: ${{ vars.CYPRESS_LIBRARIAN_NAME }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"Arxiv",
"biblio",
"Biblio",
"bibtex",
"briefcase",
"CYPRESSTEST",
"eisbn",
Expand All @@ -17,6 +18,8 @@
"liblogin",
"Moreels",
"pubmed",
"socs",
"tagify"
]
],
"typescript.tsdk": "node_modules/typescript/lib"
}
26 changes: 26 additions & 0 deletions assets/ugent/scss/components/_c-spinner-card-backdrop.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/* ==========================================================================
Additions to bootstrap/spinner – backdrop
To disable backgrounds for cards
========================================================================== */

$spinner-backdrop-bg: $gray-25;
$spinner-backdrop-opacity: .8;

.spinner-card-backdrop {
position: absolute;
z-index: 1050;
background-color: $spinner-backdrop-bg;
opacity: $spinner-backdrop-opacity;
left: 0;
right: 0;
top: 0;
bottom: 0;
text-align: center;
align-items: center;
justify-content: center;
display: none;
}

.spinner-card-backdrop.htmx-request {
display: flex;
}
3 changes: 2 additions & 1 deletion assets/ugent/scss/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,9 @@ $theme-colors: map-merge($theme-colors, $custom-theme-colors);
@import "components/c-radio-card";
@import "components/c-requested-change";
@import "components/c-sidebar";
@import "components/c-stepper";
@import "components/c-side-panel";
@import "components/c-spinner-card-backdrop";
@import "components/c-stepper";
@import "components/c-sub-sidebar";
@import "components/c-tagify";
@import "components/c-thumbnail";
Expand Down
68 changes: 41 additions & 27 deletions backends/authority/person.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"go.mongodb.org/mongo-driver/mongo"

"github.com/ugent-library/biblio-backoffice/models"
"github.com/ugent-library/biblio-backoffice/util"
)

func (c *Client) GetPerson(id string) (*models.Person, error) {
Expand Down Expand Up @@ -96,27 +95,42 @@ func (c *Client) SuggestPeople(q string) ([]*models.Person, error) {
}

func (c *Client) recordToPerson(record bson.M) (*models.Person, error) {
var person *models.Person = &models.Person{}
person := &models.Person{}

if v, e := record["_id"]; e {
// _id might be stored as number, float or even "null"
person.ID = util.ParseString(v)
if v, ok := record["_id"]; ok {
person.ID = v.(string)
}
if v, e := record["active"]; e {
person.Active = util.ParseBoolean(v)
if v, ok := record["email"]; ok {
person.Email = strings.ToLower(v.(string))
}
if v, e := record["orcid_id"]; e {
// orcid might be stored as "null"
person.ORCID = util.ParseString(v)
if v, ok := record["ugent_username"]; ok {
person.Username = v.(string)
}
if v, e := record["ugent_id"]; e {
if v, ok := record["active"]; ok {
person.Active = v.(int32) == 1
}
if v, ok := record["orcid_token"]; ok {
person.ORCIDToken = v.(string)
}
if v, ok := record["orcid_id"]; ok {
person.ORCID = v.(string)
}
if v, ok := record["ugent_id"]; ok {
for _, i := range v.(bson.A) {
person.UGentID = append(person.UGentID, util.ParseString(i))
person.UGentID = append(person.UGentID, i.(string))
}
}
if v, ok := record["roles"]; ok {
for _, r := range v.(bson.A) {
if r.(string) == "biblio-admin" {
person.Role = "admin"
break
}
}
}
if v, e := record["ugent_department_id"]; e {
if v, ok := record["ugent_department_id"]; ok {
for _, i := range v.(bson.A) {
person.Affiliations = append(person.Affiliations, &models.Affiliation{OrganizationID: util.ParseString(i)})
person.Affiliations = append(person.Affiliations, &models.Affiliation{OrganizationID: i.(string)})
}
}
if v, e := record["object_class"]; e {
Expand All @@ -131,19 +145,19 @@ func (c *Client) recordToPerson(record bson.M) (*models.Person, error) {
person.Affiliations = append(person.Affiliations, &models.Affiliation{OrganizationID: "UZGent"})
}
}
if v, e := record["preferred_first_name"]; e {
person.FirstName = util.ParseString(v)
} else if v, e := record["first_name"]; e {
person.FirstName = util.ParseString(v)
if v, ok := record["preferred_first_name"]; ok {
person.FirstName = v.(string)
} else if v, ok := record["first_name"]; ok {
person.FirstName = v.(string)
}
if v, e := record["preferred_last_name"]; e {
person.LastName = util.ParseString(v)
} else if v, e := record["last_name"]; e {
person.LastName = util.ParseString(v)
if v, ok := record["preferred_last_name"]; ok {
person.LastName = v.(string)
} else if v, ok := record["last_name"]; ok {
person.LastName = v.(string)
}

// TODO: cleanup when authority database is synchronized with full_name
if v, e := record["full_name"]; e {
if v, ok := record["full_name"]; ok {
person.FullName = v.(string)
}
if person.FullName == "" {
Expand All @@ -156,12 +170,12 @@ func (c *Client) recordToPerson(record bson.M) (*models.Person, error) {
}
}

if v, e := record["date_created"]; e {
t, _ := time.Parse(time.RFC3339, util.ParseString(v))
if v, ok := record["date_created"]; ok {
t, _ := time.Parse(time.RFC3339, v.(string))
person.DateCreated = &t
}
if v, e := record["date_updated"]; e {
t, _ := time.Parse(time.RFC3339, util.ParseString(v))
if v, ok := record["date_updated"]; ok {
t, _ := time.Parse(time.RFC3339, v.(string))
person.DateUpdated = &t
}

Expand Down
85 changes: 4 additions & 81 deletions backends/authority/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"fmt"
"strings"
"time"

"github.com/pkg/errors"
"go.mongodb.org/mongo-driver/bson"
Expand All @@ -13,7 +12,7 @@ import (
"github.com/ugent-library/biblio-backoffice/models"
)

func (c *Client) GetUser(id string) (*models.User, error) {
func (c *Client) GetUser(id string) (*models.Person, error) {
var record bson.M
err := c.mongo.Database("authority").Collection("person").FindOne(
context.Background(),
Expand All @@ -24,10 +23,10 @@ func (c *Client) GetUser(id string) (*models.User, error) {
if err != nil {
return nil, errors.Wrap(err, "unexpected error during document retrieval")
}
return c.recordToUser(record)
return c.recordToPerson(record)
}

func (c *Client) GetUserByUsername(username string) (*models.User, error) {
func (c *Client) GetUserByUsername(username string) (*models.Person, error) {
var record bson.M
err := c.mongo.Database("authority").Collection("person").FindOne(
context.Background(),
Expand All @@ -38,7 +37,7 @@ func (c *Client) GetUserByUsername(username string) (*models.User, error) {
if err != nil {
return nil, errors.Wrap(err, "unexpected error during document retrieval")
}
return c.recordToUser(record)
return c.recordToPerson(record)
}

func (c *Client) SuggestUsers(q string) ([]*models.Person, error) {
Expand Down Expand Up @@ -96,79 +95,3 @@ func (c *Client) SuggestUsers(q string) ([]*models.Person, error) {

return persons, nil
}

func (c *Client) recordToUser(record bson.M) (*models.User, error) {
user := &models.User{}

if v, ok := record["_id"]; ok {
user.ID = v.(string)
}
if v, ok := record["email"]; ok {
user.Email = strings.ToLower(v.(string))
}
if v, ok := record["ugent_username"]; ok {
user.Username = v.(string)
}
if v, ok := record["active"]; ok {
user.Active = v.(int32) == 1
}
if v, ok := record["orcid_token"]; ok {
user.ORCIDToken = v.(string)
}
if v, ok := record["orcid_id"]; ok {
user.ORCID = v.(string)
}
if v, ok := record["ugent_id"]; ok {
for _, i := range v.(bson.A) {
user.UGentID = append(user.UGentID, i.(string))
}
}
if v, ok := record["roles"]; ok {
for _, r := range v.(bson.A) {
if r.(string) == "biblio-admin" {
user.Role = "admin"
break
}
}
}
if v, ok := record["ugent_department_id"]; ok {
for _, i := range v.(bson.A) {
user.Affiliations = append(user.Affiliations, &models.Affiliation{OrganizationID: i.(string)})
}
}
if v, ok := record["preferred_first_name"]; ok {
user.FirstName = v.(string)
} else if v, ok := record["first_name"]; ok {
user.FirstName = v.(string)
}
if v, ok := record["preferred_last_name"]; ok {
user.LastName = v.(string)
} else if v, ok := record["last_name"]; ok {
user.LastName = v.(string)
}

// TODO: cleanup when authority database is synchronized with full_name
if v, ok := record["full_name"]; ok {
user.FullName = v.(string)
}
if user.FullName == "" {
if user.FirstName != "" && user.LastName != "" {
user.FullName = user.FirstName + " " + user.LastName
} else if user.LastName != "" {
user.FullName = user.LastName
} else if user.FirstName != "" {
user.FullName = user.FirstName
}
}

if v, ok := record["date_created"]; ok {
t, _ := time.Parse(time.RFC3339, v.(string))
user.DateCreated = &t
}
if v, ok := record["date_updated"]; ok {
t, _ := time.Parse(time.RFC3339, v.(string))
user.DateUpdated = &t
}

return user, nil
}
3 changes: 2 additions & 1 deletion backends/ecoom/ecoom.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"strings"

"github.com/ugent-library/biblio-backoffice/helpers"
"github.com/ugent-library/biblio-backoffice/models"
"github.com/ugent-library/biblio-backoffice/util"
"go.mongodb.org/mongo-driver/bson"
Expand Down Expand Up @@ -73,7 +74,7 @@ func NewPublicationFixer(c *mongo.Client) func(context.Context, *models.Publicat
newFields.Add(fmt.Sprintf("ecoom-%s-%s", fund, "css"), util.ParseString(v))
}
if v, ok := fundRecords[0]["internationale_samenwerking"]; ok {
newFields.Add(fmt.Sprintf("ecoom-%s-%s", fund, "international-collaboration"), util.ParseString(v))
newFields.Add(fmt.Sprintf("ecoom-%s-%s", fund, "international-collaboration"), helpers.FormatBool(util.ParseBoolean(v), "true", "false"))
}
if v, ok := fundRecords[0]["hoger_onderwijs"]; ok && util.ParseBoolean(v) {
newFields.Add(fmt.Sprintf("ecoom-%s-%s", fund, "sector"), "higher-education")
Expand Down
4 changes: 2 additions & 2 deletions backends/excel/publication/publication_list_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ var headers = []string{
"jcr_eigenfactor",
"jcr_immediacy_index",
"jcr_impact_factor",
"jcr_impact_factor_5year",
"jcr_impact_factor_5yr",
"jcr_total_cites",
"jcr_category_quartile",
"jcr_prev_impact_factor",
Expand Down Expand Up @@ -232,7 +232,7 @@ func (x *xlsx) publicationToRow(pub *models.Publication) []string {
m["jcr_eigenfactor"] = ""
m["jcr_immediacy_index"] = ""
m["jcr_impact_factor"] = ""
m["jcr_impact_factor_5year"] = ""
m["jcr_impact_factor_5yr"] = ""
m["jcr_total_cites"] = ""
m["jcr_category_quartile"] = ""
m["jcr_prev_impact_factor"] = ""
Expand Down
Loading