Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

feat: added info dismissible callout for the license row in workspace settings (#10938)

SagarRajput-7c9d5ca944ad5
diff --git a/frontend/src/constants/localStorage.ts b/frontend/src/constants/localStorage.ts
index fff9c3a86b..d13c0d07cb 100644
--- a/frontend/src/constants/localStorage.ts
+++ b/frontend/src/constants/localStorage.ts
@@ -37,4 +37,5 @@ export enum LOCALSTORAGE {
SHOW_FREQUENCY_CHART = 'SHOW_FREQUENCY_CHART',
DISSMISSED_COST_METER_INFO = 'DISMISSED_COST_METER_INFO',
DISMISSED_API_KEYS_DEPRECATION_BANNER = 'DISMISSED_API_KEYS_DEPRECATION_BANNER',
+ LICENSE_KEY_CALLOUT_DISMISSED = 'LICENSE_KEY_CALLOUT_DISMISSED',
}
diff --git a/frontend/src/container/GeneralSettings/GeneralSettings.tsx b/frontend/src/container/GeneralSettings/GeneralSettings.tsx
index 181d904872..32ff0431a0 100644
--- a/frontend/src/container/GeneralSettings/GeneralSettings.tsx
+++ b/frontend/src/container/GeneralSettings/GeneralSettings.tsx
@@ -38,6 +38,7 @@ import {
} from 'types/api/settings/getRetention';
import { USER_ROLES } from 'types/roles';
+import LicenseRowDismissibleCallout from './LicenseKeyRow/LicenseRowDismissibleCallout/LicenseRowDismissibleCallout';
import Retention from './Retention';
import StatusMessage from './StatusMessage';
import { ActionItemsContainer, ErrorText, ErrorTextContainer } from './styles';
@@ -683,7 +684,12 @@ function GeneralSettings({
{showCustomDomainSettings && activeLicense?.key && (
<div className="custom-domain-card-divider" />
)}
- {activeLicense?.key && <LicenseKeyRow />}
+ {activeLicense?.key && (
+ <>
+ <LicenseKeyRow />
+ <LicenseRowDismissibleCallout />
+ </>
+ )}
</div>
)}
diff --git a/frontend/src/container/GeneralSettings/LicenseKeyRow/LicenseRowDismissibleCallout/LicenseRowDismissible.styles.scss b/frontend/src/container/GeneralSettings/LicenseKeyRow/LicenseRowDismissibleCallout/LicenseRowDismissible.styles.scss
new file mode 100644
index 0000000000..f9bdce12ae
--- /dev/null
+++ b/frontend/src/container/GeneralSettings/LicenseKeyRow/LicenseRowDismissibleCallout/LicenseRowDismissible.styles.scss
@@ -0,0 +1,31 @@
+.license-key-callout {
+ margin: var(--spacing-4) var(--spacing-6);
+ width: auto;
+
+ .license-key-callout__description {
+ display: flex;
+ align-items: baseline;
+ gap: var(--spacing-2);
+ min-width: 0;
+ flex-wrap: wrap;
+ font-size: 13px;
+ }
+
+ .license-key-callout__link {
+ display: inline-flex;
+ align-items: center;
+ padding: var(--spacing-1) var(--spacing-3);
+ border-radius: 2px;
+ background: var(--callout-primary-background);
+ color: var(--callout-primary-description);
+ font-family: 'SF Mono', 'Fira Code', 'Fira Mono', monospace;
+ font-size: var(--paragraph-base-400-font-size);
+ text-decoration: none;
+
+ &:hover {
+ background: var(--callout-primary-border);
+ color: var(--callout-primary-icon);
+ text-decoration: none;
+ }
+ }
+}
diff --git a/frontend/src/container/GeneralSettings/LicenseKeyRow/LicenseRowDismissibleCallout/LicenseRowDismissibleCallout.tsx b/frontend/src/container/GeneralSettings/LicenseKeyRow/LicenseRowDismissibleCallout/LicenseRowDismissibleCallout.tsx
new file mode 100644
index 0000000000..9b699ec2d7
--- /dev/null
+++ b/frontend/src/container/GeneralSettings/LicenseKeyRow/LicenseRowDismissibleCallout/LicenseRowDismissibleCallout.tsx
@@ -0,0 +1,83 @@
+import { useState } from 'react';
+import { Link } from 'react-router-dom';
+import { Callout } from '@signozhq/callout';
+import getLocalStorageApi from 'api/browser/localstorage/get';
+import setLocalStorageApi from 'api/browser/localstorage/set';
+import { FeatureKeys } from 'constants/features';
+import { LOCALSTORAGE } from 'constants/localStorage';
+import ROUTES from 'constants/routes';
+import { useGetTenantLicense } from 'hooks/useGetTenantLicense';
+import { useAppContext } from 'providers/App/App';
+import { USER_ROLES } from 'types/roles';
+
+import './LicenseRowDismissible.styles.scss';
+
+function LicenseRowDismissibleCallout(): JSX.Element | null {
+ const [isCalloutDismissed, setIsCalloutDismissed] = useState<boolean>(
+ () =>
+ getLocalStorageApi(LOCALSTORAGE.LICENSE_KEY_CALLOUT_DISMISSED) === 'true',
+ );
+
+ const { user, featureFlags } = useAppContext();
+ const { isCloudUser } = useGetTenantLicense();
+
+ const isAdmin = user.role === USER_ROLES.ADMIN;
+ const isEditor = user.role === USER_ROLES.EDITOR;
+
+ const isGatewayEnabled =
+ featureFlags?.find((feature) => feature.name === FeatureKeys.GATEWAY)
+ ?.active || false;
+
+ const hasServiceAccountsAccess = isAdmin;
+
+ const hasIngestionAccess =
+ (isCloudUser && !isGatewayEnabled) ||
+ (isGatewayEnabled && (isAdmin || isEditor));
+
+ const handleDismissCallout = (): void => {
+ setLocalStorageApi(LOCALSTORAGE.LICENSE_KEY_CALLOUT_DISMISSED, 'true');
+ setIsCalloutDismissed(true);
+ };
+
+ return !isCalloutDismissed ? (
+ <Callout
+ type="info"
+ size="small"
+ showIcon
+ dismissable
+ onClose={handleDismissCallout}
+ className="license-key-callout"
+ description={
+ <div className="license-key-callout__description">
+ This is <strong>NOT</strong> your ingestion or Service account key.
+ {(hasServiceAccountsAccess || hasIngestionAccess) && (
+ <>
+ {' '}
+ Find your{' '}
+ {hasServiceAccountsAccess && (
+ <Link
+ to={ROUTES.SERVICE_ACCOUNTS_SETTINGS}
+ className="license-key-callout__link"
+ >
+ Service account here
+ </Link>
+ )}
+ {hasServiceAccountsAccess && hasIngestionAccess && ' and '}
+ {hasIngestionAccess && (
+ <Link
+ to={ROUTES.INGESTION_SETTINGS}
+ className="license-key-callout__link"
+ >
+ Ingestion key here
+ </Link>
+ )}
+ .
+ </>
+ )}
+ </div>
+ }
+ />
+ ) : null;
+}
+
+export default LicenseRowDismissibleCallout;
diff --git a/frontend/src/container/GeneralSettings/LicenseKeyRow/LicenseRowDismissibleCallout/__tests__/LicenseRowDismissibleCallout.test.tsx b/frontend/src/container/GeneralSettings/LicenseKeyRow/LicenseRowDismissibleCallout/__tests__/LicenseRowDismissibleCallout.test.tsx
new file mode 100644
index 0000000000..dadb91fd99
--- /dev/null
+++ b/frontend/src/container/GeneralSettings/LicenseKeyRow/LicenseRowDismissibleCallout/__tests__/LicenseRowDismissibleCallout.test.tsx
@@ -0,0 +1,229 @@
+import { FeatureKeys } from 'constants/features';
+import { LOCALSTORAGE } from 'constants/localStorage';
+import ROUTES from 'constants/routes';
+import { useGetTenantLicense } from 'hooks/useGetTenantLicense';
+import { render, screen, userEvent } from 'tests/test-utils';
+import { USER_ROLES } from 'types/roles';
+
+import LicenseRowDismissibleCallout from '../LicenseRowDismissibleCallout';
+
+const getDescription = (): HTMLElement =>
+ screen.getByText(
+ (_, el) =>
+ el?.classList?.contains('license-key-callout__description') ?? false,
+ );
+
+const queryDescription = (): HTMLElement | null =>
+ screen.queryByText(
+ (_, el) =>
+ el?.classList?.contains('license-key-callout__description') ?? false,
+ );
+
+jest.mock('hooks/useGetTenantLicense', () => ({
+ useGetTenantLicense: jest.fn(),
+}));
+
+const mockLicense = (isCloudUser: boolean): void => {
+ (useGetTenantLicense as jest.Mock).mockReturnValue({
+ isCloudUser,
+ isEnterpriseSelfHostedUser: !isCloudUser,
+ isCommunityUser: false,
+ isCommunityEnterpriseUser: false,
+ });
+};
+
+const renderCallout = (
+ role: string,
+ isCloudUser: boolean,
+ gatewayActive: boolean,
+): void => {
+ mockLicense(isCloudUser);
+ render(
+ <LicenseRowDismissibleCallout />,
+ {},
+ {
+ role,
+ appContextOverrides: {
+ featureFlags: [
+ {
+ name: FeatureKeys.GATEWAY,
+ active: gatewayActive,
+ usage: 0,
+ usage_limit: -1,
+ route: '',
+ },
+ ],
+ },
+ },
+ );
+};
+
+describe('LicenseRowDismissibleCallout', () => {
+ beforeEach(() => {
+ localStorage.clear();
+ jest.clearAllMocks();
+ });
+
+ describe('callout content per access level', () => {
+ it.each([
+ {
+ scenario: 'viewer, non-cloud, gateway off — base text only, no links',
+ role: USER_ROLES.VIEWER,
+ isCloudUser: false,
+ gatewayActive: false,
+ serviceAccountLink: false,
+ ingestionLink: false,
+ expectedText: 'This is NOT your ingestion or Service account key.',
+ },
+ {
+ scenario: 'admin, non-cloud, gateway off — service accounts link only',
+ role: USER_ROLES.ADMIN,
+ isCloudUser: false,
+ gatewayActive: false,
+ serviceAccountLink: true,
+ ingestionLink: false,
+ expectedText:
+ 'This is NOT your ingestion or Service account key. Find your Service account here.',
+ },
+ {
+ scenario: 'viewer, cloud, gateway off — ingestion link only',
+ role: USER_ROLES.VIEWER,
+ isCloudUser: true,
+ gatewayActive: false,
+ serviceAccountLink: false,
+ ingestionLink: true,
+ expectedText:
+ 'This is NOT your ingestion or Service account key. Find your Ingestion key here.',
+ },
+ {
+ scenario: 'admin, cloud, gateway off — both links',
+ role: USER_ROLES.ADMIN,
+ isCloudUser: true,
+ gatewayActive: false,
+ serviceAccountLink: true,
+ ingestionLink: true,
+ expectedText:
+ 'This is NOT your ingestion or Service account key. Find your Service account here and Ingestion key here.',
+ },
+ {
+ scenario: 'admin, non-cloud, gateway on — both links',
+ role: USER_ROLES.ADMIN,
+ isCloudUser: false,
+ gatewayActive: true,
+ serviceAccountLink: true,
+ ingestionLink: true,
+ expectedText:
+ 'This is NOT your ingestion or Service account key. Find your Service account here and Ingestion key here.',
+ },
+ {
+ scenario: 'editor, non-cloud, gateway on — ingestion link only',
+ role: USER_ROLES.EDITOR,
+ isCloudUser: false,
+ gatewayActive: true,
+ serviceAccountLink: false,
+ ingestionLink: true,
+ expectedText:
+ 'This is NOT your ingestion or Service account key. Find your Ingestion key here.',
+ },
+ {
+ scenario: 'editor, cloud, gateway off — ingestion link only',
+ role: USER_ROLES.EDITOR,
+ isCloudUser: true,
+ gatewayActive: false,
+ serviceAccountLink: false,
+ ingestionLink: true,
+ expectedText:
+ 'This is NOT your ingestion or Service account key. Find your Ingestion key here.',
+ },
+ ])(
+ '$scenario',
+ ({
+ role,
+ isCloudUser,
+ gatewayActive,
+ serviceAccountLink,
+ ingestionLink,
+ expectedText,
+ }) => {
+ renderCallout(role, isCloudUser, gatewayActive);
+
+ const description = getDescription();
+ expect(description).toBeInTheDocument();
+ expect(description).toHaveTextContent(expectedText);
+
+ if (serviceAccountLink) {
+ expect(
+ screen.getByRole('link', { name: /Service account here/ }),
+ ).toBeInTheDocument();
+ } else {
+ expect(
+ screen.queryByRole('link', { name: /Service account here/ }),
+ ).not.toBeInTheDocument();
+ }
+
+ if (ingestionLink) {
+ expect(
+ screen.getByRole('link', { name: /Ingestion key here/ }),
+ ).toBeInTheDocument();
+ } else {
+ expect(
+ screen.queryByRole('link', { name: /Ingestion key here/ }),
+ ).not.toBeInTheDocument();
+ }
+ },
+ );
+ });
+
+ describe('Link routing', () => {
+ it('should link to service accounts settings', () => {
+ renderCallout(USER_ROLES.ADMIN, false, false);
+
+ const link = screen.getByRole('link', {
+ name: /Service account here/,
+ }) as HTMLAnchorElement;
+
+ expect(link.getAttribute('href')).toBe(ROUTES.SERVICE_ACCOUNTS_SETTINGS);
+ });
+
+ it('should link to ingestion settings', () => {
+ renderCallout(USER_ROLES.VIEWER, true, false);
+
+ const link = screen.getByRole('link', {
+ name: /Ingestion key here/,
+ }) as HTMLAnchorElement;
+
+ expect(link.getAttribute('href')).toBe(ROUTES.INGESTION_SETTINGS);
+ });
+ });
+
+ describe('Dismissal functionality', () => {
+ it('should hide callout when dismiss button is clicked', async () => {
+ const user = userEvent.setup();
+ renderCallout(USER_ROLES.ADMIN, false, false);
+
+ expect(getDescription()).toBeInTheDocument();
+
+ await user.click(screen.getByRole('button'));
+
+ expect(queryDescription()).not.toBeInTheDocument();
+ });
+
+ it('should persist dismissal in localStorage', async () => {
+ const user = userEvent.setup();
+ renderCallout(USER_ROLES.ADMIN, false, false);
+
+ await user.click(screen.getByRole('button'));
+
+ expect(
+ localStorage.getItem(LOCALSTORAGE.LICENSE_KEY_CALLOUT_DISMISSED),
+ ).toBe('true');
+ });
+
+ it('should not render when localStorage dismissal is set', () => {
+ localStorage.setItem(LOCALSTORAGE.LICENSE_KEY_CALLOUT_DISMISSED, 'true');
+ renderCallout(USER_ROLES.ADMIN, false, false);
+
+ expect(queryDescription()).not.toBeInTheDocument();
+ });
+ });
+});