Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion redisinsight/ui/src/components/item-list/ItemList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { findColumn, getColumnWidth, hideColumn } from './utils'

import { ActionBar, DeleteAction, ExportAction } from './components'

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

export interface Props<T> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ const RedisCloudDatabaseListResult = ({ columns, onBack, onView }: Props) => {
</EuiFormRow>
<br />

<div className="databaseList cloudDatabaseListResult">
<div className="itemList databaseList cloudDatabaseListResult">
<EuiInMemoryTable
items={items}
itemId="uid"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ const RedisCloudDatabasesPage = ({
</EuiFormRow>
<br />

<div className="databaseList cloudDatabaseList">
<div className="itemList databaseList cloudDatabaseList">
<EuiInMemoryTable
items={items}
itemId="databaseId"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ const RedisCloudSubscriptions = ({
</EuiFormRow>
<br />

<div className={cx('databaseList', styles.cloudSubscriptions)}>
<div className={cx('databaseList', 'itemList', styles.cloudSubscriptions)}>
<div className={styles.account}>
<Account />
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ const SentinelDatabasesResult = ({
</EuiFormRow>
<br />

<div className="databaseList sentinelDatabaseListResult">
<div className="itemList databaseList sentinelDatabaseListResult">
<EuiInMemoryTable
items={items}
itemId="id"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const mockSentinelDatabases = (props: SentinelDatabasesProps) => (
<button type="button" onClick={() => props.onClose()} data-testid="close-btn">onClose</button>
<button type="button" onClick={() => props.onBack()} data-testid="back-btn">onBack</button>
<button type="button" onClick={() => props.onSubmit([])} data-testid="submit-btn">onSubmit</button>
<div className="databaseList sentinelDatabaseList">
<div className="itemList databaseList sentinelDatabaseList">
<EuiInMemoryTable
isSelectable
items={props.masters}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ const SentinelDatabases = ({
</EuiFormRow>
<br />

<div className="databaseList sentinelDatabaseList">
<div className="itemList databaseList sentinelDatabaseList">
<EuiInMemoryTable
isSelectable
items={items}
Expand Down
12 changes: 12 additions & 0 deletions redisinsight/ui/src/pages/rdi/constants/errors.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { upperFirst } from 'lodash'
import React from 'react'

export const rdiErrorMessages = {
invalidStructure: (name = 'Value', msg = 'Failed to convert YAML to JSON structure') => (
<>
{`${upperFirst(name)} has an invalid structure.`}
<br />
{msg}
</>
),
}
1 change: 1 addition & 0 deletions redisinsight/ui/src/pages/rdi/constants/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './errors'
10 changes: 2 additions & 8 deletions redisinsight/ui/src/pages/rdi/instance/InstancePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import React, { useEffect, useRef, useState } from 'react'
import { useDispatch, useSelector } from 'react-redux'
import { useHistory, useLocation, useParams } from 'react-router-dom'
import { Formik, FormikProps } from 'formik'
import { EuiText } from '@elastic/eui'
import { upperFirst } from 'lodash'

import {
appContextSelector,
Expand All @@ -25,6 +23,7 @@ import {
} from 'uiSrc/slices/rdi/pipeline'
import { IPipeline } from 'uiSrc/slices/interfaces'
import { createAxiosError, Nullable, pipelineToJson } from 'uiSrc/utils'
import { rdiErrorMessages } from 'uiSrc/pages/rdi/constants'
import { addErrorNotification } from 'uiSrc/slices/app/notifications'

import InstancePageRouter from './InstancePageRouter'
Expand Down Expand Up @@ -92,12 +91,7 @@ const RdiInstancePage = ({ routes = [] }: Props) => {
const onSubmit = (values: IPipeline) => {
const JSONValues = pipelineToJson(values, (errors) => {
dispatch(addErrorNotification(createAxiosError({
message: (
<>
<EuiText>{`${upperFirst(errors[0].filename)} has an invalid structure.`}</EuiText>
<EuiText>{errors[0].msg}</EuiText>
</>
)
message: rdiErrorMessages.invalidStructure(errors[0].filename, errors[0].msg)
})))
})
if (!JSONValues) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react'
import { useFormikContext } from 'formik'
import { cloneDeep } from 'lodash'
import { EuiText } from '@elastic/eui'
import { AxiosError } from 'axios'
import { rdiPipelineSelector, setChangedFile, deleteChangedFile } from 'uiSrc/slices/rdi/pipeline'
import { rdiTestConnectionsSelector } from 'uiSrc/slices/rdi/testConnections'
Expand Down Expand Up @@ -191,8 +190,9 @@ describe('Config', () => {
data: {
message: (
<>
<EuiText>Config has an invalid structure.</EuiText>
<EuiText>end of the stream or a document separator is expected</EuiText>
Config has an invalid structure.
<br />
end of the stream or a document separator is expected
</>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { FileChangeType, IPipeline, RdiPipelineTabs } from 'uiSrc/slices/interfa
import MonacoYaml from 'uiSrc/components/monaco-editor/components/monaco-yaml'
import TestConnectionsPanel from 'uiSrc/pages/rdi/pipeline-management/components/test-connections-panel'
import TemplatePopover from 'uiSrc/pages/rdi/pipeline-management/components/template-popover'
import { rdiErrorMessages } from 'uiSrc/pages/rdi/constants'
import { testConnectionsAction, rdiTestConnectionsSelector, testConnectionsController } from 'uiSrc/slices/rdi/testConnections'
import { appContextPipelineManagement } from 'uiSrc/slices/app/context'
import { createAxiosError, isEqualPipelineFile, yamlToJson } from 'uiSrc/utils'
Expand Down Expand Up @@ -59,12 +60,7 @@ const Config = () => {
const testConnections = () => {
const JSONValue = yamlToJson(config, (msg) => {
dispatch(addErrorNotification(createAxiosError({
message: (
<>
<EuiText>Config has an invalid structure.</EuiText>
<EuiText>{msg}</EuiText>
</>
)
message: rdiErrorMessages.invalidStructure('config', msg)
})))
})
if (!JSONValue) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useState, useEffect, useRef, useCallback } from 'react'
import { useDispatch, useSelector } from 'react-redux'
import { EuiText, EuiLink, EuiButton, EuiLoadingSpinner, EuiToolTip } from '@elastic/eui'
import { useFormikContext } from 'formik'
import { upperFirst, get, throttle } from 'lodash'
import { get, throttle } from 'lodash'
import cx from 'classnames'
import { monaco as monacoEditor } from 'react-monaco-editor'

Expand All @@ -12,6 +12,7 @@ import { deleteChangedFile, rdiPipelineSelector, setChangedFile } from 'uiSrc/sl
import { FileChangeType, IPipeline, RdiPipelineTabs } from 'uiSrc/slices/interfaces'
import MonacoYaml from 'uiSrc/components/monaco-editor/components/monaco-yaml'
import DryRunJobPanel from 'uiSrc/pages/rdi/pipeline-management/components/jobs-panel'
import { rdiErrorMessages } from 'uiSrc/pages/rdi/constants'
import { DSL, KEYBOARD_SHORTCUTS } from 'uiSrc/constants'
import TemplatePopover from 'uiSrc/pages/rdi/pipeline-management/components/template-popover'
import { createAxiosError, isEqualPipelineFile, Maybe, yamlToJson } from 'uiSrc/utils'
Expand Down Expand Up @@ -69,12 +70,7 @@ const Job = (props: Props) => {
const handleDryRunJob = () => {
const JSONValue = yamlToJson(value, (msg) => {
dispatch(addErrorNotification(createAxiosError({
message: (
<>
<EuiText>{`${upperFirst(name)} has an invalid structure.`}</EuiText>
<EuiText>{msg}</EuiText>
</>
)
message: rdiErrorMessages.invalidStructure(name, msg)
})))
})
if (!JSONValue) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@ import React from 'react'
import reactRouterDom from 'react-router-dom'
import { useFormikContext } from 'formik'
import { cloneDeep } from 'lodash'
import { AxiosError } from 'axios'

import { deleteChangedFile, getPipelineStrategies, rdiPipelineSelector, setChangedFile } from 'uiSrc/slices/rdi/pipeline'
import { cleanup, fireEvent, mockedStore, render, screen } from 'uiSrc/utils/test-utils'

import { sendPageViewTelemetry, TelemetryPageView, sendEventTelemetry, TelemetryEvent } from 'uiSrc/telemetry'
import { MOCK_RDI_PIPELINE_CONFIG, MOCK_RDI_PIPELINE_DATA, MOCK_RDI_PIPELINE_JOB2 } from 'uiSrc/mocks/data/rdi'
import { FileChangeType } from 'uiSrc/slices/interfaces'
import { addErrorNotification } from 'uiSrc/slices/app/notifications'
import JobWrapper from './JobWrapper'
import {addErrorNotification} from "uiSrc/slices/app/notifications";
import {EuiText} from "@elastic/eui";
import {AxiosError} from "axios";

jest.mock('uiSrc/telemetry', () => ({
...jest.requireActual('uiSrc/telemetry'),
Expand Down Expand Up @@ -207,8 +206,9 @@ describe('JobWrapper', () => {
data: {
message: (
<>
<EuiText>JobName has an invalid structure.</EuiText>
<EuiText>end of the stream or a document separator is expected</EuiText>
JobName has an invalid structure.
<br />
end of the stream or a document separator is expected
</>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ const RedisClusterDatabases = ({ columns, onClose, onBack, onSubmit }: Props) =>
</EuiFormRow>
<br />

<div className={cx('databaseList clusterDatabaseList', styles.databaseListWrapper)}>
<div className={cx('itemList databaseList clusterDatabaseList', styles.databaseListWrapper)}>
<EuiInMemoryTable
items={items}
itemId="uid"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ const RedisClusterDatabasesResult = ({ columns, onBack, onView }: Props) => {
</EuiFormRow>
<br />

<div className="databaseList clusterDatabaseListResult">
<div className="itemList databaseList clusterDatabaseListResult">
<EuiInMemoryTable
items={items}
itemId="uid"
Expand Down
1 change: 1 addition & 0 deletions redisinsight/ui/src/styles/components/_components.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@
@import "modal";
@import "markdown/index";
@import "homePage";
@import "itemList";
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@use "../mixins/eui";

.itemList {
@include eui.scrollBar;

Expand Down
13 changes: 0 additions & 13 deletions redisinsight/ui/src/styles/components/_table.scss
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,6 @@ body {
&:hover {
background-color: var(--tableRowHoverColor);
}

.copyHostPortText,
.copyUrlText,
.copyPublicEndpointText,
.column_name,
.column_name .euiToolTipAnchor {
display: inline-block;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
max-width: 100%;
vertical-align: top;
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion redisinsight/ui/src/utils/errors.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const getRdiValidationMessage = (message: string = '', loc?: Array<string
}

const [, ...rest] = loc
const formattedLoc = rest.reduce<string[]>((acc, curr, idx) => {
const formattedLoc = rest.reduce<string[]>((acc, curr) => {
if (isNumber(curr)) {
acc[acc.length - 1] += `[${curr}]`
} else {
Expand Down