Hide other IdP connector once one is connected
Previously the SCIM settings page rendered both Google Workspace and Microsoft 365 connector cards even after a bridge was connected, making it look like the other provider was still actionable. Once a bridge exists we now only show the connector matching the bridge type; both are still listed when nothing is configured. Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
@@ -27,6 +27,9 @@ const connectorListFragment = graphql`
|
|||||||
oauth2Scopes
|
oauth2Scopes
|
||||||
}
|
}
|
||||||
scimConfiguration {
|
scimConfiguration {
|
||||||
|
bridge {
|
||||||
|
type
|
||||||
|
}
|
||||||
...GoogleWorkspaceConnectorFragment
|
...GoogleWorkspaceConnectorFragment
|
||||||
...Microsoft365ConnectorFragment
|
...Microsoft365ConnectorFragment
|
||||||
}
|
}
|
||||||
@@ -43,6 +46,10 @@ export function ConnectorList(props: { fKey: ConnectorListFragment$key }) {
|
|||||||
const microsoft365Scopes
|
const microsoft365Scopes
|
||||||
= data.scimBridgeTypes.find(info => info.type === "MICROSOFT_365")?.oauth2Scopes ?? [];
|
= data.scimBridgeTypes.find(info => info.type === "MICROSOFT_365")?.oauth2Scopes ?? [];
|
||||||
|
|
||||||
|
const bridgeType = data.scimConfiguration?.bridge?.type ?? null;
|
||||||
|
const showGoogleWorkspace = bridgeType === null || bridgeType === "GOOGLE_WORKSPACE";
|
||||||
|
const showMicrosoft365 = bridgeType === null || bridgeType === "MICROSOFT_365";
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
<h2 className="text-base font-medium">{__("Identity Provider")}</h2>
|
<h2 className="text-base font-medium">{__("Identity Provider")}</h2>
|
||||||
@@ -51,14 +58,18 @@ export function ConnectorList(props: { fKey: ConnectorListFragment$key }) {
|
|||||||
"Connect your identity provider to automatically sync users to your organization. Once connected, you don't need to configure SCIM manually.",
|
"Connect your identity provider to automatically sync users to your organization. Once connected, you don't need to configure SCIM manually.",
|
||||||
)}
|
)}
|
||||||
</p>
|
</p>
|
||||||
<GoogleWorkspaceConnector
|
{showGoogleWorkspace && (
|
||||||
fKey={data.scimConfiguration ?? null}
|
<GoogleWorkspaceConnector
|
||||||
oauth2Scopes={googleWorkspaceScopes}
|
fKey={data.scimConfiguration ?? null}
|
||||||
/>
|
oauth2Scopes={googleWorkspaceScopes}
|
||||||
<Microsoft365Connector
|
/>
|
||||||
fKey={data.scimConfiguration ?? null}
|
)}
|
||||||
oauth2Scopes={microsoft365Scopes}
|
{showMicrosoft365 && (
|
||||||
/>
|
<Microsoft365Connector
|
||||||
|
fKey={data.scimConfiguration ?? null}
|
||||||
|
oauth2Scopes={microsoft365Scopes}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user