fix: cloud header button is hidden when is license is not active (#2756)

This commit is contained in:
Palash Gupta 2023-05-23 19:29:24 +05:30 committed by GitHub
parent 818a984af3
commit 5a81f5f90b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 5 deletions

View File

@ -8,6 +8,7 @@ import { Logout } from 'api/utils';
import ROUTES from 'constants/routes';
import Config from 'container/ConfigDropdown';
import { useIsDarkMode, useThemeMode } from 'hooks/useDarkMode';
import useLicense, { LICENSE_PLAN_STATUS } from 'hooks/useLicense';
import {
Dispatch,
KeyboardEvent,
@ -95,6 +96,11 @@ function HeaderContainer(): JSX.Element {
);
};
const { data } = useLicense();
const isLicenseActive =
data?.payload?.find((e) => e.isCurrent)?.status === LICENSE_PLAN_STATUS.VALID;
return (
<Header>
<Container>
@ -111,9 +117,11 @@ function HeaderContainer(): JSX.Element {
</NavLink>
<Space size="middle" align="center">
<Button onClick={onClickSignozCloud} type="primary">
Try Signoz Cloud
</Button>
{!isLicenseActive && (
<Button onClick={onClickSignozCloud} type="primary">
Try Signoz Cloud
</Button>
)}
<Config frontendId="tooltip" />

View File

@ -1,3 +1,7 @@
export const LICENSE_PLAN_KEY = {
ENTERPRISE_PLAN: 'ENTERPRISE_PLAN',
};
export const LICENSE_PLAN_STATUS = {
VALID: 'VALID',
};

View File

@ -1,6 +1,6 @@
import { LICENSE_PLAN_KEY } from './constant';
import { LICENSE_PLAN_KEY, LICENSE_PLAN_STATUS } from './constant';
import useLicense from './useLicense';
export default useLicense;
export { LICENSE_PLAN_KEY };
export { LICENSE_PLAN_KEY, LICENSE_PLAN_STATUS };