Skip to content

Commit

Permalink
Merge pull request #59 from KelvinTegelaar/dev
Browse files Browse the repository at this point in the history
[pull] dev from KelvinTegelaar:dev
  • Loading branch information
kris6673 authored Jul 17, 2024
2 parents dbf37e8 + 7b722f4 commit 73f194e
Show file tree
Hide file tree
Showing 7 changed files with 401 additions and 7 deletions.
4 changes: 3 additions & 1 deletion src/importsMap.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ import React from 'react'
"/security/defender/list-defender-tvm": React.lazy(() => import('./views/security/defender/ListVuln')),
"/teams-share/onedrive/list": React.lazy(() => import('./views/teams-share/onedrive/OneDriveList')),
"/teams-share/sharepoint/list-sharepoint": React.lazy(() => import('./views/teams-share/sharepoint/SharepointList')),
"/teams-share/sharepoint/addsite": React.lazy(() => import('./views/teams-share/sharepoint/AddSite')),
"/teams-share/sharepoint/addsitebulk": React.lazy(() => import('./views/teams-share/sharepoint/AddSiteBulk')),
"/teams-share/teams/list-team": React.lazy(() => import('./views/teams-share/teams/TeamsListTeam')),
"/teams-share/teams/view-team-settings": React.lazy(() => import('./views/teams-share/teams/ViewTeamSettings')),
"/teams-share/teams/add-team": React.lazy(() => import('./views/teams-share/teams/TeamsAddTeam')),
Expand Down Expand Up @@ -118,7 +120,7 @@ import React from 'react'
"/email/administration/add-contact": React.lazy(() => import('./views/email-exchange/administration/AddContact')),
"/email/administration/edit-calendar-permissions": React.lazy(() => import('./views/email-exchange/administration/EditCalendarPermissions')),
"/email/administration/view-mobile-devices": React.lazy(() => import('./views/email-exchange/administration/ViewMobileDevices')),
"/email/administration/edit-contact": React.lazy(() => import('./views/email-exchange/administration/EditContact.jsx')),
"/email/administration/edit-contact": React.lazy(() => import('./views/email-exchange/administration/EditContact')),
"/email/administration/mailboxes": React.lazy(() => import('./views/email-exchange/administration/MailboxesList')),
"/email/administration/deleted-mailboxes": React.lazy(() => import('./views/email-exchange/administration/DeletedMailboxes')),
"/email/administration/mailbox-rules": React.lazy(() => import('./views/email-exchange/administration/MailboxRuleList')),
Expand Down
12 changes: 12 additions & 0 deletions src/routes.json
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,18 @@
"component": "views/teams-share/sharepoint/SharepointList",
"allowedRoles": ["admin", "editor", "readonly"]
},
{
"path": "/teams-share/sharepoint/addsite",
"name": "Add SharePoint Site",
"component": "views/teams-share/sharepoint/AddSite",
"allowedRoles": ["admin", "editor", "readonly"]
},
{
"path": "/teams-share/sharepoint/addsitebulk",
"name": "Add SharePoint Site Bulk",
"component": "views/teams-share/sharepoint/AddSiteBulk",
"allowedRoles": ["admin", "editor", "readonly"]
},
{
"path": "/teams-share/teams",
"name": "Teams",
Expand Down
24 changes: 18 additions & 6 deletions src/views/email-exchange/administration/EditContact.jsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import React, { useEffect, useState } from 'react'
import { CButton, CCallout, CCol, CForm, CRow, CSpinner } from '@coreui/react'
import countryList from 'src/data/countryList'
import useQuery from 'src/hooks/useQuery'
import { useDispatch, useSelector } from 'react-redux'
import { Form } from 'react-final-form'
import { RFFCFormInput } from 'src/components/forms'
import { RFFCFormInput, RFFSelectSearch } from 'src/components/forms'
import { useListContactsQuery } from 'src/store/api/users'
import { CippCodeBlock, ModalService } from 'src/components/utilities'
import { 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 } from 'src/components/layout'
import { required } from 'src/validators'

const EditContact = () => {
const dispatch = useDispatch()
Expand Down Expand Up @@ -45,11 +47,13 @@ const EditContact = () => {
values.addedAttributes.push({ Key: key, Value: values.defaultAttributes[key].Value })
})
}
const countryValue = values.country ? values.country.value : ''

