Skip to content
This repository has been archived by the owner on Aug 6, 2024. It is now read-only.

Update v1.9.0 #78

Merged
merged 20 commits into from
Oct 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
4c83e9b
fix: adapt DataCite scraper to schema version 4.4
ewan-escience Oct 26, 2022
9c1c023
fix: add workshop as mention type
ewan-escience Oct 26, 2022
1f193dc
fix: add note field to mention table
ewan-escience Oct 26, 2022
cefea70
feat: show note in page edit and page view components
dmijatovic Oct 26, 2022
abd2464
chore: use next script tag to inject matomo script after initial load…
dmijatovic Oct 26, 2022
a4b77d0
feat: filter software on tag using link
dmijatovic Oct 26, 2022
f3576a3
feat: add keyword filter link to project page
dmijatovic Oct 27, 2022
ca0bb71
fix: add anchor tag for keyword links, remove margins and use flex ga…
dmijatovic Oct 27, 2022
0f01a00
Merge pull request #611 from research-software-directory/544-keyword-…
dmijatovic Oct 27, 2022
3905c3e
update datacite mention type detection
dmijatovic Oct 27, 2022
848fd01
refactor: lazy load matomo script
dmijatovic Oct 27, 2022
bcffbf9
chore: fix classification datacite typos en remove console log
dmijatovic Oct 27, 2022
b0c5400
fix: scraper uses note field and workshop type for mention
ewan-escience Oct 27, 2022
6b140a3
Merge pull request #614 from research-software-directory/mention-impr…
dmijatovic Oct 28, 2022
c55856b
fix: cropped cookie banner on mobile
dmijatovic Oct 28, 2022
1e22bdf
Merge pull request #615 from research-software-directory/612-cookie-b…
dmijatovic Oct 28, 2022
d3a764e
chore(release): update citation file
jmaassen Oct 28, 2022
5e3b81e
Merge tag 'v1.9.0' into 77-update_1.9.0
cmeessen Oct 28, 2022
56883df
feat: autoremove initial-spotlights container
cmeessen Oct 28, 2022
9955049
feat: always pull spotlight migration image
cmeessen Oct 28, 2022
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
4 changes: 2 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,5 @@ keywords:
- Software Impact
- Software Reuse
license: Apache-2.0
version: v1.8.0
date-released: '2022-10-14'
version: v1.9.0
date-released: '2022-10-28'
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ data:
docker-compose down

spotlights:
docker-compose run initial-spotlights
docker-compose run --rm initial-spotlights

# Helper commands
# -
Expand Down
3 changes: 3 additions & 0 deletions data-generation/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ function generateMentions(amountExtra = 10) {
'thesis',
'videoRecording',
'webpage',
'workshop',
'other',
];

Expand All @@ -55,6 +56,7 @@ function generateMentions(amountExtra = 10) {
image_url: null,
mention_type: faker.helpers.arrayElement(mentionTypes),
source: 'faker',
note: faker.helpers.maybe(() => faker.company.catchPhrase(), 0.3) ?? null
});
}

Expand All @@ -70,6 +72,7 @@ function generateMentions(amountExtra = 10) {
image_url: null,
mention_type: faker.helpers.arrayElement(mentionTypes),
source: 'faker',
note: faker.helpers.maybe(() => faker.company.catchPhrase(), 0.3) ?? null
});
}

Expand Down
2 changes: 2 additions & 0 deletions database/008-create-mention-table.sql
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ CREATE TYPE mention_type AS ENUM (
'thesis',
'videoRecording',
'webpage',
'workshop',
'other'
);

