Testing percentage indicator

This commit is contained in:
James Barnsley
2017-09-05 21:13:43 +12:00
parent 4bb3172e52
commit 0a956a3fdd
3 changed files with 14 additions and 8 deletions

View File

@ -39,12 +39,15 @@ export default class Notifications extends React.Component{
}
renderProcess(process){
var progress = ((process.data.total - process.data.remaining) / process.data.total * 100).toFixed()
switch (process.status){
case 'running':
return(
<div className="process notification" key={process.key}>
<div className="loader"></div>
{process.message}
{process.message} {progress ? progress+'%' : null}
<FontAwesome name="close" className="close-button" onClick={e => {this.props.uiActions.cancelProcess(process.key)}} />
</div>
)

View File

@ -503,6 +503,7 @@ const MopidyMiddleware = (function(){
query: action.query,
limit: action.limit,
total: uri_schemes_total,
remaining: uri_schemes.length,
uri_scheme: uri_scheme,
uri_schemes: uri_schemes
}
@ -524,16 +525,19 @@ const MopidyMiddleware = (function(){
return
}
// Update UI for this round
store.dispatch(uiActions.updateProcess(
'MOPIDY_GET_SEARCH_RESULTS_PROCESSOR',
'Searching '+action.data.uri_scheme.replace(':','')
))
// Construct our next batch's task
var next_uri_schemes = Object.assign([], action.data.uri_schemes)
var next_uri_scheme = next_uri_schemes.shift()
// Update UI for this round
store.dispatch(uiActions.updateProcess(
'MOPIDY_GET_SEARCH_RESULTS_PROCESSOR',
'Searching '+action.data.uri_scheme.replace(':',''),
{
remaining: next_uri_schemes.length,
}
))
switch (action.data.context){
// Albums

View File

@ -147,7 +147,6 @@ export default function reducer(mopidy = {}, action){
**/
case 'MOPIDY_CLEAR_SEARCH_RESULTS':
console.log(action)
return Object.assign({}, mopidy, { search_results: {} });
case 'MOPIDY_SEARCH_RESULTS_LOADED':