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.

fix: if invalid switch is disabled (#1656)

Palash Gupta4727dbc9f067
diff --git a/frontend/src/container/OrganizationSettings/AuthDomains/Switch/index.tsx b/frontend/src/container/OrganizationSettings/AuthDomains/Switch/index.tsx
index b305517429..fc24014830 100644
--- a/frontend/src/container/OrganizationSettings/AuthDomains/Switch/index.tsx
+++ b/frontend/src/container/OrganizationSettings/AuthDomains/Switch/index.tsx
@@ -25,7 +25,7 @@ function SwitchComponent({
setIsLoading(false);
};
- const isInValidCertificate = useMemo(
+ const isInValidVerificate = useMemo(
() => !getIsValidCertificate(record?.samlConfig),
[record],
);
@@ -33,7 +33,7 @@ function SwitchComponent({
return (
<Switch
loading={isLoading}
- disabled={isInValidCertificate}
+ disabled={isInValidVerificate}
checked={isChecked}
onChange={onChangeHandler}
/>
diff --git a/frontend/src/container/OrganizationSettings/AuthDomains/index.tsx b/frontend/src/container/OrganizationSettings/AuthDomains/index.tsx
index 221ba963dc..3ae10eb859 100644
--- a/frontend/src/container/OrganizationSettings/AuthDomains/index.tsx
+++ b/frontend/src/container/OrganizationSettings/AuthDomains/index.tsx
@@ -1,5 +1,5 @@
import { LockTwoTone } from '@ant-design/icons';
-import { Button, Modal, notification, Space, Table, Typography } from 'antd';
+import { Button, Modal, notification, Space, Table } from 'antd';
import { ColumnsType } from 'antd/lib/table';
import deleteDomain from 'api/SAML/deleteDomain';
import listAllDomain from 'api/SAML/listAllDomain';
@@ -20,7 +20,6 @@ import AddDomain from './AddDomain';
import Create from './Create';
import EditSaml from './Edit';
import SwitchComponent from './Switch';
-import { getIsValidCertificate } from './utils';
function AuthDomains(): JSX.Element {
const { t } = useTranslation(['common', 'organizationsettings']);
@@ -196,12 +195,6 @@ function AuthDomains(): JSX.Element {
);
}
- const isValidCertificate = getIsValidCertificate(record.samlConfig);
-
- if (!isValidCertificate) {
- return <Typography>Configure SSO &nbsp;</Typography>;
- }
-
return (
<Button type="link" onClick={onEditHandler(record)}>
Edit SSO
diff --git a/frontend/src/container/OrganizationSettings/AuthDomains/utils.ts b/frontend/src/container/OrganizationSettings/AuthDomains/utils.ts
index 17154cc917..e739cb3a8d 100644
--- a/frontend/src/container/OrganizationSettings/AuthDomains/utils.ts
+++ b/frontend/src/container/OrganizationSettings/AuthDomains/utils.ts
@@ -1,6 +1,13 @@
-export const getIsValidCertificate = (
- config: Record<string, string>,
-): boolean =>
- config?.samlCert.length !== 0 &&
- config?.samlEntity.length !== 0 &&
- config?.samlIdp.length !== 0;
+import { SAMLConfig } from 'types/api/SAML/listDomain';
+
+export const getIsValidCertificate = (config: SAMLConfig): boolean => {
+ if (config === null) {
+ return false;
+ }
+
+ return (
+ config?.samlCert?.length !== 0 &&
+ config?.samlEntity?.length !== 0 &&
+ config?.samlIdp?.length !== 0
+ );
+};
diff --git a/frontend/src/types/api/SAML/listDomain.ts b/frontend/src/types/api/SAML/listDomain.ts
index e6463e7788..bd3e8f7947 100644
--- a/frontend/src/types/api/SAML/listDomain.ts
+++ b/frontend/src/types/api/SAML/listDomain.ts
@@ -1,16 +1,18 @@
import { Organization } from '../user/getOrganization';
+export interface SAMLConfig {
+ samlEntity: string;
+ samlIdp: string;
+ samlCert: string;
+}
+
export interface SAMLDomain {
id: string;
name: string;
orgId: Organization['id'];
ssoEnabled: boolean;
ssoType: 'SAML';
- samlConfig: {
- samlEntity: string;
- samlIdp: string;
- samlCert: string;
- };
+ samlConfig: SAMLConfig;
}
export interface Props {