Skip to content

Commit e6afb3e

Browse files
authored
Merge pull request #1794 from RedisInsight/main
merge main into release/2.20.0
2 parents de26fa6 + 02eeeb7 commit e6afb3e

File tree

93 files changed

+4412
-743
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+4412
-743
lines changed

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

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ export default merge(commonConfig, {
2525
target: 'web',
2626
entry: ['regenerator-runtime/runtime', './index.tsx'],
2727
output: {
28-
filename: 'js/bundle.[fullhash].min.js',
28+
filename: 'js/bundle.[name].min.js',
2929
path: resolve(__dirname, '../redisinsight/ui/dist'),
3030
publicPath: '/',
31+
chunkFilename: '[id].[chunkhash].js'
3132
},
3233
optimization: {
3334
minimize: true,
@@ -37,6 +38,34 @@ export default merge(commonConfig, {
3738
}),
3839
new CssMinimizerPlugin(),
3940
],
41+
runtimeChunk: 'single',
42+
splitChunks: {
43+
chunks: 'all',
44+
maxInitialRequests: Infinity,
45+
minSize: 0,
46+
cacheGroups: {
47+
reactVendor: {
48+
test: /[\\/]node_modules[\\/](react|react-dom)[\\/]/,
49+
name: "reactVendor"
50+
},
51+
elasticVendor: {
52+
test: /[\\/]node_modules[\\/](@elastic)[\\/]/,
53+
name: "elasticVendor"
54+
},
55+
monacoVendor: {
56+
test: /[\\/]node_modules[\\/](monaco-editor)[\\/]/,
57+
name: "monacoVendor"
58+
},
59+
utilityVendor: {
60+
test: /[\\/]node_modules[\\/](lodash)[\\/]/,
61+
name: "utilityVendor"
62+
},
63+
vendor: {
64+
test: /[\\/]node_modules[\\/](!@elastic)(!monaco-editor)(!lodash)[\\/]/,
65+
name: "vendor"
66+
},
67+
},
68+
},
4069
},
4170
plugins: [
4271
new MiniCssExtractPlugin({
Lines changed: 3 additions & 0 deletions
Loading

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import cx from 'classnames'
44
import { EuiLoadingContent, keys } from '@elastic/eui'
55
import { useParams } from 'react-router-dom'
66

7-
import { WBQueryType } from 'uiSrc/pages/workbench/constants'
7+
import { WBQueryType, ProfileQueryType } from 'uiSrc/pages/workbench/constants'
88
import { RunQueryMode, ResultsMode, ResultsSummary } from 'uiSrc/slices/interfaces/workbench'
99
import {
1010
getWBQueryType,
@@ -44,6 +44,7 @@ export interface Props {
4444
onQueryDelete: () => void
4545
onQueryReRun: () => void
4646
onQueryOpen: () => void
47+
onQueryProfile: (type: ProfileQueryType) => void
4748
}
4849

4950
const getDefaultPlugin = (views: IPluginVisualization[], query: string) =>
@@ -75,6 +76,7 @@ const QueryCard = (props: Props) => {
7576
createdAt,
7677
onQueryOpen,
7778
onQueryDelete,
79+
onQueryProfile,
7880
onQueryReRun,
7981
loading,
8082
emptyCommand,
@@ -186,6 +188,7 @@ const QueryCard = (props: Props) => {
186188
setSelectedValue={changeViewTypeSelected}
187189
onQueryDelete={onQueryDelete}
188190
onQueryReRun={onQueryReRun}
191+
onQueryProfile={onQueryProfile}
189192
/>
190193
{isOpen && (
191194
<>

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

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import { numberWithSpaces } from 'uiSrc/utils/numbers'
3232
import { ThemeContext } from 'uiSrc/contexts/themeContext'
3333
import { appPluginsSelector } from 'uiSrc/slices/app/plugins'
3434
import { sendEventTelemetry, TelemetryEvent } from 'uiSrc/telemetry'
35-
import { getViewTypeOptions, WBQueryType } from 'uiSrc/pages/workbench/constants'
35+
import { getViewTypeOptions, WBQueryType, getProfileViewTypeOptions, ProfileQueryType, isCommandAllowedForProfile } from 'uiSrc/pages/workbench/constants'
3636
import { IPluginVisualization } from 'uiSrc/slices/interfaces'
3737
import { RunQueryMode, ResultsMode, ResultsSummary } from 'uiSrc/slices/interfaces/workbench'
3838
import { appRedisCommandsSelector } from 'uiSrc/slices/app/redis-commands'
@@ -70,6 +70,7 @@ export interface Props {
7070
setSelectedValue: (type: WBQueryType, value: string) => void
7171
onQueryDelete: () => void
7272
onQueryReRun: () => void
73+
onQueryProfile: (type: ProfileQueryType) => void
7374
}
7475

7576
const getExecutionTimeString = (value: number): string => {
@@ -109,6 +110,7 @@ const QueryCardHeader = (props: Props) => {
109110
setSelectedValue,
110111
onQueryDelete,
111112
onQueryReRun,
113+
onQueryProfile,
112114
db,
113115
} = props
114116

@@ -237,6 +239,30 @@ const QueryCardHeader = (props: Props) => {
237239
}
238240
})
239241

242+
const profileOptions: EuiSuperSelectOption<any>[] = (getProfileViewTypeOptions() as any[]).map((item) => {
243+
const { value, id, text } = item
244+
return {
245+
value: id ?? value,
246+
inputDisplay: (
247+
<div className={cx(styles.dropdownOption, styles.dropdownProfileOption)}>
248+
<EuiIcon
249+
className={styles.iconDropdownOption}
250+
type="visTagCloud"
251+
data-testid={`view-type-selected-${value}-${id}`}
252+
/>
253+
</div>
254+
),
255+
dropdownDisplay: (
256+
<div className={cx(styles.dropdownOption, styles.dropdownProfileOption)}>
257+
<span>{truncateText(text, 20)}</span>
258+
</div>
259+
),
260+
'data-test-subj': `profile-type-option-${value}-${id}`,
261+
}
262+
})
263+
264+
const canCommandProfile = isCommandAllowedForProfile(query)
265+
240266
const indexForSeparator = findIndex(pluginsOptions, (option) => !option.internal)
241267
if (indexForSeparator > -1) {
242268
modifiedOptions.splice(indexForSeparator + 1, 0, {
@@ -320,6 +346,26 @@ const QueryCardHeader = (props: Props) => {
320346
</EuiToolTip>
321347
)}
322348
</EuiFlexItem>
349+
{isOpen && canCommandProfile && !summaryText && (
350+
<EuiFlexItem
351+
grow={false}
352+
className={cx(styles.buttonIcon, styles.viewTypeIcon)}
353+
onClick={onDropDownViewClick}
354+
>
355+
<div className={styles.dropdownWrapper}>
356+
<div className={styles.dropdown}>
357+
<EuiSuperSelect
358+
options={profileOptions}
359+
itemClassName={cx(styles.changeViewItem, styles.dropdownProfileItem)}
360+
className={cx(styles.changeView, styles.dropdownProfileIcon)}
361+
valueOfSelected={ProfileQueryType.Profile}
362+
onChange={(value: ProfileQueryType) => onQueryProfile(value)}
363+
data-testid="run-profile-type"
364+
/>
365+
</div>
366+
</div>
367+
</EuiFlexItem>
368+
)}
323369
<EuiFlexItem
324370
grow={false}
325371
className={cx(styles.buttonIcon, styles.viewTypeIcon)}

redisinsight/ui/src/components/query-card/QueryCardHeader/styles.module.scss

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,27 @@ $marginIcon: 12px;
127127
height: 40px;
128128
}
129129

130+
.dropdownProfileIcon {
131+
padding: inherit !important;
132+
:global {
133+
.euiSuperSelectControl.euiFormControlLayoutIcons {
134+
display: none !important;
135+
}
136+
}
137+
}
138+
139+
.dropdownProfileOption {
140+
display: inherit !important;
141+
}
142+
143+
.dropdownProfileItem {
144+
:global {
145+
.euiContextMenu__icon {
146+
display: none !important;
147+
}
148+
}
149+
}
150+
130151
.dropdown {
131152
width: 168px;
132153
position: absolute;
File renamed without changes.

redisinsight/ui/src/components/uploadFile/UploadFile.tsx renamed to redisinsight/ui/src/components/upload-file/UploadFile.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react'
2-
import { EuiButtonEmpty, EuiText } from '@elastic/eui'
2+
import { EuiButtonEmpty, EuiText, EuiIcon } from '@elastic/eui'
33

44
import styles from './styles.module.scss'
55

@@ -10,18 +10,18 @@ export interface Props {
1010

1111
const UploadFile = ({ onFileChange, onClick }: Props) => (
1212
<EuiButtonEmpty
13-
iconType="folderOpen"
1413
className={styles.emptyBtn}
14+
onClick={onClick}
1515
>
1616
<label htmlFor="upload-input-file" className={styles.uploadBtn}>
17+
<EuiIcon className={styles.icon} type="folderOpen" />
1718
<EuiText className={styles.label}>Upload</EuiText>
1819
<input
1920
type="file"
2021
id="upload-input-file"
2122
data-testid="upload-input-file"
2223
accept="application/json, text/plain"
2324
onChange={onFileChange}
24-
onClick={onClick}
2525
className={styles.fileDrop}
2626
aria-label="Select file"
2727
/>
File renamed without changes.

redisinsight/ui/src/components/uploadFile/styles.module.scss renamed to redisinsight/ui/src/components/upload-file/styles.module.scss

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
.uploadBtn {
66
display: flex;
77
cursor: pointer;
8+
padding: 4px 12px;
89
}
910

1011
.emptyBtn:global(.euiButtonEmpty) {
@@ -13,7 +14,14 @@
1314
}
1415

1516
.emptyBtn:global(.euiButtonEmpty .euiButtonEmpty__content) {
16-
padding: 0 12px;
17+
padding: 0;
18+
}
19+
20+
.emptyBtn .icon {
21+
width: 14px;
22+
height: 14px;
23+
margin: 2px 4px 0 0;
24+
color: var(--inputTextColor);
1725
}
1826

1927
:global(.euiButtonEmpty.euiButtonEmpty--primary).emptyBtn .label {

redisinsight/ui/src/packages/clients-list/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ This command will generate the `vendor` folder with styles and fonts of the core
2020
inside the folder for your plugin and include appropriate styles to the `index.html` file.
2121

2222
```
23+
yarn
24+
yarn --cwd redisinsight/api/ install
25+
2326
yarn build:statics - for Linux or MacOs
2427
yarn build:statics:win - for Windows
2528
```

0 commit comments

Comments
 (0)