Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
8de90cb
#RI-4950 - add tutorials for home page, refactoring
rsergeenko Jan 19, 2024
836f20d
#RI-4950 - fix tests
rsergeenko Jan 19, 2024
74fbd3e
Merge branch 'feature/RI-4943_rework-tutorials' into fe/feature/RI-49…
rsergeenko Jan 22, 2024
efb29c2
#RI-5344 - update explore guides component
rsergeenko Jan 22, 2024
7f8fe76
Merge pull request #2973 from RedisInsight/fe/feature/RI-5344-update-…
rsergeenko Jan 22, 2024
702a7c9
#RI-5345 - update capability promotion from paths to ids
rsergeenko Jan 22, 2024
b392ab7
#RI-5345 - fix tests
rsergeenko Jan 22, 2024
855abe9
Merge pull request #2974 from RedisInsight/fe/feature/RI-5345-update-…
rsergeenko Jan 22, 2024
9030fb2
add test for displaying Insights panel on welcome and list of dbs
mariasergeenko Jan 22, 2024
613d1a8
remove skip
mariasergeenko Jan 22, 2024
e1ea903
e2e RI-5344
vlad-dargel Jan 22, 2024
d24c1da
Merge pull request #2975 from RedisInsight/e2e/feature/RI-4950_tutori…
mariasergeenko Jan 22, 2024
071fe23
Merge pull request #2976 from RedisInsight/e2e/feature/RI-5344_align_…
vlad-dargel Jan 22, 2024
abb8c5b
#RI-5348 - change logic to hide columns
rsergeenko Jan 23, 2024
ff08666
#RI-5348 - change name of the variable
rsergeenko Jan 23, 2024
0b5fea0
fix part of tests
mariasergeenko Jan 23, 2024
83013c9
#RI-5348 - add tests, add handling errors
rsergeenko Jan 23, 2024
b4b9d53
Merge pull request #2982 from RedisInsight/fe/bugfix/capability-promo…
rsergeenko Jan 23, 2024
b23a968
fix part#2 of tests
mariasergeenko Jan 23, 2024
895c0e4
#RI-5351 - update styles for db form
rsergeenko Jan 23, 2024
a43e3e2
fix part#3 of tests
mariasergeenko Jan 23, 2024
c855726
Merge pull request #2985 from RedisInsight/fe/feature/RI-5351-update-…
mariasergeenko Jan 23, 2024
1723f44
Merge pull request #2986 from RedisInsight/e2e/feature/RI-4950_tutori…
mariasergeenko Jan 23, 2024
2abbe95
Merge branch 'feature/RI-4943_rework-tutorials' into fe/feature/RI-49…
mariasergeenko Jan 23, 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
37 changes: 37 additions & 0 deletions redisinsight/ui/src/assets/img/click-learn-rocket.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ beforeEach(() => {
})

