Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
ddff9d9
RI-5743 Rename capabilities
Oct 30, 2024
b8d6f89
RI-5743 Rename capabilities - RedisJSON
Nov 7, 2024
ea32634
RI-5743 Rename capabilities - 2
Nov 7, 2024
1334509
RI-5743 Rename capabilities - 3
Nov 8, 2024
1ed6197
RI-5743 Rename capabilities - 4
Nov 8, 2024
ea84957
RI-5743 - Rename capabilities - 6.1
Nov 8, 2024
5effb7a
RI-5743 Rename cpaabilities - cleanup
Nov 8, 2024
12fc851
RI-5743 updated tests
KIvanow Nov 11, 2024
b1be051
fix for tests
mariasergeenko Nov 11, 2024
cfc5bbb
RI-6302 - Text to add Json data when here is no JSON module is incorrect
KIvanow Nov 12, 2024
fe8972c
RI-6303 - Module name is not correct in chat bot
KIvanow Nov 12, 2024
7546fd0
RI-6308 - Modules are not renamed on Dbs list and db Info
KIvanow Nov 12, 2024
1bdf83f
RI-6304 - Module names are incorrect on info message in tutorials
KIvanow Nov 12, 2024
2848f84
RI-6303 - Module name is not correct in chat bot
KIvanow Nov 12, 2024
7f089a6
RI-6301 - Get started for free doesn't work from Workbench
KIvanow Nov 12, 2024
91c27c9
RI-6302 - Text to add Json data when here is no JSON module is incorrect
KIvanow Nov 12, 2024
9003408
Merge branch 'main' of https://github.com/RedisInsight/RedisInsight i…
KIvanow Nov 12, 2024
1bb7959
Merge branch 'main' of https://github.com/RedisInsight/RedisInsight i…
KIvanow Nov 12, 2024
b9a3a57
Merge branch 'main' into e2e/feature/RI-5743-Rename-capabilities
mariasergeenko Nov 12, 2024
0387587
fix for tests#2
mariasergeenko Nov 12, 2024
9ce2003
fix for tests#3
mariasergeenko Nov 12, 2024
cadeae1
RI-6314 - Modules name are old
KIvanow Nov 12, 2024
7ae91ac
Merge branch 'e2e/feature/RI-5743-Rename-capabilities' of https://git…
KIvanow Nov 12, 2024
20955b9
RI-6308 - Modules are not renamed on Dbs list and db Info
KIvanow Nov 13, 2024
cbd6c7e
rename to Probabilistic
mariasergeenko Nov 13, 2024
e1c7b57
Merge branch 'main' into e2e/feature/RI-5743-Rename-capabilities
mariasergeenko Nov 13, 2024
9961cd0
Merge branch 'main' into e2e/feature/RI-5743-Rename-capabilities
mariasergeenko Nov 13, 2024
8500e0d
RI-5743 updated test cases for the UI
KIvanow Nov 13, 2024
f1ddbc8
Merge branch 'e2e/feature/RI-5743-Rename-capabilities' of https://git…
KIvanow Nov 13, 2024
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
4 changes: 2 additions & 2 deletions redisinsight/api/src/__mocks__/rdi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,13 +311,13 @@ export const mockRdiConfigSchema = {
default: 1000,
},
target_data_type: {
title: 'Target data type: hash/json - RedisJSON module must be in use in the target DB',
title: 'Target data type: hash/json - JSON module must be in use in the target DB',
type: 'string',
pattern: '^\\${.*}$|hash|json',
default: 'hash',
},
json_update_strategy: {
title: 'Target update strategy: replace/merge - RedisJSON module must be in use in the target DB',
title: 'Target update strategy: replace/merge - JSON module must be in use in the target DB',
type: 'string',
pattern: '^\\${.*}$|replace|merge',
default: 'replace',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ describe('JsonService', () => {
} catch (err) {
expect(err).toBeInstanceOf(BadRequestException);
expect(err.message).toEqual(
ERROR_MESSAGES.REDIS_MODULE_IS_REQUIRED('RedisJSON'),
ERROR_MESSAGES.REDIS_MODULE_IS_REQUIRED('JSON'),
);
}
});
Expand Down Expand Up @@ -923,7 +923,7 @@ describe('JsonService', () => {
} catch (err) {
expect(err).toBeInstanceOf(BadRequestException);
expect(err.message).toEqual(
ERROR_MESSAGES.REDIS_MODULE_IS_REQUIRED('RedisJSON'),
ERROR_MESSAGES.REDIS_MODULE_IS_REQUIRED('JSON'),
);
}
});
Expand Down Expand Up @@ -1004,7 +1004,7 @@ describe('JsonService', () => {
} catch (err) {
expect(err).toBeInstanceOf(BadRequestException);
expect(err.message).toEqual(
ERROR_MESSAGES.REDIS_MODULE_IS_REQUIRED('RedisJSON'),
ERROR_MESSAGES.REDIS_MODULE_IS_REQUIRED('JSON'),
);
}
});
Expand Down Expand Up @@ -1097,7 +1097,7 @@ describe('JsonService', () => {
} catch (err) {
expect(err).toBeInstanceOf(BadRequestException);
expect(err.message).toEqual(
ERROR_MESSAGES.REDIS_MODULE_IS_REQUIRED('RedisJSON'),
ERROR_MESSAGES.REDIS_MODULE_IS_REQUIRED('JSON'),
);
}
});
Expand Down Expand Up @@ -1170,7 +1170,7 @@ describe('JsonService', () => {
} catch (err) {
expect(err).toBeInstanceOf(BadRequestException);
expect(err.message).toEqual(
ERROR_MESSAGES.REDIS_MODULE_IS_REQUIRED('RedisJSON'),
ERROR_MESSAGES.REDIS_MODULE_IS_REQUIRED('JSON'),
);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,12 @@ export class RejsonRlService {
}

if (error.message.includes(RedisErrorCodes.UnknownCommand)) {
throw new BadRequestException(
ERROR_MESSAGES.REDIS_MODULE_IS_REQUIRED('RedisJSON'),
);
throw new BadRequestException({
message: ERROR_MESSAGES.REDIS_MODULE_IS_REQUIRED('JSON'),
additionalInfo: {
jsonModuleMissing: true
}
});
}

throw catchAclError(error);
Expand Down Expand Up @@ -307,9 +310,12 @@ export class RejsonRlService {
}

if (error.message.includes(RedisErrorCodes.UnknownCommand)) {
throw new BadRequestException(
ERROR_MESSAGES.REDIS_MODULE_IS_REQUIRED('RedisJSON'),
);
throw new BadRequestException({
message: ERROR_MESSAGES.REDIS_MODULE_IS_REQUIRED('JSON'),
additionalInfo: {
jsonModuleMissing: true
}
});
}

// todo: refactor error handling across the project
Expand Down Expand Up @@ -361,9 +367,12 @@ export class RejsonRlService {
}

if (error.message.includes(RedisErrorCodes.UnknownCommand)) {
throw new BadRequestException(
ERROR_MESSAGES.REDIS_MODULE_IS_REQUIRED('RedisJSON'),
);
throw new BadRequestException({
message: ERROR_MESSAGES.REDIS_MODULE_IS_REQUIRED('JSON'),
additionalInfo: {
jsonModuleMissing: true
}
});
}

throw catchAclError(error);
Expand Down Expand Up @@ -402,9 +411,12 @@ export class RejsonRlService {
}

if (error.message.includes(RedisErrorCodes.UnknownCommand)) {
throw new BadRequestException(
ERROR_MESSAGES.REDIS_MODULE_IS_REQUIRED('RedisJSON'),
);
throw new BadRequestException({
message: ERROR_MESSAGES.REDIS_MODULE_IS_REQUIRED('JSON'),
additionalInfo: {
jsonModuleMissing: true
}
});
}

throw catchAclError(error);
Expand Down Expand Up @@ -443,9 +455,12 @@ export class RejsonRlService {
}

if (error.message.includes(RedisErrorCodes.UnknownCommand)) {
throw new BadRequestException(
ERROR_MESSAGES.REDIS_MODULE_IS_REQUIRED('RedisJSON'),
);
throw new BadRequestException({
message: ERROR_MESSAGES.REDIS_MODULE_IS_REQUIRED('JSON'),
additionalInfo: {
jsonModuleMissing: true
}
});
}

throw catchAclError(error);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ export class DatabaseOverviewProvider {
return [undefined, undefined];
}

const totalKeysPerDb = {};
const totalKeysPerDb: Record<string, number> = {};

masterNodes.forEach((node) => {
map(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const MODULE_CAPABILITY_TEXT_NOT_AVAILABLE: { [key in RedisDefaultModules
text: 'Create a free Redis Stack database with probabilistic data structures that extend the core capabilities of your Redis.'
},
[RedisDefaultModules.ReJSON]: {
title: 'JSON capability is not available',
title: 'JSON data structure is not available',
text: 'Create a free Redis Stack database with JSON capability that extends the core capabilities of your Redis.'
},
[RedisDefaultModules.Search]: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const MAX_ELEMENT_WIDTH = 1440
const renderTitle = (width: number, moduleName?: string) => (
<EuiTitle size="m" className={styles.title} data-testid="welcome-page-title">
<h4>
{`${moduleName} ${moduleName === MODULE_TEXT_VIEW.redisgears ? 'are' : 'is'} not available `}
{`${moduleName} ${[MODULE_TEXT_VIEW.redisgears, MODULE_TEXT_VIEW.bf].includes(moduleName) ? 'are' : 'is'} not available `}
{width > MAX_ELEMENT_WIDTH && <br />}
for this database
</h4>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,13 @@ const Notifications = () => {
)
}

if (!!additionalInfo?.jsonModuleMissing) {
return errorMessages.REDIS_JSON(
id,
() => removeToast({ id })
)
}

return errorMessages.DEFAULT(id, message, () => removeToast({ id }), title)
})

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import DefaultErrorContent from './default-error-content'
import EncryptionErrorContent from './encryption-error-content'
import { INFINITE_MESSAGES, InfiniteMessagesIds } from './infinite-messages'
import JsonErrorContent from './json-error-content'

export {
EncryptionErrorContent,
DefaultErrorContent,
INFINITE_MESSAGES,
InfiniteMessagesIds
InfiniteMessagesIds,
JsonErrorContent
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import { cloneDeep } from 'lodash'
import React from 'react'
import { instance, mock } from 'ts-mockito'
import { cleanup, mockedStore, render, screen } from 'uiSrc/utils/test-utils'
import JsonErrorContent, { Props } from './JsonErrorContent'

const mockedProps = mock<Props>()

let store: typeof mockedStore
beforeEach(() => {
cleanup()
store = cloneDeep(mockedStore)
store.clearActions()
})

jest.mock('uiSrc/services', () => ({
...jest.requireActual('uiSrc/services'),
sessionStorageService: {
set: jest.fn(),
get: jest.fn(),
},
}))

describe('JsonErrorContent', () => {
it('should render', () => {
expect(render(<JsonErrorContent {...instance(mockedProps)} />)).toBeTruthy()
})

it('should display the JSON support message', () => {
render(<JsonErrorContent {...instance(mockedProps)} />)
expect(screen.getByText(/This database does not support the JSON data structure/)).toBeInTheDocument()
})

it('should call onClose when clicking Ok button', () => {
const onClose = jest.fn()
render(<JsonErrorContent onClose={onClose} />)

screen.getByText('Ok').click()
expect(onClose).toHaveBeenCalled()
})

it('should render links to documentation', () => {
render(<JsonErrorContent {...instance(mockedProps)} />)

const links = screen.getAllByRole('link')
expect(links).toHaveLength(2)
expect(links[0]).toHaveAttribute('href', 'https://redis.io/docs/stack/json/about/')
expect(links[1]).toHaveAttribute('href', 'https://redis.io/docs/stack/json/about/')
})
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { EuiButton, EuiSpacer, EuiTextColor } from '@elastic/eui'
import React from 'react'

export interface Props {
onClose?: () => void;
}
// TODO: use i18n file for texts
const DefaultErrorContent = (
{
onClose = () => {},
}: Props
) => (
<>
<EuiTextColor color="ghost">
This database does not support the JSON data structure. Learn more about JSON support <a href="https://redis.io/docs/stack/json/about/" target="_blank" rel="noreferrer">here</a>.
You can also create a <a href="https://redis.io/docs/stack/json/about/" target="_blank" rel="noreferrer">free Redis Cloud database</a> with built-in JSON support.
</EuiTextColor>
<EuiSpacer />
<EuiButton
fill
size="s"
color="warning"
onClick={onClose}
data-testid="toast-cancel-btn"
className="toast-danger-btn"
>
Ok
</EuiButton>
</>
)

export default DefaultErrorContent
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import JsonErrorContent from './JsonErrorContent'

export default JsonErrorContent
15 changes: 14 additions & 1 deletion redisinsight/ui/src/components/notifications/error-messages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,26 @@ import React from 'react'
import { EuiTextColor } from '@elastic/eui'
import { Toast } from '@elastic/eui/src/components/toast/global_toast_list'
import RdiDeployErrorContent from './components/rdi-deploy-error-content'
import { EncryptionErrorContent, DefaultErrorContent } from './components'
import { EncryptionErrorContent, DefaultErrorContent, JsonErrorContent } from './components'
import CloudCapiUnAuthorizedErrorContent from './components/cloud-capi-unauthorized'

const TOAST_LIFE_TIME = 1000 * 60 * 60 * 12 // 12hr

// TODO: use i18n file for texts
export default {
REDIS_JSON: (id: string, onClose = () => {}): Toast => ({
id,
'data-test-subj': 'toast-error',
color: 'danger',
iconType: 'alert',
onClose,
title: (
<EuiTextColor color="ghost">
<b>Error</b>
</EuiTextColor>
),
text: <JsonErrorContent onClose={onClose} />,
}),
DEFAULT: (id: string, text: any, onClose = () => {}, title: string = 'Error'): Toast => ({
id,
'data-test-subj': 'toast-error',
Expand Down
6 changes: 3 additions & 3 deletions redisinsight/ui/src/constants/help-texts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import styles from 'uiSrc/pages/browser/components/popover-delete/styles.module.
export default {
REJSON_SHOULD_BE_LOADED: (
<>
RedisJSON module should be loaded to add this key. Find&nbsp;
JSON module should be loaded to add this key. Find&nbsp;
<a
href="https://redis.io/docs/latest/operate/oss_and_stack/stack-with-enterprise/json/?utm_source=redisinsight&utm_medium=app&utm_campaign=redisinsight_tutorials"
className="link-underline"
Expand All @@ -17,12 +17,12 @@ export default {
more information
</a>
&nbsp;
about RedisJSON or create your&nbsp;
about JSON or create your&nbsp;
<a href={`${EXTERNAL_LINKS.tryFree}?utm_source=redis&utm_medium=app&utm_campaign=redisinsight_redisjson`} className="link-underline" target="_blank" rel="noreferrer">
free Redis database
</a>
&nbsp;
with RedisJSON on Redis Cloud.
with JSON on Redis Cloud.
</>
),
REMOVE_LAST_ELEMENT: (fieldType: string) => (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,7 @@ export const MOCK_RECOMMENDATIONS: IRecommendationsStatic = {
type: 'link',
value: {
href: 'https://redis.io/docs/interact/search-and-query/',
name: 'RediSearch'
name: 'Redis Query Engine'
}
},
{
Expand Down
Loading
Loading