-
Notifications
You must be signed in to change notification settings - Fork 266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conditional View Access For Discoverable Applications in MyAccount #7399
Draft
DilshanSenarath
wants to merge
6
commits into
wso2:master
Choose a base branch
from
DilshanSenarath:discoverable-apps
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
dddcb51
add discoverable groups ui
DilshanSenarath 700d579
update the styles of auto complete
DilshanSenarath 68559bd
fix the state issue of text field in auto complete
DilshanSenarath f3cd8e6
enable discoverable app view for sub orgs
DilshanSenarath d8b8aea
merge master branch
DilshanSenarath 8f3beb2
fix the type issue
DilshanSenarath File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
features/admin.applications.v1/api/use-get-groups-metadata.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/** | ||
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com). | ||
* | ||
* WSO2 LLC. licenses this file to you under the Apache License, | ||
* Version 2.0 (the "License"); you may not use this file except | ||
* in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import { store } from "@wso2is/admin.core.v1"; | ||
import useRequest, { RequestErrorInterface, RequestResultInterface } from "@wso2is/admin.core.v1/hooks/use-request"; | ||
import { HttpMethods } from "@wso2is/core/models"; | ||
import { AxiosRequestConfig } from "axios"; | ||
import { GroupMetadataInterface } from "../models/application"; | ||
|
||
export const useGetGroupsMetadata = <Data = GroupMetadataInterface[], Error = RequestErrorInterface>( | ||
userStore: string, | ||
searchTerm: string, | ||
shouldFetch: boolean = true | ||
): RequestResultInterface<Data, Error> => { | ||
|
||
const requestConfig: AxiosRequestConfig = { | ||
headers: { | ||
"Accept": "application/json", | ||
"Content-Type": "application/json" | ||
}, | ||
method: HttpMethods.GET, | ||
params: { | ||
domain: userStore, | ||
filter: searchTerm ? `name co ${searchTerm}` : undefined | ||
}, | ||
url: store?.getState()?.config?.endpoints?.groupMetadata | ||
}; | ||
|
||
const { data, error, isValidating, mutate } = useRequest<Data, Error>(shouldFetch ? requestConfig : null); | ||
|
||
return { | ||
data, | ||
error: error, | ||
isLoading: shouldFetch && !error && !data, | ||
isValidating, | ||
mutate | ||
}; | ||
}; |
162 changes: 162 additions & 0 deletions
162
....applications.v1/components/forms/general-details-form/discoverable-group-render-chip.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,162 @@ | ||
/** | ||
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com). | ||
* | ||
* WSO2 LLC. licenses this file to you under the Apache License, | ||
* Version 2.0 (the "License"); you may not use this file except | ||
* in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import Card from "@oxygen-ui/react/Card"; | ||
import CardContent from "@oxygen-ui/react/CardContent"; | ||
import Chip, { ChipProps } from "@oxygen-ui/react/Chip"; | ||
import Grid from "@oxygen-ui/react/Grid"; | ||
import ListItemText from "@oxygen-ui/react/ListItemText"; | ||
import Paper from "@oxygen-ui/react/Paper"; | ||
import Popover from "@oxygen-ui/react/Popover"; | ||
import { getSidePanelIcons } from "@wso2is/admin.core.v1/configs/ui"; | ||
import { IdentifiableComponentInterface } from "@wso2is/core/models"; | ||
import { AnimatedAvatar, AppAvatar, GenericIcon } from "@wso2is/react-components"; | ||
import React, { FunctionComponent, ReactElement, SyntheticEvent, useState } from "react"; | ||
import { GroupMetadataInterface } from "../../../models/application"; | ||
|
||
interface DiscoverableGroupRenderChipInterface extends IdentifiableComponentInterface, ChipProps { | ||
/** | ||
* Key of the chip. | ||
*/ | ||
key: string | number; | ||
/** | ||
* Callback to set the active option. | ||
*/ | ||
setActiveOption: (option: any) => void; | ||
/** | ||
* Primary text of the chip. | ||
*/ | ||
primaryText: string; | ||
/** | ||
* User store of the user. | ||
*/ | ||
userStore?: string; | ||
/** | ||
* Option object. | ||
*/ | ||
option: GroupMetadataInterface; | ||
/** | ||
* Active option object. | ||
*/ | ||
activeOption: any; | ||
} | ||
|
||
export const DiscoverableGroupRenderChip: FunctionComponent<DiscoverableGroupRenderChipInterface> = ( | ||
{ | ||
key, | ||
setActiveOption, | ||
primaryText, | ||
userStore, | ||
option, | ||
activeOption, | ||
...props | ||
}: DiscoverableGroupRenderChipInterface | ||
): ReactElement => { | ||
|
||
const [ popoverAnchorEl, setPopoverAnchorEl ] = useState<Element>(null); | ||
|
||
/** | ||
* Handles the mouse enter event of the chip. | ||
* | ||
* @param event - Mouse event. | ||
* @param option - Group or user object. | ||
*/ | ||
const handleChipMouseEnter = (event: SyntheticEvent) => { | ||
setPopoverAnchorEl(event.currentTarget); | ||
setActiveOption(option); | ||
}; | ||
|
||
/** | ||
* Handles the mouse leave event of the chip. | ||
*/ | ||
const handleChipMouseLeave = () => { | ||
setPopoverAnchorEl(null); | ||
setActiveOption(null); | ||
}; | ||
|
||
return ( | ||
<> | ||
<Chip | ||
{ ...props } | ||
key={ key } | ||
label={ primaryText } | ||
onMouseEnter={ handleChipMouseEnter } | ||
onMouseLeave={ handleChipMouseLeave } | ||
/> | ||
{ | ||
activeOption?.id === option.id && ( | ||
<Popover | ||
className="role-chip-popover" | ||
open={ !!popoverAnchorEl } | ||
anchorEl={ popoverAnchorEl } | ||
onClose={ handleChipMouseLeave } | ||
anchorOrigin={ { | ||
horizontal: "left", | ||
vertical: "bottom" | ||
} } | ||
transformOrigin={ { | ||
horizontal: "left", | ||
vertical: "top" | ||
} } | ||
elevation={ 0 } | ||
disableRestoreFocus | ||
> | ||
<Paper> | ||
<Card className="role-chip-more-details"> | ||
<CardContent> | ||
<Grid container alignItems="center" columnSpacing={ 2 }> | ||
<Grid container alignItems="center" justifyContent="flex-start"> | ||
<Grid> | ||
<AppAvatar | ||
image={ ( | ||
<AnimatedAvatar | ||
name={ primaryText } | ||
size="mini" | ||
/> | ||
) } | ||
size="mini" | ||
/> | ||
</Grid> | ||
<Grid> | ||
<ListItemText primary={ primaryText }/> | ||
</Grid> | ||
</Grid> | ||
<Grid justifyContent="flex-end"> | ||
<Chip | ||
icon={ ( | ||
<GenericIcon | ||
inline | ||
size="default" | ||
transparent | ||
icon={ getSidePanelIcons().userStore } | ||
verticalAlign="middle" | ||
/> | ||
) } | ||
label={ userStore } | ||
/> | ||
</Grid> | ||
</Grid> | ||
</CardContent> | ||
</Card> | ||
</Paper> | ||
</Popover> | ||
) | ||
} | ||
</> | ||
); | ||
}; |
84 changes: 84 additions & 0 deletions
84
...pplications.v1/components/forms/general-details-form/discoverable-group-render-option.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
/** | ||
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com). | ||
* | ||
* WSO2 LLC. licenses this file to you under the Apache License, | ||
* Version 2.0 (the "License"); you may not use this file except | ||
* in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import Checkbox from "@oxygen-ui/react/Checkbox"; | ||
import Chip from "@oxygen-ui/react/Chip"; | ||
import Grid from "@oxygen-ui/react/Grid"; | ||
import ListItemText from "@oxygen-ui/react/ListItemText"; | ||
import { getSidePanelIcons } from "@wso2is/admin.core.v1/configs/ui"; | ||
import { IdentifiableComponentInterface } from "@wso2is/core/models"; | ||
import { GenericIcon } from "@wso2is/react-components"; | ||
import React, { | ||
FunctionComponent, | ||
HTMLAttributes, | ||
ReactElement | ||
} from "react"; | ||
|
||
interface DiscoverableGroupRenderOption extends IdentifiableComponentInterface { | ||
/** | ||
* Is the option selected. | ||
*/ | ||
selected?: boolean; | ||
/** | ||
* The display name of the option. | ||
*/ | ||
displayName: string; | ||
/** | ||
* The user store of the option. | ||
*/ | ||
userStore?: string; | ||
/** | ||
* The props passed to the option. | ||
*/ | ||
renderOptionProps: HTMLAttributes<HTMLLIElement> | ||
} | ||
|
||
export const DiscoverableGroupRenderOption: FunctionComponent<DiscoverableGroupRenderOption> = ( | ||
{ | ||
selected, | ||
displayName, | ||
userStore, | ||
renderOptionProps | ||
}: DiscoverableGroupRenderOption | ||
): ReactElement => { | ||
|
||
return ( | ||
<li { ...renderOptionProps }> | ||
<Grid container justifyContent="space-between" alignItems="center" xs={ 12 }> | ||
<Grid container alignItems="center" xs={ 8 }> | ||
<Checkbox checked={ selected } /> | ||
<ListItemText primary={ displayName } /> | ||
</Grid> | ||
<Grid justifyContent="flex-end"> | ||
<Chip | ||
icon={ ( | ||
<GenericIcon | ||
inline | ||
size="default" | ||
transparent | ||
icon={ getSidePanelIcons().userStore } | ||
verticalAlign="middle" | ||
/> | ||
) } | ||
label={ userStore } | ||
/> | ||
</Grid> | ||
</Grid> | ||
</li> | ||
); | ||
}; |
49 changes: 49 additions & 0 deletions
49
...res/admin.applications.v1/components/forms/general-details-form/general-details-form.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/** | ||
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com). | ||
* | ||
* WSO2 LLC. licenses this file to you under the Apache License, | ||
* Version 2.0 (the "License"); you may not use this file except | ||
* in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
.application-general-discoverable-groups { | ||
div:nth-of-type(2) { | ||
padding-right: 0.5rem !important; | ||
} | ||
|
||
div:nth-of-type(3) { | ||
padding-left: 0.5rem !important; | ||
} | ||
|
||
.ui.header.heading { | ||
margin: 0; | ||
margin-bottom: 8px; | ||
} | ||
|
||
.MuiInputBase-root { | ||
&.oxygen-select { | ||
height: 50px; | ||
} | ||
} | ||
|
||
.oxygen-text-field { | ||
.MuiInputBase-root { | ||
min-height: 50px; | ||
|
||
.MuiInputBase-input { | ||
border: none !important; | ||
width: auto !important; | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add a parent class to application general sections and wrap discoverable-groups inside it, so that any other application general tab related styles can go under the parent class
eg: