feat: Updates templates filters section in appsmith platform (#23361)
## Description Updates templates filters 1. Removes data sources from filters 2. Renames `functions` to `teams` #### PR fixes following issue(s) Fixes # (issue number) #22959 #### Media <img width="713" alt="Screenshot 2023-05-15 at 10 14 30 PM" src="https://github.com/appsmithorg/appsmith/assets/6761673/d9021aa6-a21b-4b71-97f9-e59e6a77a93e"> #### Type of change - Breaking change (fix or feature that would cause existing functionality to not work as expected) ## Testing - [x] 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 - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [x] 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/Test-plan-implementation#speedbreaker-features-to-consider-for-every-change) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans/_edit#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:
parent
4fe71183f2
commit
acfa51aced
|
|
@ -1,4 +1,4 @@
|
|||
import React from "react";
|
||||
import React, { useMemo } from "react";
|
||||
import styled from "styled-components";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { Checkbox, Text } from "design-system";
|
||||
|
|
@ -110,6 +110,12 @@ function FilterCategory({
|
|||
label,
|
||||
selectedFilters,
|
||||
}: FilterCategoryProps) {
|
||||
const filterLabelsToDisplay: Record<string, string> = useMemo(
|
||||
() => ({
|
||||
functions: "teams",
|
||||
}),
|
||||
[],
|
||||
);
|
||||
// const [expand, setExpand] = useState(!!selectedFilters.length);
|
||||
const dispatch = useDispatch();
|
||||
// This indicates how many filter items do we want to show, the rest are hidden
|
||||
|
|
@ -139,7 +145,7 @@ function FilterCategory({
|
|||
return (
|
||||
<FilterCategoryWrapper>
|
||||
<StyledFilterCategory kind="body-m" renderAs="h4">
|
||||
{`${label} `}
|
||||
{`${filterLabelsToDisplay[label] ?? label} `}
|
||||
{!!selectedFilters.length && `(${selectedFilters.length})`}
|
||||
</StyledFilterCategory>
|
||||
<ListWrapper>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ import Fuse from "fuse.js";
|
|||
import type { AppState } from "@appsmith/reducers";
|
||||
import { createSelector } from "reselect";
|
||||
import { getWorkspaceCreateApplication } from "@appsmith/selectors/applicationSelectors";
|
||||
import { getWidgetCards } from "./editorSelectors";
|
||||
import { getDefaultPlugins } from "./entitiesSelector";
|
||||
import type { Filter } from "pages/Templates/Filters";
|
||||
|
||||
|
|
@ -149,14 +148,12 @@ export const templatesFiltersSelector = (state: AppState) =>
|
|||
// Get all filters which is associated with atleast one template
|
||||
// If no template is associated with a filter, then the filter shouldn't be in the filter list
|
||||
export const getFilterListSelector = createSelector(
|
||||
getWidgetCards,
|
||||
templatesDatasourceFiltersSelector,
|
||||
getTemplatesSelector,
|
||||
templatesFiltersSelector,
|
||||
(widgetConfigs, allDatasources, templates, allTemplateFilters) => {
|
||||
(templates, allTemplateFilters) => {
|
||||
const FUNCTIONS_FILTER = "functions";
|
||||
const filters: Record<string, Filter[]> = {
|
||||
datasources: [],
|
||||
functions: [],
|
||||
[FUNCTIONS_FILTER]: [],
|
||||
};
|
||||
|
||||
const allFunctions = allTemplateFilters.functions.map((item) => {
|
||||
|
|
@ -191,11 +188,9 @@ export const getFilterListSelector = createSelector(
|
|||
});
|
||||
};
|
||||
|
||||
templates.map((template) => {
|
||||
filterFilters("datasources", allDatasources, template);
|
||||
filterFilters("functions", allFunctions, template);
|
||||
templates.forEach((template) => {
|
||||
filterFilters(FUNCTIONS_FILTER, allFunctions, template);
|
||||
});
|
||||
|
||||
return filters;
|
||||
},
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user