Skip to content

Commit

Permalink
Fixed result json parsing error (#618)
Browse files Browse the repository at this point in the history
  • Loading branch information
FritzHeiden authored Nov 21, 2022
1 parent d8bb783 commit 87f599b
Showing 1 changed file with 67 additions and 51 deletions.
118 changes: 67 additions & 51 deletions Conformance-Frontend-JCCP/src/tool-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ function ToolView() {
async function handleProcessingFinished({ result, duration }) {
_state.result = result;
_state.duration = duration;
_state.detailSelect = { module: null, part: null, section: null, test: null },
_state.detailSelect = {
module: null,
part: null,
section: null,
test: null,
};
renderResults();
}
_validator.onProcessingFinished(handleProcessingFinished);
Expand Down Expand Up @@ -128,6 +133,15 @@ function ToolView() {

function renderResultSummary(elementId) {
_resultSummaryId = elementId = elementId || _resultSummaryId;
let moduleNames = Object.keys(_state.result.entries).filter(
(key) => key !== "Stats" && key !== "verdict"
);
let modules = moduleNames.map((name) => {
let module = _state.result.entries[name];
module.name = name;
return module;
});

let resultSummary = UI.createElement({
id: elementId,
className: "border-end w-50 d-flex flex-column",
Expand All @@ -139,63 +153,64 @@ function ToolView() {
{
id: elementId + "-scroll",
className: "flex-grow-1 overflow-auto",
children: Object.keys(_state.result.entries)
.filter((key) => key !== "Stats" && key !== "verdict")
.map((module, index) => ({
className: "p-3 border-bottom",
children: [
{
className: "fs-5 mb-2",
children: [
{
element: "i",
className: getVerdictIcon(
_state.result.entries[module].verdict
),
},
{ element: "span", className: "ms-2", text: module },
],
},
{
children: Object.keys(_state.result.entries[module])
.filter((key) => key !== "verdict")
.map((part) => ({
children: [
{
className: "my-3 fw-semibold",
children: [
{
element: "i",
className: getVerdictIcon(
_state.result.entries[module][part].verdict
),
style: "width: 1.5em",
},
{ element: "span", text: part },
],
},
{
className: "list-group",
children: _state.result.entries[module][
part
].test.map(({ section, test, state }) => ({
children: modules.map((module, index) => ({
className: "p-3 border-bottom",
children: [
{
className: "fs-5 mb-2",
children: [
{
element: "i",
className: getVerdictIcon(module.verdict),
},
{ element: "span", className: "ms-2", text: module.name },
],
},
{
children: Object.keys(module)
.filter(
(key) =>
typeof module[key] === "object" && "test" in module[key]
)
.map((part) => ({
children: [
{
className: "my-3 fw-semibold",
children: [
{
element: "i",
className: getVerdictIcon(module[part].verdict),
style: "width: 1.5em",
},
{ element: "span", text: part },
],
},
{
className: "list-group",
children: module[part].test.map(
({ section, test, state }) => ({
element: "a",
className:
"list-group-item list-group-item-action" +
(isSelected({ module, part, section, test })
(isSelected({
module: module.name,
part,
section,
test,
})
? " fw-semibold bg-light"
: ""),
href: "#",
onClick: isSelected({
module,
module: module.name,
part,
section,
test,
})
? () => {}
: () => {
_state.detailSelect = {
module,
module: module.name,
part,
section,
test,
Expand All @@ -221,13 +236,14 @@ function ToolView() {
text: test,
},
],
})),
},
],
})),
},
],
})),
})
),
},
],
})),
},
],
})),
},
],
});
Expand Down

0 comments on commit 87f599b

Please sign in to comment.