Skip to content

Commit

Permalink
Merge pull request #6942 from pavinduLakshan/fix_alignment
Browse files Browse the repository at this point in the history
  • Loading branch information
pavinduLakshan authored Sep 30, 2024
2 parents d78ad1e + 6d42e3a commit f6e3f2f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/ninety-mirrors-sip.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@wso2is/admin.roles.v2": patch
---

Fix alignment issues between application role option and the new application role button
9 changes: 5 additions & 4 deletions features/admin.roles.v2/components/application-roles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import FormControlLabel from "@oxygen-ui/react/FormControlLabel";
import FormGroup from "@oxygen-ui/react/FormGroup";
import Radio from "@oxygen-ui/react/Radio";
import TextField from "@oxygen-ui/react/TextField";
import { useRequiredScopes } from "@wso2is/access-control";
import { updateApplicationDetails } from "@wso2is/admin.applications.v1/api";
import { useGetApplication } from "@wso2is/admin.applications.v1/api/use-get-application";
import { ApplicationInterface } from "@wso2is/admin.applications.v1/models";
Expand All @@ -33,7 +34,6 @@ import { history } from "@wso2is/admin.core.v1/helpers/history";
import { FeatureConfigInterface } from "@wso2is/admin.core.v1/models";
import { AppState } from "@wso2is/admin.core.v1/store";
import { useGetCurrentOrganizationType } from "@wso2is/admin.organizations.v1/hooks/use-get-organization-type";
import { hasRequiredScopes } from "@wso2is/core/helpers";
import { AlertLevels, IdentifiableComponentInterface } from "@wso2is/core/models";
import { addAlert } from "@wso2is/core/store";
import {
Expand Down Expand Up @@ -123,9 +123,10 @@ export const ApplicationRoles: FunctionComponent<ApplicationRolesSettingsInterfa
const isReadOnly: boolean = readOnly || organizationType === OrganizationType.SUBORGANIZATION;
const [ showWizard, setShowWizard ] = useState<boolean>(false);

const allowedScopes: string = useSelector((state: AppState) => state?.auth?.allowedScopes);
const featureConfig: FeatureConfigInterface = useSelector((state: AppState) => state?.config?.ui?.features);

const hasRoleCreatePermissions: boolean = useRequiredScopes(featureConfig?.userRoles?.scopes?.create);

/**
* Fetch application roles on component load and audience switch.
*/
Expand Down Expand Up @@ -323,6 +324,7 @@ export const ApplicationRoles: FunctionComponent<ApplicationRolesSettingsInterfa
<Grid.Row columns={ 2 } className="pb-0">
<Grid.Column width={ 4 }>
<FormControlLabel
className="mt-1"
checked={ roleAudience === RoleAudienceTypes.APPLICATION }
control={ <Radio size="small" /> }
onChange={ () =>
Expand All @@ -338,8 +340,7 @@ export const ApplicationRoles: FunctionComponent<ApplicationRolesSettingsInterfa
<Grid.Column width={ 6 }>
{
roleAudience === RoleAudienceTypes.APPLICATION &&
hasRequiredScopes(featureConfig?.userRoles,
featureConfig?.userRoles?.scopes?.create, allowedScopes)
hasRoleCreatePermissions
&& (
<LinkButton
fluid
Expand Down

0 comments on commit f6e3f2f

Please sign in to comment.