Skip to content
This repository was archived by the owner on May 13, 2025. It is now read-only.

Commit 6591381

Browse files
authored
feat: Toggle Upgrade btn based on Enterprise license (#412)
1 parent 689593d commit 6591381

File tree

4 files changed

+33
-17
lines changed

4 files changed

+33
-17
lines changed

src/@types/parseable/api/about.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1+
export type QueryEngineType = 'Trino' | 'Parseable' | undefined;
2+
3+
export type LicenseType = 'AGPL-3.0-only' | undefined;
4+
15
export type AboutData = {
26
commit: string;
37
deploymentId: string;
48
latestVersion: string;
5-
license: string;
9+
license: LicenseType;
610
mode: string;
711
staging: string;
812
store: { type: string; path: string };

src/components/Header/PrimaryHeader.tsx

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,15 @@ import { Button, Divider, Image, Stack } from '@mantine/core';
55
import { FC, useCallback } from 'react';
66
import styles from './styles/Header.module.css';
77
import HelpModal from './HelpModal';
8+
import _ from 'lodash';
89
import { appStoreReducers, useAppStore } from '@/layouts/MainLayout/providers/AppProvider';
10+
import { OSS_LICENSE_TYPE } from '@/constants';
911

1012
const PrimaryHeader: FC = () => {
1113
const classes = styles;
1214
const { logoContainer, imageSty } = classes;
1315
const [maximized, setAppStore] = useAppStore((store) => store.maximized);
16+
const [instanceConfig] = useAppStore((store) => store.instanceConfig);
1417
const toggleHelpModal = useCallback(() => setAppStore(appStoreReducers.toggleHelpModal), []);
1518
if (maximized) return null;
1619

@@ -31,14 +34,16 @@ const PrimaryHeader: FC = () => {
3134
className={classes.rightSection}
3235
style={{ flexDirection: 'row', height: '100%', justifyContent: 'flex-end' }}
3336
gap={8}>
34-
<Button
35-
variant="outline"
36-
style={{ border: 'none' }}
37-
component={'a'}
38-
href="mailto:[email protected]?subject=Production%20Support%20Query"
39-
target="_blank">
40-
Upgrade
41-
</Button>
37+
{instanceConfig?.license && _.isEqual(instanceConfig?.license, OSS_LICENSE_TYPE) && (
38+
<Button
39+
variant="outline"
40+
style={{ border: 'none' }}
41+
component={'a'}
42+
href="mailto:[email protected]?subject=Production%20Support%20Query"
43+
target="_blank">
44+
Upgrade
45+
</Button>
46+
)}
4247
<Divider orientation="vertical" />
4348
<Button onClick={toggleHelpModal} style={{ border: 'none' }} variant="outline">
4449
Help

src/components/Navbar/infoModal.tsx

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import { useAbout } from '@/hooks/useGetAbout';
44
import { IconInfoCircle } from '@tabler/icons-react';
55
import styles from './styles/InfoModal.module.css';
66
import { appStoreReducers, useAppStore } from '@/layouts/MainLayout/providers/AppProvider';
7+
import { OSS_LICENSE_TYPE } from '@/constants';
8+
import _ from 'lodash';
79

810
const { setInstanceConfig } = appStoreReducers;
911

@@ -60,14 +62,16 @@ const InfoModal: FC<InfoModalProps> = (props) => {
6062
<Box className={aboutTextInnerBox}>
6163
<Text className={aboutTextKey}> License: </Text>
6264
<Text className={aboutTextValue}> {getAboutData?.data.license} </Text>
63-
<Button
64-
variant="outline"
65-
component={'a'}
66-
href="mailto:[email protected]?subject=Production%20Support%20Query"
67-
target="_blank"
68-
className={actionBtn}>
69-
Upgrade to production support
70-
</Button>
65+
{_.isEqual(getAboutData?.data.license, OSS_LICENSE_TYPE) && (
66+
<Button
67+
variant="outline"
68+
component={'a'}
69+
href="mailto:[email protected]?subject=Production%20Support%20Query"
70+
target="_blank"
71+
className={actionBtn}>
72+
Upgrade to production support
73+
</Button>
74+
)}
7175
</Box>
7276
</Box>
7377
<Box className={aboutTextBox}>

src/constants/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const OSS_LICENSE_TYPE = 'AGPL-3.0-only';
2+
3+
export { OSS_LICENSE_TYPE };

0 commit comments

Comments
 (0)