Skip to content

Commit

Permalink
Merge pull request wso2#4478 from DonOmalVindula/fix/17470
Browse files Browse the repository at this point in the history
Fix issues with the application roles edit page
  • Loading branch information
DonOmalVindula authored Nov 1, 2023
2 parents 17e7506 + 0273606 commit 5603e89
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 10 deletions.
5 changes: 5 additions & 0 deletions .changeset/tame-donuts-itch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@wso2is/console": patch
---

Fix issue with the application role edit tab
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ export const EditApplication: FunctionComponent<EditApplicationPropsInterface> =
inboundProtocolConfig: inboundProtocolConfig,
inboundProtocols: inboundProtocolList,
onApplicationUpdate: () => {
onUpdate(application?.id);
handleApplicationUpdate(application?.id);
},
onTriggerTabUpdate: (tabIndex: number) => {
setActiveTabIndex(tabIndex);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ const ApplicationEditPage: FunctionComponent<ApplicationEditPageInterface> = (
data: application,
mutate: mutateApplicationGetRequest,
isLoading: isApplicationGetRequestLoading,
isValidating: isApplicationGetRequestValidating,
error: applicationGetRequestError
} = useGetApplication(applicationId, !!applicationId);

Expand Down Expand Up @@ -553,7 +554,7 @@ const ApplicationEditPage: FunctionComponent<ApplicationEditPageInterface> = (
count: 5,
imageType: "square"
} }
isLoading={ isApplicationRequestLoading }
isLoading={ isApplicationRequestLoading || isApplicationGetRequestValidating }
backButton={ {
"data-componentid": `${componentId}-page-back-button`,
onClick: handleBackButtonClick,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,8 @@ export const ApplicationRoles: FunctionComponent<ApplicationRolesSettingsInterfa
<Heading as="h5" className="mb-2">
{ t("extensions:develop.applications.edit.sections.rolesV2.roleAudience") }
</Heading>
</Grid.Column>
<Grid.Column width={ 2 }>
<FormGroup>
<FormControlLabel
checked={ roleAudience === RoleAudienceTypes.ORGANIZATION }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { Alert, ListItemText } from "@oxygen-ui/react";
import { IdentifiableComponentInterface } from "@wso2is/core/models";
import { Field, Form } from "@wso2is/form";
import { Link } from "@wso2is/react-components";
import { FormValidation } from "@wso2is/validation";
import debounce, { DebouncedFunc } from "lodash-es/debounce";
import React, {
FunctionComponent,
Expand Down Expand Up @@ -263,15 +264,20 @@ export const RoleBasics: FunctionComponent<RoleBasicProps> = (props: RoleBasicPr
errors.roleName = t("console:manage.features.roles.addRoleWizard.forms.roleBasicDetails.roleName." +
"validations.empty", { type: "Role" });
} else {
// TODO: Need to debounce the function.
setRoleNameSearchQuery(`displayName eq ${values.roleName} and audience.value eq ${audienceId}`);

if (!isRolesListLoading || !isRolesListValidating) {
if (rolesList?.totalResults > 0) {
errors.roleName = t("console:manage.features.roles.addRoleWizard.forms.roleBasicDetails." +
"roleName.validations.duplicate", { type: "Role" });
if (!FormValidation.isValidRoleName(values.roleName?.toString().trim())) {
errors.roleName = t("console:manage.features.roles.addRoleWizard.forms.roleBasicDetails." +
"roleName.validations.invalid", { type: "Role" });
} else {
// TODO: Need to debounce the function.
setRoleNameSearchQuery(`displayName eq ${values.roleName} and audience.value eq ${audienceId}`);

if (!isRolesListLoading || !isRolesListValidating) {
if (rolesList?.totalResults > 0) {
errors.roleName = t("console:manage.features.roles.addRoleWizard.forms.roleBasicDetails." +
"roleName.validations.duplicate", { type: "Role" });
}
}
}
}
}

if (errors.roleName || errors.assignedApplicationId) {
Expand Down

0 comments on commit 5603e89

Please sign in to comment.