fix: Adds analytics event to log search input. (#27477)

## Description
Adds analytics event to log search input.
* Adds debounce to search as well.
#### PR fixes following issue(s)
Fixes #27449


#### Type of change
- Chore (housekeeping or task changes that don't impact user perception)
## Testing
>
#### How Has This Been Tested?
> Please describe the tests that you ran to verify your changes. Also
list any relevant details for your test configuration.
> Delete anything that is not relevant
- [x] Manual
- [ ] JUnit
- [ ] Jest
- [ ] Cypress
>
>
#### Test Plan
> Add Testsmith test cases links that relate to this PR
>
>
#### Issues raised during DP testing
> Link issues raised during DP testing for better visiblity and tracking
(copy link from comments dropped on this PR)
>
>
>
## Checklist:
#### Dev activity
- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] PR is being merged under a feature flag


#### QA activity:
- [ ] [Speedbreak
features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-)
have been covered
- [ ] Test plan covers all impacted features and [areas of
interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-)
- [ ] Test plan has been peer reviewed by project stakeholders and other
QA members
- [ ] Manually tested functionality on DP
- [ ] We had an implementation alignment call with stakeholders post QA
Round 2
- [ ] Cypress test cases have been added and approved by SDET/manual QA
- [ ] Added `Test Plan Approved` label after Cypress tests were reviewed
- [ ] Added `Test Plan Approved` label after JUnit tests were reviewed
This commit is contained in:
Rahul Barwal 2023-10-04 13:37:03 +05:30 committed by GitHub
parent b34eecd36f
commit ff749072da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 6 deletions

View File

@ -12,6 +12,7 @@ describe("excludeForAirgap", "Bug 17276 - Templates modal filtering", () => {
agHelper.GetText(templates.locators._resultsHeader).then((headerText) => {
templates.FilterTemplatesByName(NAME_FILTER);
agHelper.Sleep();
if (typeof headerText === "string") {
templates.AssertResultsHeaderText(headerText, "not.have.text");
}

View File

@ -38,7 +38,6 @@ describe("excludeForAirgap", "Templates page filtering", () => {
.GetText(templates.locators._resultsHeader, "text")
.then((headerText) => {
templates.FilterTemplatesByName(NAME_FILTER);
agHelper.Sleep();
agHelper.GetNClick(templates.locators._templateCard);
agHelper.GetNClick(templates.locators._templateViewGoBack);
agHelper.AssertText(

View File

@ -17,10 +17,11 @@ export class Templates {
};
FilterTemplatesByName(query: string) {
return ObjectsRegistry.AggregateHelper.TypeText(
ObjectsRegistry.AggregateHelper.TypeText(
this.locators._templatesSearchInput,
query,
);
this.agHelper.Sleep();
}
AssertResultsHeaderText(

View File

@ -335,7 +335,8 @@ export type EventName =
| "COMMUNITY_TEMPLATE_PUBLISH_CLICK"
| "EMAIL_VERIFICATION_SETTING_UPDATE"
| "EMAIL_VERIFICATION_FAILED"
| "TIME_TO_NAVIGATE_ENTITY_EXPLORER";
| "TIME_TO_NAVIGATE_ENTITY_EXPLORER"
| "TEMPLATES_SEARCH_INPUT_EVENT";
export type DATASOURCE_SCHEMA_EVENTS =
| "DATASOURCE_SCHEMA_SEARCH"

View File

@ -36,6 +36,8 @@ import type { Template } from "api/TemplatesApi";
import LoadingScreen from "./TemplatesModal/LoadingScreen";
import ReconnectDatasourceModal from "pages/Editor/gitSync/ReconnectDatasourceModal";
import { ReduxActionTypes } from "@appsmith/constants/ReduxActionConstants";
import { debounce } from "lodash";
import AnalyticsUtil from "utils/AnalyticsUtil";
const SentryRoute = Sentry.withSentryRouting(Route);
@ -152,16 +154,17 @@ type TemplatesContentProps = {
isForkingEnabled: boolean;
filterWithAllowPageImport?: boolean;
};
const INPUT_DEBOUNCE_TIMER = 500;
export function TemplatesContent(props: TemplatesContentProps) {
const templateSearchQuery = useSelector(getTemplateSearchQuery);
const isFetchingApplications = useSelector(getIsFetchingApplications);
const isFetchingTemplates = useSelector(isFetchingTemplatesSelector);
const isLoading = isFetchingApplications || isFetchingTemplates;
const dispatch = useDispatch();
const onChange = (query: string) => {
const onChange = debounce((query: string) => {
dispatch(setTemplateSearchQuery(query));
};
AnalyticsUtil.logEvent("TEMPLATES_SEARCH_INPUT_EVENT", { query });
}, INPUT_DEBOUNCE_TIMER);
const filterWithAllowPageImport = props.filterWithAllowPageImport || false;
const templates = useSelector(getSearchedTemplateList).filter((template) =>
filterWithAllowPageImport ? !!template.allowPageImport : true,