Skip to content

Commit

Permalink
Merge pull request #2118 from appsmithorg/release
Browse files Browse the repository at this point in the history
v1.2.22-rc
  • Loading branch information
mohanarpit committed Dec 10, 2020
2 parents 9c00931 + 0e47c0a commit 1a5b3fe
Show file tree
Hide file tree
Showing 25 changed files with 243 additions and 85 deletions.
37 changes: 0 additions & 37 deletions app/client/.eslintrc.js

This file was deleted.

41 changes: 41 additions & 0 deletions app/client/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// This JSON file configures the eslint plugin. It supports comments as well as per the JSON5 spec
{
"parser": "@typescript-eslint/parser",
"plugins": ["react", "@typescript-eslint", "prettier", "react-hooks"],
"extends": [
"plugin:react/recommended", // Uses the recommended rules from @eslint-plugin-react
"plugin:@typescript-eslint/recommended",
"prettier/@typescript-eslint",
"plugin:prettier/recommended",
"plugin:cypress/recommended"
],
"parserOptions": {
"ecmaVersion": 2020, // Allows for the parsing of modern ECMAScript features
"sourceType": "module", // Allows for the use of imports
"ecmaFeatures": {
"jsx": true // Allows for the parsing of JSX
}
},
"rules": {
"@typescript-eslint/no-explicit-any": 0,
"react-hooks/rules-of-hooks": "error",
"@typescript-eslint/no-use-before-define": 0,
"@typescript-eslint/no-var-requires": 0,
"import/no-webpack-loader-syntax": 0,
"no-undef": 0,
"react/prop-types": 0,
"@typescript-eslint/explicit-module-boundary-types": 0
},
"settings": {
"react": {
"pragma": "React",
// Tells eslint-plugin-react to automatically detect the version of React to use
"version": "detect"
}
},
"env": {
"browser": true,
"node": true,
"cypress/globals": true
}
}
3 changes: 2 additions & 1 deletion app/client/cypress/fixtures/testdata.json
Original file line number Diff line number Diff line change
Expand Up @@ -181,5 +181,6 @@
"btoaInput": "{{btoa('A')",
"defaultInputBinding": "{{Input2.text",
"tabBinding": "{{Tabs1.selectedTab",
"pageloadBinding": "{{PageLoadApi.data.data[1].id}}{{Input1.text}}"
"pageloadBinding": "{{PageLoadApi.data.data[1].id}}{{Input1.text}}",
"defaultRowIndexBinding": "{{Table1.selectedRowIndex"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/// <reference types="Cypress" />

const commonlocators = require("../../../locators/commonlocators.json");
const dsl = require("../../../fixtures/formInputTableDsl.json");
const widgetsPage = require("../../../locators/Widgets.json");
const publish = require("../../../locators/publishWidgetspage.json");
const testdata = require("../../../fixtures/testdata.json");

