Skip to content

Commit

Permalink
tweak(xod-client): more consistent snackbar messages
Browse files Browse the repository at this point in the history
  • Loading branch information
nkrkv committed Jul 6, 2018
1 parent 3683e18 commit d0d8b80
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 31 deletions.
4 changes: 2 additions & 2 deletions packages/xod-client-electron/src/shared/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ export const SAVE_ALL_SUCCEED = {

export const DEBUG_SESSION_STOPPED_ON_CHANGE = {
title: 'Debug session stopped',
note: 'Your Project has been changed.',
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.',
note: 'You closed the debugger tab.',
persistent: false,
};
export const DEBUG_LOST_CONNECTION = 'Lost connection with the device.';
Expand Down
2 changes: 1 addition & 1 deletion packages/xod-client-electron/test-func/pageObject.js
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ function waitUntilProjectSaved(client) {
return client.waitForExist('.SnackBarMessage*=Saved', 5000);
}
function waitUntilLibraryInstalled(client) {
return client.waitForExist('.SnackBarMessage*=installed', 10000);
return client.waitForExist('.SnackBarMessage*=Installed', 10000);
}

//-----------------------------------------------------------------------------
Expand Down
1 change: 0 additions & 1 deletion packages/xod-client/src/editor/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export const NODETYPE_ERROR_TYPES = {
export const LINK_ERRORS = {
SAME_DIRECTION: 'SAME_DIRECTION',
SAME_NODE: 'SAME_NODE',
UNKNOWN_ERROR: 'UNKNOWN_ERROR',
INCOMPATIBLE_TYPES: 'INCOMPATIBLE_TYPES',
};

Expand Down
13 changes: 9 additions & 4 deletions packages/xod-client/src/editor/messages.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
export const PATCH_FOR_NODE_IS_MISSING = 'Patch for this node is missing.';

export const libInstalled = (libName, version) => ({
title: `${libName} @ ${version} installed successfully`,
title: `Installed successfully`,
note: `${libName} version ${version} is now available in your project browser.`,
});

export const CLIPBOARD_RECURSION_PASTE_ERROR = {
title: 'Canʼt paste a patch into itself',
title: 'Cannot paste recursively',
note:
'You’re trying to add a node into its own implementation. That’s forbidden.',
persistent: false,
};
export const clipboardMissingPatchPasteError = missingPatches => ({
title: 'Canʼt paste',
note: `Canʼt find following patches: ${missingPatches}`,
title: 'Invalid paste',
note: `The clipboard contains references to missing patches: ${missingPatches}.`,
solution: 'Try to install libraries which provide the required patches.',
});

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 = {
Expand Down
36 changes: 20 additions & 16 deletions packages/xod-client/src/project/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,36 +9,40 @@ export const SUCCESSFULLY_PUBLISHED = {

export const LINK_ERRORS = {
[LE.SAME_DIRECTION]: {
title: 'Canʼt create link between pins of the same direction!',
title: 'Impossible link',
note: 'Links between pins of the same direction are not allowed.',
solution:
'Try creating a link between an input (pin on top) and output (pin at bottom)',
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,
title: 'No-no-no',
note:
'Links between pins of the same node are not allowed for historical reasons. ' +
'See: /~https://github.com/xodio/xod/issues/1328',
solution: 'Place xod/core/defer as a medium for a workaround.',
persistent: true,
},
[LE.INCOMPATIBLE_TYPES]: {
title: 'Incompatible pin types',
note: `No implicit cast exist to convert the output type to the input type.`,
solution: 'Try to find a node for the conversion and place it as a medium.',
persistent: false,
},
};

export const NODETYPE_ERRORS = {
[NTE.CANT_DELETE_USED_PATCHNODE]: {
title: 'Canʼt delete Patch',
note: 'Current Patch Node is used somewhere. You should remove it first!',
title: 'Patch in use',
note:
'You are trying to delete a patch used as a node somewhere on another patch.',
solution: 'Remove all patch nodes and try again.',
},
[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(' '),
title: 'Pin in use',
note:
'You are trying to delete a terminal which represents node pins which have links on other patches.',
solution: 'Delete all offending links first and try again.',
},
};

Expand Down
2 changes: 1 addition & 1 deletion packages/xod-client/src/projectBrowser/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import composeMessage from '../messages/composeMessage';

// eslint-disable-next-line import/prefer-default-export
export const PROJECT_BROWSER_ERRORS = {
PATCH_NAME_TAKEN: composeMessage('This patch name is already taken!'),
PATCH_NAME_TAKEN: composeMessage('Patch name already taken'),
INVALID_PATCH_NAME: composeMessage('Invalid patch name'),
INVALID_PROJECT_NAME: composeMessage('Invalid project name'),
};
27 changes: 21 additions & 6 deletions packages/xod-client/src/user/messages.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
import composeMessage from '../messages/composeMessage';
export const INCORRECT_CREDENTIALS = {
title: 'Incorrect username or password',
// TODO: button with dircet URL for password recovery
solution:
'Make sure you use the same credentials as on https://xod.io site. ' +
'If you forgot the password, open the site to recover',
};

export const INCORRECT_CREDENTIALS = composeMessage(
'Incorrect username or password'
);
export const SERVICE_UNAVAILABLE = composeMessage('Service unavailable');
export const LOG_IN_TO_CONTINUE = composeMessage('Please log in to continue');
export const SERVICE_UNAVAILABLE = {
title: 'Service unavailable',
note: 'Failed to complete a request to the XOD server.',
// TODO: button “Open XOD site”
solution:
'Make sure your internet connection is up and ' +
'https://xod.io site is allowed by your proxy or firewall.',
};

export const LOG_IN_TO_CONTINUE = {
title: 'Log in to continue',
// TODO: parametrize action
note: 'The action requires that you are signed in into your XOD account.',
};

0 comments on commit d0d8b80

Please sign in to comment.