|
@@ -23,6 +23,10 @@ function endsWith(what, endings) { |
|
|
throw Error('Expected second argument to be either a string or an array');
|
|
|
throw Error('Expected second argument to be either a string or an array');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function maskRows(rows) {
|
|
|
|
|
|
return rows.map(r => r.map(c => '-'));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
class WBCollectionContent extends Component {
|
|
|
class WBCollectionContent extends Component {
|
|
|
constructor(...args) {
|
|
|
constructor(...args) {
|
|
|
super(...args);
|
|
|
super(...args);
|
|
@@ -74,16 +78,29 @@ class WBCollectionContent extends Component { |
|
|
return manifestWorker.postMessage([ 'precreatePaths', paths ]);
|
|
|
return manifestWorker.postMessage([ 'precreatePaths', paths ]);
|
|
|
});
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
let lastListingTimestamp = new Date(0);
|
|
|
|
|
|
|
|
|
for (let i = 0; i < streams.length; i++) {
|
|
|
for (let i = 0; i < streams.length; i++) {
|
|
|
prom_1 = prom_1.then(() => manifestWorker.postMessage([ 'parseStream', streams[i] ]));
|
|
|
prom_1 = prom_1.then(() => manifestWorker.postMessage([ 'parseStream', streams[i] ]));
|
|
|
|
|
|
|
|
|
prom_1 = prom_1.then(() => manifestWorker.postMessage([
|
|
|
|
|
|
'listDirectory', '.' + this.props.collectionPath, true
|
|
|
|
|
|
]));
|
|
|
|
|
|
|
|
|
prom_1 = prom_1.then(() => {
|
|
|
|
|
|
if (new Date() - lastListingTimestamp < 1000)
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
lastListingTimestamp = new Date();
|
|
|
|
|
|
|
|
|
prom_1 = prom_1.then(e => {
|
|
|
|
|
|
this.prepareRows(e.data[1]);
|
|
|
|
|
|
this.setState({ 'parsedStreams': (i + 1) });
|
|
|
|
|
|
|
|
|
let prom_2 = new Promise(accept => accept());
|
|
|
|
|
|
|
|
|
|
|
|
prom_2 = prom_2.then(() => manifestWorker.postMessage([
|
|
|
|
|
|
'listDirectory', '.' + this.props.collectionPath, true
|
|
|
|
|
|
]));
|
|
|
|
|
|
|
|
|
|
|
|
prom_2 = prom_2.then(e => {
|
|
|
|
|
|
this.prepareRows(e.data[1]);
|
|
|
|
|
|
this.setState({ 'parsedStreams': (i + 1) });
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
return prom_2;
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
@@ -102,6 +119,8 @@ class WBCollectionContent extends Component { |
|
|
componentWillReceiveProps(nextProps) {
|
|
|
componentWillReceiveProps(nextProps) {
|
|
|
this.props = nextProps;
|
|
|
this.props = nextProps;
|
|
|
|
|
|
|
|
|
|
|
|
this.setState({ rows: maskRows(this.state.rows) });
|
|
|
|
|
|
|
|
|
const { manifestWorker, mode } = this.state;
|
|
|
const { manifestWorker, mode } = this.state;
|
|
|
const { collectionPath } = this.props;
|
|
|
const { collectionPath } = this.props;
|
|
|
|
|
|
|
|
|