From 88a6455d9ecb580da79aece98d38cc302fa2f2b1 Mon Sep 17 00:00:00 2001 From: Aaron Boodman Date: Tue, 25 Aug 2015 14:02:34 -0700 Subject: [PATCH] tagshow: Use URLs for state to ease development. --- clients/tagshow/datasetpicker.js | 23 ++++++------- clients/tagshow/main.js | 29 ++++++++++++---- clients/tagshow/package.json | 1 + clients/tagshow/root.js | 59 +++++++++++++++----------------- clients/tagshow/slideshow.js | 21 ++++++++++-- clients/tagshow/tagcloud.js | 29 +++++++++++----- 6 files changed, 100 insertions(+), 62 deletions(-) diff --git a/clients/tagshow/datasetpicker.js b/clients/tagshow/datasetpicker.js index 7a9be82e87..1eb23b0777 100644 --- a/clients/tagshow/datasetpicker.js +++ b/clients/tagshow/datasetpicker.js @@ -9,9 +9,9 @@ var DatasetPicker = React.createClass({ mixins: [ImmutableRenderMixin], propTypes: { - root: React.PropTypes.instanceOf(noms.Ref).isRequired, + datasets: React.PropTypes.instanceOf(Promise).isRequired, onChange: React.PropTypes.func.isRequired, - selected: React.PropTypes.instanceOf(Immutable.Map), + selected: React.PropTypes.string, }, getInitialState: function() { @@ -21,24 +21,21 @@ var DatasetPicker = React.createClass({ }, handleSelectChange: function(e) { - this.props.onChange( - this.state.datasets.find( - ds => ds.get('id') == e.target.value)); + this.props.onChange(e.target.value); }, render: function() { - // Get the datasets - this.props.root.deref().then( - heads => heads.first().deref()).then( - commit => commit.get('value').deref()).then( - dsRefs => Promise.all(dsRefs.map(ref => ref.deref()))).then( + this.props.datasets.then( datasets => { - this.setState({datasets: Immutable.Set.of(...datasets)}); - }); + this.setState({ + datasets: Immutable.Set.of(...datasets) + }); + } + ); return
Dataset: - this.props.onChoose(tag) }/> - + }).toArray() }