-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ce1762e
commit b03cca0
Showing
8 changed files
with
248 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
import { Layout as DashboardLayout } from "/src/layouts/index.js"; | ||
import { Grid } from "@mui/material"; | ||
import { useForm } from "react-hook-form"; | ||
import CippFormComponent from "/src/components/CippComponents/CippFormComponent"; | ||
import CippFormPage from "/src/components/CippFormPages/CippFormPage"; | ||
import { useSettings } from "/src/hooks/use-settings"; | ||
|
||
const AddSiteForm = () => { | ||
const userSettingsDefaults = useSettings(); | ||
const formControl = useForm({ | ||
mode: "onChange", | ||
defaultValues: { | ||
tenantFilter: userSettingsDefaults.currentTenant, | ||
}, | ||
}); | ||
|
||
return ( | ||
<CippFormPage | ||
title="SharePoint Site" | ||
postUrl="/api/AddSite" | ||
formControl={formControl} | ||
backButtonTitle="Back to Sites" | ||
> | ||
<Grid container spacing={2} sx={{ mb: 2 }}> | ||
<Grid item xs={12}> | ||
<CippFormComponent name="siteName" label="Site Name" formControl={formControl} required /> | ||
</Grid> | ||
<Grid item xs={12}> | ||
<CippFormComponent | ||
name="siteDescription" | ||
label="Site Description" | ||
formControl={formControl} | ||
required | ||
/> | ||
</Grid> | ||
<Grid item xs={12}> | ||
<CippFormComponent | ||
name="SiteOwner" | ||
label="Add Owner" | ||
formControl={formControl} | ||
required | ||
multiple={false} | ||
type="autoComplete" | ||
api={{ | ||
url: "/api/ListGraphRequest", | ||
data: { | ||
Endpoint: "users", | ||
$filter: "accountEnabled eq true", | ||
$top: 999, | ||
$count: true, | ||
$orderby: "displayName", | ||
$select: "id,displayName,userPrincipalName", | ||
}, | ||
dataKey: "Results", | ||
labelField: (user) => `${user.displayName} (${user.userPrincipalName})`, | ||
valueField: "userPrincipalName", | ||
addedField: { | ||
id: "id", | ||
}, | ||
}} | ||
validators={{ | ||
validate: (value) => { | ||
if (!value) { | ||
return "Required"; | ||
} | ||
return true; | ||
}, | ||
}} | ||
/> | ||
</Grid> | ||
<Grid item xs={12}> | ||
<CippFormComponent | ||
name="TemplateName" | ||
label="Template Name" | ||
formControl={formControl} | ||
required | ||
type="autoComplete" | ||
multiple={false} | ||
options={[ | ||
{ label: "Team (No Microsoft365 Group)", value: "team" }, | ||
{ label: "Communication", value: "communication" }, | ||
]} | ||
validators={{ | ||
validate: (value) => { | ||
if (!value) { | ||
return "Required"; | ||
} | ||
return true; | ||
}, | ||
}} | ||
/> | ||
</Grid> | ||
<Grid item xs={12}> | ||
<CippFormComponent | ||
name="siteDesign" | ||
label="Site Design Template" | ||
formControl={formControl} | ||
required | ||
type="autoComplete" | ||
multiple={false} | ||
options={[ | ||
{ label: "Blank", value: "blank" }, | ||
{ label: "Showcase", value: "Showcase" }, | ||
{ label: "Topic", value: "Topic" }, | ||
]} | ||
validators={{ | ||
validate: (value) => { | ||
if (!value) { | ||
return "Required"; | ||
} | ||
return true; | ||
}, | ||
}} | ||
/> | ||
</Grid> | ||
</Grid> | ||
</CippFormPage> | ||
); | ||
}; | ||
|
||
const Page = () => { | ||
return <AddSiteForm />; | ||
}; | ||
|
||
Page.getLayout = (page) => <DashboardLayout>{page}</DashboardLayout>; | ||
|
||
export default Page; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import { Layout as DashboardLayout } from "/src/layouts/index.js"; | ||
import { useSettings } from "/src/hooks/use-settings"; | ||
import { CippWizardConfirmation } from "/src/components/CippWizard/CippWizardConfirmation"; | ||
import CippWizardPage from "/src/components/CippWizard/CippWizardPage.jsx"; | ||
import { CippTenantStep } from "/src/components/CippWizard/CippTenantStep.jsx"; | ||
import { CippWizardCSVImport } from "/src/components/CippWizard/CippWizardCSVImport"; | ||
|
||
const BulkAddSiteForm = () => { | ||
const tenantFilter = useSettings().currentTenant; | ||
|
||
const fields = [ | ||
"SiteName", | ||
"siteDescription", | ||
"siteOwner", | ||
"TemplateName", | ||
"siteDesign", | ||
"sensitivityLabel", | ||
]; | ||
|
||
const steps = [ | ||
{ | ||
title: "Step 1", | ||
description: "Tenant Selection", | ||
component: CippTenantStep, | ||
componentProps: { | ||
allTenants: false, | ||
type: "single", | ||
}, | ||
}, | ||
{ | ||
title: "Step 2", | ||
description: "Upload CSV", | ||
component: (props) => <CippWizardCSVImport fileName="BulkSites" {...props} />, | ||
componentProps: { | ||
name: "bulkSites", | ||
fields: fields, | ||
manualFields: false, | ||
}, | ||
}, | ||
{ | ||
title: "Step 3", | ||
description: "Review and Confirm", | ||
component: CippWizardConfirmation, | ||
}, | ||
]; | ||
|
||
return ( | ||
<CippWizardPage | ||
initialState={{ tenantFilter }} | ||
steps={steps} | ||
postUrl="/api/AddSiteBulk" | ||
wizardTitle="Bulk Add Site Wizard" | ||
/> | ||
); | ||
}; | ||
|
||
const Page = () => { | ||
return <BulkAddSiteForm />; | ||
}; | ||
|
||
Page.getLayout = (page) => <DashboardLayout>{page}</DashboardLayout>; | ||
|
||
export default Page; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters