Skip to content

Commit

Permalink
Merge pull request wso2#4837 from dasuni-30/fix/18138
Browse files Browse the repository at this point in the history
Change the precedence of role types
  • Loading branch information
dasuni-30 authored Nov 29, 2023
2 parents 1b83973 + 1bbd52f commit c9772ff
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 39 deletions.
5 changes: 5 additions & 0 deletions .changeset/lovely-seas-begin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@wso2is/console": patch
---

Change the precendence of role types
93 changes: 56 additions & 37 deletions apps/console/src/features/roles/components/application-roles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
* under the License.
*/

import { Button } from "@oxygen-ui/react";
import { PlusIcon } from "@oxygen-ui/react-icons";
import Autocomplete, {
AutocompleteRenderGetTagProps,
AutocompleteRenderInputParams
Expand All @@ -35,6 +33,7 @@ import {
DocumentationLink,
EmphasizedSegment,
Heading,
LinkButton,
PrimaryButton,
useDocumentation
} from "@wso2is/react-components";
Expand All @@ -50,7 +49,7 @@ import React, {
import { useTranslation } from "react-i18next";
import { useDispatch } from "react-redux";
import { Dispatch } from "redux";
import { Grid } from "semantic-ui-react";
import { Grid, Icon } from "semantic-ui-react";
import { AutoCompleteRenderOption } from "./auto-complete-render-option";
import { ApplicationRoleWizard } from "./wizard-updated/application-role-wizard";
import { updateApplicationDetails } from "../../applications/api";
Expand Down Expand Up @@ -344,41 +343,61 @@ export const ApplicationRoles: FunctionComponent<ApplicationRolesSettingsInterfa
{ t("extensions:develop.applications.edit.sections.rolesV2.roleAudience") }
</Heading>
</Grid.Column>
<Grid.Column width={ 2 }>
<Grid.Column width={ 10 }>
<FormGroup>
<FormControlLabel
checked={ roleAudience === RoleAudienceTypes.ORGANIZATION }
control={ <Radio size="small"/> }
onChange={ () => promptAudienceSwitchWarning(RoleAudienceTypes.ORGANIZATION) }
label={ t("extensions:develop.applications.edit.sections.rolesV2.organization") }
data-componentid={ `${ componentId }-organization-audience-checkbox` }
disabled={ isReadOnly }
/>
<Grid.Row>
<FormControlLabel
checked={ roleAudience === RoleAudienceTypes.APPLICATION }
control={ <Radio size="small" /> }
onChange={ () => promptAudienceSwitchWarning(RoleAudienceTypes.APPLICATION) }
label={ t("extensions:develop.applications.edit.sections.rolesV2.application") }
data-componentid={ `${ componentId }-application-audience-checkbox` }
disabled={ isReadOnly }
className="mr-6"
/>
{
roleAudience === RoleAudienceTypes.APPLICATION
&& (
<Button
startIcon={ <PlusIcon/> }
variant="text"
onClick={ handleAddNewRoleWizardClick }
disabled={ isReadOnly }
>
{ t("console:develop.features.applications.edit." +
"sections.roles.createApplicationRoleWizard.button") }
</Button>
)
}
</Grid.Row>
<Grid>
<Grid.Row columns={ 2 } className="pb-0">
<Grid.Column width={ 4 }>
<FormControlLabel
checked={ roleAudience === RoleAudienceTypes.APPLICATION }
control={ <Radio size="small" /> }
onChange={ () =>
promptAudienceSwitchWarning(RoleAudienceTypes.APPLICATION) }
label={
t("extensions:develop.applications.edit.sections." +
"rolesV2.application")
}
data-componentid={ `${ componentId }-application-audience-checkbox` }
disabled={ isReadOnly }
/>
</Grid.Column>
<Grid.Column width={ 6 }>
{
roleAudience === RoleAudienceTypes.APPLICATION
&& (
<LinkButton
fluid
data-componentid="create-application-role-button"
onClick={ handleAddNewRoleWizardClick }
disabled={ isReadOnly }
>
<Icon name="plus"/>
{
t("console:develop.features.applications.edit." +
"sections.roles.createApplicationRoleWizard.button")
}
</LinkButton>
)
}
</Grid.Column>
</Grid.Row>
<Grid.Row className="pt-0">
<Grid.Column width={ 6 }>
<FormControlLabel
checked={ roleAudience === RoleAudienceTypes.ORGANIZATION }
control={ <Radio size="small"/> }
onChange={ () =>
promptAudienceSwitchWarning(RoleAudienceTypes.ORGANIZATION) }
label={
t("extensions:develop.applications.edit.sections." +
"rolesV2.organization")
}
data-componentid={ `${ componentId }-organization-audience-checkbox` }
disabled={ isReadOnly }
/>
</Grid.Column>
</Grid.Row>
</Grid>
</FormGroup>
</Grid.Column>
</Grid.Row>
Expand Down
4 changes: 2 additions & 2 deletions apps/console/src/features/roles/constants/role-constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ export const DOMAIN_SEPARATOR: string = "/";
* Role audience interface.
*/
export enum RoleAudienceTypes {
ORGANIZATION = "ORGANIZATION",
APPLICATION = "APPLICATION"
APPLICATION = "APPLICATION",
ORGANIZATION = "ORGANIZATION"
}

/**
Expand Down

0 comments on commit c9772ff

Please sign in to comment.