Skip to content

Commit

Permalink
feat: modify controls to new toml
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob Ellison committed Sep 15, 2023
1 parent e848638 commit 601f048
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
19 changes: 12 additions & 7 deletions components/compliance/ControlData.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function FrameworkPanel({value, index, framework}) {
</TableRow>
</TableHead>
<TableBody>
{framework.mapping.map((mapping, index) => (
{framework.mappings && framework.mappings.map((mapping, index) => (
<TableRow key={index}>
<TableCell>{mapping.domain}</TableCell>
<TableCell>{mapping.control_id}</TableCell>
Expand Down Expand Up @@ -164,20 +164,25 @@ export function ControlDataDisplay({ data }) {

{activeStep === 0 && (
<Box>
<Typography variant="body1" sx={{mb: '2%'}}>{data?.description || 'N/A'}</Typography>

<Typography variant="body1">
<Typography variant="h4" sx={{my: '1%'}}>{data?.description || ''}</Typography>
<Typography variant="body1" sx={{my: '1%'}}>{data?.discussion || ''}</Typography>
<Typography variant="body1" sx={{my: '1%'}}>
<strong>Provider: </strong><Chip label={data?.csp || 'N/A'} />
</Typography>
<Typography variant="body1">
<Typography variant="body1" sx={{my: '1%'}}>
<strong>Service:</strong> {data?.service || 'N/A'}
</Typography>
<Typography variant="body1">
<Typography variant="body1" sx={{my: '1%'}}>
<strong>Control Owner: </strong><Chip label={data?.control_owner || 'N/A'} />
</Typography>
<Typography variant="body1">
<Typography variant="body1" sx={{my: '1%'}}>
<strong>Quality Model: </strong><Chip label={data?.quality_model || 'N/A'} />
</Typography>
<Typography variant="body1" sx={{my: '1%'}}>
<strong>Control Owner: </strong><Chip label={data?.control_owner || 'N/A'} />
</Typography>


</Box>
)}
{activeStep === 1 && (
Expand Down
4 changes: 2 additions & 2 deletions components/dashboard/Menus/ControlsMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export function ControlsMenu({
}}
scroll='paper'>
<DialogTitle sx={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
<Typography variant="h4">{controlUrl.selectedControl?.data?.name} ({controlUrl.selectedControl?.data?.id || 'N/A'})</Typography>
<Typography variant="h4">{controlUrl.selectedControl?.data?.friendly_name || controlUrl.selectedControl?.data?.name } ({controlUrl.selectedControl?.data?.id || 'N/A'})</Typography>
<IconButton edge="end" color="inherit" onClick={() => setDialogOpen(false)} aria-label="close">
<CloseIcon />
</IconButton>
Expand All @@ -61,7 +61,7 @@ function createControlMenu(controls) {
// console.log('createControlMenu:controls: ', controls)
try {
const links = controls.map((control) => {
const label = control.data.name || control.data.id || ''; // Adjust the property name according to your control data structure
const label = control.data.friendly_name || control.data.id || ''; // Adjust the property name according to your control data structure
const url = control.file;

return {
Expand Down
5 changes: 3 additions & 2 deletions pages/services/[...service].jsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,15 @@ export async function getServerSideProps(context) {
true,
".toml"
);

const controlContent = controlFiles.map(async (file) => {
const content = await getFileContent(
siteConfig.content.services.owner,
siteConfig.content.services.repo,
siteConfig.content.services.branch,
file
file.path
);
return { data: parse(content), file: file };
return { data: parse(content), file: file.path };
});

// const util = require('util')
Expand Down

0 comments on commit 601f048

Please sign in to comment.