mirror of
https://github.com/dolthub/dolt.git
synced 2026-01-30 10:45:18 -06:00
Fix pitchmap ui demo
This broke when we changed from heads to a single head
This commit is contained in:
@@ -5,15 +5,12 @@ var React = require('react');
|
||||
var Map = require('./map.js');
|
||||
|
||||
noms.getDataset('mlb/heatmap')
|
||||
.then(getPitchers)
|
||||
.then(renderPitchersList);
|
||||
.then(getPitchers)
|
||||
.then(renderPitchersList);
|
||||
|
||||
function getPitchers(datasetRoot) {
|
||||
return datasetRoot.deref().then((root) => {
|
||||
return root.first().deref();
|
||||
}).then((map) =>{
|
||||
return map.get('value').deref();
|
||||
});
|
||||
function getPitchers(datasetRootRef) {
|
||||
return datasetRootRef.deref()
|
||||
.then(datasetRoot => datasetRoot.get('value').deref());
|
||||
}
|
||||
|
||||
var PitcherList = React.createClass({
|
||||
|
||||
@@ -3,30 +3,27 @@ var decode = require('./decode.js')
|
||||
|
||||
function getDataset(id) {
|
||||
return store.getRoot()
|
||||
.then(rootRef => decode.readValue(rootRef, store.getChunk))
|
||||
.then(root => root.deref())
|
||||
.then(heads => heads.first().deref())
|
||||
.then(commit => commit.get('value').deref())
|
||||
.then(dsRefs => Promise.all(dsRefs.map(ref => ref.deref())))
|
||||
.then(datasets =>
|
||||
{
|
||||
var match = datasets.filter(dataset => dataset.get('id') == id);
|
||||
if (match.length > 1) {
|
||||
throw Error("Um...this can't be good: More than one dataset with id " + id);
|
||||
}
|
||||
.then(rootRef => decode.readValue(rootRef, store.getChunk))
|
||||
.then(root => root.deref())
|
||||
.then(commit => commit.get('value').deref())
|
||||
.then(dsRefs => Promise.all(dsRefs.map(ref => ref.deref())))
|
||||
.then(datasets => {
|
||||
var match = datasets.filter(dataset => dataset.get('id') === id);
|
||||
if (match.length > 1) {
|
||||
throw Error("Um...this can't be good: More than one dataset with id " + id);
|
||||
}
|
||||
|
||||
return match.length == 1 ? match[0].get('heads') : null
|
||||
});
|
||||
return match.length === 1 ? match[0].get('head') : null
|
||||
});
|
||||
}
|
||||
|
||||
function getDatasetIds() {
|
||||
return store.getRoot()
|
||||
.then(rootRef => decode.readValue(rootRef, store.getChunk))
|
||||
.then(root => root.deref())
|
||||
.then(heads => heads.first().deref())
|
||||
.then(commit => commit.get('value').deref())
|
||||
.then(dsRefs => Promise.all(dsRefs.map(ref => ref.deref())))
|
||||
.then(datasets => datasets.map(dataset => dataset.get('id')))
|
||||
.then(rootRef => decode.readValue(rootRef, store.getChunk))
|
||||
.then(root => root.deref())
|
||||
.then(commit => commit.get('value').deref())
|
||||
.then(dsRefs => Promise.all(dsRefs.map(ref => ref.deref())))
|
||||
.then(datasets => datasets.map(dataset => dataset.get('id')))
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
@@ -38,4 +35,3 @@ module.exports = {
|
||||
getRef: decode.getRef,
|
||||
Ref: decode.Ref
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user