diff --git a/src/js/components/Notifications.js b/src/js/components/Notifications.js index 920fe540..a9817da0 100755 --- a/src/js/components/Notifications.js +++ b/src/js/components/Notifications.js @@ -41,13 +41,18 @@ export default class Notifications extends React.Component{ renderProcess(process){ var progress = ((process.data.total - process.data.remaining) / process.data.total * 100).toFixed() + if (isNaN(progress)){ + progress = 0 + } switch (process.status){ case 'running': return(
-
- {process.message} {progress ? progress+'%' : null} +
+
+
+ {process.message} {this.props.uiActions.cancelProcess(process.key)}} />
) diff --git a/src/js/services/mopidy/middleware.js b/src/js/services/mopidy/middleware.js index 275206dc..d4715097 100755 --- a/src/js/services/mopidy/middleware.js +++ b/src/js/services/mopidy/middleware.js @@ -1186,7 +1186,15 @@ const MopidyMiddleware = (function(){ }); // Start our process to load the full album objects - store.dispatch(uiActions.startProcess('MOPIDY_LIBRARY_ALBUMS_PROCESSOR','Loading '+uris.length+' local albums', {uris: uris})) + store.dispatch(uiActions.startProcess( + 'MOPIDY_LIBRARY_ALBUMS_PROCESSOR', + 'Loading '+uris.length+' local albums', + { + uris: uris, + total: uris.length, + remaining: uris.length + } + )) }) } else if (last_run.status == 'cancelled'){ @@ -1211,7 +1219,14 @@ const MopidyMiddleware = (function(){ var uris_to_load = uris.splice(0,50) if (uris_to_load.length > 0){ - store.dispatch(uiActions.updateProcess('MOPIDY_LIBRARY_ALBUMS_PROCESSOR', 'Loading '+uris.length+' local albums', {uris: uris})) + store.dispatch(uiActions.updateProcess( + 'MOPIDY_LIBRARY_ALBUMS_PROCESSOR', + 'Loading '+uris.length+' local albums', + { + uris: uris, + remaining: uris.length + } + )) store.dispatch(mopidyActions.getAlbums(uris_to_load, {name: 'MOPIDY_LIBRARY_ALBUMS_PROCESSOR', data: {uris: uris}})) } else { store.dispatch(uiActions.processFinished('MOPIDY_LIBRARY_ALBUMS_PROCESSOR')) diff --git a/src/js/services/spotify/actions.js b/src/js/services/spotify/actions.js index 081674a4..08883fa4 100755 --- a/src/js/services/spotify/actions.js +++ b/src/js/services/spotify/actions.js @@ -1372,7 +1372,15 @@ export function getLibraryPlaylistsProcessor(data){ var total = response.total var loaded = getState().spotify.library_playlists.length var remaining = total - loaded - dispatch(uiActions.updateProcess('SPOTIFY_GET_LIBRARY_PLAYLISTS_PROCESSOR', 'Loading '+remaining+' Spotify playlists', {next: response.next})) + dispatch(uiActions.updateProcess( + 'SPOTIFY_GET_LIBRARY_PLAYLISTS_PROCESSOR', + 'Loading '+remaining+' Spotify playlists', + { + next: response.next, + total: response.total, + remaining: remaining + } + )) dispatch(uiActions.runProcess('SPOTIFY_GET_LIBRARY_PLAYLISTS_PROCESSOR', {next: response.next})) } else { dispatch(uiActions.processFinished('SPOTIFY_GET_LIBRARY_PLAYLISTS_PROCESSOR')) @@ -1425,7 +1433,15 @@ export function getLibraryArtistsProcessor(data){ var total = response.artists.total var loaded = getState().spotify.library_artists.length var remaining = total - loaded - dispatch(uiActions.updateProcess('SPOTIFY_GET_LIBRARY_ARTISTS_PROCESSOR', 'Loading '+remaining+' Spotify artists', {next: response.artists.next})) + dispatch(uiActions.updateProcess( + 'SPOTIFY_GET_LIBRARY_ARTISTS_PROCESSOR', + 'Loading '+remaining+' Spotify artists', + { + next: response.artists.next, + total: response.artists.total, + remaining: remaining + } + )) dispatch(uiActions.runProcess('SPOTIFY_GET_LIBRARY_ARTISTS_PROCESSOR', {next: response.artists.next})) } else { dispatch(uiActions.processFinished('SPOTIFY_GET_LIBRARY_ARTISTS_PROCESSOR')) @@ -1478,7 +1494,15 @@ export function getLibraryAlbumsProcessor(data){ var total = response.total var loaded = getState().spotify.library_albums.length var remaining = total - loaded - dispatch(uiActions.updateProcess('SPOTIFY_GET_LIBRARY_ALBUMS_PROCESSOR', 'Loading '+remaining+' Spotify albums', {next: response.next})) + dispatch(uiActions.updateProcess( + 'SPOTIFY_GET_LIBRARY_ALBUMS_PROCESSOR', + 'Loading '+remaining+' Spotify albums', + { + next: response.next, + total: response.total, + remaining: remaining + } + )) dispatch(uiActions.runProcess('SPOTIFY_GET_LIBRARY_ALBUMS_PROCESSOR', {next: response.next})) } else { dispatch(uiActions.processFinished('SPOTIFY_GET_LIBRARY_ALBUMS_PROCESSOR')) diff --git a/src/js/views/Debug.js b/src/js/views/Debug.js index 33fd09c4..72da664b 100755 --- a/src/js/views/Debug.js +++ b/src/js/views/Debug.js @@ -113,7 +113,7 @@ class Debug extends React.Component{
this.props.uiActions.createNotification('Test notification')}>Create notification - this.props.uiActions.startProcess('test_process', 'Test process')}>Start process + this.props.uiActions.startProcess('test_process', 'Test process', {total: 100, remaining: 76})}>Start process this.props.uiActions.processFinished('test_process')}>Stop process
diff --git a/src/scss/components/_notifications.scss b/src/scss/components/_notifications.scss index 9bdc802d..f362fbdb 100755 --- a/src/scss/components/_notifications.scss +++ b/src/scss/components/_notifications.scss @@ -76,7 +76,9 @@ position: absolute; top: 16px; left: 18px; - opacity: 1; + opacity: 1; + z-index: 2; + border-radius: 50%; &:before { border-color: transparent; @@ -85,6 +87,18 @@ &:after { border-right-color: $white; } + + .progress { + background: $light_blue; + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + border: 0px solid $blue; + box-sizing: border-box; + border-radius: 50%; + } } } } diff --git a/src/scss/global/_core.scss b/src/scss/global/_core.scss index d10086f4..97c52014 100755 --- a/src/scss/global/_core.scss +++ b/src/scss/global/_core.scss @@ -262,6 +262,10 @@ button.placeholder { @include clearfix; } +.hidden { + display: none !important; +} + .pulse { @include pulse(); } .one-liner { @include one_line_text; } .centred-text { text-align: center; } diff --git a/src/scss/global/_variables.scss b/src/scss/global/_variables.scss index a5e9bea8..950af4c8 100755 --- a/src/scss/global/_variables.scss +++ b/src/scss/global/_variables.scss @@ -13,6 +13,7 @@ $black: #000000; $red: #cf2d2d; $green: #47af2a; $blue: #32b5f2; +$light_blue: #96cfea; $yellow: #FFF39C; $orange: #f16f19; $overlay_dark: rgba(0, 0, 0, 0.88);