Skip to content

Commit

Permalink
Merge branch 'interface-rewrite' of https://github.com/KelvinTegelaar…
Browse files Browse the repository at this point in the history
…/CIPP into interface-rewrite
  • Loading branch information
KelvinTegelaar committed Jan 8, 2025
2 parents c4fa828 + e0f61a3 commit 672e354
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 22 deletions.
72 changes: 51 additions & 21 deletions src/components/CippWizard/CippWizardCSVImport.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const CippWizardCSVImport = (props) => {
onPreviousStep,
fields,
name,
manualFields = true,
manualFields = false,
nameToCSVMapping,
fileName = "BulkUser",
} = props;
Expand Down Expand Up @@ -77,34 +77,64 @@ export const CippWizardCSVImport = (props) => {
name={name}
formControl={formControl}
/>
<Grid container spacing={2}>
<Grid item xs={12}>
<Button size="small" onClick={() => setOpen(true)}>
Add Item
</Button>
</Grid>
</Grid>
<Dialog open={open} onClose={() => setOpen(false)}>
<DialogTitle>Add a new row</DialogTitle>
<DialogContent>
<Grid container spacing={2}>
{fields.map((field) => (
<Grid item xs={12} key={field}>
{manualFields && (
<Grid container spacing={2}>
{fields.map((field) => (
<>
<Grid item xs={12} sm={6} md={4} key={field}>
<CippFormComponent
name={`addrow.${field}`}
label={getCippTranslation(field)}
type="textField"
formControl={formControl}
/>
</Grid>
))}
</>
))}
<Grid item xs={12} sm={6} md={4}>
<Button size="small" onClick={() => handleAddItem()}>
Add Item
</Button>
</Grid>
</DialogContent>
<DialogActions>
<Button onClick={() => setOpen(false)}>Cancel</Button>
<Button onClick={handleAddItem}>Add</Button>
</DialogActions>
</Dialog>
</Grid>
)}
{!manualFields && (
<>
<Grid container spacing={2}>
<Grid item xs={12}>
<Button size="small" onClick={() => setOpen(true)}>
Add Item
</Button>
</Grid>
</Grid>
<Dialog open={open} onClose={() => setOpen(false)}>
<DialogTitle>Add a new row</DialogTitle>
<DialogContent>
<Grid container spacing={2} sx={{ py: 1 }}>
{fields.map((field) => (
<Grid item xs={12} key={field}>
<CippFormComponent
name={`addrow.${field}`}
label={getCippTranslation(field)}
type="textField"
formControl={formControl}
/>
</Grid>
))}
</Grid>
</DialogContent>
<DialogActions>
<Button variant="outlined" onClick={() => setOpen(false)}>
Cancel
</Button>
<Button variant="contained" onClick={handleAddItem}>
Add
</Button>
</DialogActions>
</Dialog>
</>
)}

<CippDataTable
actions={actions}
title={`CSV Preview`}
Expand Down
1 change: 1 addition & 0 deletions src/pages/endpoint/autopilot/add-device/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const Page = () => {
component: CippWizardCSVImport,
componentProps: {
name: "autopilotData",
manualFields: true,
fields: ["SerialNumber", "oemManufacturerName", "modelName", "productKey", "hardwareHash"],
nameToCSVMapping: {
SerialNumber: "Device serial number",
Expand Down
3 changes: 2 additions & 1 deletion src/pages/teams-share/sharepoint/bulk-add-site.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ const BulkAddSiteForm = () => {
{
title: "Step 2",
description: "Upload CSV",
component: (props) => <CippWizardCSVImport fileName="BulkSites" {...props} />,
component: CippWizardCSVImport,
componentProps: {
name: "bulkSites",
fileName: "BulkSites",
fields: fields,
manualFields: false,
},
Expand Down

0 comments on commit 672e354

Please sign in to comment.