Commit 67874303 authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Fixed the missing reload button on having no uploads to show.

parent 5143296a
import React from 'react'
import PropTypes, { instanceOf } from 'prop-types'
import Markdown from '../Markdown'
import { withStyles, Paper, IconButton, FormGroup, Checkbox, FormControlLabel, FormLabel, Tooltip } from '@material-ui/core'
import { withStyles, Paper, IconButton, FormGroup, Checkbox, FormControlLabel, FormLabel, Tooltip, Typography } from '@material-ui/core'
import UploadIcon from '@material-ui/icons/CloudUpload'
import Dropzone from 'react-dropzone'
import Upload from './Upload'
......@@ -234,23 +234,25 @@ class Uploads extends React.Component {
const { selectedUnpublishedUploads, showPublishDialog } = this.state
const unpublishedUploads = this.state.unpublishedUploads || []
if (unpublishedUploads.length === 0) {
return ''
}
const reloadButton = <Tooltip title="reload uploads" >
<IconButton onClick={() => this.update()}><ReloadIcon /></IconButton>
</Tooltip>
return (<div className={classes.uploadsContainer}>
<div style={{width: '100%'}}>
<FormLabel className={classes.uploadsLabel}>Your unpublished uploads: </FormLabel>
<FormGroup className={classes.selectFormGroup} row>
<FormControlLabel label="all" style={{flexGrow: 1}} control={(
<Checkbox
checked={selectedUnpublishedUploads.length === unpublishedUploads.length && unpublishedUploads.length !== 0}
onChange={(_, checked) => this.onSelectionAllChanged(checked)}
/>
)} />
<Tooltip title="reload uploads" >
<IconButton onClick={() => this.update()}><ReloadIcon /></IconButton>
</Tooltip>
{(unpublishedUploads.length === 0) ? ''
: <FormLabel className={classes.uploadsLabel}>Your unpublished uploads: </FormLabel>
}
<FormGroup className={classes.selectFormGroup} style={{alignItems: 'center'}}row>
{(unpublishedUploads.length === 0) ? <FormLabel label="all" style={{flexGrow: 1}}>You have currently no unpublished uploads</FormLabel>
: <FormControlLabel label="all" style={{flexGrow: 1}} control={(
<Checkbox
checked={selectedUnpublishedUploads.length === unpublishedUploads.length && unpublishedUploads.length !== 0}
onChange={(_, checked) => this.onSelectionAllChanged(checked)}
/>
)} />
}
{reloadButton}
<FormLabel classes={{root: classes.selectLabel}}>
{`selected uploads ${selectedUnpublishedUploads.length}/${unpublishedUploads.length}`}
</FormLabel>
......@@ -283,31 +285,31 @@ class Uploads extends React.Component {
</FormGroup>
</div>
<div className={classes.uploads}>
<div>
<Help cookie="uploadList">{`
These are all your uploads in the *staging area*. You can see the
progress on data progresses and review your uploads before publishing
them to the *nomad repository*.
Select uploads to delete or publish them. Click on uploads to see individual
calculations. Click on calculations to see more details on each calculation.
When you select and click publish, you will be ask if you want to publish
with or without the optional *embargo period*.
`}</Help>
{
this.sortedUnpublishedUploads().map(upload => (
{
(unpublishedUploads.length === 0)
? ''
: <div className={classes.uploads}>
<Help cookie="uploadList">{`
These are all your uploads in the *staging area*. You can see the
progress on data progresses and review your uploads before publishing
them to the *nomad repository*.
Select uploads to delete or publish them. Click on uploads to see individual
calculations. Click on calculations to see more details on each calculation.
When you select and click publish, you will be ask if you want to publish
with or without the optional *embargo period*.
`}</Help>
{ this.sortedUnpublishedUploads().map(upload => (
<Upload key={upload.gui_upload_id} upload={upload}
checked={selectedUnpublishedUploads.indexOf(upload) !== -1}
onDoesNotExist={() => this.handleDoesNotExist(upload)}
onPublished={() => this.handlePublished(upload)}
onCheckboxChanged={checked => this.onSelectionChanged(upload, checked)}/>
))
}
</div>
</div>
}
</div>
}
</div>)
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment