import { h, Component } from 'preact' import { bindActionCreators } from 'redux' import { connect } from 'react-redux' import util from '../../../util' import * as bigganActions from '../biggan.actions' import * as bigganTasks from '../biggan.tasks' import { Loading, CurrentTask, FileList, FileRow } from '../../../common' import DatasetForm from '../../../dataset/dataset.form' import NewDatasetForm from '../../../dataset/dataset.new' import UploadStatus from '../../../dataset/upload.status' import DatasetComponent from '../../../dataset/dataset.component' import bigganModule from '../biggan.module' class BigGANShow extends Component { constructor(props){ super(props) this.datasetActions = this.datasetActions.bind(this) } componentWillMount(){ const id = this.props.match.params.id || localStorage.getItem('biggan.last_id') console.log('load dataset:', id) const { match, biggan, actions } = this.props if (id === 'new') return if (id) { if (parseInt(id)) localStorage.setItem('biggan.last_id', id) if (! biggan.folder || biggan.folder.id !== id) { actions.load_directories(id) } } else { this.props.history.push('/biggan/new/') } } render(){ const { biggan, match, history, actions } = this.props const { folderLookup } = (biggan.data || {}) const folder = (folderLookup || {})[biggan.folder_id] || {} return (