diff --git a/src/_nav.js b/src/_nav.js index 852e4334d8cb..252dfc86c2d4 100644 --- a/src/_nav.js +++ b/src/_nav.js @@ -137,6 +137,11 @@ const _nav = [ name: 'Enterprise Applications', to: '/tenant/administration/enterprise-apps', }, + { + component: CNavItem, + name: 'Tenant Offboarding', + to: '/tenant/administration/tenant-offboarding-wizard', + }, ], }, { diff --git a/src/adminRoutes.js b/src/adminRoutes.js index ceabcd1b7e57..e3e807e3a212 100644 --- a/src/adminRoutes.js +++ b/src/adminRoutes.js @@ -11,6 +11,9 @@ const GDAPRelationships = React.lazy(() => import('./views/tenant/administration/ListGDAPRelationships'), ) const appapproval = React.lazy(() => import('src/views/cipp/AppApproval')) +const TenantOffboardingWizard = React.lazy(() => + import('src/views/tenant/administration/tenant-offboarding-wizard'), +) const adminRoutes = [ { path: '/cipp', name: 'CIPP' }, @@ -38,6 +41,11 @@ const adminRoutes = [ { path: '/tenant/administration/appapproval', name: 'App Approval', component: appapproval }, { path: '/tenant/administration/gdap-status', name: 'GDAP Status', component: GDAPStatus }, { path: '/tenant/standards/apply-standard', name: 'Apply Standard', component: ApplyStandard }, + { + path: '/tenant/administration/tenant-offboarding-wizard', + name: 'Tenant Offboarding', + component: TenantOffboardingWizard, + }, ] export default adminRoutes diff --git a/src/routes.js b/src/routes.js index d305063a4109..ecb083880dcf 100644 --- a/src/routes.js +++ b/src/routes.js @@ -23,6 +23,7 @@ const DeployGroupTemplates = React.lazy(() => const GeoIPLookup = React.lazy(() => import('src/views/tenant/administration/GeoIPLookup')) const TenantLookup = React.lazy(() => import('src/views/tenant/administration/TenantLookup')) + const GroupTemplates = React.lazy(() => import('src/views/identity/administration/GroupTemplates')) const EditGroup = React.lazy(() => import('src/views/identity/administration/EditGroup')) diff --git a/src/views/tenant/administration/tenant-offboarding-wizard.js b/src/views/tenant/administration/tenant-offboarding-wizard.js new file mode 100644 index 000000000000..666a97781363 --- /dev/null +++ b/src/views/tenant/administration/tenant-offboarding-wizard.js @@ -0,0 +1,200 @@ +import React from 'react' +import { CCallout, CCol, CListGroup, CListGroupItem, CRow, CSpinner } from '@coreui/react' +import { Field, FormSpy } from 'react-final-form' +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' +import { faExclamationTriangle, faTimes, faCheck } from '@fortawesome/free-solid-svg-icons' +import { useSelector } from 'react-redux' +import { CippWizard } from 'src/components/layout' +import PropTypes from 'prop-types' +import { RFFCFormCheck, RFFCFormInput, RFFCFormSwitch, RFFSelectSearch } from 'src/components/forms' +import { TenantSelector } from 'src/components/utilities' +import { useLazyGenericPostRequestQuery } from 'src/store/api/app' + +const Error = ({ name }) => ( + + touched && error ? ( + + + {error} + + ) : null + } + /> +) + +Error.propTypes = { + name: PropTypes.string.isRequired, +} + +const TenantOffboardingWizard = () => { + const tenantDomain = useSelector((state) => state.app.currentTenant.defaultDomainName) + const currentSettings = useSelector((state) => state.app) + const [genericPostRequest, postResults] = useLazyGenericPostRequestQuery() + + const handleSubmit = async (values) => { + const shippedValues = { + TenantFilter: tenantDomain, + RemoveCSPGuestUsers: values.RemoveCSPGuestUsers ? values.RemoveCSPGuestUsers : '', + RemoveMultitenantCSPApps: values.RemoveMultitenantCSPApps + ? values.RemoveMultitenantCSPApps + : '', + TerminateGDAP: values.TerminateGDAP ? values.TerminateGDAP : '', + TerminateContract: values.TerminateContract ? values.TerminateContract : '', + } + + //alert(JSON.stringify(values, null, 2)) + genericPostRequest({ path: '/api/ExecOffboardTenant', values: shippedValues }) + } + + return ( + + + {console.log(currentSettings.offboardingDefaults)} +
+

Step 1

+
Choose a tenant
+
+
+ {(props) => } +
+
+ +
+

Step 2

+
Choose tenant offboarding options
+
+
+
+ + + + + + + + +
+
+
+ +
+

Step 3

+
Confirm and apply
+
+
+
+ {postResults.isFetching && ( + + Loading + + )} + {postResults.isSuccess && ( + <> + + {postResults.data.Results.map((message, idx) => { + return
  • {message}
  • + })} +
    + + {postResults.data.Errors.map((message, idx) => { + return
  • {message}
  • + })} +
    + + )} + {!postResults.isSuccess && ( + + {(props) => ( + <> + + + + + These actions are irreversible! + + + +
    Selected Tenant:
    + {tenantDomain} +
    +
    +
    +
    +
    + + + + + Remove all guest users originating from the CSP tenant + + + + Remove all multitenant applications originating from CSP tenant + + + + Terminate all active GDAP relationships + + + + Terminate contract relationship + + + +
    +
    +
    + + )} +
    + )} +
    +
    +
    +
    + ) +} + +export default TenantOffboardingWizard