PromucFlow_constructor/app/client/src/ce/constants/messages.test.ts

422 lines
11 KiB
TypeScript
Raw Normal View History

import {
ARE_YOU_SURE,
2022-03-02 13:42:06 +00:00
CANNOT_MERGE_DUE_TO_UNCOMMITTED_CHANGES,
CANNOT_PULL_WITH_LOCAL_UNCOMMITTED_CHANGES,
CHANGES_ONLY_MIGRATION,
CHANGES_ONLY_USER,
CHANGES_USER_AND_MIGRATION,
2022-03-02 13:42:06 +00:00
COMMIT_AND_PUSH,
COMMIT_CHANGES,
COMMIT_TO,
COMMITTING_AND_PUSHING_CHANGES,
2022-03-02 13:42:06 +00:00
CONNECT_BTN_LABEL,
CONNECT_GIT,
CONNECT_GIT_BETA,
2022-03-10 09:19:23 +00:00
CONNECT_TO_GIT,
CONNECT_TO_GIT_SUBTITLE,
2022-03-02 13:42:06 +00:00
CONTACT_SUPPORT,
CONTACT_SUPPORT_TO_UPGRADE,
COPIED_SSH_KEY,
COPY_SSH_KEY,
CREATE_NEW_BRANCH,
2022-03-02 13:42:06 +00:00
createMessage,
2022-03-10 09:19:23 +00:00
DEPLOY,
2022-03-02 13:42:06 +00:00
DEPLOY_KEY_USAGE_GUIDE_MESSAGE,
DISCARD_CHANGES,
DISCARD_CHANGES_WARNING,
DISCARD_SUCCESS,
DISCARDING_AND_PULLING_CHANGES,
2022-03-02 13:42:06 +00:00
DISCONNECT,
DISCONNECT_CAUSE_APPLICATION_BREAK,
DISCONNECT_EXISTING_REPOSITORIES,
DISCONNECT_EXISTING_REPOSITORIES_INFO,
DISCONNECT_GIT,
ERROR_GIT_AUTH_FAIL,
ERROR_GIT_INVALID_REMOTE,
ERROR_WHILE_PULLING_CHANGES,
2022-03-02 13:42:06 +00:00
ERROR_WIDGET_COPY_NOT_ALLOWED,
FETCH_GIT_STATUS,
FETCH_MERGE_STATUS,
FETCH_MERGE_STATUS_FAILURE,
2022-03-02 13:42:06 +00:00
GENERATE_KEY,
GIT_COMMIT_MESSAGE_PLACEHOLDER,
GIT_CONFLICTING_INFO,
2022-03-10 09:19:23 +00:00
GIT_CONNECTION,
2022-03-02 13:42:06 +00:00
GIT_DISCONNECTION_SUBMENU,
2022-03-10 09:19:23 +00:00
GIT_SETTINGS,
2022-03-02 13:42:06 +00:00
GIT_UPSTREAM_CHANGES,
GIT_USER_UPDATED_SUCCESSFULLY,
IMPORT_APP_FROM_FILE_MESSAGE,
IMPORT_APP_FROM_GIT_MESSAGE,
IMPORT_FROM_GIT_REPOSITORY,
IMPORTING_APP_FROM_GIT,
2022-03-02 13:42:06 +00:00
INVALID_USER_DETAILS_MSG,
IS_MERGING,
2022-03-10 09:19:23 +00:00
MERGE,
2022-03-02 13:42:06 +00:00
MERGE_CHANGES,
MERGE_CONFLICT_ERROR,
MERGED_SUCCESSFULLY,
2022-03-02 13:42:06 +00:00
NO_MERGE_CONFLICT,
NONE_REVERSIBLE_MESSAGE,
PASTE_SSH_URL_INFO,
PULL_CHANGES,
REGENERATE_KEY_CONFIRM_MESSAGE,
REGENERATE_SSH_KEY,
2022-03-10 09:19:23 +00:00
REMOTE_URL,
REMOTE_URL_INFO,
2022-03-02 13:42:06 +00:00
REMOTE_URL_INPUT_PLACEHOLDER,
2022-03-10 09:19:23 +00:00
REMOTE_URL_VIA,
REPOSITORY_LIMIT_REACHED,
REPOSITORY_LIMIT_REACHED_INFO,
2022-03-02 13:42:06 +00:00
RETRY,
SELECT_BRANCH_TO_MERGE,
SSH_KEY,
SUBMIT,
UPDATE_CONFIG,
2022-05-17 06:56:34 +00:00
UPLOADING_APPLICATION,
UPLOADING_JSON,
USE_DEFAULT_CONFIGURATION,
} from "./messages";
[Feature] Grid Widget (#2389) * Updated test * updated assertions * Resizing image to take full width of table cell * updated assertion * Stop updating dynamicBindingPathList directly from widget * Fix selectedRow and selectedRows computations * Fix primaryColumns computations * Updated test for derived column * Added tests for computed value * Added check clear data * Reordering of test * updated common method * Made image size as 100% of table cell size * add templating logic * Updated flow and dsl * Clear old primary columns * Updated testname * updated assertion * use evaluated values for children * Fix primary columns update on component mount and component update * add isArray check * remove property pane enhancement reducer * add property pane enhancement reducer * disable items other than template + fix running property enchancment on drop of list widget * disbled drag, resize, settingsControl, drag for items other than template * add grid options * uncomment the widget operation for add child for grid children * handle delete scenario for child widget in list widget * WIP: Use the new delete and update property features * add listdsl.json for testcases * add test cases for correct no. of items being rendered * add test cases currentItem binding in list widget * change dragEnabled to dragDisabled * change resizeEnabled to resizeDisabled * change settingsControlEnabled to settingsControlDisabled * change dropEnabled to dropDisabled * update settingsControlDisabled default value * Use deleteProperties in propertyControls * Fix unsetting of array indices when deleting widget properties * remove old TableWidget.tsx file * Fix derived column property update on primary column property update * Handle undefined primary columns * Fix filepicker immutable prop issue * Fix object.freeze issue when adding ids to the property pane configuration * fix widget issue in grid * Fix column actions dynamicBindingPathList inclusion issue * remove consoles + fix typo around batch update * Remove redundant tests * js binding test for date picker * hydate enhancement map on copy list widget * check for dynamicleaf * fixes * improve check * fix getNextWidgetName * update template in list widget when copying * updating template copy logic when copying widget * update dynamicBindingPathList in copied widget * Add path parameter to hidden functions in property pane configs * fix copy bug when copying list widget * add computed list property control * Remove time column type Fix editor prompt for currentRow Fix undefined derivedColumns scenario Remove validations for primaryColums and derivedColumns Fix section toggle for video, image and button column types * Fix table widget actions and custom column migrations * Add logs for cyclical dependency map :recycle: * Process array differences * add property control for list widget * Fix onClick migrations * Property pane config parity * binding and trigger paths from the property pane config (#2920) * try react virtualized library * Fix unit test * Fix unit test :white_check_mark: * Fix minor issues in table widget * Add default meta props to binding paths to ensure eval and validation * Dummy commit :tada: * Remove unnecessary datepicker test Fix chart data as string issue * Achieve table column sorting and resizing parity with release * handle scenario where last column isn't available to access * Fix for panel config path not existing in the widget * Fix bindings in currentRow (default) Add dummy property pane config for canvas widget * Update canvas widgets with dynamicPathLists on delete of property paths * Add all diffs to change paths and trim later * Add back default properties 🚶🏻‍♂️ * Use object based paths instead of arrays for primaryColumns and derivedColumns * Fix issue in reordered columns * Fix inccorect update order * add virtualized list * Fix failing property pane tests * minor change * minor list widget change * Remove .vscode from git * Rename ads to alloy Fix isVisible in list widget * move grid component to widget folder * fix import in widget registry * add sticky row in virtualized list * add sticky container * Fix Height of grid widget items container * fix dragging of items in children other than template children * update list widget * update list widget * Fix padding in list widget * hide scrollbar in list widget list * fix copy bug in list widget * regenrate enhancement map on undo delete widget * Use enhancementmap for autocomplete in list widget Basic styles for list widget scrollbar * add custom control in widget config * minor commit * update scrollbar styles * remove unused variable * fix typo in custom control * comment out test cases * remove unused imports * remove unused imports * add JSON stringify in interweave * add noPad styling in dragLayer for noPad prop * implement grid gap * add list item background color prop * add white color in color picker control * fix gap in last list item * remove onBeforeParse in textcomponent * remove virtualization in grid widget * allow overflow-y * add onListItemClick action * add beta label * add pagination * fix actions in pagination in list widget * add list widget icon * add list background color default value * remove extra div * fix pagination issue * fix list widget crashing on perpage change * extract child operation function to widgetblueprint saga * refactor enhancements * add enhancement hook * refactor propertyUpdate hook enhancment * remove enhacement map * revert renaming ads to alloy * add autopagination * Cleanup unused vars Re-write loop using map Fix binding with external input widget * update default background color * remove unnessary scrol + fix pagination per page * remove console.log * use grid gap in pixel instead of snap * fix list widget tests for binding * add tests for on click action and pagination * remove unnecessary imports * remove overflow hidden in list component * Add feature to enable template actions * update property pane help text for list widget * disable pagination in editor view * update property pane options * add test case for action * uncomment tests * fix grid gap validation * update test cases * fix property pane opening issue for list tempalte * Disable form widgets in list widget * fix template issue for actions * add validation tests for list data * update starting template * add selectedRow + enable pagination in edit mode * remove extra padding in list widget + popper fix on settingDisabled * add stop propagation for button click * fix click event in edit mode * disallow filepicker widget for list widget * add test for list widget entity definition for selectItem * remove unused imports * fix test * remove evaluated value for list child widgets * add comment * remove log * fix copying bug in list widget * add check for not allowing template to copy * fix test * add test for property pane actions * remove unused import * add draglayercomponent test * add test for draggable component * add test for evaluatedvalue popup * add test for messages.ts * add test for widgeticons * add test for property pane selector * add test for widget config response * start testing widget configresponse * add test for enhancements in widget config * add test for codeeditor * add test for base widget + list widget * add test for executeWidgetBlueprintChildOperations * remove unused import * add test for widget operation utils * remove unused import * add test for handleSpecificCasesWhilePasting * remove unused function * remove unused import * add empty list styling * resolve all review comments * fix message test * add test for widget operation utils * fix merge conflicts * move validations in property config Co-authored-by: Abhinav Jha <abhinav@appsmith.com> Co-authored-by: nandan.anantharamu <nandan.anantharamu@thoughtspot.com> Co-authored-by: vicky-primathon.in <vicky.bansal@primathon.in> Co-authored-by: Pawan Kumar <pawankumar@Pawans-MacBook-Pro.local> Co-authored-by: Piyush <piyush@codeitout.com> Co-authored-by: hetunandu <hetu@appsmith.com> Co-authored-by: Hetu Nandu <hetunandu@gmail.com> Co-authored-by: root <root@DESKTOP-9GENCK0.localdomain>
2021-04-23 05:43:13 +00:00
describe("messages", () => {
it("checks for ERROR_WIDGET_COPY_NOT_ALLOWED string", () => {
expect(ERROR_WIDGET_COPY_NOT_ALLOWED()).toBe(
"This selected widget cannot be copied.",
);
});
});
describe("messages without input", () => {
const expectedMessages = [
{ key: "COMMIT_CHANGES", value: "Commit changes" },
{
key: "COMMIT_TO",
value: "Commit to",
},
{ key: "COMMIT_AND_PUSH", value: "Commit & push" },
{
key: "PULL_CHANGES",
value: "PULL CHANGES",
},
{ key: "SSH_KEY", value: "SSH key" },
{
key: "COPY_SSH_KEY",
value: "Copy SSH key",
},
{
key: "REGENERATE_KEY_CONFIRM_MESSAGE",
value:
"This might cause the application to break. This key needs to be updated in your Git repository too!",
},
{
key: "DEPLOY_KEY_USAGE_GUIDE_MESSAGE",
value:
"Paste this key in your repository settings and give it write access.",
},
{
key: "COMMITTING_AND_PUSHING_CHANGES",
value: "Committing and pushing changes...",
},
{ key: "IS_MERGING", value: "Merging changes..." },
{
key: "MERGE_CHANGES",
value: "Merge changes",
},
{ key: "SELECT_BRANCH_TO_MERGE", value: "Select branch to merge" },
{
key: "CONNECT_GIT",
value: "Connect Git",
},
{ key: "CONNECT_GIT_BETA", value: "Connect Git (Beta)" },
{
key: "RETRY",
value: "RETRY",
},
{ key: "CREATE_NEW_BRANCH", value: "CREATE NEW BRANCH" },
{
key: "ERROR_WHILE_PULLING_CHANGES",
value: "ERROR WHILE PULLING CHANGES",
},
{ key: "SUBMIT", value: "SUBMIT" },
{
key: "GIT_USER_UPDATED_SUCCESSFULLY",
value: "Git user updated successfully",
},
{
key: "REMOTE_URL_INPUT_PLACEHOLDER",
value: "git@example.com:user/repo.git",
},
{ key: "COPIED_SSH_KEY", value: "Copied SSH key" },
{
key: "INVALID_USER_DETAILS_MSG",
value: "Please enter valid user details",
},
{
key: "PASTE_SSH_URL_INFO",
value: "Please enter a valid SSH URL of your repository",
},
{ key: "GENERATE_KEY", value: "Generate key" },
{
key: "UPDATE_CONFIG",
value: "UPDATE CONFIG",
},
{ key: "CONNECT_BTN_LABEL", value: "CONNECT" },
{
key: "FETCH_GIT_STATUS",
value: "Fetching status...",
},
{ key: "FETCH_MERGE_STATUS", value: "Checking mergeability..." },
{
key: "NO_MERGE_CONFLICT",
value: "This branch has no conflicts with the base branch.",
},
{ key: "MERGE_CONFLICT_ERROR", value: "Merge conflicts found!" },
{
key: "FETCH_MERGE_STATUS_FAILURE",
value: "Unable to fetch merge status",
},
{
key: "GIT_UPSTREAM_CHANGES",
value:
"Looks like there are pending upstream changes. We will pull the changes and push them to your repository.",
},
{
key: "GIT_CONFLICTING_INFO",
value: "Please resolve the merge conflicts manually on your repository.",
},
{
key: "CANNOT_PULL_WITH_LOCAL_UNCOMMITTED_CHANGES",
value:
"You have uncommitted changes. Please commit before pulling the remote changes.",
},
{
key: "CANNOT_MERGE_DUE_TO_UNCOMMITTED_CHANGES",
value:
"Your current branch has uncommitted changes. Please commit them before proceeding to merge.",
},
{
key: "DISCONNECT_EXISTING_REPOSITORIES",
value: "Disconnect existing repositories",
},
{
key: "DISCONNECT_EXISTING_REPOSITORIES_INFO",
value:
"To make space for newer repositories, you can remove existing repositories.",
},
{ key: "CONTACT_SUPPORT", value: "Contact Support" },
{
key: "REPOSITORY_LIMIT_REACHED",
value: "Repository limit reached",
},
{
key: "REPOSITORY_LIMIT_REACHED_INFO",
value:
"Adding and using upto 3 repositories is free. To add more repositories, kindly upgrade.",
},
{
key: "NONE_REVERSIBLE_MESSAGE",
value: "This action is non-reversible. Please proceed with caution.",
},
{
key: "CONTACT_SUPPORT_TO_UPGRADE",
value:
"Please contact support to upgrade. You can add unlimited private repositories in upgraded plan.",
},
{
key: "DISCONNECT_CAUSE_APPLICATION_BREAK",
value:
"Disconnecting your repository might cause the application to break.",
},
{ key: "DISCONNECT_GIT", value: "Revoke access" },
{
key: "DISCONNECT",
value: "DISCONNECT",
},
{ key: "GIT_DISCONNECTION_SUBMENU", value: "Git Connection > Disconnect" },
{
key: "USE_DEFAULT_CONFIGURATION",
value: "Use default configuration",
},
{
key: "GIT_COMMIT_MESSAGE_PLACEHOLDER",
value: "Your commit message here",
},
2022-03-10 09:19:23 +00:00
{ key: "GIT_CONNECTION", value: "Git Connection" },
{ key: "DEPLOY", value: "Deploy" },
{
key: "MERGE",
value: "Merge",
},
2022-03-10 09:19:23 +00:00
{ key: "GIT_SETTINGS", value: "Git Settings" },
{ key: "CONNECT_TO_GIT", value: "Connect to Git repository" },
2022-03-10 09:19:23 +00:00
{
key: "CONNECT_TO_GIT_SUBTITLE",
value: "Checkout branches, make commits, and deploy your application",
},
{ key: "REMOTE_URL", value: "Remote URL" },
{
key: "REMOTE_URL_INFO",
value: `Create an empty Git repository and paste the remote URL here.`,
2022-03-10 09:19:23 +00:00
},
{ key: "REMOTE_URL_VIA", value: "Remote URL via" },
{
key: "ERROR_GIT_AUTH_FAIL",
value:
"Please make sure that regenerated SSH key is added and has write access to the repo.",
},
{
key: "ERROR_GIT_INVALID_REMOTE",
value: "Remote repo doesn't exist or is unreachable.",
},
{
key: "CHANGES_ONLY_USER",
value: "Changes since last commit",
},
{
key: "CHANGES_ONLY_MIGRATION",
value: "Appsmith update changes since last commit",
},
{
key: "CHANGES_USER_AND_MIGRATION",
value: "Appsmith update and user changes since last commit",
},
{ key: "MERGED_SUCCESSFULLY", value: "Merged successfully" },
{
key: "DISCARD_CHANGES_WARNING",
value: "Discarding these changes will pull previous changes from Git.",
},
{
key: "DISCARD_SUCCESS",
value: "Discarded changes successfully.",
},
{
key: "DISCARDING_AND_PULLING_CHANGES",
value: "Discarding and pulling changes...",
},
{
key: "ARE_YOU_SURE",
value: "Are you sure?",
},
{
key: "DISCARD_CHANGES",
value: "Discard changes",
},
{
key: "IMPORTING_APP_FROM_GIT",
value: "Importing application from Git",
},
{ key: "UPLOADING_JSON", value: "Uploading JSON file" },
{
key: "UPLOADING_APPLICATION",
value: "Uploading application",
},
{
key: "IMPORT_APP_FROM_FILE_MESSAGE",
value: "Drag and drop your file or upload from your computer",
},
{
key: "IMPORT_APP_FROM_GIT_MESSAGE",
value: "Import an application from its Git repository using its SSH URL",
},
{
key: "IMPORT_FROM_GIT_REPOSITORY",
value: "Import from Git repository",
},
];
const functions = [
ARE_YOU_SURE,
2022-03-02 13:42:06 +00:00
CANNOT_MERGE_DUE_TO_UNCOMMITTED_CHANGES,
CANNOT_PULL_WITH_LOCAL_UNCOMMITTED_CHANGES,
CHANGES_ONLY_MIGRATION,
CHANGES_ONLY_USER,
CHANGES_USER_AND_MIGRATION,
2022-03-02 13:42:06 +00:00
COMMITTING_AND_PUSHING_CHANGES,
COMMIT_AND_PUSH,
COMMIT_CHANGES,
COMMIT_TO,
2022-03-02 13:42:06 +00:00
CONNECT_BTN_LABEL,
CONNECT_GIT,
CONNECT_GIT_BETA,
2022-03-10 09:19:23 +00:00
CONNECT_TO_GIT,
CONNECT_TO_GIT_SUBTITLE,
2022-03-02 13:42:06 +00:00
CONTACT_SUPPORT,
CONTACT_SUPPORT_TO_UPGRADE,
COPIED_SSH_KEY,
COPY_SSH_KEY,
CREATE_NEW_BRANCH,
2022-03-10 09:19:23 +00:00
DEPLOY,
2022-03-02 13:42:06 +00:00
DEPLOY_KEY_USAGE_GUIDE_MESSAGE,
DISCARDING_AND_PULLING_CHANGES,
DISCARD_CHANGES,
DISCARD_CHANGES_WARNING,
DISCARD_SUCCESS,
2022-03-02 13:42:06 +00:00
DISCONNECT,
DISCONNECT_CAUSE_APPLICATION_BREAK,
DISCONNECT_EXISTING_REPOSITORIES,
DISCONNECT_EXISTING_REPOSITORIES_INFO,
DISCONNECT_GIT,
ERROR_GIT_AUTH_FAIL,
ERROR_GIT_INVALID_REMOTE,
ERROR_WHILE_PULLING_CHANGES,
FETCH_GIT_STATUS,
FETCH_MERGE_STATUS,
FETCH_MERGE_STATUS_FAILURE,
2022-03-02 13:42:06 +00:00
GENERATE_KEY,
GIT_COMMIT_MESSAGE_PLACEHOLDER,
GIT_CONFLICTING_INFO,
2022-03-10 09:19:23 +00:00
GIT_CONNECTION,
2022-03-02 13:42:06 +00:00
GIT_DISCONNECTION_SUBMENU,
2022-03-10 09:19:23 +00:00
GIT_SETTINGS,
2022-03-02 13:42:06 +00:00
GIT_UPSTREAM_CHANGES,
GIT_USER_UPDATED_SUCCESSFULLY,
IMPORTING_APP_FROM_GIT,
2022-03-02 13:42:06 +00:00
INVALID_USER_DETAILS_MSG,
IS_MERGING,
2022-03-10 09:19:23 +00:00
MERGE,
2022-03-02 13:42:06 +00:00
MERGE_CHANGES,
MERGE_CONFLICT_ERROR,
NONE_REVERSIBLE_MESSAGE,
NO_MERGE_CONFLICT,
MERGED_SUCCESSFULLY,
2022-03-02 13:42:06 +00:00
PASTE_SSH_URL_INFO,
PULL_CHANGES,
REGENERATE_KEY_CONFIRM_MESSAGE,
2022-03-10 09:19:23 +00:00
REMOTE_URL,
REMOTE_URL_INFO,
2022-03-02 13:42:06 +00:00
REMOTE_URL_INPUT_PLACEHOLDER,
2022-03-10 09:19:23 +00:00
REMOTE_URL_VIA,
REPOSITORY_LIMIT_REACHED,
REPOSITORY_LIMIT_REACHED_INFO,
2022-03-02 13:42:06 +00:00
RETRY,
SELECT_BRANCH_TO_MERGE,
SSH_KEY,
SUBMIT,
UPDATE_CONFIG,
USE_DEFAULT_CONFIGURATION,
2022-05-17 06:56:34 +00:00
UPLOADING_JSON,
UPLOADING_APPLICATION,
IMPORT_APP_FROM_FILE_MESSAGE,
IMPORT_APP_FROM_GIT_MESSAGE,
IMPORT_FROM_GIT_REPOSITORY,
];
functions.forEach((fn: () => string) => {
it(`${fn.name} returns expected value`, () => {
const actual = createMessage(fn);
const found = expectedMessages.find((em) => em.key === fn.name);
const expected = found && found.value;
expect(actual).toEqual(expected);
});
});
});
describe("messages with input values", () => {
it("REGENERATE_SSH_KEY returns expected value", () => {
expect(createMessage(REGENERATE_SSH_KEY)).toEqual(
"Regenerate undefined undefined key",
);
expect(createMessage(REGENERATE_SSH_KEY, "ECDSA", 256)).toEqual(
"Regenerate ECDSA 256 key",
);
});
});