Skip to content

Commit

Permalink
Improve edit section
Browse files Browse the repository at this point in the history
  • Loading branch information
Shenali-SJ committed Jan 26, 2025
1 parent 3fedea5 commit 16f90e7
Show file tree
Hide file tree
Showing 8 changed files with 237 additions and 313 deletions.
10 changes: 9 additions & 1 deletion features/admin.connections.v1/components/authenticator-grid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import React, {
MouseEvent,
ReactElement,
SyntheticEvent,
useEffect,
useState
} from "react";
import { useTranslation } from "react-i18next";
Expand All @@ -62,6 +63,7 @@ import {
import { getConnectionIcons } from "../configs/ui";
import { AuthenticatorMeta } from "../meta/authenticator-meta";
import {
AuthenticatorCategories,
AuthenticatorExtensionsConfigInterface,
AuthenticatorInterface,
AuthenticatorTypes
Expand Down Expand Up @@ -191,8 +193,13 @@ export const AuthenticatorGrid: FunctionComponent<AuthenticatorGridPropsInterfac

break;

case AuthenticatorCategories.LOCAL:
history.push(AppConstants.getPaths().get("AUTH_EDIT").replace(":id", id));

break;

default:
// history.push(AppConstants.getPaths().get("IDP_EDIT").replace(":id", id));
history.push(AppConstants.getPaths().get("IDP_EDIT").replace(":id", id));

break;
}
Expand Down Expand Up @@ -385,6 +392,7 @@ export const AuthenticatorGrid: FunctionComponent<AuthenticatorGridPropsInterfac
*/
const handleGridItemOnClick = (e: SyntheticEvent, authenticator: ConnectionInterface
| AuthenticatorInterface): void => {

handleAuthenticatorEdit(authenticator.id, authenticator.type);
onItemClick && onItemClick(e, authenticator);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ const CustomAuthenticationCreateWizard: FunctionComponent<CustomAuthenticationCr
* @param id - ID of the created local authenticator.
*/
const handleSuccessfulAuthenticatorCreate = (id?: string): void => {
// If ID is present, navigate to the edit page of the created IDP.
if (id) {
history.push({
pathname: AppConstants.getPaths()
Expand All @@ -211,7 +210,6 @@ const CustomAuthenticationCreateWizard: FunctionComponent<CustomAuthenticationCr
return;
}

// Fallback to identity providers page, if id is not present.
history.push(AppConstants.getPaths().get("IDP"));
};

Expand Down Expand Up @@ -553,8 +551,7 @@ const CustomAuthenticationCreateWizard: FunctionComponent<CustomAuthenticationCr
message: t("authenticationProvider:notifications." + "addIDP.success.message")
})
);
// The created resource's id is sent as a location header.
// If that's available, navigate to the edit page.

if (!isEmpty(response.headers.location)) {
const location: string = response.headers.location;
const createdIdpID: string = location.substring(location.lastIndexOf("/") + 1);
Expand Down Expand Up @@ -634,8 +631,7 @@ const CustomAuthenticationCreateWizard: FunctionComponent<CustomAuthenticationCr
message: t("authenticationProvider:notifications." + "addIDP.success.message")
})
);
// The created resource's id is sent as a location header.
// If that's available, navigate to the edit page.

if (!isEmpty(response.headers.location)) {
const location: string = response.headers.location;
const createdLocalAuthID: string = location.substring(location.lastIndexOf("/") + 1);
Expand Down Expand Up @@ -739,11 +735,13 @@ const CustomAuthenticationCreateWizard: FunctionComponent<CustomAuthenticationCr
setIsSubmitting(true);
createExternalAuthenticator(identityProvider);
} else {

const { customLocalAuthenticator: customAuthenticator } = cloneDeep(connectionTemplate);

// customAuthenticator.templateId = selectedTemplateId;
customAuthenticator.name = prefixedIdentifier;
customAuthenticator.displayName = values?.displayName?.toString();
customAuthenticator.description = connectionTemplate.customLocalAuthenticator.description;
// TODO: Provide support to add local file URI as the image.

customAuthenticator.endpoint.authentication.type = endpointAuthType;
customAuthenticator.endpoint.uri = values?.endpointUri.toString();
Expand Down
Loading

0 comments on commit 16f90e7

Please sign in to comment.