fix: Updating the ramp link for Enterprise features to open the pricing page (#32698)

## Description

Updating the ramp link for Enterprise features to open the pricing page.

Fixes [#30211](https://github.com/appsmithorg/appsmith/issues/30211)  

## Automation

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

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/8706159532>
> Commit: b9925ae2ec5a14724586f72affa02a1d83078813
> Cypress dashboard url: <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=8706159532&attempt=1"
target="_blank">Click here!</a>

<!-- end of auto-generated comment: Cypress test results  -->












<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Enhanced enterprise-level provisioning and authentication settings
across various components.
- Added a new Cypress command to improve testing by simulating customer
portal interactions.

- **Refactor**
- Streamlined UI components by adjusting styles and simplifying
rendering logic.
- Removed redundant spinner components and simplified conditions in
various editor components.

- **Style**
- Updated CSS properties and variables for better consistency and
maintainability.

- **Tests**
- Updated regression tests to reflect new functionalities and page
interactions.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
Ankita Kinger 2024-04-16 19:05:07 +05:30 committed by GitHub
parent e98b824ecd
commit 3ed620e156
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 77 additions and 56 deletions

View File

@ -95,12 +95,12 @@ describe("Admin settings page", { tags: ["@tag.Settings"] }, function () {
cy.get("@pricingPage").should("be.called"); cy.get("@pricingPage").should("be.called");
cy.wait(2000); cy.wait(2000);
cy.go(-1); cy.go(-1);
cy.stubPricingPage(); cy.stubCustomerPortalPage();
cy.get(adminsSettings.branding).click(); cy.get(adminsSettings.branding).click();
cy.url().should("contain", adminSettingsHelper.routes.BRANDING); cy.url().should("contain", adminSettingsHelper.routes.BRANDING);
cy.get(adminsSettings.brandingSubmitButton).should("be.disabled"); cy.get(adminsSettings.brandingSubmitButton).should("be.disabled");
cy.xpath(adminsSettings.upgrade).click(); cy.xpath(adminsSettings.upgrade).click();
cy.get("@pricingPage").should("be.called"); cy.get("@customerPortalPage").should("be.called");
cy.wait(2000); cy.wait(2000);
cy.go(-1); cy.go(-1);
} }
@ -119,11 +119,14 @@ describe("Admin settings page", { tags: ["@tag.Settings"] }, function () {
}); });
cy.get(adminsSettings.accessControl).click(); cy.get(adminsSettings.accessControl).click();
cy.url().should("contain", adminSettingsHelper.routes.ACCESS_CONTROL); cy.url().should("contain", adminSettingsHelper.routes.ACCESS_CONTROL);
cy.stubPricingPage(); cy.stubCustomerPortalPage();
cy.xpath(adminsSettings.upgrade).click(); cy.xpath(adminsSettings.upgrade).click();
cy.get("@pricingPage").should("be.called"); cy.get("@customerPortalPage").should("be.called");
cy.wait(2000); cy.wait(2000);
cy.go(-1); agHelper.VisitNAssert(
adminSettingsHelper.routes.GENERAL,
"getEnvVariables",
);
cy.get(adminsSettings.auditLogs).within(() => { cy.get(adminsSettings.auditLogs).within(() => {
cy.get(adminsSettings.businessTag) cy.get(adminsSettings.businessTag)
.should("exist") .should("exist")
@ -131,11 +134,14 @@ describe("Admin settings page", { tags: ["@tag.Settings"] }, function () {
}); });
cy.get(adminsSettings.auditLogs).click(); cy.get(adminsSettings.auditLogs).click();
cy.url().should("contain", adminSettingsHelper.routes.AUDIT_LOGS); cy.url().should("contain", adminSettingsHelper.routes.AUDIT_LOGS);
cy.stubPricingPage(); cy.stubCustomerPortalPage();
cy.xpath(adminsSettings.upgrade).click(); cy.xpath(adminsSettings.upgrade).click();
cy.get("@pricingPage").should("be.called"); cy.get("@customerPortalPage").should("be.called");
cy.wait(2000); cy.wait(2000);
cy.go(-1); agHelper.VisitNAssert(
adminSettingsHelper.routes.GENERAL,
"getEnvVariables",
);
cy.get(adminsSettings.provisioning).within(() => { cy.get(adminsSettings.provisioning).within(() => {
cy.get(adminsSettings.enterpriseTag) cy.get(adminsSettings.enterpriseTag)
.should("exist") .should("exist")

View File

@ -2076,6 +2076,14 @@ Cypress.Commands.add("stubPricingPage", () => {
}); });
}); });
Cypress.Commands.add("stubCustomerPortalPage", () => {
cy.window().then((win) => {
cy.stub(win, "open", (url) => {
win.location.href = "https://customer.appsmith.com?";
}).as("customerPortalPage");
});
});
/** /**
* @param testID * @param testID
* @returns * @returns

View File

@ -22,6 +22,7 @@ export function ProvisioningUpgradePage() {
logEventData: { source: "Provisioning" }, logEventData: { source: "Provisioning" },
featureName: RampFeature.Provisioning, featureName: RampFeature.Provisioning,
sectionName: RampSection.AdminSettings, sectionName: RampSection.AdminSettings,
isEnterprise: true,
}); });
const header: Header = { const header: Header = {

View File

@ -9,7 +9,7 @@ import { removeSpecialChars } from "utils/helpers";
import type { AppState } from "@appsmith/reducers"; import type { AppState } from "@appsmith/reducers";
import { saveActionName } from "actions/pluginActionActions"; import { saveActionName } from "actions/pluginActionActions";
import { Flex, Spinner } from "design-system"; import { Flex } from "design-system";
import { getAction, getPlugin } from "@appsmith/selectors/entitiesSelector"; import { getAction, getPlugin } from "@appsmith/selectors/entitiesSelector";
import NameEditorComponent, { import NameEditorComponent, {
IconBox, IconBox,
@ -116,7 +116,6 @@ function ActionNameEditor(props: ActionNameEditorProps) {
updating={saveStatus.isSaving} updating={saveStatus.isSaving}
valueTransform={removeSpecialChars} valueTransform={removeSpecialChars}
/> />
{saveStatus.isSaving && <Spinner size="md" />}
</Flex> </Flex>
</NameWrapper> </NameWrapper>
)} )}

View File

@ -6,7 +6,7 @@ import {
} from "@blueprintjs/core"; } from "@blueprintjs/core";
import styled from "styled-components"; import styled from "styled-components";
import _ from "lodash"; import _ from "lodash";
import { Button, toast, Tooltip } from "design-system"; import { Button, Spinner, toast, Tooltip } from "design-system";
export enum EditInteractionKind { export enum EditInteractionKind {
SINGLE, SINGLE,
@ -221,13 +221,8 @@ export function EditableText(props: EditableTextProps) {
[valueTransform, isInvalid], [valueTransform, isInvalid],
); );
const showEditIcon = !( const showEditIcon = !(disabled || minimal || hideEditIcon || isEditing);
disabled ||
minimal ||
hideEditIcon ||
updating ||
isEditing
);
return ( return (
<EditableTextWrapper <EditableTextWrapper
isEditing={isEditing} isEditing={isEditing}
@ -265,15 +260,18 @@ export function EditableText(props: EditableTextProps) {
selectAllOnFocus selectAllOnFocus
value={value} value={value}
/> />
{showEditIcon && ( {showEditIcon &&
<Button (updating ? (
className="t--action-name-edit-icon" <Spinner size="md" />
isIconButton ) : (
kind="tertiary" <Button
size="md" className="t--action-name-edit-icon"
startIcon="pencil-line" isIconButton
/> kind="tertiary"
)} size="md"
startIcon="pencil-line"
/>
))}
</TextContainer> </TextContainer>
</Tooltip> </Tooltip>
</EditableTextWrapper> </EditableTextWrapper>

View File

@ -108,6 +108,7 @@ export function ActionButton({ method }: { method: AuthMethodType }) {
logEventData: { method: method.label }, logEventData: { method: method.label },
featureName: RampFeature.Sso, featureName: RampFeature.Sso,
sectionName: RampSection.AdminSettings, sectionName: RampSection.AdminSettings,
isEnterprise: true,
}); });
const onClickHandler = (method: AuthMethodType) => { const onClickHandler = (method: AuthMethodType) => {

View File

@ -27,13 +27,13 @@ export const StyledLabel = styled.div`
margin-bottom: 4px; margin-bottom: 4px;
display: flex; display: flex;
align-items: center; align-items: center;
gap: var(--ads-v2-spaces-3);
.admin-settings-form-group-label { .admin-settings-form-group-label {
font-weight: var(--ads-v2-h5-font-weight); font-weight: var(--ads-v2-h5-font-weight);
} }
.help-icon { .help-icon {
margin-left: 8px;
cursor: pointer; cursor: pointer;
} }
`; `;
@ -66,11 +66,11 @@ export function FormGroup({ children, className, setting }: FieldHelperProps) {
renderAs="label" renderAs="label"
> >
{setting.label || ""} {setting.label || ""}
{setting.isRequired && (
<StyledAsterisk renderAs="span">*</StyledAsterisk>
)}
</Text> </Text>
)} )}
{setting.isRequired && (
<StyledAsterisk renderAs="span">*</StyledAsterisk>
)}
{setting.helpText && ( {setting.helpText && (
<Tooltip content={createMessage(() => setting.helpText || "")}> <Tooltip content={createMessage(() => setting.helpText || "")}>
<Icon <Icon
@ -82,14 +82,8 @@ export function FormGroup({ children, className, setting }: FieldHelperProps) {
/> />
</Tooltip> </Tooltip>
)} )}
<div className="ml-2"> {setting.isFeatureEnabled === false &&
{setting.isFeatureEnabled === false && (setting.isEnterprise === true ? <EnterpriseTag /> : <BusinessTag />)}
(setting.isEnterprise === true ? (
<EnterpriseTag />
) : (
<BusinessTag />
))}
</div>
</StyledLabel> </StyledLabel>
{children} {children}
{setting.subText && ( {setting.subText && (

View File

@ -68,7 +68,7 @@ export const StyledLink = styled(Link)<{ $active: boolean }>`
.ads-v2-text { .ads-v2-text {
display: flex; display: flex;
gap: 12px; gap: var(--ads-v2-spaces-3);
align-items: center; align-items: center;
} }

View File

@ -15,7 +15,6 @@ import {
saveDatasourceName, saveDatasourceName,
updateDatasourceName, updateDatasourceName,
} from "actions/datasourceActions"; } from "actions/datasourceActions";
import { Spinner } from "@blueprintjs/core";
import { TEMP_DATASOURCE_ID } from "constants/Datasource"; import { TEMP_DATASOURCE_ID } from "constants/Datasource";
const Wrapper = styled.div` const Wrapper = styled.div`
@ -151,7 +150,6 @@ function FormTitle(props: FormTitleProps) {
underline underline
updating={saveStatus.isSaving} updating={saveStatus.isSaving}
/> />
{saveStatus.isSaving && <Spinner size={16} />}
</Wrapper> </Wrapper>
); );
} }

View File

@ -16,7 +16,7 @@ import {
import EditableText, { import EditableText, {
EditInteractionKind, EditInteractionKind,
} from "components/editorComponents/EditableText"; } from "components/editorComponents/EditableText";
import { Flex, Spinner } from "design-system"; import { Flex } from "design-system";
import { getAssetUrl } from "@appsmith/utils/airgapHelpers"; import { getAssetUrl } from "@appsmith/utils/airgapHelpers";
import NameEditorComponent, { import NameEditorComponent, {
IconBox, IconBox,
@ -113,7 +113,6 @@ export function JSObjectNameEditor(props: JSObjectNameEditorProps) {
updating={saveStatus.isSaving} updating={saveStatus.isSaving}
valueTransform={removeSpecialChars} valueTransform={removeSpecialChars}
/> />
{saveStatus.isSaving && <Spinner size="md" />}
</Flex> </Flex>
</NameWrapper> </NameWrapper>
)} )}

View File

@ -1,6 +1,9 @@
import { useSelector } from "react-redux"; import { useSelector } from "react-redux";
import { getInstanceId } from "@appsmith/selectors/tenantSelectors"; import { getInstanceId } from "@appsmith/selectors/tenantSelectors";
import { CUSTOMER_PORTAL_URL_WITH_PARAMS } from "constants/ThirdPartyConstants"; import {
CUSTOMER_PORTAL_URL_WITH_PARAMS,
PRICING_PAGE_URL,
} from "constants/ThirdPartyConstants";
import type { EventName } from "@appsmith/utils/analyticsUtilTypes"; import type { EventName } from "@appsmith/utils/analyticsUtilTypes";
import AnalyticsUtil from "utils/AnalyticsUtil"; import AnalyticsUtil from "utils/AnalyticsUtil";
import { getAppsmithConfigs } from "@appsmith/configs"; import { getAppsmithConfigs } from "@appsmith/configs";
@ -15,10 +18,12 @@ interface Props {
logEventData?: any; logEventData?: any;
featureName?: RampFeature; featureName?: RampFeature;
sectionName?: RampSection; sectionName?: RampSection;
isEnterprise?: boolean;
} }
const useOnUpgrade = (props: Props) => { const useOnUpgrade = (props: Props) => {
const { featureName, logEventData, logEventName, sectionName } = props; const { featureName, isEnterprise, logEventData, logEventName, sectionName } =
props;
const instanceId = useSelector(getInstanceId); const instanceId = useSelector(getInstanceId);
const appsmithConfigs = getAppsmithConfigs(); const appsmithConfigs = getAppsmithConfigs();
@ -27,16 +32,28 @@ const useOnUpgrade = (props: Props) => {
logEventName || "ADMIN_SETTINGS_UPGRADE", logEventName || "ADMIN_SETTINGS_UPGRADE",
logEventData, logEventData,
); );
window.open( if (isEnterprise) {
CUSTOMER_PORTAL_URL_WITH_PARAMS( window.open(
appsmithConfigs.customerPortalUrl, PRICING_PAGE_URL(
pricingPageUrlSource, appsmithConfigs.pricingUrl,
instanceId, pricingPageUrlSource,
featureName, instanceId,
sectionName, featureName,
), sectionName,
"_blank", ),
); );
} else {
window.open(
CUSTOMER_PORTAL_URL_WITH_PARAMS(
appsmithConfigs.customerPortalUrl,
pricingPageUrlSource,
instanceId,
featureName,
sectionName,
),
"_blank",
);
}
}; };
return { onUpgrade }; return { onUpgrade };