Commit 99de419e authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Hide potcar from non uploader. #236

parent f4bdef1e
......@@ -77,7 +77,7 @@ class Quantity extends React.Component {
if (noWrap && ellipsisFront) {
valueClassName = `${valueClassName} ${classes.ellipsisFront}`
}
console.log(valueClassName)
if (!loading) {
if (!(data && quantity && !data[quantity])) {
if (!children || children.length === 0) {
......
......@@ -176,6 +176,14 @@ class RawFiles extends React.Component {
}
}
filterPotcar(file) {
if (file.toLowerCase().endsWith('potcar')) {
return this.props.data.uploader.user_id === this.props.user.sub
} else {
return true
}
}
render() {
const {classes, uploadId, calcId, loading, data} = this.props
const {selectedFiles, files, doesNotExist, fileContents, shownFile} = this.state
......@@ -226,15 +234,15 @@ class RawFiles extends React.Component {
<Divider />
<div style={{display: 'flex', flexDirection: 'row'}}>
<div style={{width: '25%'}}>
{availableFiles.map((file, index) => (
{availableFiles.filter(this.filterPotcar.bind(this)).map((file, index) => (
<FormGroup row key={index} className={classes.fileNameFormGroup}>
<Tooltip title={file}>
<FormControlLabel
style={{flexGrow: 1, overflowX: 'hidden', textOverflow: 'ellipsis'}}
label={this.label(file)}
classes={{
root: classes.fileNameFormGroupLabel,
label: file === shownFile ? classes.shownFile : classes.fileNameLabel}}
root: classes.fileNameFormGroupLabel,
label: file === shownFile ? classes.shownFile : classes.fileNameLabel}}
control={
<Checkbox
disabled={loading > 0}
......
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