Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,14 @@ interface AuthenticatorCreateWizardFactoryInterface extends IdentifiableComponen
selectedTemplate?: ConnectionTemplateInterface;
}

/**
* Connection template Ids created through their own dedicated wizard in ConnectionCreateWizardFactory.
* These have no protocol template and don't need the duplicate-name lookup, so both fetches are skipped.
*/
const TEMPLATES_WITH_DEDICATED_WIZARD: string[] = [
CommonAuthenticatorConstants.CONNECTION_TEMPLATE_IDS.FLOW_EXTENSION
];

/**
* Authenticator Create Wizard factory.
*
Expand Down Expand Up @@ -108,6 +116,8 @@ export const AuthenticatorCreateWizardFactory: FC<AuthenticatorCreateWizardFacto

const productName: string = useSelector((state: AppState) => state?.config?.ui?.productName);

const hasDedicatedWizard: boolean = TEMPLATES_WITH_DEDICATED_WIZARD.includes(type);

const {
data: connectionsResponse,
isLoading: isConnectionsFetchRequestLoading,
Expand All @@ -117,19 +127,17 @@ export const AuthenticatorCreateWizardFactory: FC<AuthenticatorCreateWizardFacto
null,
!selectedTemplate?.idp?.name ? "name sw " + selectedTemplate?.name : "name sw " + selectedTemplate?.idp?.name,
null,
true
!hasDedicatedWizard
);

// The Flow Extension template has no protocol template to fetch — it is handled by a
// dedicated wizard in ConnectionCreateWizardFactory, so skip the template fetch for it.
const shouldFetchTemplate: boolean = type !== null
&& type !== CommonAuthenticatorConstants.CONNECTION_TEMPLATE_IDS.FLOW_EXTENSION;

const {
data: connectionTemplate,
isLoading: isConnectionTemplateFetchRequestLoading,
error: connectionTemplateFetchRequestError
} = useGetConnectionTemplate(type === "enterprise-protocols" ? "enterprise-idp" : type, shouldFetchTemplate);
} = useGetConnectionTemplate(
type === "enterprise-protocols" ? "enterprise-idp" : type,
type !== null && !hasDedicatedWizard
);

useEffect(() => {
if (connectionsFetchRequestError) {
Expand Down
4 changes: 3 additions & 1 deletion features/admin.connections.v1/pages/connection-edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,9 @@ const ConnectionEditPage: FunctionComponent<ConnectionEditPagePropsInterface> =
identityProviderTemplate?.id ===
CommonAuthenticatorConstants.CONNECTION_TEMPLATE_IDS.TWO_FACTOR_CUSTOM_AUTHENTICATOR ||
identityProviderTemplate?.id ===
CommonAuthenticatorConstants.CONNECTION_TEMPLATE_IDS.OUTBOUND_PROVISIONING_CONNECTION
CommonAuthenticatorConstants.CONNECTION_TEMPLATE_IDS.OUTBOUND_PROVISIONING_CONNECTION ||
identityProviderTemplate?.id ===
CommonAuthenticatorConstants.CONNECTION_TEMPLATE_IDS.FLOW_EXTENSION
) {
return;
}
Expand Down
Loading