Expand All @@ -37,6 +38,7 @@ CREATE TABLE mention (
image_url VARCHAR(500) CHECK (image_url ~ '^https?://'),
mention_type mention_type NOT NULL,
source VARCHAR(50) NOT NULL,
note VARCHAR(500),
scraped_at TIMESTAMPTZ,
created_at TIMESTAMPTZ NOT NULL,
updated_at TIMESTAMPTZ NOT NULL
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ services:

initial-spotlights:
image: ghcr.io/hifis-net/rsd-spotlight-migration:latest
pull_policy: always
environment:
- POSTGREST_URL
- PGRST_JWT_SECRET
Expand Down
4 changes: 2 additions & 2 deletions frontend/components/cookies/CookieConsentMatomo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ export default function CookieConsentMatomo({matomo, route}: CookieConsentMatomo
className="fixed bottom-0 right-0 animated animatedFadeInUp fadeInUp"
data-testid="cookie-consent-matomo"
>
<div className="container mx-auto px-20 ">
<div className="border border-b-base-content border-t-4 border-x-4 border-b-0 w-96 bg-white shadow-lg p-6 rounded-tr-3xl">
<div className="container mx-auto sm:px-20">
<div className="border border-b-base-content border-t-4 border-x-4 border-b-0 bg-white shadow-lg p-6 rounded-tr-3xl sm:w-96">
<div className="w-16 mx-auto relative mb-3">
<CookieTwoToneIcon className="scale-[2] mb-3" color="primary" fontSize="large"/>
</div>
Expand Down
2 changes: 0 additions & 2 deletions frontend/components/layout/TagChip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ export default function TagChip({label, title}:
title={title ? title : label}
label={label}
sx={{
marginBottom: '1rem',
marginRight: '0.5rem',
maxWidth: '21rem',
borderRadius: '0.125rem',
textTransform: 'capitalize'
Expand Down
36 changes: 36 additions & 0 deletions frontend/components/layout/TagChipFilter.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import Chip from '@mui/material/Chip'
import SearchIcon from '@mui/icons-material/Search'
import Link from 'next/link'

export default function TagChipFilter({url, label, title}:
{ label: string, url:string ,title?: string }) {

if (!label) return null

return (
<Link
href={url}
passHref
>
<a>
<Chip
title={`Click to filter for ${title ? title : label}`}
label={label}
icon={<SearchIcon />}
clickable
sx={{
maxWidth: '21rem',
borderRadius: '0.125rem',
textTransform: 'capitalize',
'& .MuiChip-icon': {
order: 1,
margin:'0rem 0.5rem 0rem 0rem',
height: '1.125rem',
width: '1.125rem'
}
}}
/>
</a>
</Link>
)
}
45 changes: 31 additions & 14 deletions frontend/components/mention/EditMentionModal.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// SPDX-FileCopyrightText: 2022 Christian Meeßen (GFZ) <christian.meessen@gfz-potsdam.de>
// SPDX-FileCopyrightText: 2022 Helmholtz Centre Potsdam - GFZ German Research Centre for Geosciences
// SPDX-FileCopyrightText: 2022 Dusan Mijatovic (dv4all)
// SPDX-FileCopyrightText: 2022 Ewan Cahen (Netherlands eScience Center) <e.cahen@esciencecenter.nl>
// SPDX-FileCopyrightText: 2022 Helmholtz Centre Potsdam - GFZ German Research Centre for Geosciences
// SPDX-FileCopyrightText: 2022 Netherlands eScience Center
// SPDX-FileCopyrightText: 2022 dv4all
//
// SPDX-License-Identifier: Apache-2.0
Expand Down Expand Up @@ -213,22 +215,37 @@ export default function EditMentionModal({open, onCancel, onSubmit, item, pos, t
}}
rules={config.url.validation}
/>
<div className="py-2"></div>
{formData.mention_type === 'highlight' ?
<ControlledTextField
control={control}
options={{
name: 'image_url',
label: config.image_url.label,
useNull: true,
defaultValue: formData?.image_url,
helperTextMessage: config.image_url.help,
helperTextCnt: `${formData?.image_url?.length || 0}/${config.image_url.validation.maxLength.value}`
}}
rules={config.image_url.validation}
/>
<>
<div className="py-2"></div>
<ControlledTextField
control={control}
options={{
name: 'image_url',
label: config.image_url.label,
useNull: true,
defaultValue: formData?.image_url,
helperTextMessage: config.image_url.help,
helperTextCnt: `${formData?.image_url?.length || 0}/${config.image_url.validation.maxLength.value}`
}}
rules={config.image_url.validation}
/>
</>
:null
}
<div className="py-2"></div>
<ControlledTextField
control={control}
options={{
name: 'note',
label: config.note.label,
useNull: true,
defaultValue: formData?.note,
helperTextMessage: config.note.help,
helperTextCnt: `${formData?.note?.length || 0}/${config.note.validation.maxLength.value}`,
}}
rules={config.note.validation}
/>
<Alert severity="warning" sx={{marginTop: '1.5rem'}}>
{/* <AlertTitle sx={{fontWeight: 500}}>Validate entered information</AlertTitle> */}
Please double check the data because this entry <strong>cannot be edited after it has been created</strong>.
Expand Down
2 changes: 2 additions & 0 deletions frontend/components/mention/MentionItemBase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {ReactNode} from 'react'
import {MentionItemProps} from '~/types/Mention'
import MentionAuthors from './MentionAuthors'
import MentionDoi from './MentionDoi'
import MentionNote from './MentionNote'
import MentionPublisherItem from './MentionPublisherItem'

export type MentionItemRole = 'list'|'find'|'view'
Expand Down Expand Up @@ -69,6 +70,7 @@ export default function MentionItemBase({item,pos,nav,type,role='find'}:MentionI
className="text-sm"
role={role}
/>
<MentionNote note={item.note} />
</article>
)
}
Expand Down
7 changes: 7 additions & 0 deletions frontend/components/mention/MentionNote.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

export default function MentionNote({note}: { note: string | null }) {
if (note) {
return <div className="mt-2 text-sm opacity-60">{note}</div>
}
return null
}
2 changes: 2 additions & 0 deletions frontend/components/mention/MentionViewItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import MentionAuthors from './MentionAuthors'
import MentionPublisherItem from './MentionPublisherItem'
import MentionDoi from './MentionDoi'
import {MentionTitle} from './MentionItemBase'
import MentionNote from './MentionNote'

export default function MentionViewItem({item, pos}: {item: MentionItemProps, pos:number}) {

Expand Down Expand Up @@ -39,6 +40,7 @@ export default function MentionViewItem({item, pos}: {item: MentionItemProps, po
doi={item?.doi}
className="text-sm"
/>
<MentionNote note={item.note} />
</div>
<div className="flex justify-center items-center">
{item?.url ? <LinkIcon /> : null}
Expand Down
23 changes: 21 additions & 2 deletions frontend/components/mention/config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// SPDX-FileCopyrightText: 2022 Dusan Mijatovic (dv4all)
// SPDX-FileCopyrightText: 2022 Ewan Cahen (Netherlands eScience Center) <e.cahen@esciencecenter.nl>
// SPDX-FileCopyrightText: 2022 Netherlands eScience Center
// SPDX-FileCopyrightText: 2022 dv4all
//
// SPDX-License-Identifier: Apache-2.0
Expand Down Expand Up @@ -87,6 +89,17 @@ export const mentionModal = {
}
}
},
note: {
label: 'Note',
help: 'Add a custom note',
validation: {
required: false,
maxLength: {
value: 500,
message: 'Maximum length is 500'
}
}
},
image_url: {
label: 'Image url*',
help: 'Url to publication image is required for highlighted mention',
Expand Down Expand Up @@ -190,7 +203,7 @@ export const mentionType = {
interview: {
key: 'interview',
plural: 'Interviews',
singular: 'Interviews',
singular: 'Interview',
manual: true
},
journalArticle: {
Expand Down Expand Up @@ -220,7 +233,7 @@ export const mentionType = {
report: {
key: 'report',
plural: 'Reports',
singular: 'Reports',
singular: 'Report',
manual: true
},
thesis: {
Expand All @@ -241,6 +254,12 @@ export const mentionType = {
singular: 'Webpage',
manual: true
},
workshop: {
key: 'workshop',
plural: 'Workshops',
singular: 'Workshop',
manual: true
},
other: {
key: 'other',
plural: 'Other',
Expand Down
2 changes: 1 addition & 1 deletion frontend/components/projects/ProjectKeywordFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type KeywordFilterProps = {
* Keywords filter component. It receives array of keywords and returns
* array of selected tags to use in filter using onSelect callback function
*/
export default function ProjectKeywordsFilter({items=[], onApply}:KeywordFilterProps) {
export default function ProjectKeywordFilter({items=[], onApply}:KeywordFilterProps) {
return (
<KeywordFilter
items={items}
Expand Down
43 changes: 43 additions & 0 deletions frontend/components/projects/ProjectKeywords.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// SPDX-FileCopyrightText: 2022 Dusan Mijatovic (dv4all)
// SPDX-FileCopyrightText: 2022 Ewan Cahen (Netherlands eScience Center) <e.cahen@esciencecenter.nl>
// SPDX-FileCopyrightText: 2022 Netherlands eScience Center
// SPDX-FileCopyrightText: 2022 dv4all
//
// SPDX-License-Identifier: Apache-2.0

import {KeywordForProject} from '~/types/Project'
import {ssrProjectsUrl} from '~/utils/postgrestUrl'
import TagChipFilter from '../layout/TagChipFilter'

type TagWithTitle = {
title: string
label: string
}

export default function ProjectKeywords({keywords=[]}:{keywords:KeywordForProject[]}) {

function renderTags() {
if (keywords.length === 0) {
return <i>Not specified</i>
}
return (
<div className="flex flex-wrap gap-2 py-1">
{
keywords.map((item, pos) => {
const url = ssrProjectsUrl({keywords: [item.keyword]})
return <TagChipFilter url={url} key={pos} label={item.keyword} />
})
}
</div>
)
}

return (
<div>
<h4 className="text-primary py-4">
Keywords
</h4>
{renderTags()}
</div>
)
}
7 changes: 3 additions & 4 deletions frontend/components/projects/ProjectSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {KeywordForProject, ProjectLink, ResearchDomain} from '../../types/Projec
import ProjectStatus from './ProjectStatus'
import ProjectFunding from './ProjectFunding'
import ProjectLinks from './ProjectLinks'
import ProjectTags from './ProjectTags'
import ProjectKeywords from './ProjectKeywords'
import {ProjectOrganisationProps} from '~/types/Organisation'
import ResearchDomains from './ResearchDomains'

Expand Down Expand Up @@ -48,9 +48,8 @@ export default function ProjectSidebar({date_start, date_end, grant_id, links, r
domains={researchDomains}
/>

<ProjectTags
title="Keywords"
tags={keywords.map(item=>item.keyword)}
<ProjectKeywords
keywords={keywords}
/>

</aside>
Expand Down
Loading