Merge pull request #1953 from automatisch/add-security-icon-in-additional-drawer
feat(Layout): support security icon in additional drawer link
This commit is contained in:
@@ -97,6 +97,7 @@ const appConfig = {
|
|||||||
disableNotificationsPage: process.env.DISABLE_NOTIFICATIONS_PAGE === 'true',
|
disableNotificationsPage: process.env.DISABLE_NOTIFICATIONS_PAGE === 'true',
|
||||||
disableFavicon: process.env.DISABLE_FAVICON === 'true',
|
disableFavicon: process.env.DISABLE_FAVICON === 'true',
|
||||||
additionalDrawerLink: process.env.ADDITIONAL_DRAWER_LINK,
|
additionalDrawerLink: process.env.ADDITIONAL_DRAWER_LINK,
|
||||||
|
additionalDrawerLinkIcon: process.env.ADDITIONAL_DRAWER_LINK_ICON,
|
||||||
additionalDrawerLinkText: process.env.ADDITIONAL_DRAWER_LINK_TEXT,
|
additionalDrawerLinkText: process.env.ADDITIONAL_DRAWER_LINK_TEXT,
|
||||||
disableSeedUser: process.env.DISABLE_SEED_USER === 'true',
|
disableSeedUser: process.env.DISABLE_SEED_USER === 'true',
|
||||||
};
|
};
|
||||||
|
@@ -7,6 +7,7 @@ export default async (request, response) => {
|
|||||||
disableNotificationsPage: appConfig.disableNotificationsPage,
|
disableNotificationsPage: appConfig.disableNotificationsPage,
|
||||||
disableFavicon: appConfig.disableFavicon,
|
disableFavicon: appConfig.disableFavicon,
|
||||||
additionalDrawerLink: appConfig.additionalDrawerLink,
|
additionalDrawerLink: appConfig.additionalDrawerLink,
|
||||||
|
additionalDrawerLinkIcon: appConfig.additionalDrawerLinkIcon,
|
||||||
additionalDrawerLinkText: appConfig.additionalDrawerLinkText,
|
additionalDrawerLinkText: appConfig.additionalDrawerLinkText,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -4,6 +4,7 @@ import { createConfig } from '../../../../../test/factories/config.js';
|
|||||||
import app from '../../../../app.js';
|
import app from '../../../../app.js';
|
||||||
import configMock from '../../../../../test/mocks/rest/api/v1/automatisch/config.js';
|
import configMock from '../../../../../test/mocks/rest/api/v1/automatisch/config.js';
|
||||||
import * as license from '../../../../helpers/license.ee.js';
|
import * as license from '../../../../helpers/license.ee.js';
|
||||||
|
import appConfig from '../../../../config/app.js';
|
||||||
|
|
||||||
describe('GET /api/v1/automatisch/config', () => {
|
describe('GET /api/v1/automatisch/config', () => {
|
||||||
it('should return Automatisch config', async () => {
|
it('should return Automatisch config', async () => {
|
||||||
@@ -48,4 +49,18 @@ describe('GET /api/v1/automatisch/config', () => {
|
|||||||
|
|
||||||
expect(response.body).toEqual(expectedPayload);
|
expect(response.body).toEqual(expectedPayload);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should return additional environment variables', async () => {
|
||||||
|
vi.spyOn(appConfig, 'disableNotificationsPage', 'get').mockReturnValue(true);
|
||||||
|
vi.spyOn(appConfig, 'disableFavicon', 'get').mockReturnValue(true);
|
||||||
|
vi.spyOn(appConfig, 'additionalDrawerLink', 'get').mockReturnValue('link');
|
||||||
|
vi.spyOn(appConfig, 'additionalDrawerLinkIcon', 'get').mockReturnValue('icon');
|
||||||
|
vi.spyOn(appConfig, 'additionalDrawerLinkText', 'get').mockReturnValue('text');
|
||||||
|
|
||||||
|
expect(appConfig.disableNotificationsPage).toEqual(true);
|
||||||
|
expect(appConfig.disableFavicon).toEqual(true);
|
||||||
|
expect(appConfig.additionalDrawerLink).toEqual('link');
|
||||||
|
expect(appConfig.additionalDrawerLinkIcon).toEqual('icon');
|
||||||
|
expect(appConfig.additionalDrawerLinkText).toEqual('text');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@@ -25,7 +25,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@faker-js/faker": "^8.2.0",
|
"@faker-js/faker": "^8.2.0",
|
||||||
"@playwright/test": "^1.36.2"
|
"@playwright/test": "^1.45.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"dotenv": "^16.3.1",
|
"dotenv": "^16.3.1",
|
||||||
|
@@ -8,8 +8,9 @@ import AppsIcon from '@mui/icons-material/Apps';
|
|||||||
import SwapCallsIcon from '@mui/icons-material/SwapCalls';
|
import SwapCallsIcon from '@mui/icons-material/SwapCalls';
|
||||||
import HistoryIcon from '@mui/icons-material/History';
|
import HistoryIcon from '@mui/icons-material/History';
|
||||||
import NotificationsIcon from '@mui/icons-material/Notifications';
|
import NotificationsIcon from '@mui/icons-material/Notifications';
|
||||||
import ArrowBackIosNew from '@mui/icons-material/ArrowBackIosNew';
|
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
|
import ArrowBackIosNewIcon from '@mui/icons-material/ArrowBackIosNew';
|
||||||
|
import SecurityIcon from '@mui/icons-material/Security';
|
||||||
|
|
||||||
import * as URLS from 'config/urls';
|
import * as URLS from 'config/urls';
|
||||||
import useFormatMessage from 'hooks/useFormatMessage';
|
import useFormatMessage from 'hooks/useFormatMessage';
|
||||||
@@ -18,6 +19,11 @@ import AppBar from 'components/AppBar';
|
|||||||
import Drawer from 'components/Drawer';
|
import Drawer from 'components/Drawer';
|
||||||
import useAutomatischConfig from 'hooks/useAutomatischConfig';
|
import useAutomatischConfig from 'hooks/useAutomatischConfig';
|
||||||
|
|
||||||
|
const additionalDrawerLinkIcons = {
|
||||||
|
Security: SecurityIcon,
|
||||||
|
ArrowBackIosNew: ArrowBackIosNewIcon,
|
||||||
|
};
|
||||||
|
|
||||||
const drawerLinks = [
|
const drawerLinks = [
|
||||||
{
|
{
|
||||||
Icon: SwapCallsIcon,
|
Icon: SwapCallsIcon,
|
||||||
@@ -43,6 +49,7 @@ const generateDrawerBottomLinks = async ({
|
|||||||
disableNotificationsPage,
|
disableNotificationsPage,
|
||||||
notificationBadgeContent = 0,
|
notificationBadgeContent = 0,
|
||||||
additionalDrawerLink,
|
additionalDrawerLink,
|
||||||
|
additionalDrawerLinkIcon,
|
||||||
additionalDrawerLinkText,
|
additionalDrawerLinkText,
|
||||||
formatMessage,
|
formatMessage,
|
||||||
}) => {
|
}) => {
|
||||||
@@ -57,7 +64,9 @@ const generateDrawerBottomLinks = async ({
|
|||||||
additionalDrawerLink && additionalDrawerLinkText;
|
additionalDrawerLink && additionalDrawerLinkText;
|
||||||
|
|
||||||
const additionalDrawerLinkObject = {
|
const additionalDrawerLinkObject = {
|
||||||
Icon: ArrowBackIosNew,
|
Icon:
|
||||||
|
additionalDrawerLinkIcons[additionalDrawerLinkIcon] ||
|
||||||
|
ArrowBackIosNewIcon,
|
||||||
primary: additionalDrawerLinkText || '',
|
primary: additionalDrawerLinkText || '',
|
||||||
to: additionalDrawerLink || '',
|
to: additionalDrawerLink || '',
|
||||||
target: '_blank',
|
target: '_blank',
|
||||||
@@ -95,6 +104,7 @@ function PublicLayout({ children }) {
|
|||||||
notificationBadgeContent: version.newVersionCount,
|
notificationBadgeContent: version.newVersionCount,
|
||||||
disableNotificationsPage: config?.disableNotificationsPage,
|
disableNotificationsPage: config?.disableNotificationsPage,
|
||||||
additionalDrawerLink: config?.additionalDrawerLink,
|
additionalDrawerLink: config?.additionalDrawerLink,
|
||||||
|
additionalDrawerLinkIcon: config?.additionalDrawerLinkIcon,
|
||||||
additionalDrawerLinkText: config?.additionalDrawerLinkText,
|
additionalDrawerLinkText: config?.additionalDrawerLinkText,
|
||||||
formatMessage,
|
formatMessage,
|
||||||
});
|
});
|
||||||
|
30
yarn.lock
30
yarn.lock
@@ -3315,15 +3315,12 @@
|
|||||||
resolved "https://registry.yarnpkg.com/@pkgjs/parseargs/-/parseargs-0.11.0.tgz#a77ea742fab25775145434eb1d2328cf5013ac33"
|
resolved "https://registry.yarnpkg.com/@pkgjs/parseargs/-/parseargs-0.11.0.tgz#a77ea742fab25775145434eb1d2328cf5013ac33"
|
||||||
integrity sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==
|
integrity sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==
|
||||||
|
|
||||||
"@playwright/test@^1.36.2":
|
"@playwright/test@^1.45.1":
|
||||||
version "1.36.2"
|
version "1.45.1"
|
||||||
resolved "https://registry.npmjs.org/@playwright/test/-/test-1.36.2.tgz"
|
resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.45.1.tgz#819b90fa43d17000fce5ebd127043fd661938b7a"
|
||||||
integrity sha512-2rVZeyPRjxfPH6J0oGJqE8YxiM1IBRyM8hyrXYK7eSiAqmbNhxwcLa7dZ7fy9Kj26V7FYia5fh9XJRq4Dqme+g==
|
integrity sha512-Wo1bWTzQvGA7LyKGIZc8nFSTFf2TkthGIFBR+QVNilvwouGzFd4PYukZe3rvf5PSqjHi1+1NyKSDZKcQWETzaA==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@types/node" "*"
|
playwright "1.45.1"
|
||||||
playwright-core "1.36.2"
|
|
||||||
optionalDependencies:
|
|
||||||
fsevents "2.3.2"
|
|
||||||
|
|
||||||
"@pmmmwh/react-refresh-webpack-plugin@^0.5.3":
|
"@pmmmwh/react-refresh-webpack-plugin@^0.5.3":
|
||||||
version "0.5.4"
|
version "0.5.4"
|
||||||
@@ -13048,10 +13045,19 @@ pkg-up@^3.1.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
find-up "^3.0.0"
|
find-up "^3.0.0"
|
||||||
|
|
||||||
playwright-core@1.36.2:
|
playwright-core@1.45.1:
|
||||||
version "1.36.2"
|
version "1.45.1"
|
||||||
resolved "https://registry.npmjs.org/playwright-core/-/playwright-core-1.36.2.tgz"
|
resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.45.1.tgz#549a2701556b58245cc75263f9fc2795c1158dc1"
|
||||||
integrity sha512-sQYZt31dwkqxOrP7xy2ggDfEzUxM1lodjhsQ3NMMv5uGTRDsLxU0e4xf4wwMkF2gplIxf17QMBCodSFgm6bFVQ==
|
integrity sha512-LF4CUUtrUu2TCpDw4mcrAIuYrEjVDfT1cHbJMfwnE2+1b8PZcFzPNgvZCvq2JfQ4aTjRCCHw5EJ2tmr2NSzdPg==
|
||||||
|
|
||||||
|
playwright@1.45.1:
|
||||||
|
version "1.45.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.45.1.tgz#aaa6b0d6db14796b599d80c6679e63444e942534"
|
||||||
|
integrity sha512-Hjrgae4kpSQBr98nhCj3IScxVeVUixqj+5oyif8TdIn2opTCPEzqAqNMeK42i3cWDCVu9MI+ZsGWw+gVR4ISBg==
|
||||||
|
dependencies:
|
||||||
|
playwright-core "1.45.1"
|
||||||
|
optionalDependencies:
|
||||||
|
fsevents "2.3.2"
|
||||||
|
|
||||||
pluralize@^8.0.0:
|
pluralize@^8.0.0:
|
||||||
version "8.0.0"
|
version "8.0.0"
|
||||||
|
Reference in New Issue
Block a user