mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-01 04:52:03 +08:00
fix: allow workspace blocked users to extend trial (#4393)
Co-authored-by: Vishal Sharma <makeavish786@gmail.com>
This commit is contained in:
parent
46559014f7
commit
c1b9049176
@ -125,8 +125,9 @@ export default function DataSource(): JSX.Element {
|
||||
)}
|
||||
key={dataSource.name}
|
||||
onClick={(): void => {
|
||||
updateSelectedFramework('');
|
||||
updateSelectedFramework(null);
|
||||
updateSelectedDataSource(dataSource);
|
||||
form.setFieldsValue({ selectFramework: null });
|
||||
}}
|
||||
>
|
||||
<div>
|
||||
@ -152,6 +153,7 @@ export default function DataSource(): JSX.Element {
|
||||
<Form
|
||||
initialValues={{
|
||||
serviceName,
|
||||
selectFramework: selectedFramework,
|
||||
}}
|
||||
form={form}
|
||||
onValuesChange={(): void => {
|
||||
@ -165,7 +167,6 @@ export default function DataSource(): JSX.Element {
|
||||
validateTrigger="onBlur"
|
||||
>
|
||||
<Form.Item
|
||||
hasFeedback
|
||||
name="serviceName"
|
||||
label="Service Name"
|
||||
rules={[{ required: true, message: 'Please enter service name' }]}
|
||||
@ -178,13 +179,11 @@ export default function DataSource(): JSX.Element {
|
||||
<div className="framework-selector">
|
||||
<Form.Item
|
||||
label="Select Framework"
|
||||
name="select-framework"
|
||||
hasFeedback
|
||||
name="selectFramework"
|
||||
rules={[{ required: true, message: 'Please select framework' }]}
|
||||
validateTrigger=""
|
||||
>
|
||||
<Select
|
||||
defaultValue={selectedFramework}
|
||||
value={selectedFramework}
|
||||
getPopupContainer={popupContainer}
|
||||
style={{ minWidth: 120 }}
|
||||
placeholder="Select Framework"
|
||||
|
@ -78,6 +78,7 @@ export default function ModuleStepsContainer({
|
||||
const [metaData, setMetaData] = useState<MetaDataProps[]>(defaultMetaData);
|
||||
const lastStepIndex = selectedModuleSteps.length - 1;
|
||||
|
||||
// eslint-disable-next-line sonarjs/cognitive-complexity
|
||||
const isValidForm = (): boolean => {
|
||||
const { id: selectedModuleID } = selectedModule;
|
||||
const dataSourceStep = stepsMap.dataSource;
|
||||
@ -106,7 +107,10 @@ export default function ModuleStepsContainer({
|
||||
dataSource: selectedDataSource,
|
||||
});
|
||||
|
||||
if (doesHaveFrameworks && selectedFramework === '') {
|
||||
if (
|
||||
doesHaveFrameworks &&
|
||||
(selectedFramework === null || selectedFramework === '')
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -177,7 +181,7 @@ export default function ModuleStepsContainer({
|
||||
},
|
||||
{
|
||||
name: 'Framework',
|
||||
value: selectedFramework,
|
||||
value: selectedFramework || '',
|
||||
},
|
||||
{
|
||||
name: 'Environment',
|
||||
|
@ -14,7 +14,7 @@ interface OnboardingContextData {
|
||||
ingestionData: any;
|
||||
serviceName: string;
|
||||
selectedEnvironment: string;
|
||||
selectedFramework: string;
|
||||
selectedFramework: string | null;
|
||||
selectedModule: ModuleProps | null;
|
||||
selectedMethod: any;
|
||||
selectedDataSource: DataSourceType | null;
|
||||
@ -51,7 +51,9 @@ function OnboardingContextProvider({
|
||||
|
||||
const [errorDetails, setErrorDetails] = useState(null);
|
||||
const [selectedEnvironment, setSelectedEnvironment] = useState<string>('');
|
||||
const [selectedFramework, setSelectedFramework] = useState<string>('');
|
||||
const [selectedFramework, setSelectedFramework] = useState<string | null>(
|
||||
null,
|
||||
);
|
||||
|
||||
const [selectedMethod, setSelectedMethod] = useState(
|
||||
OnboardingMethods.QUICK_START,
|
||||
|
@ -9,11 +9,19 @@
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.update-credit-card-btn {
|
||||
margin: 24px 0;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.contact-us {
|
||||
margin-top: 48px;
|
||||
}
|
||||
|
||||
.cta {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
.update-credit-card-btn,
|
||||
.extend-trial-btn {
|
||||
margin: 24px 0;
|
||||
border-radius: 5px;
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,17 @@
|
||||
/* eslint-disable react/no-unescaped-entities */
|
||||
import './WorkspaceLocked.styles.scss';
|
||||
|
||||
import { CreditCardOutlined, LockOutlined } from '@ant-design/icons';
|
||||
import {
|
||||
CreditCardOutlined,
|
||||
LockOutlined,
|
||||
SendOutlined,
|
||||
} from '@ant-design/icons';
|
||||
import { Button, Card, Skeleton, Typography } from 'antd';
|
||||
import updateCreditCardApi from 'api/billing/checkout';
|
||||
import { SOMETHING_WENT_WRONG } from 'constants/api';
|
||||
import ROUTES from 'constants/routes';
|
||||
import FullViewHeader from 'container/FullViewHeader/FullViewHeader';
|
||||
import useAnalytics from 'hooks/analytics/useAnalytics';
|
||||
import useLicense from 'hooks/useLicense';
|
||||
import { useNotifications } from 'hooks/useNotifications';
|
||||
import history from 'lib/history';
|
||||
@ -22,6 +27,7 @@ export default function WorkspaceBlocked(): JSX.Element {
|
||||
const { role } = useSelector<AppState, AppReducer>((state) => state.app);
|
||||
const isAdmin = role === 'ADMIN';
|
||||
const [activeLicense, setActiveLicense] = useState<License | null>(null);
|
||||
const { trackEvent } = useAnalytics();
|
||||
|
||||
const { notifications } = useNotifications();
|
||||
|
||||
@ -68,13 +74,36 @@ export default function WorkspaceBlocked(): JSX.Element {
|
||||
);
|
||||
|
||||
const handleUpdateCreditCard = useCallback(async () => {
|
||||
trackEvent('Workspace Blocked: User Clicked Update Credit Card');
|
||||
|
||||
updateCreditCard({
|
||||
licenseKey: activeLicense?.key || '',
|
||||
successURL: window.location.origin,
|
||||
cancelURL: window.location.origin,
|
||||
});
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [activeLicense?.key, updateCreditCard]);
|
||||
|
||||
const handleExtendTrial = (): void => {
|
||||
trackEvent('Workspace Blocked: User Clicked Extend Trial');
|
||||
|
||||
const recipient = 'cloud-support@signoz.io';
|
||||
const subject = 'Extend SigNoz Cloud Trial';
|
||||
const body = `I'd like to request an extension for SigNoz Cloud for my account. Please find my account details below
|
||||
|
||||
SigNoz URL:
|
||||
Admin Email:
|
||||
`;
|
||||
|
||||
// Create the mailto link
|
||||
const mailtoLink = `mailto:${recipient}?subject=${encodeURIComponent(
|
||||
subject,
|
||||
)}&body=${encodeURIComponent(body)}`;
|
||||
|
||||
// Open the default email client
|
||||
window.location.href = mailtoLink;
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<FullViewHeader overrideRoute={ROUTES.WORKSPACE_LOCKED} />
|
||||
@ -95,18 +124,31 @@ export default function WorkspaceBlocked(): JSX.Element {
|
||||
account.
|
||||
{!isAdmin && 'Please contact your administrator for further help'}
|
||||
</Typography.Paragraph>
|
||||
{isAdmin && (
|
||||
|
||||
<div className="cta">
|
||||
{isAdmin && (
|
||||
<Button
|
||||
className="update-credit-card-btn"
|
||||
type="primary"
|
||||
icon={<CreditCardOutlined />}
|
||||
size="middle"
|
||||
loading={isLoading}
|
||||
onClick={handleUpdateCreditCard}
|
||||
>
|
||||
Update Credit Card
|
||||
</Button>
|
||||
)}
|
||||
|
||||
<Button
|
||||
className="update-credit-card-btn"
|
||||
type="primary"
|
||||
icon={<CreditCardOutlined />}
|
||||
className="extend-trial-btn"
|
||||
type="default"
|
||||
icon={<SendOutlined />}
|
||||
size="middle"
|
||||
loading={isLoading}
|
||||
onClick={handleUpdateCreditCard}
|
||||
onClick={handleExtendTrial}
|
||||
>
|
||||
Update Credit Card
|
||||
Extend Trial
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
<div className="contact-us">
|
||||
Got Questions?
|
||||
<span>
|
||||
|
Loading…
x
Reference in New Issue
Block a user