diff --git a/redisinsight/ui/src/components/range-filter/RangeFilter.tsx b/redisinsight/ui/src/components/range-filter/RangeFilter.tsx index 173d06b279..f8503419e4 100644 --- a/redisinsight/ui/src/components/range-filter/RangeFilter.tsx +++ b/redisinsight/ui/src/components/range-filter/RangeFilter.tsx @@ -116,15 +116,15 @@ const RangeFilter = (props: Props) => { }, [end]) useEffect(() => { - if (max && prevValue && prevValue.max !== max && end === prevValue.max) { + if (prevValue.max !== max && end === prevValue.max) { handleUpdateRangeMax(max) } - if (min && prevValue && prevValue.min !== min && start === prevValue.min) { + if (prevValue.min !== min && start === prevValue.min) { handleUpdateRangeMin(min) } }, [prevValue]) - if (start === 0 && end === 0) { + if (start === 0 && max !== 0 && end === 0 && min !== 0) { return (
diff --git a/redisinsight/ui/src/pages/slowLog/SlowLogPage.tsx b/redisinsight/ui/src/pages/slowLog/SlowLogPage.tsx index 3447174f47..7cfade3875 100644 --- a/redisinsight/ui/src/pages/slowLog/SlowLogPage.tsx +++ b/redisinsight/ui/src/pages/slowLog/SlowLogPage.tsx @@ -17,8 +17,9 @@ import InstanceHeader from 'uiSrc/components/instance-header' import { DEFAULT_SLOWLOG_MAX_LEN } from 'uiSrc/constants' import { DATE_FORMAT } from 'uiSrc/pages/slowLog/components/SlowLogTable/SlowLogTable' import { convertNumberByUnits } from 'uiSrc/pages/slowLog/utils' +import { appAnalyticsInfoSelector } from 'uiSrc/slices/app/info' import { connectedInstanceSelector } from 'uiSrc/slices/instances/instances' -import { ConnectionProvider, ConnectionType } from 'uiSrc/slices/interfaces' +import { ConnectionType } from 'uiSrc/slices/interfaces' import { clearSlowLogAction, fetchSlowLogsAction, @@ -26,7 +27,7 @@ import { slowLogConfigSelector, slowLogSelector } from 'uiSrc/slices/slowlog/slowlog' -import { sendEventTelemetry, TelemetryEvent } from 'uiSrc/telemetry' +import { sendPageViewTelemetry, sendEventTelemetry, TelemetryEvent, TelemetryPageView } from 'uiSrc/telemetry' import { numberWithSpaces } from 'uiSrc/utils/numbers' import { SlowLog } from 'apiSrc/modules/slow-log/models' @@ -46,12 +47,14 @@ const countOptions: EuiSuperSelectOption[] = [ ] const SlowLogPage = () => { - const { connectionType, provider } = useSelector(connectedInstanceSelector) + const { connectionType, name: connectedInstanceName } = useSelector(connectedInstanceSelector) const { data, loading, durationUnit, config } = useSelector(slowLogSelector) const { slowlogLogSlowerThan = 0, slowlogMaxLen } = useSelector(slowLogConfigSelector) + const { identified: analyticsIdentified } = useSelector(appAnalyticsInfoSelector) const { instanceId } = useParams<{ instanceId: string }>() const [count, setCount] = useState(DEFAULT_COUNT_VALUE) + const [isPageViewSent, setIsPageViewSent] = useState(false) const dispatch = useDispatch() @@ -65,8 +68,22 @@ const SlowLogPage = () => { getSlowLogs() }, [count]) + useEffect(() => { + if (connectedInstanceName && !isPageViewSent && analyticsIdentified) { + sendPageView(instanceId) + } + }, [connectedInstanceName, isPageViewSent, analyticsIdentified]) + + const sendPageView = (instanceId: string) => { + sendPageViewTelemetry({ + name: TelemetryPageView.SLOWLOG_PAGE, + databaseId: instanceId + }) + setIsPageViewSent(true) + } + const getSlowLogs = (maxLen?: number) => { - const countToSend = (provider === ConnectionProvider.RE_CLOUD && count === MAX_COUNT_VALUE) + const countToSend = count === MAX_COUNT_VALUE ? (maxLen || slowlogMaxLen || DEFAULT_SLOWLOG_MAX_LEN) : toNumber(count) diff --git a/redisinsight/ui/src/telemetry/pageViews.ts b/redisinsight/ui/src/telemetry/pageViews.ts index b9f7e478d1..ae25e594be 100644 --- a/redisinsight/ui/src/telemetry/pageViews.ts +++ b/redisinsight/ui/src/telemetry/pageViews.ts @@ -4,4 +4,5 @@ export enum TelemetryPageView { SETTINGS_PAGE = 'Settings', BROWSER_PAGE = 'Browser', WORKBENCH_PAGE = 'Workbench', + SLOWLOG_PAGE = 'Slow Log' } diff --git a/redisinsight/ui/src/telemetry/segment.ts b/redisinsight/ui/src/telemetry/segment.ts index 28d5492cc2..8fc42c9f6c 100644 --- a/redisinsight/ui/src/telemetry/segment.ts +++ b/redisinsight/ui/src/telemetry/segment.ts @@ -32,7 +32,11 @@ export class SegmentTelemetryService implements ITelemetryService { if (!isWebApp) { pageObject.page = { - path: '', url: '', title: globalThis.document.title + path: '', url: '', title: '' + } + } else { + pageObject.page = { + ...pageObject.page, title: '' } } diff --git a/tests/e2e/pageObjects/browser-page.ts b/tests/e2e/pageObjects/browser-page.ts index 8eab09a736..0299211b78 100644 --- a/tests/e2e/pageObjects/browser-page.ts +++ b/tests/e2e/pageObjects/browser-page.ts @@ -172,9 +172,10 @@ export class BrowserPage { streamEntryColumns = Selector(this.streamEntriesContainer.find('[aria-colcount]')); streamEntryRows = Selector(this.streamEntriesContainer.find('[aria-rowcount]')); streamEntryDate = Selector('[data-testid*=-date][data-testid*=stream-entry]'); + streamEntryIdValue = Selector('.streamEntryId[data-testid*=stream-entry]'); streamFields = Selector('[data-test-id=stream-entries-container] .truncateText span'); streamEntryFields = Selector('[data-testid^=stream-entry-field]'); - confirmationMessagePopover = Selector('div.euiPopover__panel'); + confirmationMessagePopover = Selector('div.euiPopover__panel .euiText '); /** * Common part for Add any new key diff --git a/tests/e2e/tests/critical-path/browser/stream-key-entry-deletion.e2e.ts b/tests/e2e/tests/critical-path/browser/stream-key-entry-deletion.e2e.ts index ce031fbbe1..ade40b0724 100644 --- a/tests/e2e/tests/critical-path/browser/stream-key-entry-deletion.e2e.ts +++ b/tests/e2e/tests/critical-path/browser/stream-key-entry-deletion.e2e.ts @@ -55,7 +55,7 @@ test('Verify that the Stream information is refreshed and the deleted entry is r const fieldName = await browserPage.streamFields.nth(i).textContent; await t.expect(fieldName).notEql(fieldForDeletion, 'The deleted entry is removed from the Stream'); } - await t.click(browserPage.fullScreenModeButton.nth(1)); + await t.click(browserPage.fullScreenModeButton); }); test('Verify that when user delete the last Entry from the Stream the Stream key is not deleted', async t => { keyName = chance.word({length: 20}); diff --git a/tests/e2e/tests/critical-path/browser/stream-key.e2e.ts b/tests/e2e/tests/critical-path/browser/stream-key.e2e.ts index 0ea1051234..07aa093181 100644 --- a/tests/e2e/tests/critical-path/browser/stream-key.e2e.ts +++ b/tests/e2e/tests/critical-path/browser/stream-key.e2e.ts @@ -12,7 +12,7 @@ import { const browserPage = new BrowserPage(); const chance = new Chance(); -const keyName = chance.word({ length: 20 }); +let keyName = chance.word({ length: 20 }); const keyField = chance.word({ length: 20 }); const keyValue = chance.word({ length: 20 }); @@ -28,6 +28,7 @@ fixture `Stream Key` await deleteDatabase(ossStandaloneConfig.databaseName); }); test('Verify that user can create Stream key via Add New Key form', async t => { + keyName = chance.word({ length: 20 }); // Add New Stream Key await browserPage.addStreamKey(keyName, keyField, keyValue); // Verify that user can see Stream details opened after key creation @@ -64,6 +65,7 @@ test('Verify that user can add several fields and values during Stream key creat await t.expect(browserPage.keyNameFormDetails.withExactText(keyName).visible).ok('Stream Key Name'); }); test('Verify that user can add new Stream Entry for Stream data type key which has an Entry ID, Field and Value', async t => { + keyName = chance.word({ length: 20 }); // Add New Stream Key await browserPage.addStreamKey(keyName, keyField, keyValue); // Verify that when user adds a new Entry with not existed Field name, a new Field is added to the Stream @@ -81,6 +83,7 @@ test('Verify that user can add new Stream Entry for Stream data type key which h await t.expect(paramsAfterExistedFieldAdding[1]).eql(toString(toNumber(paramsBeforeExistedFieldAdding[1]) + 1), 'Increased number of rows after adding'); }); test('Verify that during new entry adding to existing Stream, user can clear the value and the row itself', async t => { + keyName = chance.word({ length: 20 }); // Generate data for stream const fields = [keyField, chance.word({ length: 20 })]; const values = [keyValue, chance.word({ length: 20 })]; @@ -107,6 +110,7 @@ test('Verify that during new entry adding to existing Stream, user can clear the await t.expect(browserPage.streamField.count).eql(fieldsNumberAfterDeletion, 'Number of fields after deletion'); }); test('Verify that user can add several fields and values to the existing Stream Key', async t => { + keyName = chance.word({ length: 20 }); // Generate field value data const entryQuantity = 10; const fields: string[] = []; diff --git a/tests/e2e/tests/regression/browser/stream-key.e2e.ts b/tests/e2e/tests/regression/browser/stream-key.e2e.ts index e695eba7b2..968e194018 100644 --- a/tests/e2e/tests/regression/browser/stream-key.e2e.ts +++ b/tests/e2e/tests/regression/browser/stream-key.e2e.ts @@ -90,7 +90,7 @@ test('Verify that user can see all the columns are displayed by default for Stre const fieldName = await browserPage.streamFields.nth(i).textContent; await t.expect(fieldName).eql(fields[i], 'All the columns are displayed by default for Stream'); } - await t.click(browserPage.fullScreenModeButton.nth(1)); + await t.click(browserPage.fullScreenModeButton); }); test('Verify that the multi-line cell value tooltip is available on hover as per standard key details behavior', async t => { keyName = chance.word({length: 20}); @@ -111,12 +111,14 @@ test('Verify that the multi-line cell value tooltip is available on hover as per test('Verify that user can see a confirmation message when request to delete an entry in the Stream', async t => { keyName = chance.word({length: 20}); field = 'fieldForRemoving'; - const confirmationMessage = 'This Entry will be removed from'; + const confirmationMessage = `will be removed from ${keyName}`; //Add new Stream key with 1 field await cliPage.sendCommandInCli(`XADD ${keyName} * ${field} ${value}`); //Open key details and click on delete entry await browserPage.openKeyDetails(keyName); + const entryId = await browserPage.streamEntryIdValue.textContent; await t.click(browserPage.removeEntryButton); //Check the confirmation message await t.expect(browserPage.confirmationMessagePopover.textContent).contains(confirmationMessage, `The confirmation message ${keyName}`); + await t.expect(browserPage.confirmationMessagePopover.textContent).contains(entryId, `The confirmation message for removing Entry`); }); diff --git a/tests/e2e/tests/regression/cli/cli-command-helper.e2e.ts b/tests/e2e/tests/regression/cli/cli-command-helper.e2e.ts index c1bea61a99..6a0d8210ad 100644 --- a/tests/e2e/tests/regression/cli/cli-command-helper.e2e.ts +++ b/tests/e2e/tests/regression/cli/cli-command-helper.e2e.ts @@ -217,7 +217,7 @@ test 'BF.MEXISTS key item [item ...]', 'CMS.QUERY key item [item ...]', 'TDIGEST.RESET key', - 'TOPK.LIST key numKeys withcount', + 'TOPK.LIST key withcount', 'CF.ADD key item' ]; externalPageLinks = [