How to use the openneuro-client.datasets.getDataset function in openneuro-client

To help you get started, we’ve selected a few openneuro-client examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github OpenNeuroOrg / openneuro / packages / openneuro-app / src / scripts / dataset / dataset.dataset-loader.jsx View on Github external
const newestSnapshot = snapshots[0].tag
      // Trim trailing slash if needed
      const currentPath = this.props.location.pathname.replace(/\/$/, '')
      const newestSnapshotUrl = `${currentPath}/versions/${newestSnapshot}`
      return (
        
          
        
      )
    } else {
      return null
    }
  }
}

export default graphql(datasets.getDataset, {
  name: 'getDataset',
  options: props => ({
    variables: {
      id: bids.decodeId(props.match.params.datasetId),
    },
  }),
})(withRouter(DatasetLoader))
github OpenNeuroOrg / openneuro / packages / openneuro-app / src / scripts / utils / datalad.js View on Github external
queryDataset(datasetId, callback) {
      console.log('datasetId in graphql query:', bids.decodeId(datasetId))

      const query = datasets.getDataset
      client.query({
        query: query,
        variables: {
            id: bids.decodeId(datasetId)
        }
      })
      .then(data => {
          data = clone(data)
          let snapshots = data.data.dataset.snapshots.slice(0)
          for (let snapshot of snapshots) {
              let splitId = snapshot.id.split(':')
              snapshot._id = splitId[splitId.length -1]
              snapshot.original = splitId[0]
          }
          data.data.dataset.files = data.data.dataset.draft ? data.data.dataset.draft.files : []
          return callback(data)
github OpenNeuroOrg / openneuro / packages / openneuro-app / src / scripts / dataset / tools / snapshot.jsx View on Github external
) : (
          content
        )}
      
    )
  }
}

Snapshot.propTypes = {
  show: PropTypes.bool,
  onHide: PropTypes.func,
  history: PropTypes.object,
  location: PropTypes.object,
}

export default graphql(openneuroDatasets.getDataset, {
  name: 'getDataset',
  options: props => ({
    variables: {
      id: props.match.params.datasetId,
    },
  }),
})(withRouter(Snapshot))
github OpenNeuroOrg / openneuro / packages / openneuro-app / src / scripts / uploader / uploader.jsx View on Github external
.then(() => {
              this.setState({ datasetId })
              client
                .query({
                  query: datasets.getDataset,
                  variables: {
                    id: datasetId,
                  },
                })
                .then(() => {
                  mutation
                    .createSnapshot(client, datasetId)
                    .then(() => {
                      this.setState({ uploading: false })
                      this.uploadCompleteAction()
                    })
                    .catch(err => {
                      this.setState({ uploading: false })
                      throw err
                    })
                })
github OpenNeuroOrg / openneuro / packages / openneuro-cli / src / datasets.js View on Github external
export const getDataset = (client, dir, datasetId) => {
  return client
    .query({
      query: datasets.getDataset,
      variables: { id: datasetId },
    })
    .then(() => datasetId)
}
github OpenNeuroOrg / openneuro / packages / openneuro-app / src / scripts / dataset / tools / snapshot.jsx View on Github external
) : (
          content
        )}
      
    )
  }
}

Snapshot.propTypes = {
  show: PropTypes.bool,
  onHide: PropTypes.func,
  history: PropTypes.object,
  location: PropTypes.object,
}

export default graphql(datasets.getDataset, {
  name: 'getDataset',
  options: props => ({
    variables: {
      id: props.match.params.datasetId,
    },
  }),
})(withRouter(Snapshot))