Commit 7ebcff84 authored by Matija Obreza's avatar Matija Obreza
Browse files

Dataset editor fixes

- Included loading indicator and back button
- versionTag, created
- Default MuiFormControl margin
parent c9042a53
......@@ -24,7 +24,9 @@ export class AccessionIdentifier extends EmptyModel {
export class Dataset extends UuidModel implements IUserPermissions {
public published: boolean;
public title: string;
public versionTag: string;
public description: string;
public created: string;
public rights: string;
public language: string;
public source: string;
......
......@@ -4,6 +4,7 @@ import Divider from 'material-ui/Divider';
import Button from 'material-ui/Button';
import {withStyles} from 'material-ui/styles';
import Hidden from 'material-ui/Hidden';
import { Link } from 'react-router';
const styles = (theme) => ({
root: {
......@@ -61,9 +62,9 @@ const TopSection = ({classes}) => (
<Button raised className={ `${ classes.headerButton } ${ classes.btnGreen }` }>
SEE GUIDED TOUR
</Button>
<Button raised className={ `${ classes.headerButton } ${ classes.btnDefault }` }>
BACK TO CATALOG
</Button>
<Link to="/dashboard"><Button raised className={ `${ classes.headerButton } ${ classes.btnDefault }` }>
BACK TO DASHBOARD
</Button></Link>
</div>
</Hidden>
<Hidden implementation="css" mdUp>
......
......@@ -12,6 +12,7 @@ import {navigateTo} from 'actions/navigation';
import {loadDataset, publishDataset} from 'actions/dataset';
import {Dataset} from 'model/dataset.model';
import StepNavigation from './StepNavigation';
import Loading from 'ui/common/Loading';
const steps = [
{
......@@ -80,16 +81,17 @@ class DatasetStepper extends React.Component<IDatasetProps, any> {
public componentDidMount() {
const {uuid, dataset, loadDataset} = this.props;
if (!dataset && uuid) {
loadDataset(uuid);
}
if (uuid && (!dataset || dataset.uuid !== uuid)) {
loadDataset(uuid);
}
}
protected gotoStep = (id) => () => {
const {uuid, navigateTo} = this.props;
const {dataset, uuid, navigateTo} = this.props;
const path = steps.find((e) => e.id === id).link;
log('Go to step', path);
navigateTo(`/datasets/${uuid}/${path}`);
navigateTo(`/datasets/${dataset ? dataset.uuid : uuid}/${path}`);
steps.forEach((i) => i.active = false);
steps[id - 1].active = true;
}
......@@ -104,6 +106,8 @@ class DatasetStepper extends React.Component<IDatasetProps, any> {
const {uuid, children, location} = this.props;
let {dataset} = this.props;
const stillLoading: boolean = (! dataset || (uuid && (dataset.uuid !== uuid)));
if (! dataset && ! uuid) {
dataset = new Dataset();
}
......@@ -120,9 +124,11 @@ class DatasetStepper extends React.Component<IDatasetProps, any> {
<Grid container spacing={ 0 } className="back-white">
<StepNavigation onGotoStep={ this.gotoStep } steps={ steps } location={ location } showStepName bottomDivider onPublish={ this.onPublish } />
<Grid item xs={ 12 }>
<div className="even-row">
{ children }
</div>
{ stillLoading ? <Loading /> :
<div className="even-row">
{ children }
</div>
}
</Grid>
<StepNavigation onGotoStep={ this.gotoStep } steps={ steps } location={ location } topDivider onPublish={ this.onPublish } />
</Grid>
......
......@@ -56,6 +56,13 @@ class BasicInfoStep extends React.Component<ILoginContainerProps, any> {
placeholder="Title"
onBlur={ this.save }
/>
<Field required
name="versionTag"
component={ TextField }
label="Dataset version"
placeholder="2018.1"
onBlur={ this.save }
/>
<Field
name="description"
component={ MarkdownField }
......
......@@ -3,7 +3,13 @@ import {ThemeOptions} from 'material-ui/styles/createMuiTheme';
const theme = createMuiTheme({
/* tslint:disable */
overrides: {
MuiFormControl: {
root: {
marginTop: '1.43rem', // 20px
},
},
},
palette: {
primary: {
50: '#f1f7e8',
......
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