Skip to content

Commit

Permalink
Merge pull request wso2#4474 from dasuni-30/fix/17351
Browse files Browse the repository at this point in the history
Improve the application selection dropdown under Application audience role creation
  • Loading branch information
dasuni-30 authored Nov 1, 2023
2 parents 853016c + cb509f3 commit 7cf21cf
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 6 deletions.
6 changes: 6 additions & 0 deletions .changeset/itchy-experts-raise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@wso2is/console": patch
"@wso2is/i18n": patch
---

Improve the application selection dropdown under Application audience role creation
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export interface ApplicationBasicInterface {
templateId?: string;
isManagementApp?: boolean;
advancedConfigurations?: AdvancedConfigurationsInterface;
associatedRoles?: AssociatedRolesInterface;
}

export enum ApplicationAccessTypes {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,17 @@ export const RoleBasics: FunctionComponent<RoleBasicProps> = (props: RoleBasicPr

const noApplicationsAvailable: MutableRefObject<boolean> = useRef<boolean>(false);

/**
* Index of the roles tab.
*/
const ROLES_TAB_INDEX: number = 5;

const {
data: applicationList,
isLoading: isApplicationListFetchRequestLoading,
error: applicationListFetchRequestError,
mutate: mutateApplicationListFetchRequest
} = useApplicationList("clientId", null, null, applicationSearchQuery);
} = useApplicationList("clientId,associatedRoles.allowedAudience", null, null, applicationSearchQuery);

const {
data: rolesList,
Expand Down Expand Up @@ -137,10 +142,26 @@ export const RoleBasics: FunctionComponent<RoleBasicProps> = (props: RoleBasicPr
content: (
<ListItemText
primary={ application.name }
secondary={ t("console:manage.features.roles.addRoleWizard.forms.roleBasicDetails." +
"assignedApplication.applicationSubTitle.application") }
secondary={
application?.associatedRoles?.allowedAudience === RoleAudienceTypes.ORGANIZATION
? (
<>
{ t("console:manage.features.roles.addRoleWizard.forms.roleBasicDetails." +
"assignedApplication.applicationSubTitle.application") }
<Link
data-componentid={ `${componentId}-link-navigate-roles` }
onClick={ () => navigateToApplicationEdit(application?.id) }
external={ false }
>
Change the audience
</Link>
</>
) : t("console:manage.features.roles.addRoleWizard.forms.roleBasicDetails." +
"assignedApplication.applicationSubTitle.organization")
}
/>
),
disabled: application?.associatedRoles?.allowedAudience === RoleAudienceTypes.ORGANIZATION,
key: application.id,
text: application.name,
value: application.id
Expand Down Expand Up @@ -204,6 +225,15 @@ export const RoleBasics: FunctionComponent<RoleBasicProps> = (props: RoleBasicPr
*/
const navigateToApplications = () => history.push(AppConstants.getPaths().get("APPLICATIONS"));

/**
* Navigate to the Applications Edit page.
*/
const navigateToApplicationEdit = (appId: string) =>
history.push({
pathname: AppConstants.getPaths().get("APPLICATION_SIGN_IN_METHOD_EDIT")
.replace(":id", appId).replace(":tabName", `#tab=${ ROLES_TAB_INDEX }`)
});

/**
* Validates the Form.
*
Expand Down
2 changes: 1 addition & 1 deletion modules/i18n/src/translations/en-US/portals/console.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10170,7 +10170,7 @@ export const console: ConsoleNS = {
label: "Assigned application",
placeholder: "Select application to assign the role",
applicationSubTitle: {
application: "Support application-scoped roles",
application: "Support application-scoped roles. ",
organization: "Support organization-scoped roles"
},
validations: {
Expand Down
2 changes: 1 addition & 1 deletion modules/i18n/src/translations/fr-FR/portals/console.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8401,7 +8401,7 @@ export const console: ConsoleNS = {
label: "Application attribuée",
placeholder: "Sélectionnez l'application pour attribuer le rôle",
applicationSubTitle: {
application: "Prise en charge des rôles à application",
application: "Prise en charge des rôles à application. ",
organization: "Rôles de soutien à l'organisation"
},
validations: {
Expand Down
2 changes: 1 addition & 1 deletion modules/i18n/src/translations/si-LK/portals/console.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8222,7 +8222,7 @@ export const console: ConsoleNS = {
label: "පවරා ඇති අයදුම්පත",
placeholder: "භූමිකාව පැවරීම සඳහා අයදුම්පත තෝරන්න",
applicationSubTitle: {
application: "අයදුම්පත් සහිත භූමිකාවන් සහාය",
application: "අයදුම්පත් සහිත භූමිකාවන් සහාය. ",
organization: "සංවිධාන භූමිකාවන් සහාය"
},
validations: {
Expand Down

0 comments on commit 7cf21cf

Please sign in to comment.