mirror of
https://github.com/xodio/xod.git
synced 2026-03-11 19:26:53 +01:00
tweak(xod-client, xod-client-electron): make snack bar messages persistent by default
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import composeMessage from './composeMessage';
|
||||
import * as EVENTS from './events';
|
||||
|
||||
export const CODE_TRANSPILED =
|
||||
'Project was successfully transpiled. Searching for device...';
|
||||
@@ -14,22 +13,23 @@ export const ENUMERATING_PORTS = 'Enumerating...';
|
||||
export const ENUMERATING_BOARDS = 'Loading list of supported boards...';
|
||||
export const NO_PORTS_FOUND = 'No connected boards found';
|
||||
|
||||
export const SUCCESS = {
|
||||
[EVENTS.SAVE_ALL]: 'Saved successfully',
|
||||
export const SAVE_ALL_FAILED = {
|
||||
title: 'Failed to save project.',
|
||||
};
|
||||
export const SAVE_ALL_SUCCEED = {
|
||||
title: 'Saved successfully!',
|
||||
};
|
||||
|
||||
export const SAVE_ALL_PROCESSED = '';
|
||||
export const SAVE_ALL_FAILED = 'Failed to save project.';
|
||||
export const SAVE_ALL_SUCCEED = 'Saved successfully!';
|
||||
|
||||
export const DEBUG_SESSION_STOPPED_ON_CHANGE = composeMessage(
|
||||
'Debug session stopped',
|
||||
'Your Project has been changed.'
|
||||
);
|
||||
export const DEBUG_SESSION_STOPPED_ON_TAB_CLOSE = composeMessage(
|
||||
'Debug session stopped',
|
||||
'You closed Debugger tab.'
|
||||
);
|
||||
export const DEBUG_SESSION_STOPPED_ON_CHANGE = {
|
||||
title: 'Debug session stopped',
|
||||
note: 'Your Project has been changed.',
|
||||
persistent: false,
|
||||
};
|
||||
export const DEBUG_SESSION_STOPPED_ON_TAB_CLOSE = {
|
||||
title: 'Debug session stopped',
|
||||
note: 'You closed Debugger tab.',
|
||||
persistent: false,
|
||||
};
|
||||
export const DEBUG_LOST_CONNECTION = 'Lost connection with the device.';
|
||||
|
||||
export const updateAvailableMessage = version =>
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
export default {
|
||||
SUCCESS: 'Uploaded successfully',
|
||||
SUCCESS: {
|
||||
title: 'Uploaded successfully',
|
||||
},
|
||||
};
|
||||
|
||||
@@ -10,7 +10,6 @@ import {
|
||||
addConfirmation,
|
||||
addError,
|
||||
SAVE_ALL,
|
||||
composeMessage,
|
||||
} from 'xod-client';
|
||||
import * as EVENTS from '../shared/events';
|
||||
import * as MESSAGES from '../shared/messages';
|
||||
@@ -60,13 +59,13 @@ const processCompleted = finishProcess(successProcess);
|
||||
|
||||
const processFailed = finishProcess(failProcess);
|
||||
|
||||
export const createAsyncAction = ({
|
||||
const createAsyncAction = ({
|
||||
eventName,
|
||||
actionType,
|
||||
messages: {
|
||||
process: processMsg = '',
|
||||
complete: completeMsg = '',
|
||||
error: errorMsg = '',
|
||||
process: processMsg,
|
||||
complete: completeMsg,
|
||||
error: errorMsg,
|
||||
} = {},
|
||||
notify = true,
|
||||
silent = false,
|
||||
@@ -97,7 +96,7 @@ export const createAsyncAction = ({
|
||||
processCompleted({ processId, actionType, payload }, dispatch);
|
||||
}
|
||||
if (notify) {
|
||||
dispatch(addConfirmation(composeMessage(completeMsg)));
|
||||
dispatch(addConfirmation(completeMsg));
|
||||
}
|
||||
|
||||
onComplete(payload, dispatch);
|
||||
@@ -122,7 +121,7 @@ export const createAsyncAction = ({
|
||||
processFailed({ processId, actionType, payload: err }, dispatch);
|
||||
}
|
||||
if (notify) {
|
||||
dispatch(addError(composeMessage(errorMsg)));
|
||||
dispatch(addError(errorMsg));
|
||||
}
|
||||
|
||||
onError(err, dispatch);
|
||||
@@ -142,7 +141,7 @@ export const saveAll = createAsyncAction({
|
||||
eventName: EVENTS.SAVE_ALL,
|
||||
actionType: SAVE_ALL,
|
||||
messages: {
|
||||
process: MESSAGES.SAVE_ALL_PROCESSED,
|
||||
process: null,
|
||||
complete: MESSAGES.SAVE_ALL_SUCCEED,
|
||||
error: MESSAGES.SAVE_ALL_FAILED,
|
||||
},
|
||||
|
||||
@@ -14,7 +14,6 @@ export const subscribeAutoUpdaterEvents = (ipcRenderer, App) => {
|
||||
console.log('Update available: ', info); // eslint-disable-line no-console
|
||||
App.props.actions.addNotification(
|
||||
updateAvailableMessage(info.version),
|
||||
true,
|
||||
UPDATE_IDE_MESSAGE_ID
|
||||
);
|
||||
});
|
||||
|
||||
@@ -247,7 +247,7 @@ class App extends client.App {
|
||||
if (payload.success) {
|
||||
proc.success(payload.message);
|
||||
|
||||
this.props.actions.addConfirmation({ title: UPLOAD_MESSAGES.SUCCESS });
|
||||
this.props.actions.addConfirmation(UPLOAD_MESSAGES.SUCCESS);
|
||||
|
||||
if (debug) {
|
||||
foldEither(
|
||||
|
||||
@@ -8,6 +8,6 @@ export default () => next => action => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(err);
|
||||
|
||||
return next(addError(formatUnexpectedError(err), true));
|
||||
return next(addError(formatUnexpectedError(err)));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
import composeMessage from '../messages/composeMessage';
|
||||
|
||||
export const PATCH_FOR_NODE_IS_MISSING = 'Patch for this node is missing.';
|
||||
|
||||
export const libInstalled = (libName, version) =>
|
||||
composeMessage(`${libName} @ ${version} installed successfully`);
|
||||
export const libInstalled = (libName, version) => ({
|
||||
title: `${libName} @ ${version} installed successfully`,
|
||||
});
|
||||
|
||||
export const CLIPBOARD_RECURSION_PASTE_ERROR = composeMessage(
|
||||
'Canʼt paste a patch into itself'
|
||||
);
|
||||
export const clipboardMissingPatchPasteError = missingPatches =>
|
||||
composeMessage(
|
||||
'Canʼt paste',
|
||||
`Canʼt find following patches: ${missingPatches}`
|
||||
);
|
||||
export const CLIPBOARD_RECURSION_PASTE_ERROR = {
|
||||
title: 'Canʼt paste a patch into itself',
|
||||
persistent: false,
|
||||
};
|
||||
export const clipboardMissingPatchPasteError = missingPatches => ({
|
||||
title: 'Canʼt paste',
|
||||
note: `Canʼt find following patches: ${missingPatches}`,
|
||||
});
|
||||
|
||||
export const LIB_SUGGESTER_TYPE_TO_BEGIN =
|
||||
'Type owner/libname to find a library';
|
||||
export const LIB_SUGGESTER_NOTHING_FOUND = 'No library found';
|
||||
|
||||
export const NO_PATCH_TO_TRANSPILE = composeMessage(
|
||||
'No patch opened',
|
||||
'Open a patch to upload and try again'
|
||||
);
|
||||
export const NO_PATCH_TO_TRANSPILE = {
|
||||
title: 'No patch opened',
|
||||
solution: 'Open a patch to upload and try again',
|
||||
persistent: false,
|
||||
};
|
||||
|
||||
@@ -1,21 +1,23 @@
|
||||
import * as R from 'ramda';
|
||||
import * as ActionType from './actionTypes';
|
||||
import { MESSAGE_TYPE } from './constants';
|
||||
import { STATUS } from '../utils/constants';
|
||||
|
||||
const getTimestamp = () => new Date().getTime();
|
||||
|
||||
export const addMessage = (
|
||||
type,
|
||||
messageData,
|
||||
persistent = false,
|
||||
id = null
|
||||
) => ({
|
||||
const getDefaultPersistencyByType = R.equals(MESSAGE_TYPE.ERROR);
|
||||
|
||||
export const addMessage = (type, messageData, id = null) => ({
|
||||
type: ActionType.MESSAGE_ADD,
|
||||
payload: messageData,
|
||||
meta: {
|
||||
id,
|
||||
type,
|
||||
persistent,
|
||||
persistent: R.propOr(
|
||||
getDefaultPersistencyByType(type),
|
||||
'persistent',
|
||||
messageData
|
||||
),
|
||||
timestamp: getTimestamp(),
|
||||
status: STATUS.STARTED,
|
||||
},
|
||||
|
||||
@@ -1,35 +1,45 @@
|
||||
import composeMessage from '../messages/composeMessage';
|
||||
import {
|
||||
LINK_ERRORS as LE,
|
||||
NODETYPE_ERROR_TYPES as NTE,
|
||||
} from '../editor/constants';
|
||||
|
||||
export const SUCCESSFULLY_PUBLISHED = composeMessage('Library published');
|
||||
export const SUCCESSFULLY_PUBLISHED = {
|
||||
title: 'Library published',
|
||||
};
|
||||
|
||||
export const LINK_ERRORS = {
|
||||
[LE.SAME_DIRECTION]: composeMessage(
|
||||
'Canʼt create link between pins of the same direction!'
|
||||
),
|
||||
[LE.SAME_NODE]: composeMessage(
|
||||
'Canʼt create link between pins of the same node!'
|
||||
),
|
||||
[LE.UNKNOWN_ERROR]: composeMessage('Canʼt create link', 'Unknown error!'),
|
||||
[LE.INCOMPATIBLE_TYPES]: composeMessage('Incompatible pin types!'),
|
||||
[LE.SAME_DIRECTION]: {
|
||||
title: 'Canʼt create link between pins of the same direction!',
|
||||
persistent: false,
|
||||
},
|
||||
[LE.SAME_NODE]: {
|
||||
title: 'Canʼt create link between pins of the same node!',
|
||||
persistent: false,
|
||||
},
|
||||
[LE.UNKNOWN_ERROR]: {
|
||||
title: 'Canʼt create link',
|
||||
note: 'Unknown error!',
|
||||
persistent: false,
|
||||
},
|
||||
[LE.INCOMPATIBLE_TYPES]: {
|
||||
title: 'Incompatible pin types',
|
||||
persistent: false,
|
||||
},
|
||||
};
|
||||
|
||||
export const NODETYPE_ERRORS = {
|
||||
[NTE.CANT_DELETE_USED_PATCHNODE]: composeMessage(
|
||||
'Canʼt delete Patch',
|
||||
'Current Patch Node is used somewhere. You should remove it first!'
|
||||
),
|
||||
[NTE.CANT_DELETE_USED_PIN_OF_PATCHNODE]: composeMessage(
|
||||
'Canʼt delete Pin',
|
||||
[
|
||||
[NTE.CANT_DELETE_USED_PATCHNODE]: {
|
||||
title: 'Canʼt delete Patch',
|
||||
note: 'Current Patch Node is used somewhere. You should remove it first!',
|
||||
},
|
||||
[NTE.CANT_DELETE_USED_PIN_OF_PATCHNODE]: {
|
||||
title: 'Canʼt delete Pin',
|
||||
note: [
|
||||
'Current IO Node is represents a Pin of Patch Node.',
|
||||
'And it is used somewhere.',
|
||||
'You should remove a linkage first!',
|
||||
].join(' ')
|
||||
),
|
||||
].join(' '),
|
||||
},
|
||||
};
|
||||
|
||||
export const missingPatchForNode = patchPath =>
|
||||
|
||||
@@ -20,7 +20,6 @@ import { isAmong, notEquals, $Maybe, foldMaybe } from 'xod-func-tools';
|
||||
import * as ProjectActions from '../../project/actions';
|
||||
import * as ProjectBrowserActions from '../actions';
|
||||
import * as EditorActions from '../../editor/actions';
|
||||
import * as MessagesActions from '../../messages/actions';
|
||||
import * as PopupActions from '../../popups/actions';
|
||||
|
||||
import * as ProjectBrowserSelectors from '../selectors';
|
||||
@@ -451,7 +450,6 @@ const mapDispatchToProps = dispatch => ({
|
||||
|
||||
closeAllPopups: PopupActions.hideAllPopups,
|
||||
|
||||
addNotification: MessagesActions.addNotification,
|
||||
showLibSuggester: EditorActions.showLibSuggester,
|
||||
showHelpbox: EditorActions.showHelpbox,
|
||||
|
||||
|
||||
Reference in New Issue
Block a user