Skip to content
This repository has been archived by the owner on Aug 5, 2022. It is now read-only.

Commit

Permalink
### Version 0.6.0
Browse files Browse the repository at this point in the history
#### Features
- Add new entry rows after DBL dot Local discovers and downloads their metadata

#### Fixes
- Improved Search input performance
- Improved scroll bar performance when loading new entries
- Improved entry row selection (toggling tray menu)
- Filter out rows that are missing name (possibly loading_metadata)

(Merge branch 'refs/heads/v0.6.0')
  • Loading branch information
ericpyle committed May 31, 2018
2 parents 5817940 + 91a58e9 commit 398d4ff
Show file tree
Hide file tree
Showing 16 changed files with 569 additions and 348 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
### Version 0.6.0

#### Features
- Add new entry rows after DBL dot Local discovers and downloads their metadata

#### Fixes
- Improved Search input performance
- Improved scroll bar performance when loading new entries
- Improved entry row selection (toggling tray menu)
- Filter out rows that are missing name (possibly loading_metadata)

### Version 0.5.0

#### Features
Expand Down
63 changes: 35 additions & 28 deletions app/actions/bundle.actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@ export function setupBundlesEventSource(authentication) {
};
const listeners = {
'storer/execute_task': listenStorerExecuteTaskDownloadResources,
'storer/change_mode': (e) => listenStorerChangeMode(e, dispatch),
'storer/change_mode': listenStorerChangeMode,
'downloader/receiver': listenDownloaderReceiver,
'downloader/status': (e) => listenDownloaderStatus(e, dispatch),
'storer/delete_resource': (e) => listenStorerDeleteResource(e, dispatch),
'storer/update_from_download': listenStorerUpdateFromDownload,
'storer/update_from_download': (e) => listenStorerUpdateFromDownload(e, dispatch),
};
Object.keys(listeners).forEach((evType) => {
const handler = listeners[evType];
Expand All @@ -99,30 +99,22 @@ export function setupBundlesEventSource(authentication) {
}
};

function listenStorerExecuteTaskDownloadResources(e) {
console.log(e);
function listenStorerExecuteTaskDownloadResources() {
// console.log(e);
}

function listenStorerChangeMode(e, dispatch) {
console.log(e);
const data = JSON.parse(e.data);
const bundleId = data.args[0];
const mode = data.args[1];
if (mode === 'store') {
dispatch(updateStatus(bundleId, 'COMPLETED'));
}
}

function updateStatus(_id, status) {
return {
type: bundleConstants.UPDATE_STATUS,
id: _id,
status,
};
function listenStorerChangeMode() {
// console.log(e);
// const data = JSON.parse(e.data);
// const bundleId = data.args[0];
// const mode = data.args[1];
// if (mode === 'store') {
// dispatch(updateStatus(bundleId, 'COMPLETED'));
// }
}

function listenDownloaderReceiver(e) {
console.log(e);
function listenDownloaderReceiver() {
// console.log(e);
}

/* downloader/status
Expand All @@ -131,7 +123,7 @@ export function setupBundlesEventSource(authentication) {
* 'component': 'downloader', 'type': 'status'}}
*/
function listenDownloaderStatus(e, dispatch) {
console.log(e);
// console.log(e);
const data = JSON.parse(e.data);
const bundleId = data.args[0];
const resourcesDownloaded = data.args[1];
Expand All @@ -149,7 +141,7 @@ export function setupBundlesEventSource(authentication) {
}

function listenStorerDeleteResource(e, dispatch) {
console.log(e);
// console.log(e);
const data = JSON.parse(e.data);
const bundleId = data.args[0];
const resourceToRemove = data.args[1];
Expand All @@ -164,8 +156,23 @@ export function setupBundlesEventSource(authentication) {
};
}

function listenStorerUpdateFromDownload(e) {
console.log(e);
async function listenStorerUpdateFromDownload(e, dispatch) {
const data = JSON.parse(e.data);
const bundleId = data.args[0];
const apiBundle = await bundleService.fetchById(bundleId);
const fileInfoKeys = Object.keys(apiBundle.store.file_info);
if (fileInfoKeys.length === 1 && fileInfoKeys[0] === 'metadata.xml') {
// we just downloaded metadata.xml
const bundle = bundleService.convertApiBundleToNathanaelBundle(apiBundle);
dispatch(addBundle(bundle));
}
}

function addBundle(bundle) {
return {
type: bundleConstants.ADD_BUNDLE,
bundle
};
}
}

Expand Down Expand Up @@ -318,8 +325,8 @@ export function toggleModePauseResume(id) {
return { type: bundleConstants.TOGGLE_MODE_PAUSE_RESUME, id };
}

export function toggleSelectBundle(id) {
return { type: bundleConstants.TOGGLE_SELECT, id };
export function toggleSelectBundle(selectedBundle) {
return { type: bundleConstants.TOGGLE_SELECT, selectedBundle };
}

function getMockBundles() {
Expand Down
30 changes: 26 additions & 4 deletions app/actions/bundleFilter.actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { bundleFilterConstants } from '../constants/bundleFilter.constants';

export const bundleFilterActions = {
updateSearchInput,
addSearchMatch,
addSearchResults,
clearSearch
};

Expand Down Expand Up @@ -36,6 +36,11 @@ export function updateSearchInput(searchInput, bundles) {
textToHighlight})
*/
function updateAllSearchMatches(dispatch, searchableBundles, searchKeywords) {
let searchResults = {
chunks: {},
foundChunks: {},
bundlesMatching: {},
};
const chunksAcrossBundles = {};
searchableBundles.forEach((searchableBundle) => {
const chunksInBundle = {};
Expand All @@ -55,15 +60,32 @@ export function updateSearchInput(searchInput, bundles) {
}
});
if (Object.keys(matchesInBundle).length > 0) {
dispatch(addSearchMatch(searchableBundle, chunksInBundle, matchesInBundle));
searchResults = addSearchResults(searchResults, searchableBundle, chunksInBundle, matchesInBundle);
}
});
dispatch(updateSearchResults(searchResults));
}
}

export function addSearchMatch(bundle, chunks, matches) {
function addSearchResults(searchResults, bundle, chunks, matches) {
const oldBundlesMatching = searchResults.bundlesMatching;
const oldChunks = searchResults.chunks;
const oldMatches = searchResults.matches;
const key = bundle.id;
const newMatchingBundle = { [key]: bundle };
const newChunks = chunks;
const newMatches = matches;
return {
type: bundleFilterConstants.ADD_SEARCH_MATCH, bundle, chunks, matches
bundlesMatching: { ...oldBundlesMatching, ...newMatchingBundle },
chunks: { ...oldChunks, ...newChunks },
matches: { ...oldMatches, ...newMatches }
};
}


export function updateSearchResults(searchResults) {
return {
type: bundleFilterConstants.UPDATE_SEARCH_RESULTS, searchResults
};
}

Expand Down
Loading

0 comments on commit 398d4ff

Please sign in to comment.