diff --git a/configs/webpack.config.web.prod.babel.js b/configs/webpack.config.web.prod.babel.js index 214fc4773d..bffe500985 100644 --- a/configs/webpack.config.web.prod.babel.js +++ b/configs/webpack.config.web.prod.babel.js @@ -25,9 +25,10 @@ export default merge(commonConfig, { target: 'web', entry: ['regenerator-runtime/runtime', './index.tsx'], output: { - filename: 'js/bundle.[fullhash].min.js', + filename: 'js/bundle.[name].min.js', path: resolve(__dirname, '../redisinsight/ui/dist'), publicPath: '/', + chunkFilename: '[id].[chunkhash].js' }, optimization: { minimize: true, @@ -37,6 +38,34 @@ export default merge(commonConfig, { }), new CssMinimizerPlugin(), ], + runtimeChunk: 'single', + splitChunks: { + chunks: 'all', + maxInitialRequests: Infinity, + minSize: 0, + cacheGroups: { + reactVendor: { + test: /[\\/]node_modules[\\/](react|react-dom)[\\/]/, + name: "reactVendor" + }, + elasticVendor: { + test: /[\\/]node_modules[\\/](@elastic)[\\/]/, + name: "elasticVendor" + }, + monacoVendor: { + test: /[\\/]node_modules[\\/](monaco-editor)[\\/]/, + name: "monacoVendor" + }, + utilityVendor: { + test: /[\\/]node_modules[\\/](lodash)[\\/]/, + name: "utilityVendor" + }, + vendor: { + test: /[\\/]node_modules[\\/](!@elastic)(!monaco-editor)(!lodash)[\\/]/, + name: "vendor" + }, + }, + }, }, plugins: [ new MiniCssExtractPlugin({ diff --git a/redisinsight/ui/src/assets/img/workbench/vis_tag_cloud.svg b/redisinsight/ui/src/assets/img/workbench/vis_tag_cloud.svg new file mode 100644 index 0000000000..22259f5eab --- /dev/null +++ b/redisinsight/ui/src/assets/img/workbench/vis_tag_cloud.svg @@ -0,0 +1,3 @@ + + + diff --git a/redisinsight/ui/src/components/query-card/QueryCard.tsx b/redisinsight/ui/src/components/query-card/QueryCard.tsx index 166fe60835..694ed6187b 100644 --- a/redisinsight/ui/src/components/query-card/QueryCard.tsx +++ b/redisinsight/ui/src/components/query-card/QueryCard.tsx @@ -4,7 +4,7 @@ import cx from 'classnames' import { EuiLoadingContent, keys } from '@elastic/eui' import { useParams } from 'react-router-dom' -import { WBQueryType } from 'uiSrc/pages/workbench/constants' +import { WBQueryType, ProfileQueryType } from 'uiSrc/pages/workbench/constants' import { RunQueryMode, ResultsMode, ResultsSummary } from 'uiSrc/slices/interfaces/workbench' import { getWBQueryType, @@ -44,6 +44,7 @@ export interface Props { onQueryDelete: () => void onQueryReRun: () => void onQueryOpen: () => void + onQueryProfile: (type: ProfileQueryType) => void } const getDefaultPlugin = (views: IPluginVisualization[], query: string) => @@ -75,6 +76,7 @@ const QueryCard = (props: Props) => { createdAt, onQueryOpen, onQueryDelete, + onQueryProfile, onQueryReRun, loading, emptyCommand, @@ -186,6 +188,7 @@ const QueryCard = (props: Props) => { setSelectedValue={changeViewTypeSelected} onQueryDelete={onQueryDelete} onQueryReRun={onQueryReRun} + onQueryProfile={onQueryProfile} /> {isOpen && ( <> diff --git a/redisinsight/ui/src/components/query-card/QueryCardHeader/QueryCardHeader.tsx b/redisinsight/ui/src/components/query-card/QueryCardHeader/QueryCardHeader.tsx index 9aeb779b54..09de6cefa7 100644 --- a/redisinsight/ui/src/components/query-card/QueryCardHeader/QueryCardHeader.tsx +++ b/redisinsight/ui/src/components/query-card/QueryCardHeader/QueryCardHeader.tsx @@ -32,7 +32,7 @@ import { numberWithSpaces } from 'uiSrc/utils/numbers' import { ThemeContext } from 'uiSrc/contexts/themeContext' import { appPluginsSelector } from 'uiSrc/slices/app/plugins' import { sendEventTelemetry, TelemetryEvent } from 'uiSrc/telemetry' -import { getViewTypeOptions, WBQueryType } from 'uiSrc/pages/workbench/constants' +import { getViewTypeOptions, WBQueryType, getProfileViewTypeOptions, ProfileQueryType, isCommandAllowedForProfile } from 'uiSrc/pages/workbench/constants' import { IPluginVisualization } from 'uiSrc/slices/interfaces' import { RunQueryMode, ResultsMode, ResultsSummary } from 'uiSrc/slices/interfaces/workbench' import { appRedisCommandsSelector } from 'uiSrc/slices/app/redis-commands' @@ -70,6 +70,7 @@ export interface Props { setSelectedValue: (type: WBQueryType, value: string) => void onQueryDelete: () => void onQueryReRun: () => void + onQueryProfile: (type: ProfileQueryType) => void } const getExecutionTimeString = (value: number): string => { @@ -109,6 +110,7 @@ const QueryCardHeader = (props: Props) => { setSelectedValue, onQueryDelete, onQueryReRun, + onQueryProfile, db, } = props @@ -237,6 +239,30 @@ const QueryCardHeader = (props: Props) => { } }) + const profileOptions: EuiSuperSelectOption[] = (getProfileViewTypeOptions() as any[]).map((item) => { + const { value, id, text } = item + return { + value: id ?? value, + inputDisplay: ( + + + + ), + dropdownDisplay: ( + + {truncateText(text, 20)} + + ), + 'data-test-subj': `profile-type-option-${value}-${id}`, + } + }) + + const canCommandProfile = isCommandAllowedForProfile(query) + const indexForSeparator = findIndex(pluginsOptions, (option) => !option.internal) if (indexForSeparator > -1) { modifiedOptions.splice(indexForSeparator + 1, 0, { @@ -320,6 +346,26 @@ const QueryCardHeader = (props: Props) => { )} + {isOpen && canCommandProfile && !summaryText && ( + + + + onQueryProfile(value)} + data-testid="run-profile-type" + /> + + + + )} ( + Upload ( data-testid="upload-input-file" accept="application/json, text/plain" onChange={onFileChange} - onClick={onClick} className={styles.fileDrop} aria-label="Select file" /> diff --git a/redisinsight/ui/src/components/uploadFile/index.ts b/redisinsight/ui/src/components/upload-file/index.ts similarity index 100% rename from redisinsight/ui/src/components/uploadFile/index.ts rename to redisinsight/ui/src/components/upload-file/index.ts diff --git a/redisinsight/ui/src/components/uploadFile/styles.module.scss b/redisinsight/ui/src/components/upload-file/styles.module.scss similarity index 75% rename from redisinsight/ui/src/components/uploadFile/styles.module.scss rename to redisinsight/ui/src/components/upload-file/styles.module.scss index 6d5396e6f5..1c087ddc2a 100644 --- a/redisinsight/ui/src/components/uploadFile/styles.module.scss +++ b/redisinsight/ui/src/components/upload-file/styles.module.scss @@ -5,6 +5,7 @@ .uploadBtn { display: flex; cursor: pointer; + padding: 4px 12px; } .emptyBtn:global(.euiButtonEmpty) { @@ -13,7 +14,14 @@ } .emptyBtn:global(.euiButtonEmpty .euiButtonEmpty__content) { - padding: 0 12px; + padding: 0; +} + +.emptyBtn .icon { + width: 14px; + height: 14px; + margin: 2px 4px 0 0; + color: var(--inputTextColor); } :global(.euiButtonEmpty.euiButtonEmpty--primary).emptyBtn .label { diff --git a/redisinsight/ui/src/packages/clients-list/README.md b/redisinsight/ui/src/packages/clients-list/README.md index dfb349d4e5..1c68459449 100644 --- a/redisinsight/ui/src/packages/clients-list/README.md +++ b/redisinsight/ui/src/packages/clients-list/README.md @@ -20,6 +20,9 @@ This command will generate the `vendor` folder with styles and fonts of the core inside the folder for your plugin and include appropriate styles to the `index.html` file. ``` +yarn +yarn --cwd redisinsight/api/ install + yarn build:statics - for Linux or MacOs yarn build:statics:win - for Windows ``` diff --git a/redisinsight/ui/src/packages/clients-list/package.json b/redisinsight/ui/src/packages/clients-list/package.json index 4c0fa50114..b647c562b0 100644 --- a/redisinsight/ui/src/packages/clients-list/package.json +++ b/redisinsight/ui/src/packages/clients-list/package.json @@ -45,16 +45,13 @@ ], "devDependencies": { "@babel/core": "^7.12.0", - "@parcel/compressor-brotli": "^2.0.0", - "@parcel/compressor-gzip": "^2.0.0", - "@parcel/transformer-sass": "^2.0.0", - "@parcel/transformer-typescript-tsc": "^2.3.2", + "@parcel/transformer-sass": "2.3.2", "@types/node": "^17.0.21", "@types/react": "^17.0.40", "@types/react-dom": "^17.0.13", "concurrently": "^6.3.0", "cross-env": "^7.0.3", - "parcel": "^2.0.0", + "parcel": "2.3.2", "rimraf": "^3.0.2", "terser": "^5.9.0", "typescript": ">=3.0.0" diff --git a/redisinsight/ui/src/packages/clients-list/src/index.html b/redisinsight/ui/src/packages/clients-list/src/index.html index 2254419e39..7225fea8db 100644 --- a/redisinsight/ui/src/packages/clients-list/src/index.html +++ b/redisinsight/ui/src/packages/clients-list/src/index.html @@ -5,13 +5,13 @@ Client list plugin - - - + + + - +