Skip to content

Commit

Permalink
Ensure github/zenodo publising
Browse files Browse the repository at this point in the history
  • Loading branch information
roll committed Jul 18, 2023
1 parent 37ef32f commit 361aef3
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ dependencies = [
"platformdirs>=3.8",
"python-multipart>=0.0",
"typing-extensions>=4.3",
"frictionless[ckan,csv,excel,json,github,pandas,sql,zenodo]>=5.15.8",
"frictionless[ckan,csv,excel,json,github,pandas,sql,zenodo]>=5.15.9",
]

[tool.hatch.version]
Expand Down
2 changes: 1 addition & 1 deletion src/client/components/Controllers/Base/Dialogs/Publish.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default function PublishDialog(props: PublishDialogProps) {
onCancel={handleClose}
onConfirm={publishedUrl ? handleClose : handlePublish}
>
<Box sx={{ marginLeft: -2 }}>
<Box sx={{ marginLeft: -2, paddingBottom: 2 }}>
<PortalEditor
portal={portal}
onChange={(portal) => {
Expand Down
2 changes: 1 addition & 1 deletion src/client/components/Controllers/Base/Panels/Source.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default function SourcePanel(props: SourcePanelProps) {
}}
language="json"
options={{ readOnly: !props.onChange }}
height={theme.spacing(47)}
height={theme.spacing(41)}
/>
</Box>
)
Expand Down
43 changes: 43 additions & 0 deletions src/client/components/Editors/Portal/Sections/Zenodo.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,60 @@
import * as React from 'react'
import EditorSection from '../../Base/Section'
import MultilineField from '../../../Parts/Fields/Multiline'
import InputField from '../../../Parts/Fields/Input'
import { useStore } from '../store'

export default function ZenodoSection() {
const updateHelp = useStore((state) => state.updateHelp)
return (
<EditorSection name="Zenodo" onHeadingClick={() => updateHelp('zenodo')}>
<Title />
<Description />
<Author />
<Apikey />
</EditorSection>
)
}

function Title() {
const title = useStore((state) => state.descriptor.zenodo?.title)
const updateZenodo = useStore((state) => state.updateZenodo)
return (
<InputField
required
label="Title"
value={title || ''}
onChange={(value) => updateZenodo({ title: value || undefined })}
/>
)
}

function Description() {
const description = useStore((state) => state.descriptor.zenodo?.description)
const updateZenodo = useStore((state) => state.updateZenodo)
return (
<MultilineField
required
label="Description"
value={description || ''}
onChange={(value) => updateZenodo({ description: value || undefined })}
/>
)
}

function Author() {
const author = useStore((state) => state.descriptor.zenodo?.author)
const updateZenodo = useStore((state) => state.updateZenodo)
return (
<InputField
required
label="Author"
value={author || ''}
onChange={(value) => updateZenodo({ author: value || undefined })}
/>
)
}

function Apikey() {
const apikey = useStore((state) => state.descriptor.zenodo?.apikey)
const updateZenodo = useStore((state) => state.updateZenodo)
Expand Down
2 changes: 2 additions & 0 deletions src/client/components/Parts/Fields/Multiline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ interface MultilineFieldProps {
onFocus?: () => void
placeholder?: string
autoFocus?: boolean
required?: boolean
}

export default function MultilineField(props: MultilineFieldProps) {
Expand All @@ -34,6 +35,7 @@ export default function MultilineField(props: MultilineFieldProps) {
onChange={(ev) => props.onChange(ev.target.value as any)}
onFocus={onFocus}
autoFocus={props.autoFocus}
required={props.required}
/>
)
}
3 changes: 3 additions & 0 deletions src/client/helpers/portal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ export function makeControl(portal: types.IPortal) {
if (portal.type === 'zenodo') {
const control: Partial<types.IZenodoControl> = portal.zenodo || {}
control.type = 'zenodo'
if (!control.title) return
if (!control.description) return
if (!control.author) return
if (!control.apikey) return
return control as types.IZenodoControl
}
Expand Down
3 changes: 3 additions & 0 deletions src/client/types/portal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,8 @@ export interface IGithubControl {

export interface IZenodoControl {
type: 'zenodo'
title: string
description: string
author: string
apikey: string
}

0 comments on commit 361aef3

Please sign in to comment.