Skip to content

Commit 7dd4d4a

Browse files
author
Roman.Sergeenko
committed
#RI-2088 - codeql fe fixes
1 parent 131632c commit 7dd4d4a

File tree

6 files changed

+36
-31
lines changed

6 files changed

+36
-31
lines changed

configs/webpack.config.main.prod.babel.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import path from 'path';
22
import webpack from 'webpack';
33
import { merge } from 'webpack-merge';
4-
import TerserPlugin from 'terser-webpack-plugin';
54
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
65
import baseConfig from './webpack.config.base';
76
import DeleteSourceMaps from '../scripts/DeleteSourceMaps';

redisinsight/ui/src/components/ContentEditable.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ export const parseMultilineContentEditableChangeHtml = (text: string = '') =>
2828
export const parseContentEditableHtml = (text: string = '') =>
2929
text
3030
.replace(/ /gi, ' ')
31-
.replace(/&/gi, '&')
3231
.replace(/&lt;/gi, '<')
3332
.replace(/&gt;/gi, '>')
33+
.replace(/&amp;/gi, '&')
3434

3535
const onPaste = (e: React.ClipboardEvent) => {
3636
e.preventDefault()

redisinsight/ui/src/components/query-card/QueryCardCliPlugin/QueryCardCliPlugin.tsx

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ const QueryCardCliPlugin = (props: Props) => {
4545
const generatedIframeNameRef = useRef<string>('')
4646
const { theme } = useContext(ThemeContext)
4747

48-
const dispatch = useDispatch()
49-
5048
const executeCommand = () => {
5149
pluginIframeRef?.current?.contentWindow?.postMessage({
5250
event: 'executeCommand',
@@ -55,20 +53,20 @@ const QueryCardCliPlugin = (props: Props) => {
5553
}, '*')
5654
}
5755

58-
const sendRedisCommand = (command: string, requestId: string) => {
59-
dispatch(
60-
sendPluginCommandAction({
61-
command,
62-
onSuccessAction: (response) => {
63-
pluginIframeRef?.current?.contentWindow?.postMessage({
64-
event: 'executeRedisCommand',
65-
requestId,
66-
data: response
67-
}, '*')
68-
}
69-
})
70-
)
71-
}
56+
// const sendRedisCommand = (command: string, requestId: string) => {
57+
// dispatch(
58+
// sendPluginCommandAction({
59+
// command,
60+
// onSuccessAction: (response) => {
61+
// pluginIframeRef?.current?.contentWindow?.postMessage({
62+
// event: 'executeRedisCommand',
63+
// requestId,
64+
// data: response
65+
// }, '*')
66+
// }
67+
// })
68+
// )
69+
// }
7270

7371
useEffect(() => {
7472
if (currentView === null) return

redisinsight/ui/src/pages/browser/components/add-key/AddKeyCommonFields/AddKeyCommonFields.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { ChangeEvent, Fragment } from 'react'
1+
import React, { ChangeEvent } from 'react'
22
import { toNumber } from 'lodash'
33
import { EuiFieldText, EuiFormRow } from '@elastic/eui'
44

redisinsight/ui/src/pages/home/components/AddInstanceForm/InstanceForm/InstanceForm.tsx

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -255,13 +255,6 @@ const AddStandaloneForm = (props: Props) => {
255255
errs.newCaCert = fieldDisplayNames.newCaCert
256256
}
257257

258-
if (
259-
values.tls
260-
&& values.tlsClientAuthRequired
261-
&& values.selectedTlsClientCertId === ''
262-
) {
263-
errs.selectedTlsClientCertId = fieldDisplayNames.selectedTlsClientCertId
264-
}
265258
if (
266259
values.tls
267260
&& values.tlsClientAuthRequired

redisinsight/ui/src/plugins/pluginImport.ts

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,28 @@ export const importPluginScript = () => (config) => {
3737

3838
const listenEvents = () => {
3939
globalThis.onmessage = (e) => {
40+
// eslint-disable-next-line sonarjs/no-collapsible-if
4041
if (e.data.event === events.EXECUTE_COMMAND) {
41-
plugin[e.data.method] && plugin[e.data.method](e.data.data)
42+
const { plugin } = globalThis
43+
// eslint-disable-next-line no-prototype-builtins
44+
if (plugin.hasOwnProperty(e.data.method)) {
45+
const action = plugin[e.data.method]
46+
if (typeof action === 'function') {
47+
action(e.data.data)
48+
}
49+
}
4250
}
4351

52+
// eslint-disable-next-line sonarjs/no-collapsible-if
4453
if (e.data.event === events.EXECUTE_REDIS_COMMAND) {
45-
callbacks[e.data.requestId] && callbacks[e.data.requestId](e.data.data)
46-
delete callbacks[e.data.requestId]
54+
// eslint-disable-next-line no-prototype-builtins
55+
if (callbacks.hasOwnProperty(e.data.requestId)) {
56+
const action = callbacks[e.data.requestId]
57+
if (typeof action === 'function') {
58+
action(e.data.data)
59+
}
60+
delete callbacks[e.data.requestId]
61+
}
4762
}
4863
}
4964

@@ -84,11 +99,11 @@ export const prepareIframeHtml = (config) => {
8499
<body class="${bodyClass}" style="height: fit-content">
85100
<div id="app"></div>
86101
<script>
87-
let plugin = {}
102+
globalThis.plugin = {}
88103
;(${importPluginScriptInner})(\`${configString}\`);
89104
import(\`${scriptSrc}\`)
90105
.then((module) => {
91-
plugin = { ...module.default };
106+
globalThis.plugin = { ...module.default };
92107
globalThis.top.postMessage({
93108
event: 'loaded',
94109
iframeId: \`${iframeId}\`

0 commit comments

Comments
 (0)