From 72fdd673629320b2ae2876f45293b3e6c0c69c3e Mon Sep 17 00:00:00 2001 From: KelvinTegelaar Date: Fri, 12 Apr 2024 00:16:33 +0200 Subject: [PATCH] added listing of applications --- src/views/tenant/conditional/TestCAPolicy.jsx | 39 +++++++++++-------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/src/views/tenant/conditional/TestCAPolicy.jsx b/src/views/tenant/conditional/TestCAPolicy.jsx index fe402e7e8f9c..098ec1b1e796 100644 --- a/src/views/tenant/conditional/TestCAPolicy.jsx +++ b/src/views/tenant/conditional/TestCAPolicy.jsx @@ -3,7 +3,11 @@ import { CButton, CCallout, CCol, CForm, CRow, CSpinner, CTooltip } from '@coreu import { useSelector } from 'react-redux' import { Field, Form } from 'react-final-form' import { RFFCFormInput, 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' @@ -20,9 +24,6 @@ import countryList from 'src/data/countryList' const TestCAPolicy = () => { const [ExecuteGetRequest, getResults] = useLazyGenericGetRequestQuery() const currentDate = new Date() - const [startDate, setStartDate] = useState(currentDate) - const [endDate, setEndDate] = useState(currentDate) - const tenantDomain = useSelector((state) => state.app.currentTenant.defaultDomainName) const [refreshState, setRefreshState] = useState(false) const [genericPostRequest, postResults] = useLazyGenericPostRequestQuery() @@ -42,11 +43,15 @@ const TestCAPolicy = () => { error: usersError, } = useListUsersQuery({ tenantDomain }) - const { - data: caPolicies = [], - isFetching: caIsFetching, - error: caError, - } = useListConditionalAccessPoliciesQuery({ domain: tenantDomain }) + const applications = useGenericGetRequestQuery({ + path: '/api/ListGraphRequest', + params: { + Endpoint: 'servicePrincipals', + TenantFilter: tenantDomain, + IgnoreErrors: true, + $top: 999, + }, + }) const columns = [ { name: 'Display Name', @@ -122,11 +127,13 @@ const TestCAPolicy = () => { ({ - value: ca.id, + values={applications?.data?.Results?.map((ca) => ({ + value: ca.appId, name: `${ca.displayName}`, }))} - placeholder={!caIsFetching ? 'Select Application' : 'Loading...'} + placeholder={ + !applications.isFetching ? 'Select Application' : 'Loading...' + } name="includeApplications" /> @@ -168,7 +175,7 @@ const TestCAPolicy = () => { { value: 'MacOS', name: 'MacOS' }, { value: 'Linux', name: 'Linux' }, ]} - placeholder={!caIsFetching ? 'Select platform' : 'Loading...'} + placeholder={'Select platform'} name="devicePlatform" /> @@ -188,7 +195,7 @@ const TestCAPolicy = () => { { value: 'easSupported', name: 'EAS supported' }, { value: 'other', name: 'Other clients' }, ]} - placeholder={!caIsFetching ? 'Select client application' : 'Loading...'} + placeholder={'Select client application'} name="clientAppType" /> @@ -203,7 +210,7 @@ const TestCAPolicy = () => { { value: 'high', name: 'High' }, { value: 'none', name: 'None' }, ]} - placeholder={!caIsFetching ? 'Select Sign-in risk' : 'Loading...'} + placeholder={'Select Sign-in risk'} name="SignInRiskLevel" /> @@ -218,7 +225,7 @@ const TestCAPolicy = () => { { value: 'high', name: 'High' }, { value: 'none', name: 'None' }, ]} - placeholder={!caIsFetching ? 'Select User Risk' : 'Loading...'} + placeholder={'Select User Risk'} name="userRiskLevel" />