Skip to content

Commit

Permalink
Merge pull request #272 from akaene/feature/improvements-for-systems-…
Browse files Browse the repository at this point in the history
…and-trees-view

[#247] Fixes for system table
  • Loading branch information
blcham authored May 6, 2024
2 parents fc1dd3a + a4a9cf3 commit fc071e0
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { ROUTES } from "@utils/constants";
import { extractFragment } from "@services/utils/uriIdentifierUtils";
import { System } from "@models/systemModel";

const tableHeadCells = [
const faultTreeTableHeadCells = [
"faultTreeOverviewTable.name",
"faultTreeOverviewTable.aircraftType",
"faultTreeOverviewTable.ata",
Expand All @@ -21,6 +21,8 @@ const tableHeadCells = [
"faultTreeOverviewTable.status",
];

const systemTableHeadCells = ["faultTreeOverviewTable.name"];

interface FaultTreeOverviewTableProps {
faultTrees?: FaultTree[];
systems?: System[];
Expand All @@ -44,14 +46,24 @@ const FaultTreeAndSystemOverviewTable: FC<FaultTreeOverviewTableProps> = ({
<Table className={classes.table}>
<TableHead>
<TableRow>
{tableHeadCells.map((headCell, index) => {
const styling = index === 0 ? classes.firstColumn : classes.tableHeaderCell;
return (
<TableCell key={index} className={styling}>
{t(headCell)}
</TableCell>
);
})}
{faultTrees &&
faultTreeTableHeadCells.map((headCell, index) => {
const styling = index === 0 ? classes.firstColumn : classes.tableHeaderCell;
return (
<TableCell key={index} className={styling}>
{t(headCell)}
</TableCell>
);
})}
{systems &&
systemTableHeadCells.map((headCell, index) => {
const styling = index === 0 ? classes.systemFirstColumn : classes.tableHeaderCell;
return (
<TableCell key={index} className={styling}>
{t(headCell)}
</TableCell>
);
})}
<TableCell className={classes.emptyCell} />
</TableRow>
</TableHead>
Expand All @@ -67,7 +79,7 @@ const FaultTreeAndSystemOverviewTable: FC<FaultTreeOverviewTableProps> = ({
<TableCell className={classes.tableCell}></TableCell>
<TableCell className={classes.tableCell}></TableCell>
<TableCell className={classes.tableCell}></TableCell>
<TableCell className={classes.tableCell}></TableCell>
<TableCell className={classes.tableCell}>{faultTree.requiredFailureRate}</TableCell>
<TableCell className={classes.tableCell}></TableCell>
<TableCell className={classes.tableCell}></TableCell>
<TableCell className={classes.tableCell}>{/* <DoneIcon /> */}</TableCell>
Expand All @@ -90,15 +102,7 @@ const FaultTreeAndSystemOverviewTable: FC<FaultTreeOverviewTableProps> = ({
const routePath = ROUTES.SYSTEMS + `/${extractFragment(system.iri)}`;
return (
<TableRow key={rowIndex} className={classes.noBorder}>
<TableCell className={classes.firstColumn}>{system.name}</TableCell>
<TableCell className={classes.tableCell}></TableCell>
<TableCell className={classes.tableCell}></TableCell>
<TableCell className={classes.tableCell}></TableCell>
<TableCell className={classes.tableCell}></TableCell>
<TableCell className={classes.tableCell}></TableCell>
<TableCell className={classes.tableCell}></TableCell>
<TableCell className={classes.tableCell}></TableCell>
<TableCell className={classes.tableCell}>{/* <DoneIcon /> */}</TableCell>
<TableCell className={classes.systemFirstColumn}>{system.name}</TableCell>
<TableCell className={classes.tableCell}>
<Box className={classes.rowOptionsContainer}>
<Button variant="contained" className={classes.editButton} onClick={() => navigate(routePath)}>
Expand All @@ -120,4 +124,4 @@ const FaultTreeAndSystemOverviewTable: FC<FaultTreeOverviewTableProps> = ({
);
};

export default FaultTreeAndSystemOverviewTable;
export default FaultTreeAndSystemOverviewTable;
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
import { makeStyles } from "tss-react/mui";
import { Theme } from "@mui/material";

const commonCellStyle: React.CSSProperties = {
padding: 4,
overflow: "hidden",
textAlign: "left",
verticalAlign: "middle",
maxWidth: 72,
fontWeight: "bold",
};

const useStyles = makeStyles()((theme: Theme) => ({
tableContainer: {
flex: 1,
Expand Down Expand Up @@ -48,12 +57,10 @@ const useStyles = makeStyles()((theme: Theme) => ({
},
firstColumn: {
width: "15%",
padding: 4,
overflow: "hidden",
textAlign: "left",
verticalAlign: "middle",
maxWidth: 72,
fontWeight: "bold",
...commonCellStyle
},
systemFirstColumn: {
...commonCellStyle
},
}));

Expand Down
3 changes: 3 additions & 0 deletions src/models/eventModel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ const ctx = {
references: VocabularyUtils.PREFIX + "is-reference-to",
isPartOf: VocabularyUtils.PREFIX + "is-part-of",
isReference: VocabularyUtils.PREFIX + "is-reference",
system: VocabularyUtils.PREFIX + "is-artifact-of",
subSystem: VocabularyUtils.PREFIX + "is-performed-by",
requiredFailureRate: VocabularyUtils.PREFIX + "required-failure-rate"
};

export const CONTEXT = Object.assign({}, ctx, ABSTRACT_CONTEXT, FAILURE_MODE_CONTEXT, RECTANGLE_CONTEXT);
Expand Down
1 change: 1 addition & 0 deletions src/models/faultTreeModel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ export interface FaultTree extends AbstractModel {
name: string;
manifestingEvent: FaultEvent;
faultEventScenarios: FaultEventScenario[];
requiredFailureRate: number
}

0 comments on commit fc071e0

Please sign in to comment.