describe('DatabaseSidePanels', () => {
beforeEach(() => {
reactRouterDom.useParams = jest.fn().mockReturnValue({ instanceId: 'instanceId' })
})
it('should render', () => {
expect(render(<DatabaseSidePanels />)).toBeTruthy()
})
Expand Down Expand Up @@ -135,6 +138,25 @@ describe('DatabaseSidePanels', () => {
expect(screen.queryByTestId('recommendations-unread-count')).not.toBeInTheDocument()
})

it('should not render recommendations count without instanceId', () => {
reactRouterDom.useParams = jest.fn().mockReturnValue({ instanceId: undefined });
(insightsPanelSelector as jest.Mock).mockReturnValue({
isOpen: true,
tabSelected: 'tips'
});

(recommendationsSelector as jest.Mock).mockImplementationOnce(() => ({
...mockRecommendationsSelector,
data: {
recommendations: [],
totalUnread: 7,
},
}))

render(<DatabaseSidePanels />)
expect(screen.queryByTestId('recommendations-unread-count')).not.toBeInTheDocument()
})

it('should render recommendations count with totalUnread > 0', () => {
(insightsPanelSelector as jest.Mock).mockReturnValue({
isOpen: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { useHistory, useLocation, useParams } from 'react-router-dom'
import { changeSelectedTab, insightsPanelSelector, resetExplorePanelSearch, setExplorePanelIsPageOpen, toggleInsightsPanel } from 'uiSrc/slices/panels/insights'
import { InsightsPanelTabs } from 'uiSrc/slices/interfaces/insights'
import { recommendationsSelector } from 'uiSrc/slices/recommendations/recommendations'
import { sendEventTelemetry, TelemetryEvent } from 'uiSrc/telemetry'
import { sendEventTelemetry, TELEMETRY_EMPTY_VALUE, TelemetryEvent } from 'uiSrc/telemetry'
import { connectedInstanceCDSelector, connectedInstanceSelector } from 'uiSrc/slices/instances/instances'
import { ONBOARDING_FEATURES } from 'uiSrc/components/onboarding-features'
import { FullScreen, OnboardingTour } from 'uiSrc/components'
Expand Down Expand Up @@ -93,7 +93,7 @@ const DatabaseSidePanels = (props: Props) => {
sendEventTelemetry({
event: TelemetryEvent.INSIGHTS_PANEL_CLOSED,
eventData: {
databaseId: instanceId,
databaseId: instanceId || TELEMETRY_EMPTY_VALUE,
provider,
page,
tab: tabSelected
Expand All @@ -109,7 +109,7 @@ const DatabaseSidePanels = (props: Props) => {
sendEventTelemetry({
event: TelemetryEvent.INSIGHTS_PANEL_TAB_CHANGED,
eventData: {
databaseId: instanceId,
databaseId: instanceId || TELEMETRY_EMPTY_VALUE,
prevTab: tabSelected,
currentTab: name,
},
Expand All @@ -121,7 +121,7 @@ const DatabaseSidePanels = (props: Props) => {
sendEventTelemetry({
event: TelemetryEvent.INSIGHTS_PANEL_FULL_SCREEN_CLICKED,
eventData: {
databaseId: instanceId,
databaseId: instanceId || TELEMETRY_EMPTY_VALUE,
state: value ? 'exit' : 'open'
},
})
Expand Down Expand Up @@ -155,7 +155,7 @@ const DatabaseSidePanels = (props: Props) => {
>
<>
<span className={styles.tabName}>Tips</span>
{!!totalUnread && (
{(!!totalUnread && instanceId) && (
<div
className={styles.tabTotalUnread}
data-testid="recommendations-unread-count"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useSelector } from 'react-redux'
import EnablementAreaContext from 'uiSrc/pages/workbench/contexts/enablementAreaContext'
import { CodeButtonParams } from 'uiSrc/constants'
import { parseParams } from 'uiSrc/utils'
import { sendEventTelemetry, TelemetryEvent } from 'uiSrc/telemetry'
import { sendEventTelemetry, TELEMETRY_EMPTY_VALUE, TelemetryEvent } from 'uiSrc/telemetry'
import { connectedInstanceSelector } from 'uiSrc/slices/instances/instances'
import { getFileInfo, getTutorialSection, } from '../../utils'

Expand Down Expand Up @@ -64,7 +64,7 @@ const Code = ({ children, params = '', label, path, ...rest }: Props) => {
sendEventTelemetry({
event: TelemetryEvent.EXPLORE_PANEL_COMMAND_COPIED,
eventData: {
databaseId: instanceId,
databaseId: instanceId || TELEMETRY_EMPTY_VALUE,
buttonName: label,
path,
provider,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,32 +149,48 @@ describe('CodeButtonBlock', () => {

expect(sendEventTelemetry).toBeCalledWith({
event: TelemetryEvent.EXPLORE_PANEL_DATABASE_CHANGE_CLICKED,
eventData:
{
databaseId: 'instanceId'
}
eventData: {
databaseId: 'instanceId'
}
})
})

it('should call popover with no module loaded', async () => {
const sendEventTelemetryMock = jest.fn();
(sendEventTelemetry as jest.Mock).mockImplementation(() => sendEventTelemetryMock)
const onApply = jest.fn()

render(
<CodeButtonBlock
{...instance(mockedProps)}
label={label}
onApply={onApply}
params={{ run_confirmation: 'true' }}
params={{ run_confirmation: 'false' }}
content="ft.info"
/>
)
await act(() => {
fireEvent.click(screen.getByTestId(`run-btn-${label}`))
})

expect(screen.getByTestId('tutorials-docker-link')).toBeInTheDocument()
expect(screen.getByTestId('tutorials-get-started-link')).toBeInTheDocument()
expect(screen.getByTestId('module-not-loaded-popover')).toBeInTheDocument()
})

it('should call not opened db popover without instanceId', async () => {
reactRouterDom.useParams = jest.fn().mockReturnValue({ instanceId: undefined })
const onApply = jest.fn()

render(
<CodeButtonBlock
{...instance(mockedProps)}
label={label}
onApply={onApply}
params={{ run_confirmation: 'false' }}
content={simpleContent}
/>
)
await act(() => {
fireEvent.click(screen.getByTestId(`run-btn-${label}`))
})

expect(screen.getByTestId('database-not-opened-popover')).toBeInTheDocument()
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ import { BooleanParams, CodeButtonParams, MonacoLanguage } from 'uiSrc/constants
import { CodeBlock } from 'uiSrc/components'
import { getDBConfigStorageField } from 'uiSrc/services'
import { ConfigDBStorageItem } from 'uiSrc/constants/storage'
import ModuleNotLoadedMinimalized
from 'uiSrc/components/messages/module-not-loaded-minimalized/ModuleNotLoadedMinimalized'
import { ModuleNotLoadedMinimalized, DatabaseNotOpened } from 'uiSrc/components/messages'
import { OAuthSocialSource } from 'uiSrc/slices/interfaces'
import { AdditionalRedisModule } from 'apiSrc/modules/database/models/additional.redis.module'

Expand Down Expand Up @@ -82,12 +81,7 @@ const CodeButtonBlock = (props: Props) => {
}

const handleRunClicked = () => {
if (notLoadedModule) {
setIsPopoverOpen(true)
return
}

if (!isNotShowConfirmation && isButtonHasConfirmation) {
if (!instanceId || notLoadedModule || (!isNotShowConfirmation && isButtonHasConfirmation)) {
setIsPopoverOpen(true)
return
}
Expand All @@ -104,6 +98,24 @@ const CodeButtonBlock = (props: Props) => {
setIsPopoverOpen(false)
}

const getPopoverMessage = (): React.ReactNode => {
if (!instanceId) {
return (<DatabaseNotOpened />)
}

if (notLoadedModule) {
return (
<ModuleNotLoadedMinimalized
moduleName={notLoadedModule}
source={OAuthSocialSource.Tutorials}
onClose={() => setIsPopoverOpen(false)}
/>
)
}

return (<RunConfirmationPopover onApply={handleApplyRun} />)
}

return (
<div className={styles.wrapper}>
<EuiFlexGroup gutterSize="none">
Expand Down Expand Up @@ -157,14 +169,7 @@ const CodeButtonBlock = (props: Props) => {
</EuiToolTip>
)}
>
{!!notLoadedModule && (
<ModuleNotLoadedMinimalized
moduleName={notLoadedModule}
source={OAuthSocialSource.Tutorials}
onClose={() => setIsPopoverOpen(false)}
/>
)}
{!notLoadedModule && <RunConfirmationPopover onApply={handleApplyRun} />}
{getPopoverMessage()}
</EuiPopover>
</EuiFlexItem>
</EuiFlexGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useSelector } from 'react-redux'
import { useParams } from 'react-router-dom'
import cx from 'classnames'

import { sendEventTelemetry, TelemetryEvent } from 'uiSrc/telemetry'
import { sendEventTelemetry, TELEMETRY_EMPTY_VALUE, TelemetryEvent } from 'uiSrc/telemetry'
import { workbenchCustomTutorialsSelector } from 'uiSrc/slices/workbench/wb-custom-tutorials'
import { EAItemActions } from 'uiSrc/constants'
import { ONBOARDING_FEATURES } from 'uiSrc/components/onboarding-features'
Expand Down Expand Up @@ -60,7 +60,7 @@ const Group = (props: Props) => {
sendEventTelemetry({
event: TelemetryEvent.EXPLORE_PANEL_IMPORT_CLICKED,
eventData: {
databaseId: instanceId,
databaseId: instanceId || TELEMETRY_EMPTY_VALUE,
}
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { useSelector } from 'react-redux'

import { ExternalLink } from 'uiSrc/components'
import { IEnablementAreaItem } from 'uiSrc/slices/interfaces'
import { sendEventTelemetry, TelemetryEvent } from 'uiSrc/telemetry'
import { sendEventTelemetry, TELEMETRY_EMPTY_VALUE, TelemetryEvent } from 'uiSrc/telemetry'
import { getTutorialCapability, Nullable } from 'uiSrc/utils'

import { ReactComponent as RocketIcon } from 'uiSrc/assets/img/icons/rocket.svg'
Expand Down Expand Up @@ -88,7 +88,7 @@ const InternalPage = (props: Props) => {
path,
link,
section: getTutorialSection(manifestPath),
databaseId: instanceId,
databaseId: instanceId || TELEMETRY_EMPTY_VALUE,
}
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,7 @@
margin: ($margin-size-pace * 3 + px) 0;
}

img {
max-width: 100%;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { useDispatch } from 'react-redux'
import { EnablementAreaComponent, IEnablementAreaItem } from 'uiSrc/slices/interfaces'

import { ApiEndpoints, EAItemActions, EAManifestFirstKey } from 'uiSrc/constants'
import { sendEventTelemetry, TelemetryEvent } from 'uiSrc/telemetry'
import { sendEventTelemetry, TELEMETRY_EMPTY_VALUE, TelemetryEvent } from 'uiSrc/telemetry'
import { deleteCustomTutorial, uploadCustomTutorial } from 'uiSrc/slices/workbench/wb-custom-tutorials'

import {
Expand Down Expand Up @@ -58,7 +58,7 @@ const Navigation = (props: Props) => {
sendEventTelemetry({
event: TelemetryEvent.EXPLORE_PANEL_IMPORT_SUBMITTED,
eventData: {
databaseId: instanceId,
databaseId: instanceId || TELEMETRY_EMPTY_VALUE,
source: file ? 'Upload' : 'URL'
}
})
Expand All @@ -74,7 +74,7 @@ const Navigation = (props: Props) => {
sendEventTelemetry({
event: TelemetryEvent.EXPLORE_PANEL_TUTORIAL_DELETED,
eventData: {
databaseId: instanceId,
databaseId: instanceId || TELEMETRY_EMPTY_VALUE,
}
})
}))
Expand Down
Loading