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: Toggle Upgrade btn based on Enterprise license #412

Merged
merged 3 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/@types/parseable/api/about.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
export type QueryEngineType = 'Trino' | 'Parseable' | undefined;

export type LicenseType = 'AGPL-3.0-only' | undefined;

export type AboutData = {
commit: string;
deploymentId: string;
latestVersion: string;
license: string;
license: LicenseType;
mode: string;
staging: string;
store: { type: string; path: string };
Expand Down
21 changes: 13 additions & 8 deletions src/components/Header/PrimaryHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@ import { Button, Divider, Image, Stack } from '@mantine/core';
import { FC, useCallback } from 'react';
import styles from './styles/Header.module.css';
import HelpModal from './HelpModal';
import _ from 'lodash';
import { appStoreReducers, useAppStore } from '@/layouts/MainLayout/providers/AppProvider';
import { OSS_LICENSE_TYPE } from '@/constants';

const PrimaryHeader: FC = () => {
const classes = styles;
const { logoContainer, imageSty } = classes;
const [maximized, setAppStore] = useAppStore((store) => store.maximized);
const [instanceConfig] = useAppStore((store) => store.instanceConfig);
const toggleHelpModal = useCallback(() => setAppStore(appStoreReducers.toggleHelpModal), []);
if (maximized) return null;

Expand All @@ -31,14 +34,16 @@ const PrimaryHeader: FC = () => {
className={classes.rightSection}
style={{ flexDirection: 'row', height: '100%', justifyContent: 'flex-end' }}
gap={8}>
<Button
variant="outline"
style={{ border: 'none' }}
component={'a'}
href="mailto:[email protected]?subject=Production%20Support%20Query"
target="_blank">
Upgrade
</Button>
{instanceConfig?.license && _.isEqual(instanceConfig?.license, OSS_LICENSE_TYPE) && (
<Button
variant="outline"
style={{ border: 'none' }}
component={'a'}
href="mailto:[email protected]?subject=Production%20Support%20Query"
target="_blank">
Upgrade
</Button>
)}
<Divider orientation="vertical" />
<Button onClick={toggleHelpModal} style={{ border: 'none' }} variant="outline">
Help
Expand Down
20 changes: 12 additions & 8 deletions src/components/Navbar/infoModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { useAbout } from '@/hooks/useGetAbout';
import { IconInfoCircle } from '@tabler/icons-react';
import styles from './styles/InfoModal.module.css';
import { appStoreReducers, useAppStore } from '@/layouts/MainLayout/providers/AppProvider';
import { OSS_LICENSE_TYPE } from '@/constants';
import _ from 'lodash';

const { setInstanceConfig } = appStoreReducers;

Expand Down Expand Up @@ -60,14 +62,16 @@ const InfoModal: FC<InfoModalProps> = (props) => {
<Box className={aboutTextInnerBox}>
<Text className={aboutTextKey}> License: </Text>
<Text className={aboutTextValue}> {getAboutData?.data.license} </Text>
<Button
variant="outline"
component={'a'}
href="mailto:[email protected]?subject=Production%20Support%20Query"
target="_blank"
className={actionBtn}>
Upgrade to production support
</Button>
{_.isEqual(getAboutData?.data.license, OSS_LICENSE_TYPE) && (
<Button
variant="outline"
component={'a'}
href="mailto:[email protected]?subject=Production%20Support%20Query"
target="_blank"
className={actionBtn}>
Upgrade to production support
</Button>
)}
</Box>
</Box>
<Box className={aboutTextBox}>
Expand Down
3 changes: 3 additions & 0 deletions src/constants/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const OSS_LICENSE_TYPE = 'AGPL-3.0-only';

export { OSS_LICENSE_TYPE };
Loading