Skip to content

Commit

Permalink
Fix and document publishing (#708)
Browse files Browse the repository at this point in the history
* Added Zenodo publishing docs

* Added GitHub publishing docs; recover funcionality

* Added CKAN publishing docs

* Added GitHub scope note
  • Loading branch information
roll authored Dec 26, 2024
1 parent a372aff commit a24c81e
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 15 deletions.
17 changes: 9 additions & 8 deletions client/components/Application/Dialogs/Publish.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import * as React from 'react'
import * as store from '@client/store'
import CheckIcon from '@mui/icons-material/Check'
import Box from '@mui/material/Box'
import Link from '@mui/material/Link'
import LinearProgress from '@mui/material/LinearProgress'
import CheckIcon from '@mui/icons-material/Check'
import OneButtonDialog from '../../Parts/Dialogs/OneButton'
import PortalEditor from '../../Editors/Portal'
import Link from '@mui/material/Link'
import * as React from 'react'
import { useTranslation } from 'react-i18next'
import * as helpers from '../../../helpers'
import * as types from '../../../types'
import { useTranslation } from 'react-i18next'
import PortalEditor from '../../Editors/Portal'
import OneButtonDialog from '../../Parts/Dialogs/OneButton'

type IState = 'form' | 'load' | 'done' | 'fail'

Expand Down Expand Up @@ -46,20 +46,21 @@ export default function PublishDialog() {
<PortalEditor
portal={portal}
onChange={(portal) => {
console.log('portal', portal)
setPortal(portal)
setControl(helpers.makeControl(portal))
}}
/>
</Box>
{state === 'load' && (
<Box sx={{ borderTop: 'solid 1px #ddd', padding: 2 }}>
{t('publishing')}
{t('uploading')}
<LinearProgress />
</Box>
)}
{state === 'done' && (
<Box sx={{ borderTop: 'solid 1px #ddd', padding: 2 }}>
{t('published')}:{' '}
{t('uploaded')}:{' '}
<Link href={publishedUrl} target="_blank">
{publishedUrl}
</Link>{' '}
Expand Down
15 changes: 9 additions & 6 deletions client/components/Editors/Portal/store.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import cloneDeep from 'lodash/cloneDeep'
import noop from 'lodash/noop'
import * as React from 'react'
import * as zustand from 'zustand'
import { createSelector } from 'reselect'
import { assert } from 'ts-essentials'
import noop from 'lodash/noop'
import cloneDeep from 'lodash/cloneDeep'
import * as zustand from 'zustand'
import { createStore } from 'zustand/vanilla'
import { createSelector } from 'reselect'
import { PortalProps } from './index'
import * as settings from '../../../settings'
import * as helpers from '../../../helpers'
import * as settings from '../../../settings'
import * as types from '../../../types'
import help from './help.yaml'
import { PortalProps } from './index'

const DEFAULT_HELP_ITEM = helpers.readHelpItem(help, 'ckan')!

Expand Down Expand Up @@ -53,20 +53,23 @@ export function makeStore(props: PortalProps) {

updateCkan: (patch) => {
const { descriptor, updateDescriptor } = get()
descriptor.type = 'ckan'
descriptor.ckan = descriptor.ckan || {}
Object.assign(descriptor.ckan, patch)
updateDescriptor(descriptor)
},

updateGithub: (patch) => {
const { descriptor, updateDescriptor } = get()
descriptor.type = 'github'
descriptor.github = descriptor.github || {}
Object.assign(descriptor.github, patch)
updateDescriptor(descriptor)
},

updateZenodo: (patch) => {
const { descriptor, updateDescriptor } = get()
descriptor.type = 'zenodo'
descriptor.zenodo = descriptor.zenodo || {}
Object.assign(descriptor.zenodo, patch)
updateDescriptor(descriptor)
Expand Down
2 changes: 2 additions & 0 deletions locale/translations/en.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"uploading": "Uploading",
"uploaded": "Uploaded",
"export-error": "Export error",
"export-error-message": "An error occurred while exporting the table",
"select-metadata-format": "Select metadata format to export information about the table",
Expand Down
50 changes: 49 additions & 1 deletion portal/content/docs/documentation/publishing-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,52 @@ Once you click the **Publish** button, the ODE will display the following dialog

:::note
To be able to publish, you have to set the required credentials to connect to a data portal (CKAN, Zenodo, Github).
:::
:::

## Zenodo

:::note
Open Data Editor will create a new draft on Zenodo. You will need to go to Zenodo to complete the publication process.
:::

To publish your data on Zenodo, you need to provide the following information:

- **Title**: The title of the dataset.
- **Description**: A description of the dataset.
- **Author**: The author of the dataset.
- **API Key**: Your Zenodo API key. You can find it in your Zenodo account settings:
- Go to the [token creation page](https://zenodo.org/account/settings/applications/tokens/new/)
- Set the name of the token (e.g. ODE)
- Set scopes to `deposit:write`
- Click on the `Create` button
- Copy the token, securely save it

## GitHub

:::note
Currently, Open Data Editor requires the `repo` scope to publish data on GitHub. The ODE team will review this scope in the future.
:::

To publish your data on GitHub, you need to provide the following information:

- **User**: Your GitHub username.
- **Repo**: A new repository where the data will be published.
- **Email**: Your email address.
- **API Key**: Your GitHub API key. You can find it in your GitHub account settings:
- Go to the [token creation page](https://github.com/settings/tokens/new)
- Set the note for the token (e.g. ODE)
- Set expiration date
- Select the `repo` scope
- Click on the `Generate token` button
- Copy the token, securely save it

## CKAN

To publish your data on CKAN, you need to provide the following information:

- **Base Url**: Endpoint url for CKAN instance. e.g. https://dados.gov.br
- **Dataset**: The dataset name where the data will be published.
- **Allow Update**: If checked, it will overwrite the selected dataset (use with caution!).
- **API Key**: Your CKAN API key. You can find it in your CKAN account settings:
- Go to the API key page in the CKAN instance settings
- Copy the API key, securely save it

0 comments on commit a24c81e

Please sign in to comment.