feat: add DISABLE_NOTIFICATIONS_PAGE feature flag
This commit is contained in:
@@ -88,6 +88,7 @@ const appConfig = {
|
||||
licenseKey: process.env.LICENSE_KEY,
|
||||
sentryDsn: process.env.SENTRY_DSN,
|
||||
CI: process.env.CI === 'true',
|
||||
disableNotificationsPage: process.env.DISABLE_NOTIFICATIONS_PAGE === 'true',
|
||||
};
|
||||
|
||||
if (!appConfig.encryptionKey) {
|
||||
|
@@ -1,6 +1,11 @@
|
||||
import appConfig from '../../config/app.js';
|
||||
import { hasValidLicense } from '../../helpers/license.ee.js';
|
||||
import Config from '../../models/config.js';
|
||||
|
||||
const defaultConfig = {
|
||||
disableNotificationsPage: appConfig.disableNotificationsPage,
|
||||
};
|
||||
|
||||
const getConfig = async (_parent, params) => {
|
||||
if (!(await hasValidLicense())) return {};
|
||||
|
||||
@@ -18,7 +23,7 @@ const getConfig = async (_parent, params) => {
|
||||
computedConfig[key] = value?.data;
|
||||
|
||||
return computedConfig;
|
||||
}, {});
|
||||
}, defaultConfig);
|
||||
};
|
||||
|
||||
export default getConfig;
|
||||
|
@@ -15,7 +15,7 @@ Please be careful with the `ENCRYPTION_KEY` and `WEBHOOK_SECRET_KEY` environment
|
||||
:::
|
||||
|
||||
| Variable Name | Type | Default Value | Description |
|
||||
| --------------------------- | ------- | ------------------ | ---------------------------------------------------------------------------------------------------- |
|
||||
| ---------------------------- | ------- | ------------------ | ----------------------------------------------------------------------------------- |
|
||||
| `HOST` | string | `localhost` | HTTP Host |
|
||||
| `PROTOCOL` | string | `http` | HTTP Protocol |
|
||||
| `PORT` | string | `3000` | HTTP Port |
|
||||
@@ -42,3 +42,4 @@ Please be careful with the `ENCRYPTION_KEY` and `WEBHOOK_SECRET_KEY` environment
|
||||
| `ENABLE_BULLMQ_DASHBOARD` | boolean | `false` | Enable BullMQ Dashboard |
|
||||
| `BULLMQ_DASHBOARD_USERNAME` | string | | Username to login BullMQ Dashboard |
|
||||
| `BULLMQ_DASHBOARD_PASSWORD` | string | | Password to login BullMQ Dashboard |
|
||||
| `DISABLE_NOTIFICATIONS_PAGE` | boolean | `false` | Enable/Disable notifications page |
|
||||
|
@@ -12,7 +12,7 @@ import * as URLS from 'config/urls';
|
||||
import useVersion from 'hooks/useVersion';
|
||||
import AppBar from 'components/AppBar';
|
||||
import Drawer from 'components/Drawer';
|
||||
import useAutomatischInfo from 'hooks/useAutomatischInfo';
|
||||
import useConfig from 'hooks/useConfig';
|
||||
|
||||
type PublicLayoutProps = {
|
||||
children: React.ReactNode;
|
||||
@@ -40,17 +40,17 @@ const drawerLinks = [
|
||||
];
|
||||
|
||||
type GenerateDrawerBottomLinksOptions = {
|
||||
isMation: boolean;
|
||||
disableNotificationsPage: boolean;
|
||||
loading: boolean;
|
||||
notificationBadgeContent: number;
|
||||
};
|
||||
|
||||
const generateDrawerBottomLinks = ({
|
||||
isMation,
|
||||
disableNotificationsPage,
|
||||
loading,
|
||||
notificationBadgeContent = 0,
|
||||
}: GenerateDrawerBottomLinksOptions) => {
|
||||
if (loading || isMation) {
|
||||
if (loading || disableNotificationsPage) {
|
||||
return [];
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ export default function PublicLayout({
|
||||
children,
|
||||
}: PublicLayoutProps): React.ReactElement {
|
||||
const version = useVersion();
|
||||
const { isMation, loading } = useAutomatischInfo();
|
||||
const { config, loading } = useConfig(['disableNotificationsPage']);
|
||||
const theme = useTheme();
|
||||
const matchSmallScreens = useMediaQuery(theme.breakpoints.down('lg'));
|
||||
const [isDrawerOpen, setDrawerOpen] = React.useState(!matchSmallScreens);
|
||||
@@ -79,7 +79,7 @@ export default function PublicLayout({
|
||||
const drawerBottomLinks = generateDrawerBottomLinks({
|
||||
notificationBadgeContent: version.newVersionCount,
|
||||
loading,
|
||||
isMation,
|
||||
disableNotificationsPage: config?.disableNotificationsPage as boolean,
|
||||
});
|
||||
|
||||
return (
|
||||
|
Reference in New Issue
Block a user