From 5948a9fd0246b9d67fd2074a613f081e53a19670 Mon Sep 17 00:00:00 2001
From: AAfghahi <48933336+AAfghahi@users.noreply.github.com>
Date: Fri, 29 Oct 2021 18:30:20 -0400
Subject: [PATCH] fix(AlertReportModal): Text Area Change (#17176)
* Text Area Change
* added unique key to component
* tests passing
* changed css
* data flow and naming convention
---
superset-frontend/package-lock.json | 2 +-
superset-frontend/package.json | 2 +-
.../TemplateParamsEditor.test.tsx | 2 +-
superset-frontend/src/SqlLab/main.less | 2 +-
.../AsyncAceEditor/AsyncAceEditor.test.tsx | 2 +-
.../src/components/AsyncAceEditor/index.tsx | 8 ++---
.../components/CssEditor/CssEditor.test.tsx | 4 +--
.../stylesheets/components/markdown.less | 2 +-
.../components/controls/TextAreaControl.jsx | 31 +++++--------------
.../src/views/CRUD/alert/AlertList.tsx | 3 ++
.../CRUD/alert/AlertReportModal.test.jsx | 2 +-
.../src/views/CRUD/alert/AlertReportModal.tsx | 3 +-
12 files changed, 24 insertions(+), 39 deletions(-)
diff --git a/superset-frontend/package-lock.json b/superset-frontend/package-lock.json
index 4ec930d8ad1b8..0ecf24d44d029 100644
--- a/superset-frontend/package-lock.json
+++ b/superset-frontend/package-lock.json
@@ -87,7 +87,7 @@
"query-string": "^6.13.7",
"re-resizable": "^6.6.1",
"react": "^16.13.1",
- "react-ace": "^5.10.0",
+ "react-ace": "^9.9.4",
"react-checkbox-tree": "^1.5.1",
"react-color": "^2.13.8",
"react-datetime": "^3.0.4",
diff --git a/superset-frontend/package.json b/superset-frontend/package.json
index b25d5af07f2ed..e7e0f1a8c2d63 100644
--- a/superset-frontend/package.json
+++ b/superset-frontend/package.json
@@ -139,7 +139,7 @@
"query-string": "^6.13.7",
"re-resizable": "^6.6.1",
"react": "^16.13.1",
- "react-ace": "^5.10.0",
+ "react-ace": "^9.4.4",
"react-checkbox-tree": "^1.5.1",
"react-color": "^2.13.8",
"react-datetime": "^3.0.4",
diff --git a/superset-frontend/src/SqlLab/components/TemplateParamsEditor/TemplateParamsEditor.test.tsx b/superset-frontend/src/SqlLab/components/TemplateParamsEditor/TemplateParamsEditor.test.tsx
index ec64b9daf4505..e663704ba21b8 100644
--- a/superset-frontend/src/SqlLab/components/TemplateParamsEditor/TemplateParamsEditor.test.tsx
+++ b/superset-frontend/src/SqlLab/components/TemplateParamsEditor/TemplateParamsEditor.test.tsx
@@ -51,7 +51,7 @@ describe('TemplateParamsEditor', () => {
const spy = jest.spyOn(brace, 'acequire');
spy.mockReturnValue({ setCompleters: () => 'foo' });
await waitFor(() => {
- expect(baseElement.querySelector('#brace-editor')).toBeInTheDocument();
+ expect(baseElement.querySelector('#ace-editor')).toBeInTheDocument();
});
});
});
diff --git a/superset-frontend/src/SqlLab/main.less b/superset-frontend/src/SqlLab/main.less
index a6c473889710e..7822b91d3cc86 100644
--- a/superset-frontend/src/SqlLab/main.less
+++ b/superset-frontend/src/SqlLab/main.less
@@ -207,7 +207,7 @@ div.Workspace {
flex-direction: column;
}
- #brace-editor {
+ #ace-editor {
height: calc(100% - 51px);
flex-grow: 1;
}
diff --git a/superset-frontend/src/components/AsyncAceEditor/AsyncAceEditor.test.tsx b/superset-frontend/src/components/AsyncAceEditor/AsyncAceEditor.test.tsx
index 08ddf2f87ad1e..6d07fd7032760 100644
--- a/superset-frontend/src/components/AsyncAceEditor/AsyncAceEditor.test.tsx
+++ b/superset-frontend/src/components/AsyncAceEditor/AsyncAceEditor.test.tsx
@@ -30,7 +30,7 @@ import AsyncAceEditor, {
AsyncAceEditorOptions,
} from 'src/components/AsyncAceEditor';
-const selector = '[id="brace-editor"]';
+const selector = '[id="ace-editor"]';
test('renders SQLEditor', async () => {
const { container } = render();
diff --git a/superset-frontend/src/components/AsyncAceEditor/index.tsx b/superset-frontend/src/components/AsyncAceEditor/index.tsx
index 2a5683574a85d..412872cc48aea 100644
--- a/superset-frontend/src/components/AsyncAceEditor/index.tsx
+++ b/superset-frontend/src/components/AsyncAceEditor/index.tsx
@@ -23,7 +23,7 @@ import {
Position,
TextMode as OrigTextMode,
} from 'brace';
-import AceEditor, { AceEditorProps } from 'react-ace';
+import AceEditor, { IAceEditorProps } from 'react-ace';
import AsyncEsmComponent, {
PlaceholderProps,
} from 'src/components/AsyncEsmComponent';
@@ -72,7 +72,7 @@ const aceModuleLoaders = {
export type AceModule = keyof typeof aceModuleLoaders;
-export type AsyncAceEditorProps = AceEditorProps & {
+export type AsyncAceEditorProps = IAceEditorProps & {
keywords?: AceCompleterKeyword[];
};
@@ -83,7 +83,7 @@ export type AsyncAceEditorOptions = {
defaultTheme?: AceEditorTheme;
defaultTabSize?: number;
placeholder?: React.ComponentType<
- PlaceholderProps & Partial
+ PlaceholderProps & Partial
> | null;
};
@@ -120,7 +120,6 @@ export default function AsyncAceEditor(
theme = inferredTheme,
tabSize = defaultTabSize,
defaultValue = '',
- value = '',
...props
},
ref,
@@ -153,7 +152,6 @@ export default function AsyncAceEditor(
theme={theme}
tabSize={tabSize}
defaultValue={defaultValue}
- value={value || ''}
{...props}
/>
);
diff --git a/superset-frontend/src/dashboard/components/CssEditor/CssEditor.test.tsx b/superset-frontend/src/dashboard/components/CssEditor/CssEditor.test.tsx
index e96291c9b64c0..16b2a1afbb7c7 100644
--- a/superset-frontend/src/dashboard/components/CssEditor/CssEditor.test.tsx
+++ b/superset-frontend/src/dashboard/components/CssEditor/CssEditor.test.tsx
@@ -19,12 +19,12 @@
import React from 'react';
import { render, screen, waitFor } from 'spec/helpers/testing-library';
import { CssEditor as AceCssEditor } from 'src/components/AsyncAceEditor';
-import { AceEditorProps } from 'react-ace';
+import { IAceEditorProps } from 'react-ace';
import userEvent from '@testing-library/user-event';
import CssEditor from '.';
jest.mock('src/components/AsyncAceEditor', () => ({
- CssEditor: ({ value, onChange }: AceEditorProps) => (
+ CssEditor: ({ value, onChange }: IAceEditorProps) => (