From 7b031ee255679351249c8fb722645a030dc6e98a Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Thu, 9 Jan 2020 21:10:11 +0100 Subject: sliders --- app/client/modules/biggan/biggan.actions.js | 13 ++++--- app/client/modules/biggan/biggan.module.js | 2 +- .../modules/biggan/views/biggan.encodingList.js | 44 +++++++++++++++------- 3 files changed, 38 insertions(+), 21 deletions(-) (limited to 'app/client') diff --git a/app/client/modules/biggan/biggan.actions.js b/app/client/modules/biggan/biggan.actions.js index f09510c..10d36ff 100644 --- a/app/client/modules/biggan/biggan.actions.js +++ b/app/client/modules/biggan/biggan.actions.js @@ -181,6 +181,7 @@ export const load_results = (id) => (dispatch) => { export const load_encodings = () => dispatch => { const module = bigganModule.name + console.log(actions) util.allProgress([ actions.folder.index({ module }), actions.file.index({ @@ -188,8 +189,10 @@ export const load_encodings = () => dispatch => { datatype: 'image', generated: 1, }), - ], (folders, files) => { - console.log(folders, files) + ], (percent, i, n) => { + // loading function + }).then(res => { + const [folders, files] = res const folder_name_lookup = {} const encodings = {} folders.forEach(folder => { @@ -197,19 +200,17 @@ export const load_encodings = () => dispatch => { encodings[folder.name] = [] }) files.forEach(file => { - folder_name = folder_name_lookup[file.folder_id] + const folder_name = folder_name_lookup[file.folder_id] encodings[folder_name].push(file) }) folders.forEach(folder => { if (!encodings[folder.name].length) { - delete encodings[folder_name] + delete encodings[folder.name] } }) dispatch({ type: types.biggan.load_encodings, encodings }) - }) } - diff --git a/app/client/modules/biggan/biggan.module.js b/app/client/modules/biggan/biggan.module.js index 6407f61..e86d312 100644 --- a/app/client/modules/biggan/biggan.module.js +++ b/app/client/modules/biggan/biggan.module.js @@ -1,7 +1,7 @@ const bigganModule = { name: 'biggan', displayName: 'BigGAN', - datatype: 'video', + datatype: 'image', } export default bigganModule diff --git a/app/client/modules/biggan/views/biggan.encodingList.js b/app/client/modules/biggan/views/biggan.encodingList.js index d041e2e..76c306c 100644 --- a/app/client/modules/biggan/views/biggan.encodingList.js +++ b/app/client/modules/biggan/views/biggan.encodingList.js @@ -3,38 +3,54 @@ import { bindActionCreators } from 'redux' import { connect } from 'react-redux' import { - Loading + Loading, Group, Slider } from '../../../common/' import actions from '../../../actions' import * as bigganTasks from '../biggan.tasks' import * as bigganActions from '../biggan.actions' -const ALL_CATEGORIES = 'inversion/categories/biggan_all.json' - class BigGANEncodingList extends Component { - constructor() { - super() - if (!this.props.encodings) { - this.actions.biggan.load_encodings() + componentDidMount() { + if (!this.props.biggan.encodings) { + this.props.actions.biggan.load_encodings() } } render() { - const { encodings } = this.props + const { encodings } = this.props.biggan if (!encodings) { return
Loading encodings...
} return (
-
- -
-
this.categoryRef = ref}> + + + + + + +
this.categoryRef = ref}> {Object.keys(encodings).sort().map(name => { return (
+

{name}

{encodings[name].map(file => ( ({ } }) -export default connect(mapStateToProps, mapDispatchToProps)(BigGANCategoryList) +export default connect(mapStateToProps, mapDispatchToProps)(BigGANEncodingList) -- cgit v1.2.3-70-g09d2