const shippedValues = {
BusinessPhone: values.businessPhones,
City: values.city,
CompanyName: values.companyName,
Country: values.country,
Country: countryValue,
mail: values.mail,
DisplayName: values.displayName,
firstName: values.givenName,
Expand All @@ -66,6 +70,7 @@ const EditContact = () => {
}
const [addedAttributes, setAddedAttribute] = React.useState(0)
const currentSettings = useSelector((state) => state.app)
const country = useSelector((state) => state.app.usageLocation)

// Extract the first contact from the array
const contactData = Contact.length > 0 ? Contact[0] : {}
Expand All @@ -88,7 +93,10 @@ const EditContact = () => {
streetAddress: address.street || '',
postalCode: address.postalCode || '',
city: address.city || '',
country: address.countryOrRegion || '',
country: {
value: address.countryOrRegion ? address.countryOrRegion : country?.value,
label: address.countryOrRegion ? address.countryOrRegion : country?.label,
},
mobilePhone: mobilePhone ? mobilePhone.number : '',
businessPhones: businessPhones || '',
}
Expand Down Expand Up @@ -204,11 +212,15 @@ const EditContact = () => {
/>
</CCol>
<CCol md={6}>
<RFFCFormInput
<RFFSelectSearch
values={countryList.map(({ Code, Name }) => ({
value: Code,
name: Name,
}))}
name="country"
placeholder="Type to search..."
label="Country"
type="text"
disabled={formDisabled}
validate={required}
/>
</CCol>
</CRow>
Expand Down
1 change: 1 addition & 0 deletions src/views/identity/administration/AddGroup.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ const AddGroup = () => {
<CRow>
<RFFCFormRadio name="groupType" label="Azure Role Group" value="azurerole" />
<RFFCFormRadio name="groupType" label="Security Group" value="generic" />
<RFFCFormRadio name="groupType" label="Microsoft 365 Group" value="m365" />
<RFFCFormRadio name="groupType" label="Dynamic Group" value="dynamic" />
<RFFCFormRadio
name="groupType"
Expand Down
110 changes: 110 additions & 0 deletions src/views/teams-share/sharepoint/AddSite.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
import React from 'react'
import {
CCallout,
CButton,
CCol,
CForm,
CRow,
CSpinner,
CCard,
CCardHeader,
CCardTitle,
CCardBody,
} from '@coreui/react'
import { Form } from 'react-final-form'
import { RFFCFormCheck, RFFCFormInput, RFFSelectSearch } from 'src/components/forms'
import { CippPage } from 'src/components/layout/CippPage'
import { useLazyGenericPostRequestQuery } from 'src/store/api/app'
import { useSelector } from 'react-redux'
import CippButtonCard from 'src/components/contentcards/CippButtonCard'
import { useListUsersQuery } from 'src/store/api/users'

const AddSite = () => {
const tenantDomain = useSelector((state) => state.app.currentTenant.defaultDomainName)
const {
data: users = [],
isFetching: usersIsFetching,
error: usersError,
} = useListUsersQuery({ tenantDomain })

const [genericPostRequest, postResults] = useLazyGenericPostRequestQuery()
const onSubmit = (values) => {
const shippedValues = {
tenantFilter: tenantDomain,
...values,
}
genericPostRequest({ path: '/api/AddSite', values: shippedValues })
}
return (
<CippButtonCard
title="Add Contact"
CardButton={
<CButton form="siteForm" type="submit">
Add Site
</CButton>
}
>
<Form
onSubmit={onSubmit}
render={({ handleSubmit, submitting, values }) => {
return (
<CForm id="siteForm" onSubmit={handleSubmit} autoComplete="off">
<CRow className="mb-1">
<CCol>
<RFFCFormInput type="text" name="siteName" label="Site Name" />
</CCol>
</CRow>
<CRow className="mb-1">
<CCol>
<RFFCFormInput type="text" name="siteDescription" label="Site Description" />
</CCol>
<CCol>
<RFFSelectSearch
label="Add Owner"
values={users?.map((user) => ({
value: user.userPrincipalName,
name: `${user.displayName} - ${user.userPrincipalName}`,
}))}
placeholder={!usersIsFetching ? 'Select user' : 'Loading...'}
name="SiteOwner"
/>
</CCol>
</CRow>
<CRow className="mb-1">
<RFFSelectSearch
name="TemplateName"
label="Template Name"
values={[
{ value: 'team', name: 'Team (No Microsoft365 Group)' },
{ value: 'communication', name: 'Communication' },
]}
/>
</CRow>
<CRow className="mb-1">
<RFFSelectSearch
name="siteDesign"
label="Site Design Template"
values={[
{ value: 'blank', name: 'Blank' },
{ value: 'Showcase ', name: 'ShowCase' },
{ value: 'Topic ', name: 'Topic' },
]}
/>
</CRow>
{postResults.isFetching && (
<CCallout color="success">
<CSpinner />
</CCallout>
)}
{postResults.isSuccess && (
<CCallout color="success">{postResults.data.Results}</CCallout>
)}
</CForm>
)
}}
/>
</CippButtonCard>
)
}

export default AddSite
Loading

0 comments on commit 73f194e

Please sign in to comment.