Skip to content
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

JIT Update users query to ListGraphRequest #2580

Merged
merged 1 commit into from
Jun 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions src/views/identity/administration/DeployJITAdmin.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,20 @@
RFFCFormSwitch,
RFFSelectSearch,
} from 'src/components/forms'
import { useLazyGenericGetRequestQuery, useLazyGenericPostRequestQuery } from 'src/store/api/app'
import {
useGenericGetRequestQuery,
useLazyGenericGetRequestQuery,
useLazyGenericPostRequestQuery,
} from 'src/store/api/app'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { faCircleNotch, faEdit, faEye } from '@fortawesome/free-solid-svg-icons'
import { CippContentCard, CippPage, CippPageList } from 'src/components/layout'
import { CellTip, cellGenericFormatter } from 'src/components/tables/CellGenericFormat'
import 'react-datepicker/dist/react-datepicker.css'

Check warning on line 21 in src/views/identity/administration/DeployJITAdmin.jsx

View workflow job for this annotation

GitHub Actions / NPM Install and Build (16.x, ubuntu-latest)

'/home/runner/work/CIPP/CIPP/node_modules/react-datepicker/dist/react-datepicker.css' imported multiple times
import { TenantSelector } from 'src/components/utilities'
import arrayMutators from 'final-form-arrays'
import DatePicker from 'react-datepicker'
import 'react-datepicker/dist/react-datepicker.css'

Check warning on line 25 in src/views/identity/administration/DeployJITAdmin.jsx

View workflow job for this annotation

GitHub Actions / NPM Install and Build (16.x, ubuntu-latest)

'/home/runner/work/CIPP/CIPP/node_modules/react-datepicker/dist/react-datepicker.css' imported multiple times
import { useListUsersQuery } from 'src/store/api/users'
import GDAPRoles from 'src/data/GDAPRoles'
import { CippDatatable, cellDateFormatter } from 'src/components/tables'
Expand Down Expand Up @@ -63,7 +67,16 @@
data: users = [],
isFetching: usersIsFetching,
error: usersError,
} = useListUsersQuery({ tenantDomain })
} = useGenericGetRequestQuery({
path: '/api/ListGraphRequest',
params: {
TenantFilter: tenantDomain,
Endpoint: 'users',
$select: 'id,displayName,userPrincipalName,accountEnabled',
$count: true,
$top: 999,
},
})

return (
<CippPage title={`Add JIT Admin`} tenantSelector={false}>
Expand Down Expand Up @@ -130,7 +143,7 @@
<CCol>
<RFFSelectSearch
label={'Users in ' + tenantDomain}
values={users?.map((user) => ({
values={users?.Results?.map((user) => ({
value: user.id,
name: `${user.displayName} <${user.userPrincipalName}>`,
}))}
Expand All @@ -140,7 +153,7 @@
/>
<FormSpy subscription={{ values: true }}>
{({ values }) => {
return users.map((user, key) => {
return users?.Results?.map((user, key) => {
if (
user.id === values?.UserId?.value &&
user.accountEnabled === false
Expand Down
Loading