Simplifying processes
This commit is contained in:
@ -109902,6 +109902,8 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
||||
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
|
||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
|
||||
|
||||
|
||||
|
||||
@ -109923,15 +109925,34 @@ var Notifications = /*#__PURE__*/function (_React$Component) {
|
||||
var _super = _createSuper(Notifications);
|
||||
|
||||
function Notifications() {
|
||||
var _this;
|
||||
|
||||
_classCallCheck(this, Notifications);
|
||||
|
||||
return _super.apply(this, arguments);
|
||||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
_this = _super.call.apply(_super, [this].concat(args));
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "renderProcesses", function () {
|
||||
var processesObj = _this.props.processes;
|
||||
var processes = Object(_util_arrays__WEBPACK_IMPORTED_MODULE_10__["indexToArray"])(processesObj).filter(function (process) {
|
||||
return process.notification;
|
||||
});
|
||||
if (!processes) return null;
|
||||
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_0__["Fragment"], null, processes.map(function (process) {
|
||||
return _this.renderProcess(process);
|
||||
}));
|
||||
});
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
_createClass(Notifications, [{
|
||||
key: "importConfiguration",
|
||||
value: function importConfiguration(notification_key, configuration) {
|
||||
var _this = this;
|
||||
var _this2 = this;
|
||||
|
||||
if (configuration.ui) {
|
||||
this.props.uiActions.set(configuration.ui);
|
||||
@ -109944,7 +109965,7 @@ var Notifications = /*#__PURE__*/function (_React$Component) {
|
||||
if (configuration.snapcast) {
|
||||
this.props.snapcastActions.set(configuration.snapcast);
|
||||
setTimeout(function () {
|
||||
return _this.props.snapcastActions.connect();
|
||||
return _this2.props.snapcastActions.connect();
|
||||
}, 100);
|
||||
}
|
||||
|
||||
@ -109964,7 +109985,7 @@ var Notifications = /*#__PURE__*/function (_React$Component) {
|
||||
}, {
|
||||
key: "renderNotifications",
|
||||
value: function renderNotifications() {
|
||||
var _this2 = this;
|
||||
var _this3 = this;
|
||||
|
||||
if (!this.props.notifications || this.props.notifications.length <= 0) return null;
|
||||
var notifications = Object(_util_arrays__WEBPACK_IMPORTED_MODULE_10__["indexToArray"])(this.props.notifications);
|
||||
@ -110006,7 +110027,7 @@ var Notifications = /*#__PURE__*/function (_React$Component) {
|
||||
name: "close",
|
||||
className: "notification__close-button",
|
||||
onClick: function onClick(e) {
|
||||
return _this2.props.uiActions.removeNotification(notification.key, true);
|
||||
return _this3.props.uiActions.removeNotification(notification.key, true);
|
||||
},
|
||||
"data-qa-node": "Icon",
|
||||
"data-qa-file": "Notifications"
|
||||
@ -110081,7 +110102,7 @@ var Notifications = /*#__PURE__*/function (_React$Component) {
|
||||
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_Button__WEBPACK_IMPORTED_MODULE_13__["default"], {
|
||||
className: "notification__actions__item",
|
||||
onClick: function onClick() {
|
||||
return _this2.importConfiguration(notification.key, notification.configuration);
|
||||
return _this3.importConfiguration(notification.key, notification.configuration);
|
||||
},
|
||||
tracking: {
|
||||
category: 'ShareConfiguration',
|
||||
@ -110111,7 +110132,7 @@ var Notifications = /*#__PURE__*/function (_React$Component) {
|
||||
name: "close",
|
||||
className: "notification__close-button",
|
||||
onClick: function onClick() {
|
||||
return _this2.props.uiActions.removeNotification(notification.key, true);
|
||||
return _this3.props.uiActions.removeNotification(notification.key, true);
|
||||
},
|
||||
"data-qa-node": "Icon",
|
||||
"data-qa-file": "Notifications"
|
||||
@ -110153,9 +110174,8 @@ var Notifications = /*#__PURE__*/function (_React$Component) {
|
||||
}, {
|
||||
key: "renderProcess",
|
||||
value: function renderProcess(process) {
|
||||
var _process$data = process.data,
|
||||
total = _process$data.total,
|
||||
remaining = _process$data.remaining,
|
||||
var total = process.total,
|
||||
remaining = process.remaining,
|
||||
_process$level = process.level,
|
||||
level = _process$level === void 0 ? 'info' : _process$level,
|
||||
content = process.content,
|
||||
@ -110278,21 +110298,6 @@ var Notifications = /*#__PURE__*/function (_React$Component) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "renderProcesses",
|
||||
value: function renderProcesses() {
|
||||
var _this3 = this;
|
||||
|
||||
var _this$props$processes = this.props.processes,
|
||||
processesObj = _this$props$processes === void 0 ? {} : _this$props$processes;
|
||||
var processes = Object.keys(processesObj).map(function (key) {
|
||||
return processesObj[key];
|
||||
});
|
||||
if (!processes.length) return null;
|
||||
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_0__["Fragment"], null, processes.map(function (process) {
|
||||
return _this3.renderProcess(process);
|
||||
}));
|
||||
}
|
||||
}, {
|
||||
key: "render",
|
||||
value: function render() {
|
||||
@ -119508,14 +119513,32 @@ var GoogleMiddleware = function () {
|
||||
switch (action.type) {
|
||||
case 'GOOGLE_GET_LIBRARY_ALBUMS':
|
||||
{
|
||||
store.dispatch(uiActions.updateProcess(action.type, {
|
||||
notification: false
|
||||
}));
|
||||
request(store, 'library.browse', {
|
||||
uri: 'gmusic:album'
|
||||
}, function (browseResponse) {
|
||||
var allUris = Object(_util_arrays__WEBPACK_IMPORTED_MODULE_1__["arrayOf"])('uri', browseResponse);
|
||||
store.dispatch(uiActions.updateProcess('GOOGLE_GET_LIBRARY_ALBUMS', {
|
||||
remaining: allUris.length,
|
||||
total: allUris.length
|
||||
}));
|
||||
|
||||
var run = function run() {
|
||||
if (allUris.length) {
|
||||
var uris = allUris.splice(0, 5);
|
||||
var processor = store.getState().ui.processes[action.type];
|
||||
|
||||
if (processor && processor.status === 'cancelling') {
|
||||
store.dispatch(uiActions.processCancelled(action.type));
|
||||
store.dispatch(uiActions.stopLoading('google:library:artists'));
|
||||
return;
|
||||
}
|
||||
|
||||
store.dispatch(uiActions.updateProcess(action.type, {
|
||||
remaining: allUris.length
|
||||
}));
|
||||
request(store, 'library.lookup', {
|
||||
uris: uris
|
||||
}, function (lookupResponse) {
|
||||
@ -119536,6 +119559,7 @@ var GoogleMiddleware = function () {
|
||||
run();
|
||||
});
|
||||
} else {
|
||||
store.dispatch(uiActions.processFinished(action.type));
|
||||
store.dispatch(coreActions.libraryLoaded({
|
||||
uri: 'google:library:albums',
|
||||
items_uris: Object(_util_arrays__WEBPACK_IMPORTED_MODULE_1__["arrayOf"])('uri', allUris)
|
||||
@ -119550,17 +119574,13 @@ var GoogleMiddleware = function () {
|
||||
|
||||
case 'GOOGLE_GET_LIBRARY_ARTISTS':
|
||||
{
|
||||
store.dispatch(uiActions.updateProcess('GOOGLE_GET_LIBRARY_ARTISTS', Object(_locale__WEBPACK_IMPORTED_MODULE_3__["i18n"])('common.loading_library', {
|
||||
provider: Object(_locale__WEBPACK_IMPORTED_MODULE_3__["i18n"])('services.google.title'),
|
||||
type: Object(_locale__WEBPACK_IMPORTED_MODULE_3__["i18n"])('artist.title')
|
||||
})));
|
||||
store.dispatch(uiActions.updateProcess(action.type, {
|
||||
notification: false
|
||||
}));
|
||||
request(store, 'library.browse', {
|
||||
uri: 'gmusic:artist'
|
||||
}, function (browseResponse) {
|
||||
store.dispatch(uiActions.updateProcess('GOOGLE_GET_LIBRARY_ARTISTS', Object(_locale__WEBPACK_IMPORTED_MODULE_3__["i18n"])('common.loading_library', {
|
||||
provider: Object(_locale__WEBPACK_IMPORTED_MODULE_3__["i18n"])('services.google.title'),
|
||||
type: Object(_locale__WEBPACK_IMPORTED_MODULE_3__["i18n"])('artist.title')
|
||||
}), {
|
||||
store.dispatch(uiActions.updateProcess(action.type, {
|
||||
remaining: browseResponse.length,
|
||||
total: browseResponse.length
|
||||
}));
|
||||
@ -119568,17 +119588,15 @@ var GoogleMiddleware = function () {
|
||||
|
||||
var run = function run() {
|
||||
var uris = allUris.splice(0, 5);
|
||||
var processor = store.getState().ui.processes.GOOGLE_GET_LIBRARY_ARTISTS;
|
||||
var processor = store.getState().ui.processes[action.type];
|
||||
|
||||
if (processor && processor.status === 'cancelling') {
|
||||
store.dispatch(uiActions.processCancelled('GOOGLE_GET_LIBRARY_ARTISTS'));
|
||||
store.dispatch(uiActions.processCancelled(action.type));
|
||||
store.dispatch(uiActions.stopLoading('google:library:artists'));
|
||||
return;
|
||||
}
|
||||
|
||||
store.dispatch(uiActions.updateProcess('GOOGLE_GET_LIBRARY_ARTISTS', Object(_locale__WEBPACK_IMPORTED_MODULE_3__["i18n"])('common.loading_library', {
|
||||
provider: Object(_locale__WEBPACK_IMPORTED_MODULE_3__["i18n"])('services.google.title'),
|
||||
type: Object(_locale__WEBPACK_IMPORTED_MODULE_3__["i18n"])('artist.title')
|
||||
}), {
|
||||
store.dispatch(uiActions.updateProcess(action.type, {
|
||||
remaining: allUris.length
|
||||
}));
|
||||
|
||||
@ -119603,7 +119621,7 @@ var GoogleMiddleware = function () {
|
||||
run();
|
||||
});
|
||||
} else {
|
||||
store.dispatch(uiActions.processFinished('GOOGLE_GET_LIBRARY_ARTISTS'));
|
||||
store.dispatch(uiActions.processFinished(action.type));
|
||||
store.dispatch(coreActions.libraryLoaded({
|
||||
uri: 'google:library:artists',
|
||||
items_uris: Object(_util_arrays__WEBPACK_IMPORTED_MODULE_1__["arrayOf"])('uri', allUris)
|
||||
@ -122716,6 +122734,9 @@ var MopidyMiddleware = function () {
|
||||
*/
|
||||
|
||||
case 'MOPIDY_GET_LIBRARY_ARTISTS':
|
||||
store.dispatch(uiActions.startProcess('MOPIDY_GET_LIBRARY_ARTISTS', {
|
||||
notification: false
|
||||
}));
|
||||
request(store, 'library.browse', {
|
||||
uri: store.getState().mopidy.library_artists_uri
|
||||
}).then(function (raw_response) {
|
||||
@ -122732,17 +122753,25 @@ var MopidyMiddleware = function () {
|
||||
uri: 'mopidy:library:artists',
|
||||
items_uris: Object(_util_arrays__WEBPACK_IMPORTED_MODULE_7__["arrayOf"])('uri', response)
|
||||
}));
|
||||
store.dispatch(uiActions.processFinished('MOPIDY_GET_LIBRARY_ARTISTS'));
|
||||
});
|
||||
break;
|
||||
|
||||
case 'MOPIDY_GET_LIBRARY_PLAYLISTS':
|
||||
{
|
||||
store.dispatch(uiActions.startProcess('MOPIDY_GET_LIBRARY_PLAYLISTS', {
|
||||
notification: false
|
||||
}));
|
||||
request(store, 'playlists.asList').then(function (listResponse) {
|
||||
// Remove any Spotify playlists. These will be handled by our Spotify API
|
||||
var playlist_uris = Object(_util_arrays__WEBPACK_IMPORTED_MODULE_7__["arrayOf"])('uri', listResponse).filter(function (playlistUri) {
|
||||
return Object(_util_helpers__WEBPACK_IMPORTED_MODULE_5__["uriSource"])(playlistUri) !== 'spotify';
|
||||
});
|
||||
var libraryPlaylists = [];
|
||||
store.dispatch(uiActions.updateProcess('MOPIDY_GET_LIBRARY_PLAYLISTS', {
|
||||
total: playlist_uris.length,
|
||||
remaining: playlist_uris.length
|
||||
}));
|
||||
|
||||
if (playlist_uris.length) {
|
||||
playlist_uris.forEach(function (uri, index) {
|
||||
@ -122758,6 +122787,9 @@ var MopidyMiddleware = function () {
|
||||
// want these simple tracks because they don't contain duration, artist, etc.
|
||||
tracks_total: response.tracks ? response.tracks.length : null
|
||||
}));
|
||||
store.dispatch(uiActions.updateProcess('MOPIDY_GET_LIBRARY_PLAYLISTS', {
|
||||
remaining: playlist_uris.length - index - 1
|
||||
}));
|
||||
|
||||
if (index === playlist_uris.length - 1) {
|
||||
store.dispatch(coreActions.itemsLoaded(libraryPlaylists));
|
||||
@ -122765,21 +122797,30 @@ var MopidyMiddleware = function () {
|
||||
uri: 'mopidy:library:playlists',
|
||||
items_uris: Object(_util_arrays__WEBPACK_IMPORTED_MODULE_7__["arrayOf"])('uri', libraryPlaylists)
|
||||
}));
|
||||
store.dispatch(uiActions.processFinished('MOPIDY_GET_LIBRARY_PLAYLISTS'));
|
||||
}
|
||||
});
|
||||
});
|
||||
} else {
|
||||
store.dispatch(uiActions.stopLoading('mopidy:library:playlists'));
|
||||
store.dispatch(uiActions.processFinished('MOPIDY_GET_LIBRARY_PLAYLISTS'));
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
case 'MOPIDY_GET_LIBRARY_ALBUMS':
|
||||
store.dispatch(uiActions.startProcess('MOPIDY_GET_LIBRARY_ALBUMS', {
|
||||
notification: false
|
||||
}));
|
||||
request(store, 'library.browse', {
|
||||
uri: store.getState().mopidy.library_albums_uri
|
||||
}).then(function (response) {
|
||||
var uris = Object(_util_arrays__WEBPACK_IMPORTED_MODULE_7__["arrayOf"])('uri', response);
|
||||
store.dispatch(uiActions.updateProcess('MOPIDY_GET_LIBRARY_ALBUMS', {
|
||||
total: uris.length,
|
||||
remaining: uris.length
|
||||
}));
|
||||
request(store, 'library.lookup', {
|
||||
uris: uris
|
||||
}).then(function (response) {
|
||||
@ -122790,11 +122831,13 @@ var MopidyMiddleware = function () {
|
||||
last_modified: tracks[0].last_modified
|
||||
}, Object(_util_format__WEBPACK_IMPORTED_MODULE_6__["formatAlbum"])(tracks[0].album));
|
||||
});
|
||||
console.log('LOADED', response);
|
||||
store.dispatch(coreActions.itemsLoaded(libraryAlbums));
|
||||
store.dispatch(coreActions.libraryLoaded({
|
||||
uri: 'mopidy:library:albums',
|
||||
items_uris: Object(_util_arrays__WEBPACK_IMPORTED_MODULE_7__["arrayOf"])('uri', libraryAlbums)
|
||||
}));
|
||||
store.dispatch(uiActions.processFinished('MOPIDY_GET_LIBRARY_ALBUMS'));
|
||||
});
|
||||
});
|
||||
break;
|
||||
@ -126602,10 +126645,26 @@ function flushLibrary() {
|
||||
}
|
||||
function getLibraryPlaylists(forceRefetch) {
|
||||
return function (dispatch, getState) {
|
||||
var processKey = 'SPOTIFY_GET_LIBRARY_PLAYLISTS';
|
||||
dispatch(uiActions.updateProcess(processKey, {
|
||||
notification: false
|
||||
}));
|
||||
var libraryItems = [];
|
||||
|
||||
var fetchLibraryPlaylists = function fetchLibraryPlaylists(endpoint) {
|
||||
return request(dispatch, getState, endpoint).then(function (response) {
|
||||
var processor = getState().ui.processes[processKey];
|
||||
|
||||
if (processor && processor.status === 'cancelling') {
|
||||
dispatch(uiActions.processCancelled(processKey));
|
||||
dispatch(uiActions.stopLoading('spotify:library:albums'));
|
||||
return;
|
||||
}
|
||||
|
||||
dispatch(uiActions.updateProcess(processKey, {
|
||||
total: response.total,
|
||||
remaining: response.total - libraryItems.length
|
||||
}));
|
||||
var items = response.items.map(function (item) {
|
||||
return _objectSpread(_objectSpread({}, Object(_util_format__WEBPACK_IMPORTED_MODULE_3__["formatPlaylist"])(item)), {}, {
|
||||
in_library: true,
|
||||
@ -126617,6 +126676,7 @@ function getLibraryPlaylists(forceRefetch) {
|
||||
if (response.next) {
|
||||
fetchLibraryPlaylists("".concat(response.next).concat(forceRefetch ? "&refetch=".concat(Date.now()) : ''));
|
||||
} else {
|
||||
dispatch(uiActions.processFinished(processKey));
|
||||
dispatch(coreActions.itemsLoaded(libraryItems));
|
||||
dispatch(coreActions.libraryLoaded({
|
||||
uri: 'spotify:library:playlists',
|
||||
@ -126631,10 +126691,26 @@ function getLibraryPlaylists(forceRefetch) {
|
||||
}
|
||||
function getLibraryAlbums(forceRefetch) {
|
||||
return function (dispatch, getState) {
|
||||
var processKey = 'SPOTIFY_GET_LIBRARY_ALBUMS';
|
||||
dispatch(uiActions.updateProcess(processKey, {
|
||||
notification: false
|
||||
}));
|
||||
var libraryItems = [];
|
||||
|
||||
var fetchLibraryAlbums = function fetchLibraryAlbums(endpoint) {
|
||||
return request(dispatch, getState, endpoint).then(function (response) {
|
||||
var processor = getState().ui.processes[processKey];
|
||||
|
||||
if (processor && processor.status === 'cancelling') {
|
||||
dispatch(uiActions.processCancelled(processKey));
|
||||
dispatch(uiActions.stopLoading('spotify:library:albums'));
|
||||
return;
|
||||
}
|
||||
|
||||
dispatch(uiActions.updateProcess(processKey, {
|
||||
total: response.total,
|
||||
remaining: response.total - libraryItems.length
|
||||
}));
|
||||
var items = response.items.map(function (item) {
|
||||
return _objectSpread(_objectSpread({}, Object(_util_format__WEBPACK_IMPORTED_MODULE_3__["formatAlbum"])(item)), {}, {
|
||||
in_library: true
|
||||
@ -126645,6 +126721,7 @@ function getLibraryAlbums(forceRefetch) {
|
||||
if (response.next) {
|
||||
fetchLibraryAlbums("".concat(response.next).concat(forceRefetch ? "&refetch=".concat(Date.now()) : ''));
|
||||
} else {
|
||||
dispatch(uiActions.processFinished(processKey));
|
||||
dispatch(coreActions.itemsLoaded(libraryItems));
|
||||
dispatch(coreActions.libraryLoaded({
|
||||
uri: 'spotify:library:albums',
|
||||
@ -126659,10 +126736,26 @@ function getLibraryAlbums(forceRefetch) {
|
||||
}
|
||||
function getLibraryArtists(forceRefetch) {
|
||||
return function (dispatch, getState) {
|
||||
var processKey = 'SPOTIFY_GET_LIBRARY_ARTISTS';
|
||||
dispatch(uiActions.updateProcess(processKey, {
|
||||
notification: false
|
||||
}));
|
||||
var libraryItems = [];
|
||||
|
||||
var fetchLibraryArtists = function fetchLibraryArtists(endpoint) {
|
||||
return request(dispatch, getState, endpoint).then(function (response) {
|
||||
var processor = getState().ui.processes[processKey];
|
||||
|
||||
if (processor && processor.status === 'cancelling') {
|
||||
dispatch(uiActions.processCancelled(processKey));
|
||||
dispatch(uiActions.stopLoading('spotify:library:artists'));
|
||||
return;
|
||||
}
|
||||
|
||||
dispatch(uiActions.updateProcess(processKey, {
|
||||
total: response.artists.total,
|
||||
remaining: response.artists.total - libraryItems.length
|
||||
}));
|
||||
var items = response.artists.items.map(function (item) {
|
||||
return _objectSpread(_objectSpread({}, Object(_util_format__WEBPACK_IMPORTED_MODULE_3__["formatArtist"])(item)), {}, {
|
||||
in_library: true
|
||||
@ -126673,6 +126766,7 @@ function getLibraryArtists(forceRefetch) {
|
||||
if (response.next) {
|
||||
fetchLibraryArtists("".concat(response.next).concat(forceRefetch ? "&refetch=".concat(Date.now()) : ''));
|
||||
} else {
|
||||
dispatch(uiActions.processFinished(processKey));
|
||||
dispatch(coreActions.itemsLoaded(libraryItems));
|
||||
dispatch(coreActions.libraryLoaded({
|
||||
uri: 'spotify:library:artists',
|
||||
@ -127361,7 +127455,7 @@ function reducer() {
|
||||
/*!***************************************!*\
|
||||
!*** ./src/js/services/ui/actions.js ***!
|
||||
\***************************************/
|
||||
/*! exports provided: getBroadcasts, setWindowTitle, setCurrentTrackTransition, setSelectedTracks, showContextMenu, setSlimMode, setWindowFocus, setLanguage, hideContextMenu, removeContextMenu, showTouchContextMenu, hideTouchContextMenu, removeTouchContextMenu, lazyLoading, toggleSidebar, dragStart, dragActive, dragEnd, set, installPrompt, createBrowserNotification, createNotification, closeNotification, removeNotification, startLoading, stopLoading, startProcess, resumeProcess, updateProcess, runProcess, cancelProcess, processCancelled, processFinished, closeProcess, removeProcess */
|
||||
/*! exports provided: getBroadcasts, setWindowTitle, setCurrentTrackTransition, setSelectedTracks, showContextMenu, setSlimMode, setWindowFocus, setLanguage, hideContextMenu, removeContextMenu, showTouchContextMenu, hideTouchContextMenu, removeTouchContextMenu, lazyLoading, toggleSidebar, dragStart, dragActive, dragEnd, set, installPrompt, createBrowserNotification, createNotification, closeNotification, removeNotification, startLoading, stopLoading, startProcess, updateProcess, runProcess, cancelProcess, processCancelled, processFinished, closeProcess, removeProcess */
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
@ -127393,7 +127487,6 @@ __webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "startLoading", function() { return startLoading; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "stopLoading", function() { return stopLoading; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "startProcess", function() { return startProcess; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "resumeProcess", function() { return resumeProcess; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "updateProcess", function() { return updateProcess; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "runProcess", function() { return runProcess; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "cancelProcess", function() { return cancelProcess; });
|
||||
@ -127658,34 +127751,18 @@ function stopLoading(keys) {
|
||||
keys: Array.isArray(keys) ? keys : [keys]
|
||||
};
|
||||
}
|
||||
function startProcess(key, content) {
|
||||
var data = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
||||
var description = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
|
||||
function startProcess(key, process) {
|
||||
return {
|
||||
type: 'START_PROCESS',
|
||||
key: key,
|
||||
data: data,
|
||||
content: content,
|
||||
description: description
|
||||
process: process
|
||||
};
|
||||
}
|
||||
function resumeProcess(key) {
|
||||
return {
|
||||
type: 'RESUME_PROCESS',
|
||||
key: key
|
||||
};
|
||||
}
|
||||
function updateProcess(key, content) {
|
||||
var data = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
||||
var description = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
|
||||
var level = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 'info';
|
||||
function updateProcess(key, process) {
|
||||
return {
|
||||
type: 'UPDATE_PROCESS',
|
||||
key: key,
|
||||
content: content,
|
||||
data: data,
|
||||
description: description,
|
||||
level: level
|
||||
process: process
|
||||
};
|
||||
}
|
||||
function runProcess(key) {
|
||||
@ -127928,25 +128005,6 @@ var UIMiddleware = function () {
|
||||
next(action);
|
||||
break;
|
||||
|
||||
case 'START_PROCESS':
|
||||
store.dispatch({
|
||||
type: action.key,
|
||||
data: action.data
|
||||
});
|
||||
store.dispatch({
|
||||
type: "".concat(action.key, "_STARTED")
|
||||
});
|
||||
next(action);
|
||||
break;
|
||||
|
||||
case 'RESUME_PROCESS':
|
||||
store.dispatch({
|
||||
type: action.key,
|
||||
data: store.getState().ui.processes[action.key].data
|
||||
});
|
||||
next(action);
|
||||
break;
|
||||
|
||||
case 'PROCESS_CANCELLED':
|
||||
store.dispatch({
|
||||
type: "".concat(action.key, "_CANCELLED")
|
||||
@ -128237,110 +128295,99 @@ function reducer() {
|
||||
|
||||
case 'START_PROCESS':
|
||||
case 'UPDATE_PROCESS':
|
||||
var processes = _objectSpread({}, ui.processes || []);
|
||||
{
|
||||
var _processes = _objectSpread({}, ui.processes || []);
|
||||
|
||||
var last_run = processes[action.key];
|
||||
var status = 'running';
|
||||
|
||||
if (last_run) {
|
||||
var data = _objectSpread(_objectSpread({}, last_run.data), action.data);
|
||||
|
||||
if (action.type === 'UPDATE_PROCESS') status = last_run.status;
|
||||
} else {
|
||||
var data = action.data;
|
||||
}
|
||||
|
||||
processes[action.key] = {
|
||||
key: action.key,
|
||||
content: action.content,
|
||||
description: action.description,
|
||||
level: action.level,
|
||||
status: status,
|
||||
data: data
|
||||
};
|
||||
return _objectSpread(_objectSpread({}, ui), {}, {
|
||||
processes: processes
|
||||
});
|
||||
|
||||
case 'RESUME_PROCESS':
|
||||
var processes = _objectSpread({}, ui.processes ? ui.processes : {});
|
||||
|
||||
if (processes[action.key]) {
|
||||
processes[action.key] = _objectSpread(_objectSpread({}, processes[action.key]), {}, {
|
||||
status: 'running'
|
||||
_processes[action.key] = _objectSpread(_objectSpread(_objectSpread({
|
||||
key: action.key
|
||||
}, _processes[action.key] || {
|
||||
notification: true
|
||||
}), action.type === 'START_PROCESS' ? {
|
||||
status: 'running',
|
||||
remaining: 0,
|
||||
total: 0
|
||||
} : {}), action.process);
|
||||
return _objectSpread(_objectSpread({}, ui), {}, {
|
||||
processes: _processes
|
||||
});
|
||||
}
|
||||
|
||||
return _objectSpread(_objectSpread({}, ui), {}, {
|
||||
processes: processes
|
||||
});
|
||||
|
||||
case 'CANCEL_PROCESS':
|
||||
var processes = _objectSpread({}, ui.processes ? ui.processes : {});
|
||||
{
|
||||
var _processes2 = _objectSpread({}, ui.processes ? ui.processes : {});
|
||||
|
||||
if (processes[action.key]) {
|
||||
processes[action.key] = _objectSpread(_objectSpread({}, processes[action.key]), {}, {
|
||||
status: 'cancelling'
|
||||
if (_processes2[action.key]) {
|
||||
_processes2[action.key] = _objectSpread(_objectSpread({}, _processes2[action.key]), {}, {
|
||||
status: 'cancelling'
|
||||
});
|
||||
}
|
||||
|
||||
return _objectSpread(_objectSpread({}, ui), {}, {
|
||||
processes: _processes2
|
||||
});
|
||||
}
|
||||
|
||||
return _objectSpread(_objectSpread({}, ui), {}, {
|
||||
processes: processes
|
||||
});
|
||||
|
||||
case 'PROCESS_CANCELLED':
|
||||
var processes = _objectSpread({}, ui.processes ? ui.processes : {});
|
||||
{
|
||||
var processes = _objectSpread({}, ui.processes ? ui.processes : {});
|
||||
|
||||
if (processes[action.key]) {
|
||||
processes[action.key] = _objectSpread(_objectSpread({}, processes[action.key]), {}, {
|
||||
status: 'cancelled'
|
||||
if (processes[action.key]) {
|
||||
processes[action.key] = _objectSpread(_objectSpread({}, processes[action.key]), {}, {
|
||||
status: 'cancelled'
|
||||
});
|
||||
}
|
||||
|
||||
return _objectSpread(_objectSpread({}, ui), {}, {
|
||||
processes: processes
|
||||
});
|
||||
}
|
||||
|
||||
return _objectSpread(_objectSpread({}, ui), {}, {
|
||||
processes: processes
|
||||
});
|
||||
|
||||
case 'PROCESS_FINISHED':
|
||||
var processes = _objectSpread({}, ui.processes ? ui.processes : {});
|
||||
{
|
||||
var processes = _objectSpread({}, ui.processes ? ui.processes : {});
|
||||
|
||||
if (processes[action.key]) {
|
||||
processes[action.key] = _objectSpread(_objectSpread({}, processes[action.key]), {}, {
|
||||
status: 'finished'
|
||||
if (processes[action.key]) {
|
||||
processes[action.key] = _objectSpread(_objectSpread({}, processes[action.key]), {}, {
|
||||
status: 'finished'
|
||||
});
|
||||
}
|
||||
|
||||
return _objectSpread(_objectSpread({}, ui), {}, {
|
||||
processes: processes
|
||||
});
|
||||
}
|
||||
|
||||
return _objectSpread(_objectSpread({}, ui), {}, {
|
||||
processes: processes
|
||||
});
|
||||
|
||||
case 'CLOSE_PROCESS':
|
||||
var processes = _objectSpread({}, ui.processes ? ui.processes : {});
|
||||
{
|
||||
var processes = _objectSpread({}, ui.processes ? ui.processes : {});
|
||||
|
||||
if (processes[action.key]) {
|
||||
processes[action.key] = _objectSpread(_objectSpread({}, processes[action.key]), {}, {
|
||||
closing: true
|
||||
if (processes[action.key]) {
|
||||
processes[action.key] = _objectSpread(_objectSpread({}, processes[action.key]), {}, {
|
||||
closing: true
|
||||
});
|
||||
}
|
||||
|
||||
return _objectSpread(_objectSpread({}, ui), {}, {
|
||||
processes: processes
|
||||
});
|
||||
}
|
||||
|
||||
return _objectSpread(_objectSpread({}, ui), {}, {
|
||||
processes: processes
|
||||
});
|
||||
|
||||
case 'REMOVE_PROCESS':
|
||||
var processes = _objectSpread({}, ui.processes ? ui.processes : {});
|
||||
{
|
||||
var processes = _objectSpread({}, ui.processes ? ui.processes : {});
|
||||
|
||||
if (processes[action.key]) {
|
||||
processes[action.key] = _objectSpread(_objectSpread({}, processes[action.key]), {}, {
|
||||
status: 'completed',
|
||||
closing: false
|
||||
if (processes[action.key]) {
|
||||
processes[action.key] = _objectSpread(_objectSpread({}, processes[action.key]), {}, {
|
||||
status: 'completed',
|
||||
closing: false
|
||||
});
|
||||
}
|
||||
|
||||
return _objectSpread(_objectSpread({}, ui), {}, {
|
||||
processes: processes
|
||||
});
|
||||
}
|
||||
|
||||
return _objectSpread(_objectSpread({}, ui), {}, {
|
||||
processes: processes
|
||||
});
|
||||
|
||||
case 'SUPPRESS_BROADCAST':
|
||||
return _objectSpread(_objectSpread({}, ui), {}, {
|
||||
suppressed_broadcasts: [].concat(_toConsumableArray(ui.suppressed_broadcasts || []), [action.key])
|
||||
@ -133174,7 +133221,7 @@ console.warn('WARN: note that setting Flac.onready handler after Flac.isReady()
|
||||
/*!**********************************!*\
|
||||
!*** ./src/js/util/selectors.js ***!
|
||||
\**********************************/
|
||||
/*! exports provided: getItem, getLibrary, getGridGlowEnabled, makeItemSelector, makeLibrarySelector, makeLoadingSelector, makeSearchResultsSelector, queueHistorySelector */
|
||||
/*! exports provided: getItem, getLibrary, getGridGlowEnabled, makeItemSelector, makeLibrarySelector, makeLoadingSelector, makeSearchResultsSelector, makeProcessProgressSelector, queueHistorySelector */
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
@ -133186,6 +133233,7 @@ __webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "makeLibrarySelector", function() { return makeLibrarySelector; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "makeLoadingSelector", function() { return makeLoadingSelector; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "makeSearchResultsSelector", function() { return makeSearchResultsSelector; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "makeProcessProgressSelector", function() { return makeProcessProgressSelector; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "queueHistorySelector", function() { return queueHistorySelector; });
|
||||
/* harmony import */ var reselect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! reselect */ "./node_modules/reselect/es/index.js");
|
||||
/* harmony import */ var _arrays__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./arrays */ "./src/js/util/arrays.js");
|
||||
@ -133224,6 +133272,10 @@ var getLoadQueue = function getLoadQueue(state) {
|
||||
return state.ui.load_queue;
|
||||
};
|
||||
|
||||
var getProcesses = function getProcesses(state) {
|
||||
return state.ui.processes;
|
||||
};
|
||||
|
||||
var getLibrary = function getLibrary(state, uri) {
|
||||
return state.core.libraries[uri];
|
||||
};
|
||||
@ -133282,6 +133334,25 @@ var makeSearchResultsSelector = function makeSearchResultsSelector(term, type) {
|
||||
});
|
||||
};
|
||||
|
||||
var makeProcessProgressSelector = function makeProcessProgressSelector(keys) {
|
||||
return Object(reselect__WEBPACK_IMPORTED_MODULE_0__["createSelector"])([getProcesses], function (processes) {
|
||||
var selectedProcesses = keys.map(function (key) {
|
||||
return processes[key] || {};
|
||||
});
|
||||
var total = 0;
|
||||
var remaining = 0;
|
||||
selectedProcesses.forEach(function (process) {
|
||||
if (process.total) total += process.total;
|
||||
if (process.remaining) remaining += process.remaining;
|
||||
});
|
||||
console.log({
|
||||
total: total,
|
||||
remaining: remaining
|
||||
});
|
||||
return total && remaining ? ((total - remaining) / total).toFixed(4) : 0;
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
/***/ }),
|
||||
@ -141218,16 +141289,19 @@ var LibraryAlbums = /*#__PURE__*/function (_React$Component) {
|
||||
sort = _this$props6.sort,
|
||||
sort_reverse = _this$props6.sort_reverse,
|
||||
view = _this$props6.view,
|
||||
loading = _this$props6.loading;
|
||||
loading = _this$props6.loading,
|
||||
loading_progress = _this$props6.loading_progress;
|
||||
var _this$state2 = _this.state,
|
||||
limit = _this$state2.limit,
|
||||
filter = _this$state2.filter;
|
||||
var albums = _this.props.albums;
|
||||
|
||||
if (loading) {
|
||||
console.log(loading_progress);
|
||||
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_components_Loader__WEBPACK_IMPORTED_MODULE_18__["default"], {
|
||||
body: true,
|
||||
loading: true,
|
||||
progress: loading_progress,
|
||||
"data-qa-node": "Loader",
|
||||
"data-qa-file": "LibraryAlbums"
|
||||
});
|
||||
@ -141490,8 +141564,10 @@ var mapStateToProps = function mapStateToProps(state) {
|
||||
if (source === 'all' || source === 'spotify') libraryUris.push('spotify:library:albums');
|
||||
if (source === 'all' || source === 'google') libraryUris.push('google:library:albums');
|
||||
var librarySelector = Object(_util_selectors__WEBPACK_IMPORTED_MODULE_19__["makeLibrarySelector"])(libraryUris);
|
||||
var processProgressSelector = Object(_util_selectors__WEBPACK_IMPORTED_MODULE_19__["makeProcessProgressSelector"])(['MOPIDY_GET_LIBRARY_ALBUMS', 'SPOTIFY_GET_LIBRARY_ALBUMS', 'GOOGLE_GET_LIBRARY_ALBUMS']);
|
||||
return {
|
||||
loading: loadingSelector(state),
|
||||
loading_progress: processProgressSelector(state),
|
||||
mopidy_uri_schemes: state.mopidy.uri_schemes,
|
||||
albums: librarySelector(state),
|
||||
google_available: state.mopidy.uri_schemes && state.mopidy.uri_schemes.includes('gmusic:'),
|
||||
@ -141703,7 +141779,8 @@ var LibraryArtists = /*#__PURE__*/function (_React$Component) {
|
||||
sort = _this$props5.sort,
|
||||
sort_reverse = _this$props5.sort_reverse,
|
||||
view = _this$props5.view,
|
||||
loading = _this$props5.loading;
|
||||
loading = _this$props5.loading,
|
||||
loading_progress = _this$props5.loading_progress;
|
||||
var _this$state = _this.state,
|
||||
limit = _this$state.limit,
|
||||
filter = _this$state.filter;
|
||||
@ -141713,6 +141790,7 @@ var LibraryArtists = /*#__PURE__*/function (_React$Component) {
|
||||
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_components_Loader__WEBPACK_IMPORTED_MODULE_15__["default"], {
|
||||
body: true,
|
||||
loading: true,
|
||||
progress: loading_progress,
|
||||
"data-qa-node": "Loader",
|
||||
"data-qa-file": "LibraryArtists"
|
||||
});
|
||||
@ -141964,7 +142042,9 @@ var mapStateToProps = function mapStateToProps(state) {
|
||||
if (source === 'all' || source === 'spotify') libraryUris.push('spotify:library:artists');
|
||||
if (source === 'all' || source === 'google') libraryUris.push('google:library:artists');
|
||||
var librarySelector = Object(_util_selectors__WEBPACK_IMPORTED_MODULE_16__["makeLibrarySelector"])(libraryUris);
|
||||
var processProgressSelector = Object(_util_selectors__WEBPACK_IMPORTED_MODULE_16__["makeProcessProgressSelector"])(['MOPIDY_GET_LIBRARY_ARTISTS', 'SPOTIFY_GET_LIBRARY_ARTISTS', 'GOOGLE_GET_LIBRARY_ARTISTS']);
|
||||
return {
|
||||
loading_progress: processProgressSelector(state),
|
||||
mopidy_uri_schemes: state.mopidy.uri_schemes,
|
||||
google_available: state.mopidy.uri_schemes && state.mopidy.uri_schemes.includes('gmusic:'),
|
||||
spotify_available: state.spotify.access_token,
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -106,7 +106,7 @@
|
||||
|
||||
// Release details
|
||||
// These are automatically injected to built HTML
|
||||
var build = "1603129371";
|
||||
var build = "1603178804";
|
||||
var version = "3.53.0";
|
||||
|
||||
// Construct the script tag
|
||||
|
||||
Reference in New Issue
Block a user