Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add "Start with template" option and refactor template components #30946

Merged
merged 43 commits into from
Feb 13, 2024

Conversation

rahulbarwal
Copy link
Contributor

@rahulbarwal rahulbarwal commented Feb 7, 2024

Description

This pull request adds the "Start with template" option to the workspace action menu and refactors several template components to improve code organization and maintainability.

PR fixes following issue(s)

Fixes #30860

if no issue exists, please create an issue and ask the maintainers about this first

Media

A video or a GIF is preferred. when using Loom, don’t embed because it looks like it’s a GIF. instead, just link to the video

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Chore (housekeeping or task changes that don't impact user perception)
  • This change requires a documentation update

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

  • 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 have been covered
  • Test plan covers all impacted features and 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

Summary by CodeRabbit

  • New Features
    • Introduced the ability to create new applications from templates, enhancing user experience with a selection of predefined options.
    • Added a new feature flag to toggle the visibility of the "Create App from Template" functionality, allowing for phased rollouts.
  • Enhancements
    • Updated text constants for a more intuitive user interface.
    • Streamlined the template selection and application creation process with improved UI components and logic.
  • Refactor
    • Significant code organization and refactoring in template handling components for better maintainability and readability.
  • Tests
    • Adjusted unit tests to align with the new template creation flow.
  • Style
    • Adjusted styling for template views, ensuring a consistent and appealing user interface.

@rahulbarwal rahulbarwal self-assigned this Feb 7, 2024
@rahulbarwal
Copy link
Contributor Author

/build-deploy-preview

@github-actions github-actions bot added the Enhancement New feature or request label Feb 7, 2024
Copy link

github-actions bot commented Feb 7, 2024

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/7810603206.
Workflow: On demand build Docker image and deploy preview.
skip-tests: . env: .
PR: 30946.
recreate: .

@rahulbarwal
Copy link
Contributor Author

/ok-to-test tags="@tag.templates"

Copy link

github-actions bot commented Feb 7, 2024

Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/7810631145.
Workflow: Appsmith External Integration Test Workflow.
Tags: @tag.templates.

Copy link

github-actions bot commented Feb 7, 2024

Deploy-Preview-URL: https://ce-30946.dp.appsmith.com

Copy link

github-actions bot commented Feb 7, 2024

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/7810631145.
Commit: ``.
Cypress dashboard: Click here!
The following are new failures, please fix them before merging the PR:

  1. cypress/e2e/Regression/ServerSide/GenerateCRUD/MySQL2_Spec.ts

To know the list of identified flaky tests - Refer here

@rahulbarwal
Copy link
Contributor Author

/build-deploy-preview skip-tests=true recreate=false

Copy link

github-actions bot commented Feb 7, 2024

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/7811038111.
Workflow: On demand build Docker image and deploy preview.
skip-tests: true.
env: ``.
PR: 30946.
recreate: false.

Copy link

github-actions bot commented Feb 7, 2024

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/7810631145.
Commit: ``.
Cypress dashboard: Click here!
The following are new failures, please fix them before merging the PR:

  1. cypress/e2e/Regression/ServerSide/GenerateCRUD/MySQL2_Spec.ts

To know the list of identified flaky tests - Refer here

Copy link

github-actions bot commented Feb 7, 2024

Deploy-Preview-URL: https://ce-30946.dp.appsmith.com

@github-actions github-actions bot added Templates Templates Product Issues related to Templates labels Feb 11, 2024
@rahulbarwal
Copy link
Contributor Author

/build-deploy-preview

interface HeaderProps {
subtitle: string;
title: string;
isModalLayout?: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The isModalLayout prop in StartWithTemplatesHeader should have a default value to ensure backward compatibility and prevent potential issues when the prop is not explicitly provided. Consider setting a default value that reflects the most common usage scenario.

-  isModalLayout?: boolean;
+  isModalLayout: boolean = false;

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
isModalLayout?: boolean;
isModalLayout: boolean = false;

<Flex
flexDirection="column"
mb={isModalLayout ? "spaces-5" : "spaces-14"}
mt={isModalLayout ? "" : "spaces-7"}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The conditional margin-bottom (mb) based on isModalLayout is a good approach for responsive design. However, ensure that the empty string assignment for mt when isModalLayout is true does not lead to unintended layout issues. It might be safer to explicitly set a value or use conditional rendering to include or exclude the margin-top property.

-  mt={isModalLayout ? "" : "spaces-7"}
+  mt={isModalLayout ? "0" : "spaces-7"}

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
mt={isModalLayout ? "" : "spaces-7"}
mt={isModalLayout ? "0" : "spaces-7"}

@rahulbarwal
Copy link
Contributor Author

/ok-to-test tags="@tag.Templates"

Copy link

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/7867588162.
Workflow: On demand build Docker image and deploy preview.
skip-tests: . env: .
PR: 30946.
recreate: .

Copy link

Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/7867590515.
Workflow: Appsmith External Integration Test Workflow.
Tags: @tag.Templates.

Copy link

Deploy-Preview-URL: https://ce-30946.dp.appsmith.com

Copy link

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/7867590515.
Commit: ``.
Cypress dashboard: Click here!
The following are new failures, please fix them before merging the PR:

  1. cypress/e2e/Regression/ClientSide/Onboarding/StartFromScratch_spec.ts

To know the list of identified flaky tests - Refer here

@rahulbarwal
Copy link
Contributor Author

/build-deploy-preview

Copy link

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/7867825703.
Workflow: On demand build Docker image and deploy preview.
skip-tests: . env: .
PR: 30946.
recreate: .

Copy link

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/7867590515.
Commit: ``.
Cypress dashboard: Click here!
The following are new failures, please fix them before merging the PR:

  1. cypress/e2e/Regression/ClientSide/Onboarding/StartFromScratch_spec.ts

To know the list of identified flaky tests - Refer here

Copy link

Deploy-Preview-URL: https://ce-30946.dp.appsmith.com

@rahulbarwal
Copy link
Contributor Author

/build-deploy-preview

Copy link

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/7868153710.
Workflow: On demand build Docker image and deploy preview.
skip-tests: . env: .
PR: 30946.
recreate: .

Copy link

Deploy-Preview-URL: https://ce-30946.dp.appsmith.com

@rahulbarwal
Copy link
Contributor Author

/build-deploy-preview

Copy link

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/7868395498.
Workflow: On demand build Docker image and deploy preview.
skip-tests: . env: .
PR: 30946.
recreate: .

Comment on lines +8 to +11
import TemplatesLayoutWithFilters from "pages/Templates/TemplatesLayoutWithFilters";
import React from "react";
import { useDispatch, useSelector } from "react-redux";
import {
getForkableWorkspaces,
isImportingTemplateToAppSelector,
} from "selectors/templatesSelectors";
import { useSelector } from "react-redux";
import { getForkableWorkspaces } from "selectors/templatesSelectors";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider grouping imports from the same library or module together to improve readability and maintainability.

import React from "react";
import { useSelector } from "react-redux";
import { getForkableWorkspaces } from "selectors/templatesSelectors";
import styled from "styled-components";

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
import TemplatesLayoutWithFilters from "pages/Templates/TemplatesLayoutWithFilters";
import React from "react";
import { useDispatch, useSelector } from "react-redux";
import {
getForkableWorkspaces,
isImportingTemplateToAppSelector,
} from "selectors/templatesSelectors";
import { useSelector } from "react-redux";
import { getForkableWorkspaces } from "selectors/templatesSelectors";
import TemplatesLayoutWithFilters from "pages/Templates/TemplatesLayoutWithFilters";
import React from "react";
import { useSelector } from "react-redux";
import { getForkableWorkspaces } from "selectors/templatesSelectors";
import styled from "styled-components";

Comment on lines +16 to +17
onForkTemplateClick: (template: Template) => void;
isInsideModal?: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The isInsideModal prop is declared but not used within StartWithTemplatesWrapper. If it's intended for future use, ensure it's documented; otherwise, consider removing it to avoid confusion.

Comment on lines +33 to +34
<TemplatesLayoutWithFilters
analyticsEventNameForTemplateCardClick="CLICK_ON_TEMPLATE_CARD_WHEN_ONBOARDING"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The analyticsEventNameForTemplateCardClick prop in TemplatesLayoutWithFilters is hardcoded. Consider making this value configurable through props or a constants file to enhance flexibility and maintainability.

Comment on lines +36 to +42
interface TemplatesLayoutWithFilterProps {
initialFilters?: Record<string, string[]>;
isForkingEnabled?: boolean;
isModalLayout?: boolean;
setSelectedTemplate: (id: string) => void;
onForkTemplateClick: (template: TemplateInterface) => void;
analyticsEventNameForTemplateCardClick: EventName;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The analyticsEventNameForTemplateCardClick prop is a good addition for custom analytics events. However, ensure that this prop is documented, especially regarding its expected values and usage, to aid in maintainability and clarity for future developers.

Copy link

Deploy-Preview-URL: https://ce-30946.dp.appsmith.com

@rahulbarwal rahulbarwal merged commit b380b28 into release Feb 13, 2024
16 checks passed
@rahulbarwal rahulbarwal deleted the feat/30859/revert-templates-exp-in-homepage branch February 13, 2024 07:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request Templates Product Issues related to Templates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Task: Move template to app creation flow
2 participants