Theoretical handling of system task updates; stdout straight to logger

This commit is contained in:
James Barnsley
2020-01-17 23:14:43 +13:00
parent 0e15a8745e
commit 169396042a
11 changed files with 7788 additions and 54 deletions

View File

@ -116,6 +116,9 @@ const PusherMiddleware = (function () {
case 'local_scan_started':
store.dispatch(uiActions.updateProcess('local_scan', 'Scanning local library'));
break;
case 'local_scan_updated':
store.dispatch(uiActions.updateProcess('local_scan', 'Scanning local library', {}, message.params.output));
break;
case 'local_scan_finished':
store.dispatch(uiActions.processFinished('local_scan'));
store.dispatch(uiActions.createNotification({
@ -124,7 +127,7 @@ const PusherMiddleware = (function () {
break;
case 'local_scan_error':
store.dispatch(uiActions.processFinished('local_scan'));
store.dispatch(uiActions.createNotification({ type: 'bad', content: message.params.message, description: message.params.error }));
store.dispatch(coreActions.handleException('Local scan failed', message, message.params.error));
break;
// Upgrade
@ -136,7 +139,7 @@ const PusherMiddleware = (function () {
break;
case 'upgrade_error':
store.dispatch(uiActions.processFinished('upgrade'));
store.dispatch(uiActions.createNotification({ type: 'bad', content: message.params.message, description: message.params.error }));
store.dispatch(coreActions.handleException('Upgrade failed', message, message.params.error));
break;
// Restart
@ -146,7 +149,7 @@ const PusherMiddleware = (function () {
break;
case 'restart_error':
store.dispatch(uiActions.processFinished('upgrade'));
store.dispatch(uiActions.createNotification({ type: 'bad', content: message.params.message, description: message.params.error }));
store.dispatch(coreActions.handleException('Restart failed', message, message.params.error));
break;
// Test

View File

@ -32,7 +32,7 @@ export function setSelectedTracks(keys = []) {
};
}
export function showContextMenu(data) {
export function showContextMenu(data) {
// Touchend
if (data.e.changedTouches) {
data.position_x = data.e.changedTouches[0].clientX;
@ -165,7 +165,7 @@ export function createBrowserNotification(data) {
};
}
export function createNotification(data) {
export function createNotification(data) {
// Allow 'message' as an alias of our content
if (data.message) {
data.content = data.message;
@ -228,12 +228,13 @@ export function stopLoading(key) {
};
}
export function startProcess(key, message, data = {}) {
export function startProcess(key, message, data = {}, description = null) {
return {
type: 'START_PROCESS',
key,
message,
data,
description,
};
}
@ -244,12 +245,13 @@ export function resumeProcess(key, message, data = {}) {
};
}
export function updateProcess(key, message, data = {}) {
export function updateProcess(key, message, data = {}, description = null) {
return {
type: 'UPDATE_PROCESS',
key,
message,
data,
description,
};
}

View File

@ -2,7 +2,7 @@
import * as helpers from '../../helpers';
export default function reducer(ui = {}, action) {
switch (action.type) {
switch (action.type) {
case 'LAZY_LOADING':
return { ...ui, lazy_loading: action.start };
@ -81,8 +81,8 @@ export default function reducer(ui = {}, action) {
* */
case 'DRAG_START':
return {
...ui,
return {
...ui,
dragger: {
dragging: true,
active: false,
@ -92,7 +92,7 @@ export default function reducer(ui = {}, action) {
victims_indexes: action.victims_indexes,
start_x: action.start_x,
start_y: action.start_y,
},
},
};
case 'DRAG_ACTIVE':
@ -163,6 +163,7 @@ export default function reducer(ui = {}, action) {
processes[action.key] = {
key: action.key,
message: action.message,
description: action.description,
status: 'running',
data,
};