-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- [x] Create a report structure that reflects the UI structure - [x] Routing to go through capability children - [x] Display table for a given capability <img width="858" alt="Screenshot 2023-08-14 at 16 45 02" src="https://github.com/Orbitalize/reports/assets/1410314/47f92ab3-b0ce-4b42-8b83-3a3ff5bc4fd4"> TODO: - [ ] Parse the report to create the internal report structure
- Loading branch information
1 parent
04f514d
commit 72e7581
Showing
12 changed files
with
394 additions
and
57 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
# Report examples | ||
public/monitoring-tests-reports | ||
|
||
# Logs | ||
logs | ||
*.log | ||
|
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 |
---|---|---|
@@ -1,34 +1,19 @@ | ||
import './App.css' | ||
|
||
import { ReportsReportTestRunReport } from './types/TestRunReport' | ||
|
||
// TODO: Replace with actual JSON report. Placeholder to verify proper typing. | ||
const report: ReportsReportTestRunReport = | ||
{ | ||
baseline_signature: '', | ||
codebase_version: '', | ||
commit_hash: '', | ||
report: {}, | ||
configuration: { | ||
action: {}, | ||
resources: { | ||
resource_declarations: {} | ||
} | ||
}, | ||
file_signatures: {} | ||
} | ||
import { RouterProvider, createBrowserRouter } from "react-router-dom"; | ||
import { useReport } from "./capability/useReport"; | ||
import "./App.css"; | ||
|
||
function App() { | ||
// FIXME | ||
// FIXME use the report from the config | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
const configuration = JSON.stringify((window as any)["interuss"]) | ||
console.log("Configuration:", configuration) | ||
return ( | ||
<> | ||
<h1>Report</h1> | ||
<code>{JSON.stringify(report, null, 2)}</code> | ||
</> | ||
) | ||
const configuration = JSON.stringify((window as any)["interuss"]); | ||
console.log("Configuration:", configuration); | ||
|
||
const { report, nav } = useReport(); | ||
if (!report) { | ||
return <div>Report not found</div>; | ||
} | ||
const router = createBrowserRouter(nav); | ||
return <RouterProvider router={router} />; | ||
} | ||
|
||
export default App | ||
export default App; |
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,114 @@ | ||
import { | ||
Capability, | ||
Check, | ||
Requirement, | ||
exampleReport, | ||
} from "./capabilityTypes"; | ||
|
||
type CapabilityTableProps = { | ||
capability?: Capability; | ||
}; | ||
|
||
export const CheckRow = ({ check }: { check: Check }) => { | ||
return ( | ||
<tr> | ||
<td>{check.name}</td> | ||
<td className={check.result === "pass" ? "pass" : "fail"}> | ||
{check.result === "pass" ? "PASS" : "FAIL"} | ||
</td> | ||
<td> | ||
<a href={check.detailLink}>Link</a> | ||
</td> | ||
</tr> | ||
); | ||
}; | ||
|
||
const requirementRow = (requirement: Requirement) => { | ||
const checks = requirement.checks.map((c) => <CheckRow check={c} />); | ||
const requirementHeader = ( | ||
<tr> | ||
<td rowSpan={checks.length + 1}>{requirement.name}</td> | ||
{!checks.length && <td colSpan={3}>Not tested</td>} | ||
</tr> | ||
); | ||
|
||
if (checks.length) { | ||
return [requirementHeader, ...checks]; | ||
} else { | ||
return [requirementHeader]; | ||
} | ||
}; | ||
|
||
export const ChildCapabilityRow = ({ | ||
capability, | ||
path, | ||
}: { | ||
capability: Capability; | ||
path: string; | ||
}) => { | ||
return ( | ||
<tr> | ||
<td colSpan={2}> | ||
<a href={path}>{capability.name}</a> | ||
</td> | ||
<td | ||
className={capability.result === "pass" ? "pass" : "fail"} | ||
colSpan={2} | ||
> | ||
{capability.result === "pass" ? "PASS" : "FAIL"} | ||
</td> | ||
</tr> | ||
); | ||
}; | ||
|
||
const ChildCapabilityHeader = () => { | ||
return ( | ||
<tr> | ||
<th colSpan={2}>Child Capability</th> | ||
<th colSpan={2}>Result</th> | ||
</tr> | ||
); | ||
}; | ||
|
||
export const CapabilityRows = ({ capability }: { capability: Capability }) => { | ||
const requirements = capability.requirements | ||
.flatMap((r) => requirementRow(r)) | ||
.flat(); | ||
const childCapabilities = capability.childCapabilities.map((c, i) => ( | ||
<ChildCapabilityRow capability={c} path={i.toString()} /> | ||
)); | ||
const childTable = childCapabilities | ||
? [<ChildCapabilityHeader />, ...childCapabilities] | ||
: []; | ||
|
||
const allRows = [...requirements, ...childTable]; | ||
return [ | ||
<tr> | ||
<td rowSpan={allRows.length + 1}>{capability.name}</td> | ||
</tr>, | ||
...allRows, | ||
]; | ||
}; | ||
|
||
export const CapabilityTable = ({ | ||
capability = exampleReport.capability, | ||
}: CapabilityTableProps) => { | ||
return ( | ||
<> | ||
<table> | ||
<thead> | ||
<tr> | ||
<th>Capability</th> | ||
<th>Requirement</th> | ||
<th>Test Check</th> | ||
<th>Result</th> | ||
<th>Details</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<CapabilityRows capability={capability} /> | ||
</tbody> | ||
</table> | ||
</> | ||
); | ||
}; |
Oops, something went wrong.