Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard87 committed Apr 23, 2024
1 parent e647816 commit 79b6f24
Showing 1 changed file with 34 additions and 38 deletions.
72 changes: 34 additions & 38 deletions src/components/graph/adGroups.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,38 +52,36 @@ export function ADGroups({
const unknownADGroups = adGroups?.filter(
(adGroupId) => !groupsInfo?.some((adGroup) => adGroup.id === adGroupId)
);
return (
return state.isLoading ? (
<>
{state.isLoading ? (
<>
<CircularProgress size={24} /> Updating…
</>
) : (
<AsyncSelect
isMulti
name="ADGroups"
menuPosition="fixed"
closeMenuOnScroll={(e: Event) => {
const target = e.target as HTMLInputElement;
return (
target?.parentElement?.className &&
!target.parentElement.className.match(/menu/)
);
}}
noOptionsMessage={() => null}
loadOptions={(inputValue, callback) => {
inputValue?.length < 3
? callback([])
: loadOptions(callback, searchGroups, inputValue);
}}
onChange={handleAdGroupsChange}
getOptionLabel={({ displayName }) => displayName}
getOptionValue={({ id }) => id}
closeMenuOnSelect={false}
defaultValue={groupsInfo}
isDisabled={isDisabled}
/>
)}
<CircularProgress size={24} /> Updating…
</>
) : (
<>
<AsyncSelect
isMulti
name="ADGroups"
menuPosition="fixed"
closeMenuOnScroll={(e: Event) => {
const target = e.target as HTMLInputElement;
return (
target?.parentElement?.className &&
!target.parentElement.className.match(/menu/)
);
}}
noOptionsMessage={() => null}
loadOptions={(inputValue, callback) => {
inputValue?.length < 3
? callback([])
: loadOptions(callback, searchGroups, inputValue);
}}
onChange={handleAdGroupsChange}
getOptionLabel={({ displayName }) => displayName}
getOptionValue={({ id }) => id}
closeMenuOnSelect={false}
defaultValue={groupsInfo}
isDisabled={isDisabled}
/>
<Typography
className="helpertext"
group="input"
Expand All @@ -92,13 +90,11 @@ export function ADGroups({
>
Azure Active Directory groups (type 3 characters to search)
</Typography>
{!state.isLoading &&
adGroups?.length > 0 &&
unknownADGroups?.length > 0 && (
<UnknownADGroupsAlert
unknownADGroups={unknownADGroups}
></UnknownADGroupsAlert>
)}
{adGroups?.length > 0 && unknownADGroups?.length > 0 && (
<UnknownADGroupsAlert
unknownADGroups={unknownADGroups}
></UnknownADGroupsAlert>
)}
</>
);
}
Expand Down

0 comments on commit 79b6f24

Please sign in to comment.