describe("Binding the table widget and input Widget", function() {
before(() => {
cy.addDsl(dsl);
});

it("Input widget test with default value from table widget", function() {
cy.SearchEntityandOpen("Input1");
cy.get(widgetsPage.defaultInput).type(testdata.defaultInputWidget);
cy.get(commonlocators.editPropCrossButton).click();
cy.wait("@updateLayout").should(
"have.nested.property",
"response.body.responseMeta.status",
200,
);
});

it("Input widget test with default value from table widget", function() {
cy.SearchEntityandOpen("Input2");
cy.get(widgetsPage.defaultInput).type(testdata.defaultRowIndexBinding);
cy.get(commonlocators.editPropCrossButton).click();
cy.wait("@updateLayout").should(
"have.nested.property",
"response.body.responseMeta.status",
200,
);
});

it("validation of data displayed in input widgets based on selected row", function() {
cy.SearchEntityandOpen("Table1");
cy.get(commonlocators.deflautSelectedRow)
.last()
.type("2", { force: true });
cy.get(commonlocators.editPropCrossButton).click();
cy.readTabledataPublish("2", "0").then(tabData => {
const tabValue = tabData;
expect(tabValue).to.be.equal("6788734");
cy.log("the value is" + tabValue);
cy.get(publish.inputWidget + " " + "input")
.first()
.invoke("attr", "value")
.should("contain", tabValue);
cy.get(publish.inputWidget + " " + "input")
.last()
.invoke("attr", "value")
.should("contain", 2);
});
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
const commonlocators = require("../../../locators/commonlocators.json");
const formWidgetsPage = require("../../../locators/FormWidgets.json");
const dsl = require("../../../fixtures/formInputTableDsl.json");
const pages = require("../../../locators/Pages.json");
const widgetsPage = require("../../../locators/Widgets.json");
const publish = require("../../../locators/publishWidgetspage.json");
const testdata = require("../../../fixtures/testdata.json");

describe("Binding the Table and input Widget", function() {
before(() => {
cy.addDsl(dsl);
});

it("Input widget test with default value from table widget", function() {
cy.SearchEntityandOpen("Input1");
cy.get(widgetsPage.defaultInput).type(testdata.defaultInputWidget);
cy.get(commonlocators.editPropCrossButton).click();
cy.wait("@updateLayout").should(
"have.nested.property",
"response.body.responseMeta.status",
200,
);
});

it("validation of data displayed in input widgets based on search value set", function() {
cy.SearchEntityandOpen("Table1");
cy.get(commonlocators.defaultSearchText)
.last()
.type("2736212", { force: true });
cy.get(commonlocators.editPropCrossButton).click();
cy.isSelectRow(0);
cy.readTabledataPublish("0", "0").then(tabData => {
const tabValue = tabData;
expect(tabValue).to.be.equal("2736212");
cy.log("the value is" + tabValue);
cy.get(publish.inputWidget + " " + "input")
.first()
.invoke("attr", "value")
.should("contain", tabValue);
});
});
});
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/// <reference types="Cypress" />

const queryLocators = require("../../../locators/QueryEditor.json");
const datasource = require("../../../locators/DatasourcesEditor.json");
const apiwidget = require("../../../locators/apiWidgetslocator.json");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/// <reference types="Cypress" />

const homePage = require("../../../locators/HomePage.json");

describe("Create new org and an app within the same", function() {
let orgid;
let appid;
Expand Down
2 changes: 2 additions & 0 deletions app/client/cypress/locators/commonlocators.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@
"selectedZoomlevel": ".t--property-control-maxzoomlevel button span",
"imgWidget": "div[data-testid='styledImage']",
"selectTab": ".t--tab-Tab",
"deflautSelectedRow": ".t--property-control-defaultselectedrow textarea",
"defaultSearchText": ".t--property-control-defaultsearchtext textarea",
"entityName": ".t--entity-name",
"filePickerButton": ".t--widget-filepickerwidget",
"filePickerInput": ".uppy-Dashboard-input",
Expand Down
1 change: 1 addition & 0 deletions app/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-react": "^7.21.3",
"eslint-plugin-react-hooks": "^2.3.0",
"eslint-plugin-cypress": "^2.11.2",
"mocha": "^7.1.0",
"mocha-junit-reporter": "^1.23.3",
"mochawesome": "^5.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export enum EditorModes {
JSON = "application/json",
JSON_WITH_BINDING = "json-js",
SQL_WITH_BINDING = "sql-js",
JAVASCRIPT = "javascript",
}

export enum EditorTheme {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,9 @@ export const CurrentValueViewer = (props: {
} else {
content = (
<CodeWrapper colorTheme={props.theme}>
{props.evaluatedValue ? props.evaluatedValue.toString() : "null"}
{props.evaluatedValue === null
? "null"
: props.evaluatedValue.toString()}
</CodeWrapper>
);
}
Expand Down
23 changes: 18 additions & 5 deletions app/client/src/components/editorComponents/CodeEditor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import AnalyticsUtil from "utils/AnalyticsUtil";
import "components/editorComponents/CodeEditor/modes";
import {
EditorConfig,
EditorModes,
EditorSize,
EditorTheme,
EditorThemes,
Expand Down Expand Up @@ -140,6 +141,7 @@ class CodeEditor extends Component<Props, State> {
this.editor.on("change", this.onChangeTigger);
this.editor.on("keyup", this.handleAutocompleteHide);
this.editor.on("focus", this.handleEditorFocus);
this.editor.on("cursorActivity", this.handleCursorMovement);
this.editor.on("focus", this.onFocusTrigger);
this.editor.on("blur", this.handleEditorBlur);
if (this.props.height) {
Expand Down Expand Up @@ -216,17 +218,28 @@ class CodeEditor extends Component<Props, State> {
}
};

handleCursorMovement = (cm: CodeMirror.Editor) => {
// ignore if disabled
if (!this.props.input.onChange || this.props.disabled) {
return;
}
const mode = cm.getModeAt(cm.getCursor());
if (
mode &&
[EditorModes.JAVASCRIPT, EditorModes.JSON].includes(mode.name)
) {
this.editor.setOption("matchBrackets", true);
} else {
this.editor.setOption("matchBrackets", false);
}
};

handleEditorFocus = () => {
this.setState({ isFocused: true });
this.editor.refresh();
if (this.props.size === EditorSize.COMPACT) {
this.editor.setOption("lineWrapping", true);
}

// Highlight matching brackets only when focused and not in readonly mode
if (this.props.input.onChange && !this.props.disabled) {
this.editor.setOption("matchBrackets", true);
}
};

handleEditorBlur = () => {
Expand Down
2 changes: 1 addition & 1 deletion app/client/src/configs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ export const getAppsmithConfigs = (): AppsmithUIConfigs => {
dsn: sentryDSN.value,
release: sentryRelease.value,
environment: sentryENV.value,
normalizeDepth: 5,
normalizeDepth: 3,
integrations: [
new Integrations.BrowserTracing({
// Can also use reactRouterV4Instrumentation
Expand Down
4 changes: 2 additions & 2 deletions app/client/src/sagas/ErrorSagas.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export function* errorSaga(
if (show) {
effects.push(ErrorEffectTypes.SHOW_ALERT);
}
if (error.crash) {
if (error && error.crash) {
effects.push(ErrorEffectTypes.SAFE_CRASH);
}
for (const effect of effects) {
Expand Down Expand Up @@ -138,7 +138,7 @@ export function* errorSaga(

function logErrorSaga(action: ReduxAction<{ error: ErrorPayloadType }>) {
log.debug(`Error in action ${action.type}`);
log.error(action.payload.error);
if (action.payload) log.error(action.payload.error);
}

function showAlertAboutError(message: string) {
Expand Down
12 changes: 11 additions & 1 deletion app/client/src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,20 @@ import createSagaMiddleware from "redux-saga";
import { rootSaga } from "sagas";
import { composeWithDevTools } from "redux-devtools-extension/logOnlyInProduction";
import * as Sentry from "@sentry/react";
import { ReduxActionTypes } from "constants/ReduxActionConstants";

const sagaMiddleware = createSagaMiddleware();
const sentryReduxEnhancer = Sentry.createReduxEnhancer({
// Optionally pass options listed below
actionTransformer: action => {
if (
action.type === ReduxActionTypes.SET_EVALUATED_TREE ||
action.type === ReduxActionTypes.EXECUTE_API_ACTION_SUCCESS
) {
// Return null to not log the action to Sentry
action.payload = null;
}
return action;
},
});

export default createStore(
Expand Down
21 changes: 20 additions & 1 deletion app/client/src/utils/AppsmithUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,26 @@ export const appInitializer = () => {
FeatureFlag.initialize(appsmithConfigs.featureFlag);

if (appsmithConfigs.sentry.enabled) {
Sentry.init(appsmithConfigs.sentry);
Sentry.init({
...appsmithConfigs.sentry,
beforeBreadcrumb(breadcrumb, hint) {
if (breadcrumb.category === "console" && breadcrumb.level !== "error") {
return null;
}
if (breadcrumb.category === "sentry.transaction") {
return null;
}
if (breadcrumb.category === "redux.action") {
if (
breadcrumb.data &&
breadcrumb.data.type === "SET_EVALUATED_TREE"
) {
breadcrumb.data = undefined;
}
}
return breadcrumb;
},
});
}

if (appsmithConfigs.smartLook.enabled) {
Expand Down
Loading

0 comments on commit 1a5b3fe

Please sign in to comment.